aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/Kconfig34
-rw-r--r--arch/powerpc/Kconfig.debug9
-rw-r--r--arch/powerpc/configs/cell_defconfig7
-rw-r--r--arch/powerpc/configs/chrp32_defconfig1378
-rw-r--r--arch/powerpc/configs/mpc7448_hpc2_defconfig923
-rw-r--r--arch/powerpc/kernel/Makefile3
-rw-r--r--arch/powerpc/kernel/asm-offsets.c1
-rw-r--r--arch/powerpc/kernel/binfmt_elf32.c1
-rw-r--r--arch/powerpc/kernel/btext.c21
-rw-r--r--arch/powerpc/kernel/cpu_setup_6xx.S1
-rw-r--r--arch/powerpc/kernel/cpu_setup_power4.S15
-rw-r--r--arch/powerpc/kernel/cputable.c13
-rw-r--r--arch/powerpc/kernel/crash.c155
-rw-r--r--arch/powerpc/kernel/entry_32.S1
-rw-r--r--arch/powerpc/kernel/entry_64.S1
-rw-r--r--arch/powerpc/kernel/firmware.c1
-rw-r--r--arch/powerpc/kernel/fpu.S1
-rw-r--r--arch/powerpc/kernel/head_32.S1
-rw-r--r--arch/powerpc/kernel/head_44x.S1
-rw-r--r--arch/powerpc/kernel/head_4xx.S1
-rw-r--r--arch/powerpc/kernel/head_64.S63
-rw-r--r--arch/powerpc/kernel/head_8xx.S1
-rw-r--r--arch/powerpc/kernel/head_fsl_booke.S1
-rw-r--r--arch/powerpc/kernel/ibmebus.c9
-rw-r--r--arch/powerpc/kernel/idle.c1
-rw-r--r--arch/powerpc/kernel/idle_6xx.S1
-rw-r--r--arch/powerpc/kernel/idle_power4.S1
-rw-r--r--arch/powerpc/kernel/iommu.c31
-rw-r--r--arch/powerpc/kernel/irq.c670
-rw-r--r--arch/powerpc/kernel/kprobes.c1
-rw-r--r--arch/powerpc/kernel/l2cr_6xx.S1
-rw-r--r--arch/powerpc/kernel/legacy_serial.c69
-rw-r--r--arch/powerpc/kernel/lparcfg.c148
-rw-r--r--arch/powerpc/kernel/machine_kexec_32.c4
-rw-r--r--arch/powerpc/kernel/machine_kexec_64.c4
-rw-r--r--arch/powerpc/kernel/misc.S203
-rw-r--r--arch/powerpc/kernel/misc_32.S157
-rw-r--r--arch/powerpc/kernel/misc_64.S234
-rw-r--r--arch/powerpc/kernel/of_device.c1
-rw-r--r--arch/powerpc/kernel/paca.c2
-rw-r--r--arch/powerpc/kernel/pci_32.c85
-rw-r--r--arch/powerpc/kernel/pci_64.c38
-rw-r--r--arch/powerpc/kernel/perfmon_fsl_booke.c1
-rw-r--r--arch/powerpc/kernel/pmc.c1
-rw-r--r--arch/powerpc/kernel/ppc_ksyms.c1
-rw-r--r--arch/powerpc/kernel/proc_ppc64.c1
-rw-r--r--arch/powerpc/kernel/process.c1
-rw-r--r--arch/powerpc/kernel/prom.c504
-rw-r--r--arch/powerpc/kernel/prom_init.c23
-rw-r--r--arch/powerpc/kernel/prom_parse.c443
-rw-r--r--arch/powerpc/kernel/ptrace-common.h1
-rw-r--r--arch/powerpc/kernel/ptrace.c1
-rw-r--r--arch/powerpc/kernel/ptrace32.c1
-rw-r--r--arch/powerpc/kernel/rtas.c119
-rw-r--r--arch/powerpc/kernel/rtas_pci.c17
-rw-r--r--arch/powerpc/kernel/setup-common.c1
-rw-r--r--arch/powerpc/kernel/setup_32.c5
-rw-r--r--arch/powerpc/kernel/setup_64.c38
-rw-r--r--arch/powerpc/kernel/signal_32.c1
-rw-r--r--arch/powerpc/kernel/signal_64.c1
-rw-r--r--arch/powerpc/kernel/smp-tbsync.c1
-rw-r--r--arch/powerpc/kernel/smp.c1
-rw-r--r--arch/powerpc/kernel/swsusp_32.S1
-rw-r--r--arch/powerpc/kernel/sys_ppc32.c1
-rw-r--r--arch/powerpc/kernel/sysfs.c32
-rw-r--r--arch/powerpc/kernel/systbl.S1
-rw-r--r--arch/powerpc/kernel/tau_6xx.c1
-rw-r--r--arch/powerpc/kernel/time.c3
-rw-r--r--arch/powerpc/kernel/traps.c28
-rw-r--r--arch/powerpc/kernel/udbg.c8
-rw-r--r--arch/powerpc/kernel/udbg_16550.c1
-rw-r--r--arch/powerpc/kernel/vdso.c1
-rw-r--r--arch/powerpc/kernel/vdso32/cacheflush.S1
-rw-r--r--arch/powerpc/kernel/vdso32/datapage.S1
-rw-r--r--arch/powerpc/kernel/vdso32/gettimeofday.S1
-rw-r--r--arch/powerpc/kernel/vdso32/sigtramp.S1
-rw-r--r--arch/powerpc/kernel/vdso64/cacheflush.S1
-rw-r--r--arch/powerpc/kernel/vdso64/datapage.S1
-rw-r--r--arch/powerpc/kernel/vdso64/gettimeofday.S1
-rw-r--r--arch/powerpc/kernel/vdso64/sigtramp.S1
-rw-r--r--arch/powerpc/kernel/vector.S1
-rw-r--r--arch/powerpc/kernel/vio.c12
-rw-r--r--arch/powerpc/kernel/vmlinux.lds.S1
-rw-r--r--arch/powerpc/lib/copy_32.S1
-rw-r--r--arch/powerpc/lib/locks.c1
-rw-r--r--arch/powerpc/lib/sstep.c1
-rw-r--r--arch/powerpc/lib/string.S1
-rw-r--r--arch/powerpc/math-emu/math.c1
-rw-r--r--arch/powerpc/mm/44x_mmu.c1
-rw-r--r--arch/powerpc/mm/4xx_mmu.c1
-rw-r--r--arch/powerpc/mm/fault.c37
-rw-r--r--arch/powerpc/mm/fsl_booke_mmu.c1
-rw-r--r--arch/powerpc/mm/hash_low_32.S1
-rw-r--r--arch/powerpc/mm/hash_low_64.S1
-rw-r--r--arch/powerpc/mm/hash_native_64.c3
-rw-r--r--arch/powerpc/mm/hash_utils_64.c107
-rw-r--r--arch/powerpc/mm/init_32.c1
-rw-r--r--arch/powerpc/mm/init_64.c4
-rw-r--r--arch/powerpc/mm/lmb.c1
-rw-r--r--arch/powerpc/mm/mem.c12
-rw-r--r--arch/powerpc/mm/mmu_context_32.c1
-rw-r--r--arch/powerpc/mm/mmu_context_64.c3
-rw-r--r--arch/powerpc/mm/numa.c11
-rw-r--r--arch/powerpc/mm/pgtable_32.c1
-rw-r--r--arch/powerpc/mm/pgtable_64.c1
-rw-r--r--arch/powerpc/mm/ppc_mmu_32.c1
-rw-r--r--arch/powerpc/mm/slb.c1
-rw-r--r--arch/powerpc/mm/slb_low.S1
-rw-r--r--arch/powerpc/mm/stab.c1
-rw-r--r--arch/powerpc/mm/tlb_32.c1
-rw-r--r--arch/powerpc/mm/tlb_64.c1
-rw-r--r--arch/powerpc/oprofile/common.c2
-rw-r--r--arch/powerpc/platforms/83xx/misc.c1
-rw-r--r--arch/powerpc/platforms/83xx/mpc834x_sys.c1
-rw-r--r--arch/powerpc/platforms/83xx/pci.c6
-rw-r--r--arch/powerpc/platforms/85xx/mpc8540_ads.h1
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_ads.c1
-rw-r--r--arch/powerpc/platforms/85xx/pci.c6
-rw-r--r--arch/powerpc/platforms/86xx/Kconfig6
-rw-r--r--arch/powerpc/platforms/86xx/Makefile3
-rw-r--r--arch/powerpc/platforms/86xx/mpc8641_hpcn.h1
-rw-r--r--arch/powerpc/platforms/86xx/mpc86xx.h8
-rw-r--r--arch/powerpc/platforms/86xx/mpc86xx_hpcn.c129
-rw-r--r--arch/powerpc/platforms/86xx/mpc86xx_smp.c10
-rw-r--r--arch/powerpc/platforms/86xx/pci.c137
-rw-r--r--arch/powerpc/platforms/Makefile1
-rw-r--r--arch/powerpc/platforms/cell/Kconfig2
-rw-r--r--arch/powerpc/platforms/cell/interrupt.c420
-rw-r--r--arch/powerpc/platforms/cell/interrupt.h19
-rw-r--r--arch/powerpc/platforms/cell/pervasive.c1
-rw-r--r--arch/powerpc/platforms/cell/setup.c39
-rw-r--r--arch/powerpc/platforms/cell/smp.c1
-rw-r--r--arch/powerpc/platforms/cell/spider-pic.c394
-rw-r--r--arch/powerpc/platforms/cell/spu_base.c127
-rw-r--r--arch/powerpc/platforms/cell/spufs/backing_ops.c1
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c10
-rw-r--r--arch/powerpc/platforms/cell/spufs/hw_ops.c1
-rw-r--r--arch/powerpc/platforms/cell/spufs/sched.c1
-rw-r--r--arch/powerpc/platforms/cell/spufs/switch.c11
-rw-r--r--arch/powerpc/platforms/chrp/pci.c16
-rw-r--r--arch/powerpc/platforms/chrp/setup.c102
-rw-r--r--arch/powerpc/platforms/chrp/smp.c2
-rw-r--r--arch/powerpc/platforms/embedded6xx/Kconfig15
-rw-r--r--arch/powerpc/platforms/embedded6xx/Makefile4
-rw-r--r--arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c335
-rw-r--r--arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.h26
-rw-r--r--arch/powerpc/platforms/iseries/dt.c2
-rw-r--r--arch/powerpc/platforms/iseries/htab.c4
-rw-r--r--arch/powerpc/platforms/iseries/irq.c110
-rw-r--r--arch/powerpc/platforms/iseries/irq.h2
-rw-r--r--arch/powerpc/platforms/iseries/lpardata.c1
-rw-r--r--arch/powerpc/platforms/iseries/lpevents.c55
-rw-r--r--arch/powerpc/platforms/iseries/proc.c1
-rw-r--r--arch/powerpc/platforms/iseries/setup.c26
-rw-r--r--arch/powerpc/platforms/iseries/smp.c1
-rw-r--r--arch/powerpc/platforms/maple/pci.c22
-rw-r--r--arch/powerpc/platforms/maple/setup.c102
-rw-r--r--arch/powerpc/platforms/maple/time.c1
-rw-r--r--arch/powerpc/platforms/powermac/backlight.c15
-rw-r--r--arch/powerpc/platforms/powermac/bootx_init.c34
-rw-r--r--arch/powerpc/platforms/powermac/cache.S1
-rw-r--r--arch/powerpc/platforms/powermac/cpufreq_32.c5
-rw-r--r--arch/powerpc/platforms/powermac/cpufreq_64.c1
-rw-r--r--arch/powerpc/platforms/powermac/feature.c1
-rw-r--r--arch/powerpc/platforms/powermac/low_i2c.c10
-rw-r--r--arch/powerpc/platforms/powermac/nvram.c6
-rw-r--r--arch/powerpc/platforms/powermac/pci.c73
-rw-r--r--arch/powerpc/platforms/powermac/pfunc_base.c14
-rw-r--r--arch/powerpc/platforms/powermac/pfunc_core.c3
-rw-r--r--arch/powerpc/platforms/powermac/pic.c425
-rw-r--r--arch/powerpc/platforms/powermac/pmac.h2
-rw-r--r--arch/powerpc/platforms/powermac/setup.c13
-rw-r--r--arch/powerpc/platforms/powermac/sleep.S1
-rw-r--r--arch/powerpc/platforms/powermac/smp.c3
-rw-r--r--arch/powerpc/platforms/powermac/time.c1
-rw-r--r--arch/powerpc/platforms/powermac/udbg_adb.c1
-rw-r--r--arch/powerpc/platforms/powermac/udbg_scc.c1
-rw-r--r--arch/powerpc/platforms/pseries/eeh_cache.c2
-rw-r--r--arch/powerpc/platforms/pseries/eeh_driver.c2
-rw-r--r--arch/powerpc/platforms/pseries/eeh_event.c2
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c34
-rw-r--r--arch/powerpc/platforms/pseries/lpar.c5
-rw-r--r--arch/powerpc/platforms/pseries/ras.c82
-rw-r--r--arch/powerpc/platforms/pseries/setup.c255
-rw-r--r--arch/powerpc/platforms/pseries/smp.c33
-rw-r--r--arch/powerpc/platforms/pseries/xics.c732
-rw-r--r--arch/powerpc/platforms/pseries/xics.h17
-rw-r--r--arch/powerpc/sysdev/Makefile7
-rw-r--r--arch/powerpc/sysdev/dart.h6
-rw-r--r--arch/powerpc/sysdev/dart_iommu.c50
-rw-r--r--arch/powerpc/sysdev/fsl_soc.c1
-rw-r--r--arch/powerpc/sysdev/i8259.c163
-rw-r--r--arch/powerpc/sysdev/ipic.c2
-rw-r--r--arch/powerpc/sysdev/mmio_nvram.c2
-rw-r--r--arch/powerpc/sysdev/mpic.c486
-rw-r--r--arch/powerpc/sysdev/todc.c392
-rw-r--r--arch/powerpc/sysdev/tsi108_dev.c145
-rw-r--r--arch/powerpc/sysdev/tsi108_pci.c412
-rw-r--r--arch/powerpc/xmon/xmon.c1
199 files changed, 7958 insertions, 3402 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index e922a88b2bad..2643dbc3f289 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -30,6 +30,10 @@ config GENERIC_HARDIRQS
30 bool 30 bool
31 default y 31 default y
32 32
33config IRQ_PER_CPU
34 bool
35 default y
36
33config RWSEM_GENERIC_SPINLOCK 37config RWSEM_GENERIC_SPINLOCK
34 bool 38 bool
35 39
@@ -336,7 +340,7 @@ config PPC_ISERIES
336 340
337config EMBEDDED6xx 341config EMBEDDED6xx
338 bool "Embedded 6xx/7xx/7xxx-based board" 342 bool "Embedded 6xx/7xx/7xxx-based board"
339 depends on PPC32 && BROKEN 343 depends on PPC32 && (BROKEN||BROKEN_ON_SMP)
340 344
341config APUS 345config APUS
342 bool "Amiga-APUS" 346 bool "Amiga-APUS"
@@ -413,12 +417,17 @@ config PPC_CELL_NATIVE
413 default n 417 default n
414 418
415config PPC_IBM_CELL_BLADE 419config PPC_IBM_CELL_BLADE
416 bool " IBM Cell Blade" 420 bool "IBM Cell Blade"
417 depends on PPC_MULTIPLATFORM && PPC64 421 depends on PPC_MULTIPLATFORM && PPC64
418 select PPC_CELL_NATIVE 422 select PPC_CELL_NATIVE
419 select PPC_RTAS 423 select PPC_RTAS
420 select MMIO_NVRAM 424 select MMIO_NVRAM
421 select PPC_UDBG_16550 425 select PPC_UDBG_16550
426 select UDBG_RTAS_CONSOLE
427
428config UDBG_RTAS_CONSOLE
429 bool
430 default n
422 431
423config XICS 432config XICS
424 depends on PPC_PSERIES 433 depends on PPC_PSERIES
@@ -431,7 +440,8 @@ config U3_DART
431 default n 440 default n
432 441
433config MPIC 442config MPIC
434 depends on PPC_PSERIES || PPC_PMAC || PPC_MAPLE || PPC_CHRP 443 depends on PPC_PSERIES || PPC_PMAC || PPC_MAPLE || PPC_CHRP \
444 || MPC7448HPC2
435 bool 445 bool
436 default y 446 default y
437 447
@@ -557,6 +567,13 @@ config TAU_AVERAGE
557 /proc/cpuinfo. 567 /proc/cpuinfo.
558 568
559 If in doubt, say N here. 569 If in doubt, say N here.
570
571config PPC_TODC
572 depends on EMBEDDED6xx
573 bool "Generic Time-of-day Clock (TODC) support"
574 ---help---
575 This adds support for many TODC/RTC chips.
576
560endmenu 577endmenu
561 578
562source arch/powerpc/platforms/embedded6xx/Kconfig 579source arch/powerpc/platforms/embedded6xx/Kconfig
@@ -618,16 +635,19 @@ config HOTPLUG_CPU
618 635
619 Say N if you are unsure. 636 Say N if you are unsure.
620 637
638config ARCH_ENABLE_MEMORY_HOTPLUG
639 def_bool y
640
621config KEXEC 641config KEXEC
622 bool "kexec system call (EXPERIMENTAL)" 642 bool "kexec system call (EXPERIMENTAL)"
623 depends on PPC_MULTIPLATFORM && EXPERIMENTAL 643 depends on PPC_MULTIPLATFORM && EXPERIMENTAL
624 help 644 help
625 kexec is a system call that implements the ability to shutdown your 645 kexec is a system call that implements the ability to shutdown your
626 current kernel, and to start another kernel. It is like a reboot 646 current kernel, and to start another kernel. It is like a reboot
627 but it is indepedent of the system firmware. And like a reboot 647 but it is independent of the system firmware. And like a reboot
628 you can start any kernel with it, not just Linux. 648 you can start any kernel with it, not just Linux.
629 649
630 The name comes from the similiarity to the exec system call. 650 The name comes from the similarity to the exec system call.
631 651
632 It is an ongoing process to be certain the hardware in a machine 652 It is an ongoing process to be certain the hardware in a machine
633 is properly shutdown, so do not be surprised if this code does not 653 is properly shutdown, so do not be surprised if this code does not
@@ -794,7 +814,6 @@ config GENERIC_ISA_DMA
794 814
795config PPC_I8259 815config PPC_I8259
796 bool 816 bool
797 default y if MPC8641_HPCN
798 default n 817 default n
799 818
800config PPC_INDIRECT_PCI 819config PPC_INDIRECT_PCI
@@ -817,7 +836,8 @@ config MCA
817 bool 836 bool
818 837
819config PCI 838config PCI
820 bool "PCI support" if 40x || CPM2 || PPC_83xx || PPC_85xx || PPC_86xx || PPC_MPC52xx || (EMBEDDED && PPC_ISERIES) 839 bool "PCI support" if 40x || CPM2 || PPC_83xx || PPC_85xx || PPC_MPC52xx || (EMBEDDED && PPC_ISERIES) \
840 || MPC7448HPC2
821 default y if !40x && !CPM2 && !8xx && !APUS && !PPC_83xx && !PPC_85xx && !PPC_86xx 841 default y if !40x && !CPM2 && !8xx && !APUS && !PPC_83xx && !PPC_85xx && !PPC_86xx
822 default PCI_PERMEDIA if !4xx && !CPM2 && !8xx && APUS 842 default PCI_PERMEDIA if !4xx && !CPM2 && !8xx && APUS
823 default PCI_QSPAN if !4xx && !CPM2 && 8xx 843 default PCI_QSPAN if !4xx && !CPM2 && 8xx
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index c69006ae8246..e29ef77d3b00 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -134,12 +134,19 @@ config PPC_EARLY_DEBUG_G5
134 help 134 help
135 Select this to enable early debugging for Apple G5 machines. 135 Select this to enable early debugging for Apple G5 machines.
136 136
137config PPC_EARLY_DEBUG_RTAS 137config PPC_EARLY_DEBUG_RTAS_PANEL
138 bool "RTAS Panel" 138 bool "RTAS Panel"
139 depends on PPC_RTAS 139 depends on PPC_RTAS
140 help 140 help
141 Select this to enable early debugging via the RTAS panel. 141 Select this to enable early debugging via the RTAS panel.
142 142
143config PPC_EARLY_DEBUG_RTAS_CONSOLE
144 bool "RTAS Console"
145 depends on PPC_RTAS
146 select UDBG_RTAS_CONSOLE
147 help
148 Select this to enable early debugging via the RTAS console.
149
143config PPC_EARLY_DEBUG_MAPLE 150config PPC_EARLY_DEBUG_MAPLE
144 bool "Maple real mode" 151 bool "Maple real mode"
145 depends on PPC_MAPLE 152 depends on PPC_MAPLE
diff --git a/arch/powerpc/configs/cell_defconfig b/arch/powerpc/configs/cell_defconfig
index b8b8d4675dc0..e028a2ecb8a3 100644
--- a/arch/powerpc/configs/cell_defconfig
+++ b/arch/powerpc/configs/cell_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.17 3# Linux kernel version: 2.6.17-rc6
4# Mon Jun 19 17:23:03 2006 4# Thu Jun 22 15:28:36 2006
5# 5#
6CONFIG_PPC64=y 6CONFIG_PPC64=y
7CONFIG_64BIT=y 7CONFIG_64BIT=y
@@ -1063,7 +1063,8 @@ CONFIG_DEBUG_FS=y
1063# CONFIG_DEBUG_STACKOVERFLOW is not set 1063# CONFIG_DEBUG_STACKOVERFLOW is not set
1064# CONFIG_DEBUG_STACK_USAGE is not set 1064# CONFIG_DEBUG_STACK_USAGE is not set
1065CONFIG_DEBUGGER=y 1065CONFIG_DEBUGGER=y
1066# CONFIG_XMON is not set 1066CONFIG_XMON=y
1067CONFIG_XMON_DEFAULT=y
1067CONFIG_IRQSTACKS=y 1068CONFIG_IRQSTACKS=y
1068# CONFIG_BOOTX_TEXT is not set 1069# CONFIG_BOOTX_TEXT is not set
1069# CONFIG_PPC_EARLY_DEBUG is not set 1070# CONFIG_PPC_EARLY_DEBUG is not set
diff --git a/arch/powerpc/configs/chrp32_defconfig b/arch/powerpc/configs/chrp32_defconfig
new file mode 100644
index 000000000000..0fa010a63a8e
--- /dev/null
+++ b/arch/powerpc/configs/chrp32_defconfig
@@ -0,0 +1,1378 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.17
4# Mon Jul 3 12:08:41 2006
5#
6# CONFIG_PPC64 is not set
7CONFIG_PPC32=y
8CONFIG_PPC_MERGE=y
9CONFIG_MMU=y
10CONFIG_GENERIC_HARDIRQS=y
11CONFIG_RWSEM_XCHGADD_ALGORITHM=y
12CONFIG_GENERIC_HWEIGHT=y
13CONFIG_GENERIC_CALIBRATE_DELAY=y
14CONFIG_GENERIC_FIND_NEXT_BIT=y
15CONFIG_PPC=y
16CONFIG_EARLY_PRINTK=y
17CONFIG_GENERIC_NVRAM=y
18CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
19CONFIG_ARCH_MAY_HAVE_PC_FDC=y
20CONFIG_PPC_OF=y
21CONFIG_PPC_UDBG_16550=y
22CONFIG_GENERIC_TBSYNC=y
23# CONFIG_DEFAULT_UIMAGE is not set
24
25#
26# Processor support
27#
28CONFIG_CLASSIC32=y
29# CONFIG_PPC_52xx is not set
30# CONFIG_PPC_82xx is not set
31# CONFIG_PPC_83xx is not set
32# CONFIG_PPC_85xx is not set
33# CONFIG_PPC_86xx is not set
34# CONFIG_40x is not set
35# CONFIG_44x is not set
36# CONFIG_8xx is not set
37# CONFIG_E200 is not set
38CONFIG_6xx=y
39CONFIG_PPC_FPU=y
40# CONFIG_ALTIVEC is not set
41CONFIG_PPC_STD_MMU=y
42CONFIG_PPC_STD_MMU_32=y
43CONFIG_SMP=y
44CONFIG_NR_CPUS=4
45
46#
47# Code maturity level options
48#
49CONFIG_EXPERIMENTAL=y
50CONFIG_LOCK_KERNEL=y
51CONFIG_INIT_ENV_ARG_LIMIT=32
52
53#
54# General setup
55#
56CONFIG_LOCALVERSION=""
57# CONFIG_LOCALVERSION_AUTO is not set
58CONFIG_SWAP=y
59CONFIG_SYSVIPC=y
60CONFIG_POSIX_MQUEUE=y
61# CONFIG_BSD_PROCESS_ACCT is not set
62CONFIG_SYSCTL=y
63# CONFIG_AUDIT is not set
64CONFIG_IKCONFIG=y
65CONFIG_IKCONFIG_PROC=y
66# CONFIG_CPUSETS is not set
67# CONFIG_RELAY is not set
68CONFIG_INITRAMFS_SOURCE=""
69# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
70# CONFIG_EMBEDDED is not set
71CONFIG_KALLSYMS=y
72# CONFIG_KALLSYMS_ALL is not set
73# CONFIG_KALLSYMS_EXTRA_PASS is not set
74CONFIG_HOTPLUG=y
75CONFIG_PRINTK=y
76CONFIG_BUG=y
77CONFIG_ELF_CORE=y
78CONFIG_BASE_FULL=y
79CONFIG_FUTEX=y
80CONFIG_EPOLL=y
81CONFIG_SHMEM=y
82CONFIG_SLAB=y
83# CONFIG_TINY_SHMEM is not set
84CONFIG_BASE_SMALL=0
85# CONFIG_SLOB is not set
86
87#
88# Loadable module support
89#
90CONFIG_MODULES=y
91CONFIG_MODULE_UNLOAD=y
92CONFIG_MODULE_FORCE_UNLOAD=y
93# CONFIG_MODVERSIONS is not set
94# CONFIG_MODULE_SRCVERSION_ALL is not set
95CONFIG_KMOD=y
96CONFIG_STOP_MACHINE=y
97
98#
99# Block layer
100#
101CONFIG_LBD=y
102# CONFIG_BLK_DEV_IO_TRACE is not set
103# CONFIG_LSF is not set
104
105#
106# IO Schedulers
107#
108CONFIG_IOSCHED_NOOP=y
109CONFIG_IOSCHED_AS=y
110CONFIG_IOSCHED_DEADLINE=y
111CONFIG_IOSCHED_CFQ=y
112CONFIG_DEFAULT_AS=y
113# CONFIG_DEFAULT_DEADLINE is not set
114# CONFIG_DEFAULT_CFQ is not set
115# CONFIG_DEFAULT_NOOP is not set
116CONFIG_DEFAULT_IOSCHED="anticipatory"
117
118#
119# Platform support
120#
121CONFIG_PPC_MULTIPLATFORM=y
122# CONFIG_PPC_ISERIES is not set
123# CONFIG_EMBEDDED6xx is not set
124# CONFIG_APUS is not set
125CONFIG_PPC_CHRP=y
126# CONFIG_PPC_PMAC is not set
127# CONFIG_PPC_CELL is not set
128# CONFIG_PPC_CELL_NATIVE is not set
129CONFIG_MPIC=y
130CONFIG_PPC_RTAS=y
131# CONFIG_RTAS_ERROR_LOGGING is not set
132CONFIG_RTAS_PROC=y
133# CONFIG_MMIO_NVRAM is not set
134CONFIG_PPC_MPC106=y
135# CONFIG_PPC_970_NAP is not set
136# CONFIG_CPU_FREQ is not set
137# CONFIG_TAU is not set
138# CONFIG_WANT_EARLY_SERIAL is not set
139
140#
141# Kernel options
142#
143CONFIG_HIGHMEM=y
144# CONFIG_HZ_100 is not set
145CONFIG_HZ_250=y
146# CONFIG_HZ_1000 is not set
147CONFIG_HZ=250
148CONFIG_PREEMPT_NONE=y
149# CONFIG_PREEMPT_VOLUNTARY is not set
150# CONFIG_PREEMPT is not set
151CONFIG_PREEMPT_BKL=y
152CONFIG_BINFMT_ELF=y
153CONFIG_BINFMT_MISC=y
154# CONFIG_KEXEC is not set
155CONFIG_IRQ_ALL_CPUS=y
156CONFIG_ARCH_FLATMEM_ENABLE=y
157CONFIG_SELECT_MEMORY_MODEL=y
158CONFIG_FLATMEM_MANUAL=y
159# CONFIG_DISCONTIGMEM_MANUAL is not set
160# CONFIG_SPARSEMEM_MANUAL is not set
161CONFIG_FLATMEM=y
162CONFIG_FLAT_NODE_MEM_MAP=y
163# CONFIG_SPARSEMEM_STATIC is not set
164CONFIG_SPLIT_PTLOCK_CPUS=4
165CONFIG_PROC_DEVICETREE=y
166# CONFIG_CMDLINE_BOOL is not set
167# CONFIG_PM is not set
168CONFIG_SECCOMP=y
169CONFIG_ISA_DMA_API=y
170
171#
172# Bus options
173#
174CONFIG_ISA=y
175CONFIG_GENERIC_ISA_DMA=y
176CONFIG_PPC_I8259=y
177CONFIG_PPC_INDIRECT_PCI=y
178CONFIG_PCI=y
179CONFIG_PCI_DOMAINS=y
180# CONFIG_PCIEPORTBUS is not set
181# CONFIG_PCI_DEBUG is not set
182
183#
184# PCCARD (PCMCIA/CardBus) support
185#
186# CONFIG_PCCARD is not set
187
188#
189# PCI Hotplug Support
190#
191# CONFIG_HOTPLUG_PCI is not set
192
193#
194# Advanced setup
195#
196# CONFIG_ADVANCED_OPTIONS is not set
197
198#
199# Default settings for advanced configuration options are used
200#
201CONFIG_HIGHMEM_START=0xfe000000
202CONFIG_LOWMEM_SIZE=0x30000000
203CONFIG_KERNEL_START=0xc0000000
204CONFIG_TASK_SIZE=0x80000000
205CONFIG_BOOT_LOAD=0x00800000
206
207#
208# Networking
209#
210CONFIG_NET=y
211
212#
213# Networking options
214#
215# CONFIG_NETDEBUG is not set
216CONFIG_PACKET=y
217# CONFIG_PACKET_MMAP is not set
218CONFIG_UNIX=y
219# CONFIG_NET_KEY is not set
220CONFIG_INET=y
221CONFIG_IP_MULTICAST=y
222# CONFIG_IP_ADVANCED_ROUTER is not set
223CONFIG_IP_FIB_HASH=y
224# CONFIG_IP_PNP is not set
225# CONFIG_NET_IPIP is not set
226# CONFIG_NET_IPGRE is not set
227# CONFIG_IP_MROUTE is not set
228# CONFIG_ARPD is not set
229CONFIG_SYN_COOKIES=y
230# CONFIG_INET_AH is not set
231# CONFIG_INET_ESP is not set
232# CONFIG_INET_IPCOMP is not set
233# CONFIG_INET_XFRM_TUNNEL is not set
234# CONFIG_INET_TUNNEL is not set
235# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
236# CONFIG_INET_XFRM_MODE_TUNNEL is not set
237CONFIG_INET_DIAG=y
238CONFIG_INET_TCP_DIAG=y
239# CONFIG_TCP_CONG_ADVANCED is not set
240CONFIG_TCP_CONG_BIC=y
241
242#
243# IP: Virtual Server Configuration
244#
245# CONFIG_IP_VS is not set
246# CONFIG_IPV6 is not set
247# CONFIG_INET6_XFRM_TUNNEL is not set
248# CONFIG_INET6_TUNNEL is not set
249# CONFIG_NETWORK_SECMARK is not set
250CONFIG_NETFILTER=y
251# CONFIG_NETFILTER_DEBUG is not set
252
253#
254# Core Netfilter Configuration
255#
256# CONFIG_NETFILTER_NETLINK is not set
257# CONFIG_NETFILTER_XTABLES is not set
258
259#
260# IP: Netfilter Configuration
261#
262CONFIG_IP_NF_CONNTRACK=m
263# CONFIG_IP_NF_CT_ACCT is not set
264# CONFIG_IP_NF_CONNTRACK_MARK is not set
265# CONFIG_IP_NF_CONNTRACK_EVENTS is not set
266# CONFIG_IP_NF_CT_PROTO_SCTP is not set
267CONFIG_IP_NF_FTP=m
268CONFIG_IP_NF_IRC=m
269# CONFIG_IP_NF_NETBIOS_NS is not set
270CONFIG_IP_NF_TFTP=m
271CONFIG_IP_NF_AMANDA=m
272# CONFIG_IP_NF_PPTP is not set
273# CONFIG_IP_NF_H323 is not set
274# CONFIG_IP_NF_SIP is not set
275# CONFIG_IP_NF_QUEUE is not set
276
277#
278# DCCP Configuration (EXPERIMENTAL)
279#
280# CONFIG_IP_DCCP is not set
281
282#
283# SCTP Configuration (EXPERIMENTAL)
284#
285# CONFIG_IP_SCTP is not set
286
287#
288# TIPC Configuration (EXPERIMENTAL)
289#
290# CONFIG_TIPC is not set
291# CONFIG_ATM is not set
292# CONFIG_BRIDGE is not set
293# CONFIG_VLAN_8021Q is not set
294# CONFIG_DECNET is not set
295# CONFIG_LLC2 is not set
296# CONFIG_IPX is not set
297# CONFIG_ATALK is not set
298# CONFIG_X25 is not set
299# CONFIG_LAPB is not set
300# CONFIG_NET_DIVERT is not set
301# CONFIG_ECONET is not set
302# CONFIG_WAN_ROUTER is not set
303
304#
305# QoS and/or fair queueing
306#
307# CONFIG_NET_SCHED is not set
308
309#
310# Network testing
311#
312# CONFIG_NET_PKTGEN is not set
313# CONFIG_HAMRADIO is not set
314# CONFIG_IRDA is not set
315# CONFIG_BT is not set
316# CONFIG_IEEE80211 is not set
317
318#
319# Device Drivers
320#
321
322#
323# Generic Driver Options
324#
325# CONFIG_STANDALONE is not set
326CONFIG_PREVENT_FIRMWARE_BUILD=y
327# CONFIG_FW_LOADER is not set
328# CONFIG_DEBUG_DRIVER is not set
329# CONFIG_SYS_HYPERVISOR is not set
330
331#
332# Connector - unified userspace <-> kernelspace linker
333#
334# CONFIG_CONNECTOR is not set
335
336#
337# Memory Technology Devices (MTD)
338#
339# CONFIG_MTD is not set
340
341#
342# Parallel port support
343#
344# CONFIG_PARPORT is not set
345
346#
347# Plug and Play support
348#
349# CONFIG_PNP is not set
350
351#
352# Block devices
353#
354CONFIG_BLK_DEV_FD=y
355# CONFIG_BLK_DEV_XD is not set
356# CONFIG_BLK_CPQ_DA is not set
357# CONFIG_BLK_CPQ_CISS_DA is not set
358# CONFIG_BLK_DEV_DAC960 is not set
359# CONFIG_BLK_DEV_UMEM is not set
360# CONFIG_BLK_DEV_COW_COMMON is not set
361CONFIG_BLK_DEV_LOOP=y
362# CONFIG_BLK_DEV_CRYPTOLOOP is not set
363# CONFIG_BLK_DEV_NBD is not set
364# CONFIG_BLK_DEV_SX8 is not set
365# CONFIG_BLK_DEV_UB is not set
366CONFIG_BLK_DEV_RAM=y
367CONFIG_BLK_DEV_RAM_COUNT=16
368CONFIG_BLK_DEV_RAM_SIZE=4096
369CONFIG_BLK_DEV_INITRD=y
370# CONFIG_CDROM_PKTCDVD is not set
371# CONFIG_ATA_OVER_ETH is not set
372
373#
374# ATA/ATAPI/MFM/RLL support
375#
376CONFIG_IDE=y
377CONFIG_BLK_DEV_IDE=y
378
379#
380# Please see Documentation/ide.txt for help/info on IDE drives
381#
382# CONFIG_BLK_DEV_IDE_SATA is not set
383CONFIG_BLK_DEV_IDEDISK=y
384CONFIG_IDEDISK_MULTI_MODE=y
385CONFIG_BLK_DEV_IDECD=y
386# CONFIG_BLK_DEV_IDETAPE is not set
387# CONFIG_BLK_DEV_IDEFLOPPY is not set
388# CONFIG_BLK_DEV_IDESCSI is not set
389# CONFIG_IDE_TASK_IOCTL is not set
390
391#
392# IDE chipset support/bugfixes
393#
394CONFIG_IDE_GENERIC=y
395CONFIG_BLK_DEV_IDEPCI=y
396CONFIG_IDEPCI_SHARE_IRQ=y
397# CONFIG_BLK_DEV_OFFBOARD is not set
398CONFIG_BLK_DEV_GENERIC=y
399# CONFIG_BLK_DEV_OPTI621 is not set
400CONFIG_BLK_DEV_SL82C105=y
401CONFIG_BLK_DEV_IDEDMA_PCI=y
402# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
403CONFIG_IDEDMA_PCI_AUTO=y
404# CONFIG_IDEDMA_ONLYDISK is not set
405# CONFIG_BLK_DEV_AEC62XX is not set
406# CONFIG_BLK_DEV_ALI15X3 is not set
407# CONFIG_BLK_DEV_AMD74XX is not set
408# CONFIG_BLK_DEV_CMD64X is not set
409# CONFIG_BLK_DEV_TRIFLEX is not set
410# CONFIG_BLK_DEV_CY82C693 is not set
411# CONFIG_BLK_DEV_CS5520 is not set
412# CONFIG_BLK_DEV_CS5530 is not set
413# CONFIG_BLK_DEV_HPT34X is not set
414# CONFIG_BLK_DEV_HPT366 is not set
415# CONFIG_BLK_DEV_SC1200 is not set
416# CONFIG_BLK_DEV_PIIX is not set
417# CONFIG_BLK_DEV_IT821X is not set
418# CONFIG_BLK_DEV_NS87415 is not set
419# CONFIG_BLK_DEV_PDC202XX_OLD is not set
420# CONFIG_BLK_DEV_PDC202XX_NEW is not set
421# CONFIG_BLK_DEV_SVWKS is not set
422# CONFIG_BLK_DEV_SIIMAGE is not set
423# CONFIG_BLK_DEV_SLC90E66 is not set
424# CONFIG_BLK_DEV_TRM290 is not set
425CONFIG_BLK_DEV_VIA82CXXX=y
426# CONFIG_IDE_ARM is not set
427# CONFIG_IDE_CHIPSETS is not set
428CONFIG_BLK_DEV_IDEDMA=y
429# CONFIG_IDEDMA_IVB is not set
430CONFIG_IDEDMA_AUTO=y
431# CONFIG_BLK_DEV_HD is not set
432
433#
434# SCSI device support
435#
436# CONFIG_RAID_ATTRS is not set
437CONFIG_SCSI=y
438CONFIG_SCSI_PROC_FS=y
439
440#
441# SCSI support type (disk, tape, CD-ROM)
442#
443CONFIG_BLK_DEV_SD=y
444CONFIG_CHR_DEV_ST=y
445# CONFIG_CHR_DEV_OSST is not set
446CONFIG_BLK_DEV_SR=y
447CONFIG_BLK_DEV_SR_VENDOR=y
448CONFIG_CHR_DEV_SG=y
449# CONFIG_CHR_DEV_SCH is not set
450
451#
452# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
453#
454# CONFIG_SCSI_MULTI_LUN is not set
455CONFIG_SCSI_CONSTANTS=y
456# CONFIG_SCSI_LOGGING is not set
457
458#
459# SCSI Transport Attributes
460#
461CONFIG_SCSI_SPI_ATTRS=y
462# CONFIG_SCSI_FC_ATTRS is not set
463# CONFIG_SCSI_ISCSI_ATTRS is not set
464# CONFIG_SCSI_SAS_ATTRS is not set
465
466#
467# SCSI low-level drivers
468#
469# CONFIG_ISCSI_TCP is not set
470# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
471# CONFIG_SCSI_3W_9XXX is not set
472# CONFIG_SCSI_7000FASST is not set
473# CONFIG_SCSI_ACARD is not set
474# CONFIG_SCSI_AHA152X is not set
475# CONFIG_SCSI_AHA1542 is not set
476# CONFIG_SCSI_AACRAID is not set
477# CONFIG_SCSI_AIC7XXX is not set
478# CONFIG_SCSI_AIC7XXX_OLD is not set
479# CONFIG_SCSI_AIC79XX is not set
480# CONFIG_SCSI_DPT_I2O is not set
481# CONFIG_SCSI_IN2000 is not set
482# CONFIG_MEGARAID_NEWGEN is not set
483# CONFIG_MEGARAID_LEGACY is not set
484# CONFIG_MEGARAID_SAS is not set
485# CONFIG_SCSI_SATA is not set
486# CONFIG_SCSI_HPTIOP is not set
487# CONFIG_SCSI_BUSLOGIC is not set
488# CONFIG_SCSI_DMX3191D is not set
489# CONFIG_SCSI_DTC3280 is not set
490# CONFIG_SCSI_EATA is not set
491# CONFIG_SCSI_FUTURE_DOMAIN is not set
492# CONFIG_SCSI_GDTH is not set
493# CONFIG_SCSI_GENERIC_NCR5380 is not set
494# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
495# CONFIG_SCSI_IPS is not set
496# CONFIG_SCSI_INITIO is not set
497# CONFIG_SCSI_INIA100 is not set
498# CONFIG_SCSI_NCR53C406A is not set
499CONFIG_SCSI_SYM53C8XX_2=y
500CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
501CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
502CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
503CONFIG_SCSI_SYM53C8XX_MMIO=y
504# CONFIG_SCSI_IPR is not set
505# CONFIG_SCSI_PAS16 is not set
506# CONFIG_SCSI_PSI240I is not set
507# CONFIG_SCSI_QLOGIC_FAS is not set
508# CONFIG_SCSI_QLOGIC_1280 is not set
509# CONFIG_SCSI_QLA_FC is not set
510# CONFIG_SCSI_LPFC is not set
511# CONFIG_SCSI_SYM53C416 is not set
512# CONFIG_SCSI_DC395x is not set
513# CONFIG_SCSI_DC390T is not set
514# CONFIG_SCSI_T128 is not set
515# CONFIG_SCSI_U14_34F is not set
516# CONFIG_SCSI_NSP32 is not set
517# CONFIG_SCSI_DEBUG is not set
518
519#
520# Old CD-ROM drivers (not SCSI, not IDE)
521#
522# CONFIG_CD_NO_IDESCSI is not set
523
524#
525# Multi-device support (RAID and LVM)
526#
527# CONFIG_MD is not set
528
529#
530# Fusion MPT device support
531#
532# CONFIG_FUSION is not set
533# CONFIG_FUSION_SPI is not set
534# CONFIG_FUSION_FC is not set
535# CONFIG_FUSION_SAS is not set
536
537#
538# IEEE 1394 (FireWire) support
539#
540# CONFIG_IEEE1394 is not set
541
542#
543# I2O device support
544#
545# CONFIG_I2O is not set
546
547#
548# Macintosh device drivers
549#
550# CONFIG_WINDFARM is not set
551
552#
553# Network device support
554#
555CONFIG_NETDEVICES=y
556# CONFIG_DUMMY is not set
557# CONFIG_BONDING is not set
558# CONFIG_EQUALIZER is not set
559# CONFIG_TUN is not set
560
561#
562# ARCnet devices
563#
564# CONFIG_ARCNET is not set
565
566#
567# PHY device support
568#
569# CONFIG_PHYLIB is not set
570
571#
572# Ethernet (10 or 100Mbit)
573#
574CONFIG_NET_ETHERNET=y
575CONFIG_MII=y
576# CONFIG_HAPPYMEAL is not set
577# CONFIG_SUNGEM is not set
578# CONFIG_CASSINI is not set
579# CONFIG_NET_VENDOR_3COM is not set
580# CONFIG_LANCE is not set
581# CONFIG_NET_VENDOR_SMC is not set
582# CONFIG_NET_VENDOR_RACAL is not set
583
584#
585# Tulip family network device support
586#
587CONFIG_NET_TULIP=y
588# CONFIG_DE2104X is not set
589# CONFIG_TULIP is not set
590CONFIG_DE4X5=y
591# CONFIG_WINBOND_840 is not set
592# CONFIG_DM9102 is not set
593# CONFIG_ULI526X is not set
594# CONFIG_AT1700 is not set
595# CONFIG_DEPCA is not set
596# CONFIG_HP100 is not set
597# CONFIG_NET_ISA is not set
598CONFIG_NET_PCI=y
599CONFIG_PCNET32=y
600# CONFIG_AMD8111_ETH is not set
601# CONFIG_ADAPTEC_STARFIRE is not set
602# CONFIG_AC3200 is not set
603# CONFIG_APRICOT is not set
604# CONFIG_B44 is not set
605# CONFIG_FORCEDETH is not set
606# CONFIG_CS89x0 is not set
607# CONFIG_DGRS is not set
608# CONFIG_EEPRO100 is not set
609# CONFIG_E100 is not set
610# CONFIG_FEALNX is not set
611# CONFIG_NATSEMI is not set
612# CONFIG_NE2K_PCI is not set
613CONFIG_8139CP=y
614CONFIG_8139TOO=y
615# CONFIG_8139TOO_PIO is not set
616# CONFIG_8139TOO_TUNE_TWISTER is not set
617# CONFIG_8139TOO_8129 is not set
618# CONFIG_8139_OLD_RX_RESET is not set
619# CONFIG_SIS900 is not set
620# CONFIG_EPIC100 is not set
621# CONFIG_SUNDANCE is not set
622# CONFIG_TLAN is not set
623CONFIG_VIA_RHINE=y
624# CONFIG_VIA_RHINE_MMIO is not set
625
626#
627# Ethernet (1000 Mbit)
628#
629# CONFIG_ACENIC is not set
630# CONFIG_DL2K is not set
631# CONFIG_E1000 is not set
632# CONFIG_NS83820 is not set
633# CONFIG_HAMACHI is not set
634# CONFIG_YELLOWFIN is not set
635# CONFIG_R8169 is not set
636# CONFIG_SIS190 is not set
637# CONFIG_SKGE is not set
638# CONFIG_SKY2 is not set
639# CONFIG_SK98LIN is not set
640# CONFIG_VIA_VELOCITY is not set
641# CONFIG_TIGON3 is not set
642# CONFIG_BNX2 is not set
643CONFIG_MV643XX_ETH=y
644# CONFIG_MV643XX_ETH_0 is not set
645# CONFIG_MV643XX_ETH_1 is not set
646# CONFIG_MV643XX_ETH_2 is not set
647
648#
649# Ethernet (10000 Mbit)
650#
651# CONFIG_CHELSIO_T1 is not set
652# CONFIG_IXGB is not set
653# CONFIG_S2IO is not set
654# CONFIG_MYRI10GE is not set
655
656#
657# Token Ring devices
658#
659# CONFIG_TR is not set
660
661#
662# Wireless LAN (non-hamradio)
663#
664# CONFIG_NET_RADIO is not set
665
666#
667# Wan interfaces
668#
669# CONFIG_WAN is not set
670# CONFIG_FDDI is not set
671# CONFIG_HIPPI is not set
672CONFIG_PPP=m
673CONFIG_PPP_MULTILINK=y
674CONFIG_PPP_FILTER=y
675CONFIG_PPP_ASYNC=m
676CONFIG_PPP_SYNC_TTY=m
677CONFIG_PPP_DEFLATE=m
678CONFIG_PPP_BSDCOMP=m
679CONFIG_PPP_MPPE=m
680CONFIG_PPPOE=m
681# CONFIG_SLIP is not set
682# CONFIG_NET_FC is not set
683# CONFIG_SHAPER is not set
684# CONFIG_NETCONSOLE is not set
685# CONFIG_NETPOLL is not set
686# CONFIG_NET_POLL_CONTROLLER is not set
687
688#
689# ISDN subsystem
690#
691# CONFIG_ISDN is not set
692
693#
694# Telephony Support
695#
696# CONFIG_PHONE is not set
697
698#
699# Input device support
700#
701CONFIG_INPUT=y
702
703#
704# Userland interfaces
705#
706CONFIG_INPUT_MOUSEDEV=y
707CONFIG_INPUT_MOUSEDEV_PSAUX=y
708CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
709CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
710# CONFIG_INPUT_JOYDEV is not set
711# CONFIG_INPUT_TSDEV is not set
712CONFIG_INPUT_EVDEV=y
713# CONFIG_INPUT_EVBUG is not set
714
715#
716# Input Device Drivers
717#
718CONFIG_INPUT_KEYBOARD=y
719CONFIG_KEYBOARD_ATKBD=y
720# CONFIG_KEYBOARD_SUNKBD is not set
721# CONFIG_KEYBOARD_LKKBD is not set
722# CONFIG_KEYBOARD_XTKBD is not set
723# CONFIG_KEYBOARD_NEWTON is not set
724CONFIG_INPUT_MOUSE=y
725CONFIG_MOUSE_PS2=y
726# CONFIG_MOUSE_SERIAL is not set
727# CONFIG_MOUSE_INPORT is not set
728# CONFIG_MOUSE_LOGIBM is not set
729# CONFIG_MOUSE_PC110PAD is not set
730# CONFIG_MOUSE_VSXXXAA is not set
731# CONFIG_INPUT_JOYSTICK is not set
732# CONFIG_INPUT_TOUCHSCREEN is not set
733CONFIG_INPUT_MISC=y
734# CONFIG_INPUT_PCSPKR is not set
735CONFIG_INPUT_UINPUT=y
736
737#
738# Hardware I/O ports
739#
740CONFIG_SERIO=y
741CONFIG_SERIO_I8042=y
742CONFIG_SERIO_SERPORT=y
743# CONFIG_SERIO_PCIPS2 is not set
744CONFIG_SERIO_LIBPS2=y
745# CONFIG_SERIO_RAW is not set
746# CONFIG_GAMEPORT is not set
747
748#
749# Character devices
750#
751CONFIG_VT=y
752CONFIG_VT_CONSOLE=y
753CONFIG_HW_CONSOLE=y
754# CONFIG_SERIAL_NONSTANDARD is not set
755
756#
757# Serial drivers
758#
759CONFIG_SERIAL_8250=y
760CONFIG_SERIAL_8250_CONSOLE=y
761CONFIG_SERIAL_8250_PCI=y
762CONFIG_SERIAL_8250_NR_UARTS=4
763CONFIG_SERIAL_8250_RUNTIME_UARTS=4
764# CONFIG_SERIAL_8250_EXTENDED is not set
765
766#
767# Non-8250 serial port support
768#
769CONFIG_SERIAL_CORE=y
770CONFIG_SERIAL_CORE_CONSOLE=y
771# CONFIG_SERIAL_JSM is not set
772CONFIG_UNIX98_PTYS=y
773CONFIG_LEGACY_PTYS=y
774CONFIG_LEGACY_PTY_COUNT=256
775# CONFIG_HVC_RTAS is not set
776
777#
778# IPMI
779#
780# CONFIG_IPMI_HANDLER is not set
781
782#
783# Watchdog Cards
784#
785# CONFIG_WATCHDOG is not set
786CONFIG_NVRAM=y
787CONFIG_GEN_RTC=y
788# CONFIG_GEN_RTC_X is not set
789# CONFIG_DTLK is not set
790# CONFIG_R3964 is not set
791# CONFIG_APPLICOM is not set
792
793#
794# Ftape, the floppy tape device driver
795#
796# CONFIG_AGP is not set
797# CONFIG_DRM is not set
798# CONFIG_RAW_DRIVER is not set
799
800#
801# TPM devices
802#
803# CONFIG_TCG_TPM is not set
804# CONFIG_TELCLOCK is not set
805
806#
807# I2C support
808#
809CONFIG_I2C=y
810# CONFIG_I2C_CHARDEV is not set
811
812#
813# I2C Algorithms
814#
815CONFIG_I2C_ALGOBIT=y
816# CONFIG_I2C_ALGOPCF is not set
817# CONFIG_I2C_ALGOPCA is not set
818
819#
820# I2C Hardware Bus support
821#
822# CONFIG_I2C_ALI1535 is not set
823# CONFIG_I2C_ALI1563 is not set
824# CONFIG_I2C_ALI15X3 is not set
825# CONFIG_I2C_AMD756 is not set
826# CONFIG_I2C_AMD8111 is not set
827# CONFIG_I2C_HYDRA is not set
828# CONFIG_I2C_I801 is not set
829# CONFIG_I2C_I810 is not set
830# CONFIG_I2C_PIIX4 is not set
831# CONFIG_I2C_MPC is not set
832# CONFIG_I2C_NFORCE2 is not set
833# CONFIG_I2C_OCORES is not set
834# CONFIG_I2C_PARPORT_LIGHT is not set
835# CONFIG_I2C_PROSAVAGE is not set
836# CONFIG_I2C_SAVAGE4 is not set
837# CONFIG_I2C_SIS5595 is not set
838# CONFIG_I2C_SIS630 is not set
839# CONFIG_I2C_SIS96X is not set
840# CONFIG_I2C_STUB is not set
841# CONFIG_I2C_VIA is not set
842# CONFIG_I2C_VIAPRO is not set
843# CONFIG_I2C_VOODOO3 is not set
844# CONFIG_I2C_PCA_ISA is not set
845
846#
847# Miscellaneous I2C Chip support
848#
849# CONFIG_SENSORS_DS1337 is not set
850# CONFIG_SENSORS_DS1374 is not set
851# CONFIG_SENSORS_EEPROM is not set
852# CONFIG_SENSORS_PCF8574 is not set
853# CONFIG_SENSORS_PCA9539 is not set
854# CONFIG_SENSORS_PCF8591 is not set
855# CONFIG_SENSORS_M41T00 is not set
856# CONFIG_SENSORS_MAX6875 is not set
857# CONFIG_I2C_DEBUG_CORE is not set
858# CONFIG_I2C_DEBUG_ALGO is not set
859# CONFIG_I2C_DEBUG_BUS is not set
860# CONFIG_I2C_DEBUG_CHIP is not set
861
862#
863# SPI support
864#
865# CONFIG_SPI is not set
866# CONFIG_SPI_MASTER is not set
867
868#
869# Dallas's 1-wire bus
870#
871
872#
873# Hardware Monitoring support
874#
875# CONFIG_HWMON is not set
876# CONFIG_HWMON_VID is not set
877
878#
879# Misc devices
880#
881
882#
883# Multimedia devices
884#
885# CONFIG_VIDEO_DEV is not set
886CONFIG_VIDEO_V4L2=y
887
888#
889# Digital Video Broadcasting Devices
890#
891# CONFIG_DVB is not set
892# CONFIG_USB_DABUSB is not set
893
894#
895# Graphics support
896#
897CONFIG_FB=y
898CONFIG_FB_CFB_FILLRECT=y
899CONFIG_FB_CFB_COPYAREA=y
900CONFIG_FB_CFB_IMAGEBLIT=y
901CONFIG_FB_MACMODES=y
902CONFIG_FB_FIRMWARE_EDID=y
903# CONFIG_FB_BACKLIGHT is not set
904CONFIG_FB_MODE_HELPERS=y
905CONFIG_FB_TILEBLITTING=y
906# CONFIG_FB_CIRRUS is not set
907# CONFIG_FB_PM2 is not set
908# CONFIG_FB_CYBER2000 is not set
909CONFIG_FB_OF=y
910# CONFIG_FB_CT65550 is not set
911# CONFIG_FB_ASILIANT is not set
912# CONFIG_FB_IMSTT is not set
913# CONFIG_FB_VGA16 is not set
914# CONFIG_FB_S1D13XXX is not set
915# CONFIG_FB_NVIDIA is not set
916# CONFIG_FB_RIVA is not set
917CONFIG_FB_MATROX=y
918CONFIG_FB_MATROX_MILLENIUM=y
919CONFIG_FB_MATROX_MYSTIQUE=y
920CONFIG_FB_MATROX_G=y
921# CONFIG_FB_MATROX_I2C is not set
922# CONFIG_FB_MATROX_MULTIHEAD is not set
923CONFIG_FB_RADEON=y
924CONFIG_FB_RADEON_I2C=y
925# CONFIG_FB_RADEON_DEBUG is not set
926# CONFIG_FB_ATY128 is not set
927CONFIG_FB_ATY=y
928CONFIG_FB_ATY_CT=y
929# CONFIG_FB_ATY_GENERIC_LCD is not set
930CONFIG_FB_ATY_GX=y
931# CONFIG_FB_SAVAGE is not set
932# CONFIG_FB_SIS is not set
933# CONFIG_FB_NEOMAGIC is not set
934# CONFIG_FB_KYRO is not set
935CONFIG_FB_3DFX=y
936# CONFIG_FB_3DFX_ACCEL is not set
937# CONFIG_FB_VOODOO1 is not set
938# CONFIG_FB_TRIDENT is not set
939# CONFIG_FB_VIRTUAL is not set
940
941#
942# Console display driver support
943#
944CONFIG_VGA_CONSOLE=y
945# CONFIG_VGACON_SOFT_SCROLLBACK is not set
946# CONFIG_MDA_CONSOLE is not set
947CONFIG_DUMMY_CONSOLE=y
948CONFIG_FRAMEBUFFER_CONSOLE=y
949# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
950# CONFIG_FONTS is not set
951CONFIG_FONT_8x8=y
952CONFIG_FONT_8x16=y
953
954#
955# Logo configuration
956#
957CONFIG_LOGO=y
958CONFIG_LOGO_LINUX_MONO=y
959CONFIG_LOGO_LINUX_VGA16=y
960CONFIG_LOGO_LINUX_CLUT224=y
961# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
962
963#
964# Sound
965#
966# CONFIG_SOUND is not set
967
968#
969# USB support
970#
971CONFIG_USB_ARCH_HAS_HCD=y
972CONFIG_USB_ARCH_HAS_OHCI=y
973CONFIG_USB_ARCH_HAS_EHCI=y
974CONFIG_USB=y
975# CONFIG_USB_DEBUG is not set
976
977#
978# Miscellaneous USB options
979#
980CONFIG_USB_DEVICEFS=y
981# CONFIG_USB_BANDWIDTH is not set
982# CONFIG_USB_DYNAMIC_MINORS is not set
983# CONFIG_USB_OTG is not set
984
985#
986# USB Host Controller Drivers
987#
988CONFIG_USB_EHCI_HCD=m
989# CONFIG_USB_EHCI_SPLIT_ISO is not set
990# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
991# CONFIG_USB_EHCI_TT_NEWSCHED is not set
992# CONFIG_USB_ISP116X_HCD is not set
993CONFIG_USB_OHCI_HCD=y
994# CONFIG_USB_OHCI_BIG_ENDIAN is not set
995CONFIG_USB_OHCI_LITTLE_ENDIAN=y
996CONFIG_USB_UHCI_HCD=y
997# CONFIG_USB_SL811_HCD is not set
998
999#
1000# USB Device Class drivers
1001#
1002# CONFIG_USB_ACM is not set
1003# CONFIG_USB_PRINTER is not set
1004
1005#
1006# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
1007#
1008
1009#
1010# may also be needed; see USB_STORAGE Help for more information
1011#
1012CONFIG_USB_STORAGE=m
1013# CONFIG_USB_STORAGE_DEBUG is not set
1014# CONFIG_USB_STORAGE_DATAFAB is not set
1015# CONFIG_USB_STORAGE_FREECOM is not set
1016# CONFIG_USB_STORAGE_ISD200 is not set
1017# CONFIG_USB_STORAGE_DPCM is not set
1018# CONFIG_USB_STORAGE_USBAT is not set
1019# CONFIG_USB_STORAGE_SDDR09 is not set
1020# CONFIG_USB_STORAGE_SDDR55 is not set
1021# CONFIG_USB_STORAGE_JUMPSHOT is not set
1022# CONFIG_USB_STORAGE_ALAUDA is not set
1023# CONFIG_USB_STORAGE_ONETOUCH is not set
1024# CONFIG_USB_LIBUSUAL is not set
1025
1026#
1027# USB Input Devices
1028#
1029CONFIG_USB_HID=y
1030CONFIG_USB_HIDINPUT=y
1031# CONFIG_USB_HIDINPUT_POWERBOOK is not set
1032# CONFIG_HID_FF is not set
1033# CONFIG_USB_HIDDEV is not set
1034# CONFIG_USB_AIPTEK is not set
1035# CONFIG_USB_WACOM is not set
1036# CONFIG_USB_ACECAD is not set
1037# CONFIG_USB_KBTAB is not set
1038# CONFIG_USB_POWERMATE is not set
1039# CONFIG_USB_TOUCHSCREEN is not set
1040# CONFIG_USB_YEALINK is not set
1041# CONFIG_USB_XPAD is not set
1042# CONFIG_USB_ATI_REMOTE is not set
1043# CONFIG_USB_ATI_REMOTE2 is not set
1044# CONFIG_USB_KEYSPAN_REMOTE is not set
1045# CONFIG_USB_APPLETOUCH is not set
1046
1047#
1048# USB Imaging devices
1049#
1050# CONFIG_USB_MDC800 is not set
1051# CONFIG_USB_MICROTEK is not set
1052
1053#
1054# USB Network Adapters
1055#
1056# CONFIG_USB_CATC is not set
1057# CONFIG_USB_KAWETH is not set
1058# CONFIG_USB_PEGASUS is not set
1059# CONFIG_USB_RTL8150 is not set
1060# CONFIG_USB_USBNET is not set
1061CONFIG_USB_MON=y
1062
1063#
1064# USB port drivers
1065#
1066
1067#
1068# USB Serial Converter support
1069#
1070# CONFIG_USB_SERIAL is not set
1071
1072#
1073# USB Miscellaneous drivers
1074#
1075# CONFIG_USB_EMI62 is not set
1076# CONFIG_USB_EMI26 is not set
1077# CONFIG_USB_AUERSWALD is not set
1078# CONFIG_USB_RIO500 is not set
1079# CONFIG_USB_LEGOTOWER is not set
1080# CONFIG_USB_LCD is not set
1081# CONFIG_USB_LED is not set
1082# CONFIG_USB_CY7C63 is not set
1083# CONFIG_USB_CYTHERM is not set
1084# CONFIG_USB_PHIDGETKIT is not set
1085# CONFIG_USB_PHIDGETSERVO is not set
1086# CONFIG_USB_IDMOUSE is not set
1087# CONFIG_USB_APPLEDISPLAY is not set
1088# CONFIG_USB_SISUSBVGA is not set
1089# CONFIG_USB_LD is not set
1090# CONFIG_USB_TEST is not set
1091
1092#
1093# USB DSL modem support
1094#
1095
1096#
1097# USB Gadget Support
1098#
1099# CONFIG_USB_GADGET is not set
1100
1101#
1102# MMC/SD Card support
1103#
1104# CONFIG_MMC is not set
1105
1106#
1107# LED devices
1108#
1109# CONFIG_NEW_LEDS is not set
1110
1111#
1112# LED drivers
1113#
1114
1115#
1116# LED Triggers
1117#
1118
1119#
1120# InfiniBand support
1121#
1122# CONFIG_INFINIBAND is not set
1123
1124#
1125# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
1126#
1127
1128#
1129# Real Time Clock
1130#
1131# CONFIG_RTC_CLASS is not set
1132
1133#
1134# DMA Engine support
1135#
1136# CONFIG_DMA_ENGINE is not set
1137
1138#
1139# DMA Clients
1140#
1141
1142#
1143# DMA Devices
1144#
1145
1146#
1147# File systems
1148#
1149CONFIG_EXT2_FS=y
1150# CONFIG_EXT2_FS_XATTR is not set
1151# CONFIG_EXT2_FS_XIP is not set
1152CONFIG_EXT3_FS=y
1153CONFIG_EXT3_FS_XATTR=y
1154# CONFIG_EXT3_FS_POSIX_ACL is not set
1155# CONFIG_EXT3_FS_SECURITY is not set
1156CONFIG_JBD=y
1157# CONFIG_JBD_DEBUG is not set
1158CONFIG_FS_MBCACHE=y
1159# CONFIG_REISERFS_FS is not set
1160# CONFIG_JFS_FS is not set
1161# CONFIG_FS_POSIX_ACL is not set
1162# CONFIG_XFS_FS is not set
1163# CONFIG_OCFS2_FS is not set
1164# CONFIG_MINIX_FS is not set
1165# CONFIG_ROMFS_FS is not set
1166CONFIG_INOTIFY=y
1167CONFIG_INOTIFY_USER=y
1168# CONFIG_QUOTA is not set
1169CONFIG_DNOTIFY=y
1170# CONFIG_AUTOFS_FS is not set
1171# CONFIG_AUTOFS4_FS is not set
1172# CONFIG_FUSE_FS is not set
1173
1174#
1175# CD-ROM/DVD Filesystems
1176#
1177CONFIG_ISO9660_FS=y
1178# CONFIG_JOLIET is not set
1179# CONFIG_ZISOFS is not set
1180# CONFIG_UDF_FS is not set
1181
1182#
1183# DOS/FAT/NT Filesystems
1184#
1185CONFIG_FAT_FS=m
1186CONFIG_MSDOS_FS=m
1187CONFIG_VFAT_FS=m
1188CONFIG_FAT_DEFAULT_CODEPAGE=437
1189CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1190# CONFIG_NTFS_FS is not set
1191
1192#
1193# Pseudo filesystems
1194#
1195CONFIG_PROC_FS=y
1196CONFIG_PROC_KCORE=y
1197CONFIG_SYSFS=y
1198CONFIG_TMPFS=y
1199# CONFIG_HUGETLB_PAGE is not set
1200CONFIG_RAMFS=y
1201# CONFIG_CONFIGFS_FS is not set
1202
1203#
1204# Miscellaneous filesystems
1205#
1206# CONFIG_ADFS_FS is not set
1207# CONFIG_AFFS_FS is not set
1208# CONFIG_HFS_FS is not set
1209# CONFIG_HFSPLUS_FS is not set
1210# CONFIG_BEFS_FS is not set
1211# CONFIG_BFS_FS is not set
1212# CONFIG_EFS_FS is not set
1213# CONFIG_CRAMFS is not set
1214# CONFIG_VXFS_FS is not set
1215# CONFIG_HPFS_FS is not set
1216# CONFIG_QNX4FS_FS is not set
1217# CONFIG_SYSV_FS is not set
1218# CONFIG_UFS_FS is not set
1219
1220#
1221# Network File Systems
1222#
1223# CONFIG_NFS_FS is not set
1224# CONFIG_NFSD is not set
1225# CONFIG_SMB_FS is not set
1226# CONFIG_CIFS is not set
1227# CONFIG_NCP_FS is not set
1228# CONFIG_CODA_FS is not set
1229# CONFIG_AFS_FS is not set
1230# CONFIG_9P_FS is not set
1231
1232#
1233# Partition Types
1234#
1235CONFIG_PARTITION_ADVANCED=y
1236# CONFIG_ACORN_PARTITION is not set
1237# CONFIG_OSF_PARTITION is not set
1238# CONFIG_AMIGA_PARTITION is not set
1239# CONFIG_ATARI_PARTITION is not set
1240CONFIG_MAC_PARTITION=y
1241CONFIG_MSDOS_PARTITION=y
1242# CONFIG_BSD_DISKLABEL is not set
1243# CONFIG_MINIX_SUBPARTITION is not set
1244# CONFIG_SOLARIS_X86_PARTITION is not set
1245# CONFIG_UNIXWARE_DISKLABEL is not set
1246# CONFIG_LDM_PARTITION is not set
1247# CONFIG_SGI_PARTITION is not set
1248# CONFIG_ULTRIX_PARTITION is not set
1249# CONFIG_SUN_PARTITION is not set
1250# CONFIG_KARMA_PARTITION is not set
1251# CONFIG_EFI_PARTITION is not set
1252
1253#
1254# Native Language Support
1255#
1256CONFIG_NLS=y
1257CONFIG_NLS_DEFAULT="iso8859-1"
1258# CONFIG_NLS_CODEPAGE_437 is not set
1259# CONFIG_NLS_CODEPAGE_737 is not set
1260# CONFIG_NLS_CODEPAGE_775 is not set
1261# CONFIG_NLS_CODEPAGE_850 is not set
1262# CONFIG_NLS_CODEPAGE_852 is not set
1263# CONFIG_NLS_CODEPAGE_855 is not set
1264# CONFIG_NLS_CODEPAGE_857 is not set
1265# CONFIG_NLS_CODEPAGE_860 is not set
1266# CONFIG_NLS_CODEPAGE_861 is not set
1267# CONFIG_NLS_CODEPAGE_862 is not set
1268# CONFIG_NLS_CODEPAGE_863 is not set
1269# CONFIG_NLS_CODEPAGE_864 is not set
1270# CONFIG_NLS_CODEPAGE_865 is not set
1271# CONFIG_NLS_CODEPAGE_866 is not set
1272# CONFIG_NLS_CODEPAGE_869 is not set
1273# CONFIG_NLS_CODEPAGE_936 is not set
1274# CONFIG_NLS_CODEPAGE_950 is not set
1275# CONFIG_NLS_CODEPAGE_932 is not set
1276# CONFIG_NLS_CODEPAGE_949 is not set
1277# CONFIG_NLS_CODEPAGE_874 is not set
1278# CONFIG_NLS_ISO8859_8 is not set
1279# CONFIG_NLS_CODEPAGE_1250 is not set
1280# CONFIG_NLS_CODEPAGE_1251 is not set
1281CONFIG_NLS_ASCII=y
1282CONFIG_NLS_ISO8859_1=m
1283# CONFIG_NLS_ISO8859_2 is not set
1284# CONFIG_NLS_ISO8859_3 is not set
1285# CONFIG_NLS_ISO8859_4 is not set
1286# CONFIG_NLS_ISO8859_5 is not set
1287# CONFIG_NLS_ISO8859_6 is not set
1288# CONFIG_NLS_ISO8859_7 is not set
1289# CONFIG_NLS_ISO8859_9 is not set
1290# CONFIG_NLS_ISO8859_13 is not set
1291# CONFIG_NLS_ISO8859_14 is not set
1292# CONFIG_NLS_ISO8859_15 is not set
1293# CONFIG_NLS_KOI8_R is not set
1294# CONFIG_NLS_KOI8_U is not set
1295# CONFIG_NLS_UTF8 is not set
1296
1297#
1298# Library routines
1299#
1300CONFIG_CRC_CCITT=m
1301# CONFIG_CRC16 is not set
1302CONFIG_CRC32=y
1303# CONFIG_LIBCRC32C is not set
1304CONFIG_ZLIB_INFLATE=m
1305CONFIG_ZLIB_DEFLATE=m
1306CONFIG_TEXTSEARCH=y
1307CONFIG_TEXTSEARCH_KMP=m
1308
1309#
1310# Instrumentation Support
1311#
1312# CONFIG_PROFILING is not set
1313
1314#
1315# Kernel hacking
1316#
1317# CONFIG_PRINTK_TIME is not set
1318CONFIG_MAGIC_SYSRQ=y
1319CONFIG_DEBUG_KERNEL=y
1320CONFIG_LOG_BUF_SHIFT=15
1321CONFIG_DETECT_SOFTLOCKUP=y
1322# CONFIG_SCHEDSTATS is not set
1323# CONFIG_DEBUG_SLAB is not set
1324CONFIG_DEBUG_MUTEXES=y
1325# CONFIG_DEBUG_SPINLOCK is not set
1326CONFIG_DEBUG_SPINLOCK_SLEEP=y
1327# CONFIG_DEBUG_KOBJECT is not set
1328# CONFIG_DEBUG_HIGHMEM is not set
1329# CONFIG_DEBUG_INFO is not set
1330# CONFIG_DEBUG_FS is not set
1331# CONFIG_DEBUG_VM is not set
1332CONFIG_FORCED_INLINING=y
1333# CONFIG_RCU_TORTURE_TEST is not set
1334CONFIG_DEBUGGER=y
1335CONFIG_XMON=y
1336CONFIG_XMON_DEFAULT=y
1337# CONFIG_BDI_SWITCH is not set
1338# CONFIG_BOOTX_TEXT is not set
1339# CONFIG_PPC_EARLY_DEBUG is not set
1340
1341#
1342# Security options
1343#
1344# CONFIG_KEYS is not set
1345# CONFIG_SECURITY is not set
1346
1347#
1348# Cryptographic options
1349#
1350CONFIG_CRYPTO=y
1351# CONFIG_CRYPTO_HMAC is not set
1352# CONFIG_CRYPTO_NULL is not set
1353# CONFIG_CRYPTO_MD4 is not set
1354# CONFIG_CRYPTO_MD5 is not set
1355CONFIG_CRYPTO_SHA1=m
1356# CONFIG_CRYPTO_SHA256 is not set
1357# CONFIG_CRYPTO_SHA512 is not set
1358# CONFIG_CRYPTO_WP512 is not set
1359# CONFIG_CRYPTO_TGR192 is not set
1360# CONFIG_CRYPTO_DES is not set
1361# CONFIG_CRYPTO_BLOWFISH is not set
1362# CONFIG_CRYPTO_TWOFISH is not set
1363# CONFIG_CRYPTO_SERPENT is not set
1364# CONFIG_CRYPTO_AES is not set
1365# CONFIG_CRYPTO_CAST5 is not set
1366# CONFIG_CRYPTO_CAST6 is not set
1367# CONFIG_CRYPTO_TEA is not set
1368CONFIG_CRYPTO_ARC4=m
1369# CONFIG_CRYPTO_KHAZAD is not set
1370# CONFIG_CRYPTO_ANUBIS is not set
1371# CONFIG_CRYPTO_DEFLATE is not set
1372# CONFIG_CRYPTO_MICHAEL_MIC is not set
1373# CONFIG_CRYPTO_CRC32C is not set
1374# CONFIG_CRYPTO_TEST is not set
1375
1376#
1377# Hardware crypto devices
1378#
diff --git a/arch/powerpc/configs/mpc7448_hpc2_defconfig b/arch/powerpc/configs/mpc7448_hpc2_defconfig
new file mode 100644
index 000000000000..15a50f4ceb1f
--- /dev/null
+++ b/arch/powerpc/configs/mpc7448_hpc2_defconfig
@@ -0,0 +1,923 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.17-rc4
4# Sat May 27 18:45:55 2006
5#
6# CONFIG_PPC64 is not set
7CONFIG_PPC32=y
8CONFIG_PPC_MERGE=y
9CONFIG_MMU=y
10CONFIG_GENERIC_HARDIRQS=y
11CONFIG_RWSEM_XCHGADD_ALGORITHM=y
12CONFIG_GENERIC_HWEIGHT=y
13CONFIG_GENERIC_CALIBRATE_DELAY=y
14CONFIG_PPC=y
15CONFIG_EARLY_PRINTK=y
16CONFIG_GENERIC_NVRAM=y
17CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
18CONFIG_ARCH_MAY_HAVE_PC_FDC=y
19CONFIG_PPC_OF=y
20CONFIG_PPC_UDBG_16550=y
21# CONFIG_GENERIC_TBSYNC is not set
22CONFIG_DEFAULT_UIMAGE=y
23
24#
25# Processor support
26#
27CONFIG_CLASSIC32=y
28# CONFIG_PPC_52xx is not set
29# CONFIG_PPC_82xx is not set
30# CONFIG_PPC_83xx is not set
31# CONFIG_PPC_85xx is not set
32# CONFIG_40x is not set
33# CONFIG_44x is not set
34# CONFIG_8xx is not set
35# CONFIG_E200 is not set
36CONFIG_6xx=y
37CONFIG_PPC_FPU=y
38# CONFIG_ALTIVEC is not set
39CONFIG_PPC_STD_MMU=y
40CONFIG_PPC_STD_MMU_32=y
41# CONFIG_SMP is not set
42
43#
44# Code maturity level options
45#
46CONFIG_EXPERIMENTAL=y
47CONFIG_BROKEN_ON_SMP=y
48CONFIG_INIT_ENV_ARG_LIMIT=32
49
50#
51# General setup
52#
53CONFIG_LOCALVERSION=""
54CONFIG_LOCALVERSION_AUTO=y
55CONFIG_SWAP=y
56CONFIG_SYSVIPC=y
57# CONFIG_POSIX_MQUEUE is not set
58# CONFIG_BSD_PROCESS_ACCT is not set
59CONFIG_SYSCTL=y
60# CONFIG_AUDIT is not set
61# CONFIG_IKCONFIG is not set
62# CONFIG_RELAY is not set
63CONFIG_INITRAMFS_SOURCE=""
64# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
65CONFIG_EMBEDDED=y
66CONFIG_KALLSYMS=y
67# CONFIG_KALLSYMS_EXTRA_PASS is not set
68CONFIG_HOTPLUG=y
69CONFIG_PRINTK=y
70CONFIG_BUG=y
71CONFIG_ELF_CORE=y
72CONFIG_BASE_FULL=y
73CONFIG_FUTEX=y
74CONFIG_EPOLL=y
75CONFIG_SHMEM=y
76CONFIG_SLAB=y
77# CONFIG_TINY_SHMEM is not set
78CONFIG_BASE_SMALL=0
79# CONFIG_SLOB is not set
80
81#
82# Loadable module support
83#
84# CONFIG_MODULES is not set
85
86#
87# Block layer
88#
89CONFIG_LBD=y
90# CONFIG_BLK_DEV_IO_TRACE is not set
91# CONFIG_LSF is not set
92
93#
94# IO Schedulers
95#
96CONFIG_IOSCHED_NOOP=y
97CONFIG_IOSCHED_AS=y
98CONFIG_IOSCHED_DEADLINE=y
99CONFIG_IOSCHED_CFQ=y
100CONFIG_DEFAULT_AS=y
101# CONFIG_DEFAULT_DEADLINE is not set
102# CONFIG_DEFAULT_CFQ is not set
103# CONFIG_DEFAULT_NOOP is not set
104CONFIG_DEFAULT_IOSCHED="anticipatory"
105
106#
107# Platform support
108#
109# CONFIG_PPC_MULTIPLATFORM is not set
110# CONFIG_PPC_ISERIES is not set
111CONFIG_EMBEDDED6xx=y
112# CONFIG_APUS is not set
113CONFIG_MPIC=y
114# CONFIG_PPC_RTAS is not set
115# CONFIG_MMIO_NVRAM is not set
116# CONFIG_PPC_MPC106 is not set
117# CONFIG_PPC_970_NAP is not set
118# CONFIG_CPU_FREQ is not set
119# CONFIG_TAU is not set
120# CONFIG_KATANA is not set
121# CONFIG_WILLOW is not set
122# CONFIG_CPCI690 is not set
123# CONFIG_POWERPMC250 is not set
124# CONFIG_CHESTNUT is not set
125# CONFIG_SPRUCE is not set
126# CONFIG_HDPU is not set
127# CONFIG_EV64260 is not set
128# CONFIG_LOPEC is not set
129# CONFIG_MVME5100 is not set
130# CONFIG_PPLUS is not set
131# CONFIG_PRPMC750 is not set
132# CONFIG_PRPMC800 is not set
133# CONFIG_SANDPOINT is not set
134CONFIG_MPC7448HPC2=y
135# CONFIG_RADSTONE_PPC7D is not set
136# CONFIG_PAL4 is not set
137# CONFIG_GEMINI is not set
138# CONFIG_EST8260 is not set
139# CONFIG_SBC82xx is not set
140# CONFIG_SBS8260 is not set
141# CONFIG_RPX8260 is not set
142# CONFIG_TQM8260 is not set
143# CONFIG_ADS8272 is not set
144# CONFIG_PQ2FADS is not set
145# CONFIG_LITE5200 is not set
146# CONFIG_EV64360 is not set
147CONFIG_TSI108_BRIDGE=y
148# CONFIG_WANT_EARLY_SERIAL is not set
149
150#
151# Kernel options
152#
153# CONFIG_HIGHMEM is not set
154# CONFIG_HZ_100 is not set
155CONFIG_HZ_250=y
156# CONFIG_HZ_1000 is not set
157CONFIG_HZ=250
158CONFIG_PREEMPT_NONE=y
159# CONFIG_PREEMPT_VOLUNTARY is not set
160# CONFIG_PREEMPT is not set
161CONFIG_BINFMT_ELF=y
162CONFIG_BINFMT_MISC=y
163CONFIG_ARCH_FLATMEM_ENABLE=y
164CONFIG_SELECT_MEMORY_MODEL=y
165CONFIG_FLATMEM_MANUAL=y
166# CONFIG_DISCONTIGMEM_MANUAL is not set
167# CONFIG_SPARSEMEM_MANUAL is not set
168CONFIG_FLATMEM=y
169CONFIG_FLAT_NODE_MEM_MAP=y
170# CONFIG_SPARSEMEM_STATIC is not set
171CONFIG_SPLIT_PTLOCK_CPUS=4
172CONFIG_PROC_DEVICETREE=y
173# CONFIG_CMDLINE_BOOL is not set
174# CONFIG_PM is not set
175# CONFIG_SOFTWARE_SUSPEND is not set
176# CONFIG_SECCOMP is not set
177CONFIG_ISA_DMA_API=y
178
179#
180# Bus options
181#
182CONFIG_GENERIC_ISA_DMA=y
183# CONFIG_PPC_I8259 is not set
184# CONFIG_PPC_INDIRECT_PCI is not set
185CONFIG_PCI=y
186CONFIG_PCI_DOMAINS=y
187
188#
189# PCCARD (PCMCIA/CardBus) support
190#
191# CONFIG_PCCARD is not set
192
193#
194# PCI Hotplug Support
195#
196# CONFIG_HOTPLUG_PCI is not set
197
198#
199# Advanced setup
200#
201# CONFIG_ADVANCED_OPTIONS is not set
202
203#
204# Default settings for advanced configuration options are used
205#
206CONFIG_HIGHMEM_START=0xfe000000
207CONFIG_LOWMEM_SIZE=0x30000000
208CONFIG_KERNEL_START=0xc0000000
209CONFIG_TASK_SIZE=0x80000000
210CONFIG_BOOT_LOAD=0x00800000
211
212#
213# Networking
214#
215CONFIG_NET=y
216
217#
218# Networking options
219#
220# CONFIG_NETDEBUG is not set
221CONFIG_PACKET=y
222# CONFIG_PACKET_MMAP is not set
223CONFIG_UNIX=y
224# CONFIG_NET_KEY is not set
225CONFIG_INET=y
226CONFIG_IP_MULTICAST=y
227# CONFIG_IP_ADVANCED_ROUTER is not set
228CONFIG_IP_FIB_HASH=y
229CONFIG_IP_PNP=y
230CONFIG_IP_PNP_DHCP=y
231CONFIG_IP_PNP_BOOTP=y
232# CONFIG_IP_PNP_RARP is not set
233# CONFIG_NET_IPIP is not set
234# CONFIG_NET_IPGRE is not set
235# CONFIG_IP_MROUTE is not set
236# CONFIG_ARPD is not set
237CONFIG_SYN_COOKIES=y
238# CONFIG_INET_AH is not set
239# CONFIG_INET_ESP is not set
240# CONFIG_INET_IPCOMP is not set
241# CONFIG_INET_XFRM_TUNNEL is not set
242# CONFIG_INET_TUNNEL is not set
243CONFIG_INET_DIAG=y
244CONFIG_INET_TCP_DIAG=y
245# CONFIG_TCP_CONG_ADVANCED is not set
246CONFIG_TCP_CONG_BIC=y
247# CONFIG_IPV6 is not set
248# CONFIG_INET6_XFRM_TUNNEL is not set
249# CONFIG_INET6_TUNNEL is not set
250# CONFIG_NETFILTER is not set
251
252#
253# DCCP Configuration (EXPERIMENTAL)
254#
255# CONFIG_IP_DCCP is not set
256
257#
258# SCTP Configuration (EXPERIMENTAL)
259#
260# CONFIG_IP_SCTP is not set
261
262#
263# TIPC Configuration (EXPERIMENTAL)
264#
265# CONFIG_TIPC is not set
266# CONFIG_ATM is not set
267# CONFIG_BRIDGE is not set
268# CONFIG_VLAN_8021Q is not set
269# CONFIG_DECNET is not set
270# CONFIG_LLC2 is not set
271# CONFIG_IPX is not set
272# CONFIG_ATALK is not set
273# CONFIG_X25 is not set
274# CONFIG_LAPB is not set
275# CONFIG_NET_DIVERT is not set
276# CONFIG_ECONET is not set
277# CONFIG_WAN_ROUTER is not set
278
279#
280# QoS and/or fair queueing
281#
282# CONFIG_NET_SCHED is not set
283
284#
285# Network testing
286#
287# CONFIG_NET_PKTGEN is not set
288# CONFIG_HAMRADIO is not set
289# CONFIG_IRDA is not set
290# CONFIG_BT is not set
291# CONFIG_IEEE80211 is not set
292
293#
294# Device Drivers
295#
296
297#
298# Generic Driver Options
299#
300CONFIG_STANDALONE=y
301CONFIG_PREVENT_FIRMWARE_BUILD=y
302# CONFIG_FW_LOADER is not set
303
304#
305# Connector - unified userspace <-> kernelspace linker
306#
307# CONFIG_CONNECTOR is not set
308
309#
310# Memory Technology Devices (MTD)
311#
312# CONFIG_MTD is not set
313
314#
315# Parallel port support
316#
317# CONFIG_PARPORT is not set
318
319#
320# Plug and Play support
321#
322
323#
324# Block devices
325#
326# CONFIG_BLK_DEV_FD is not set
327# CONFIG_BLK_CPQ_DA is not set
328# CONFIG_BLK_CPQ_CISS_DA is not set
329# CONFIG_BLK_DEV_DAC960 is not set
330# CONFIG_BLK_DEV_UMEM is not set
331# CONFIG_BLK_DEV_COW_COMMON is not set
332CONFIG_BLK_DEV_LOOP=y
333# CONFIG_BLK_DEV_CRYPTOLOOP is not set
334# CONFIG_BLK_DEV_NBD is not set
335# CONFIG_BLK_DEV_SX8 is not set
336CONFIG_BLK_DEV_RAM=y
337CONFIG_BLK_DEV_RAM_COUNT=16
338CONFIG_BLK_DEV_RAM_SIZE=131072
339CONFIG_BLK_DEV_INITRD=y
340# CONFIG_CDROM_PKTCDVD is not set
341# CONFIG_ATA_OVER_ETH is not set
342
343#
344# ATA/ATAPI/MFM/RLL support
345#
346# CONFIG_IDE is not set
347
348#
349# SCSI device support
350#
351# CONFIG_RAID_ATTRS is not set
352CONFIG_SCSI=y
353CONFIG_SCSI_PROC_FS=y
354
355#
356# SCSI support type (disk, tape, CD-ROM)
357#
358CONFIG_BLK_DEV_SD=y
359# CONFIG_CHR_DEV_ST is not set
360# CONFIG_CHR_DEV_OSST is not set
361# CONFIG_BLK_DEV_SR is not set
362# CONFIG_CHR_DEV_SG is not set
363# CONFIG_CHR_DEV_SCH is not set
364
365#
366# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
367#
368# CONFIG_SCSI_MULTI_LUN is not set
369# CONFIG_SCSI_CONSTANTS is not set
370# CONFIG_SCSI_LOGGING is not set
371
372#
373# SCSI Transport Attributes
374#
375# CONFIG_SCSI_SPI_ATTRS is not set
376# CONFIG_SCSI_FC_ATTRS is not set
377# CONFIG_SCSI_ISCSI_ATTRS is not set
378# CONFIG_SCSI_SAS_ATTRS is not set
379
380#
381# SCSI low-level drivers
382#
383# CONFIG_ISCSI_TCP is not set
384# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
385# CONFIG_SCSI_3W_9XXX is not set
386# CONFIG_SCSI_ACARD is not set
387# CONFIG_SCSI_AACRAID is not set
388# CONFIG_SCSI_AIC7XXX is not set
389# CONFIG_SCSI_AIC7XXX_OLD is not set
390# CONFIG_SCSI_AIC79XX is not set
391# CONFIG_SCSI_DPT_I2O is not set
392# CONFIG_MEGARAID_NEWGEN is not set
393# CONFIG_MEGARAID_LEGACY is not set
394# CONFIG_MEGARAID_SAS is not set
395CONFIG_SCSI_SATA=y
396# CONFIG_SCSI_SATA_AHCI is not set
397# CONFIG_SCSI_SATA_SVW is not set
398# CONFIG_SCSI_ATA_PIIX is not set
399CONFIG_SCSI_SATA_MV=y
400# CONFIG_SCSI_SATA_NV is not set
401# CONFIG_SCSI_PDC_ADMA is not set
402# CONFIG_SCSI_SATA_QSTOR is not set
403# CONFIG_SCSI_SATA_PROMISE is not set
404# CONFIG_SCSI_SATA_SX4 is not set
405# CONFIG_SCSI_SATA_SIL is not set
406# CONFIG_SCSI_SATA_SIL24 is not set
407# CONFIG_SCSI_SATA_SIS is not set
408# CONFIG_SCSI_SATA_ULI is not set
409# CONFIG_SCSI_SATA_VIA is not set
410# CONFIG_SCSI_SATA_VITESSE is not set
411# CONFIG_SCSI_BUSLOGIC is not set
412# CONFIG_SCSI_DMX3191D is not set
413# CONFIG_SCSI_EATA is not set
414# CONFIG_SCSI_FUTURE_DOMAIN is not set
415# CONFIG_SCSI_GDTH is not set
416# CONFIG_SCSI_IPS is not set
417# CONFIG_SCSI_INITIO is not set
418# CONFIG_SCSI_INIA100 is not set
419# CONFIG_SCSI_SYM53C8XX_2 is not set
420# CONFIG_SCSI_IPR is not set
421# CONFIG_SCSI_QLOGIC_1280 is not set
422# CONFIG_SCSI_QLA_FC is not set
423# CONFIG_SCSI_LPFC is not set
424# CONFIG_SCSI_DC395x is not set
425# CONFIG_SCSI_DC390T is not set
426# CONFIG_SCSI_NSP32 is not set
427# CONFIG_SCSI_DEBUG is not set
428
429#
430# Multi-device support (RAID and LVM)
431#
432# CONFIG_MD is not set
433
434#
435# Fusion MPT device support
436#
437# CONFIG_FUSION is not set
438# CONFIG_FUSION_SPI is not set
439# CONFIG_FUSION_FC is not set
440# CONFIG_FUSION_SAS is not set
441
442#
443# IEEE 1394 (FireWire) support
444#
445# CONFIG_IEEE1394 is not set
446
447#
448# I2O device support
449#
450# CONFIG_I2O is not set
451
452#
453# Macintosh device drivers
454#
455# CONFIG_WINDFARM is not set
456
457#
458# Network device support
459#
460CONFIG_NETDEVICES=y
461# CONFIG_DUMMY is not set
462# CONFIG_BONDING is not set
463# CONFIG_EQUALIZER is not set
464# CONFIG_TUN is not set
465
466#
467# ARCnet devices
468#
469# CONFIG_ARCNET is not set
470
471#
472# PHY device support
473#
474CONFIG_PHYLIB=y
475
476#
477# MII PHY device drivers
478#
479# CONFIG_MARVELL_PHY is not set
480# CONFIG_DAVICOM_PHY is not set
481# CONFIG_QSEMI_PHY is not set
482# CONFIG_LXT_PHY is not set
483# CONFIG_CICADA_PHY is not set
484
485#
486# Ethernet (10 or 100Mbit)
487#
488CONFIG_NET_ETHERNET=y
489CONFIG_MII=y
490# CONFIG_HAPPYMEAL is not set
491# CONFIG_SUNGEM is not set
492# CONFIG_CASSINI is not set
493# CONFIG_NET_VENDOR_3COM is not set
494
495#
496# Tulip family network device support
497#
498# CONFIG_NET_TULIP is not set
499# CONFIG_HP100 is not set
500CONFIG_NET_PCI=y
501# CONFIG_PCNET32 is not set
502# CONFIG_AMD8111_ETH is not set
503# CONFIG_ADAPTEC_STARFIRE is not set
504# CONFIG_B44 is not set
505# CONFIG_FORCEDETH is not set
506# CONFIG_DGRS is not set
507# CONFIG_EEPRO100 is not set
508CONFIG_E100=y
509# CONFIG_FEALNX is not set
510# CONFIG_NATSEMI is not set
511# CONFIG_NE2K_PCI is not set
512# CONFIG_8139CP is not set
513CONFIG_8139TOO=y
514# CONFIG_8139TOO_PIO is not set
515# CONFIG_8139TOO_TUNE_TWISTER is not set
516# CONFIG_8139TOO_8129 is not set
517# CONFIG_8139_OLD_RX_RESET is not set
518# CONFIG_SIS900 is not set
519# CONFIG_EPIC100 is not set
520# CONFIG_SUNDANCE is not set
521# CONFIG_TLAN is not set
522# CONFIG_VIA_RHINE is not set
523
524#
525# Ethernet (1000 Mbit)
526#
527# CONFIG_ACENIC is not set
528# CONFIG_DL2K is not set
529# CONFIG_E1000 is not set
530# CONFIG_NS83820 is not set
531# CONFIG_HAMACHI is not set
532# CONFIG_YELLOWFIN is not set
533# CONFIG_R8169 is not set
534# CONFIG_SIS190 is not set
535# CONFIG_SKGE is not set
536# CONFIG_SKY2 is not set
537# CONFIG_SK98LIN is not set
538# CONFIG_VIA_VELOCITY is not set
539# CONFIG_TIGON3 is not set
540# CONFIG_BNX2 is not set
541CONFIG_TSI108_ETH=y
542
543#
544# Ethernet (10000 Mbit)
545#
546# CONFIG_CHELSIO_T1 is not set
547# CONFIG_IXGB is not set
548# CONFIG_S2IO is not set
549
550#
551# Token Ring devices
552#
553# CONFIG_TR is not set
554
555#
556# Wireless LAN (non-hamradio)
557#
558# CONFIG_NET_RADIO is not set
559
560#
561# Wan interfaces
562#
563# CONFIG_WAN is not set
564# CONFIG_FDDI is not set
565# CONFIG_HIPPI is not set
566# CONFIG_PPP is not set
567# CONFIG_SLIP is not set
568# CONFIG_NET_FC is not set
569# CONFIG_SHAPER is not set
570# CONFIG_NETCONSOLE is not set
571# CONFIG_NETPOLL is not set
572# CONFIG_NET_POLL_CONTROLLER is not set
573
574#
575# ISDN subsystem
576#
577# CONFIG_ISDN is not set
578
579#
580# Telephony Support
581#
582# CONFIG_PHONE is not set
583
584#
585# Input device support
586#
587CONFIG_INPUT=y
588
589#
590# Userland interfaces
591#
592# CONFIG_INPUT_MOUSEDEV is not set
593# CONFIG_INPUT_JOYDEV is not set
594# CONFIG_INPUT_TSDEV is not set
595# CONFIG_INPUT_EVDEV is not set
596# CONFIG_INPUT_EVBUG is not set
597
598#
599# Input Device Drivers
600#
601# CONFIG_INPUT_KEYBOARD is not set
602# CONFIG_INPUT_MOUSE is not set
603# CONFIG_INPUT_JOYSTICK is not set
604# CONFIG_INPUT_TOUCHSCREEN is not set
605# CONFIG_INPUT_MISC is not set
606
607#
608# Hardware I/O ports
609#
610# CONFIG_SERIO is not set
611# CONFIG_GAMEPORT is not set
612
613#
614# Character devices
615#
616# CONFIG_VT is not set
617# CONFIG_SERIAL_NONSTANDARD is not set
618
619#
620# Serial drivers
621#
622CONFIG_SERIAL_8250=y
623CONFIG_SERIAL_8250_CONSOLE=y
624CONFIG_SERIAL_8250_PCI=y
625CONFIG_SERIAL_8250_NR_UARTS=4
626CONFIG_SERIAL_8250_RUNTIME_UARTS=4
627# CONFIG_SERIAL_8250_EXTENDED is not set
628
629#
630# Non-8250 serial port support
631#
632CONFIG_SERIAL_CORE=y
633CONFIG_SERIAL_CORE_CONSOLE=y
634# CONFIG_SERIAL_JSM is not set
635CONFIG_UNIX98_PTYS=y
636CONFIG_LEGACY_PTYS=y
637CONFIG_LEGACY_PTY_COUNT=256
638
639#
640# IPMI
641#
642# CONFIG_IPMI_HANDLER is not set
643
644#
645# Watchdog Cards
646#
647# CONFIG_WATCHDOG is not set
648# CONFIG_NVRAM is not set
649CONFIG_GEN_RTC=y
650# CONFIG_GEN_RTC_X is not set
651# CONFIG_DTLK is not set
652# CONFIG_R3964 is not set
653# CONFIG_APPLICOM is not set
654
655#
656# Ftape, the floppy tape device driver
657#
658# CONFIG_AGP is not set
659# CONFIG_DRM is not set
660# CONFIG_RAW_DRIVER is not set
661
662#
663# TPM devices
664#
665# CONFIG_TCG_TPM is not set
666# CONFIG_TELCLOCK is not set
667
668#
669# I2C support
670#
671# CONFIG_I2C is not set
672
673#
674# SPI support
675#
676# CONFIG_SPI is not set
677# CONFIG_SPI_MASTER is not set
678
679#
680# Dallas's 1-wire bus
681#
682# CONFIG_W1 is not set
683
684#
685# Hardware Monitoring support
686#
687CONFIG_HWMON=y
688# CONFIG_HWMON_VID is not set
689# CONFIG_SENSORS_F71805F is not set
690# CONFIG_HWMON_DEBUG_CHIP is not set
691
692#
693# Misc devices
694#
695
696#
697# Multimedia devices
698#
699# CONFIG_VIDEO_DEV is not set
700
701#
702# Digital Video Broadcasting Devices
703#
704# CONFIG_DVB is not set
705
706#
707# Graphics support
708#
709# CONFIG_FB is not set
710
711#
712# Sound
713#
714# CONFIG_SOUND is not set
715
716#
717# USB support
718#
719CONFIG_USB_ARCH_HAS_HCD=y
720CONFIG_USB_ARCH_HAS_OHCI=y
721CONFIG_USB_ARCH_HAS_EHCI=y
722# CONFIG_USB is not set
723
724#
725# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
726#
727
728#
729# USB Gadget Support
730#
731# CONFIG_USB_GADGET is not set
732
733#
734# MMC/SD Card support
735#
736# CONFIG_MMC is not set
737
738#
739# LED devices
740#
741# CONFIG_NEW_LEDS is not set
742
743#
744# LED drivers
745#
746
747#
748# LED Triggers
749#
750
751#
752# InfiniBand support
753#
754# CONFIG_INFINIBAND is not set
755
756#
757# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
758#
759
760#
761# Real Time Clock
762#
763# CONFIG_RTC_CLASS is not set
764
765#
766# File systems
767#
768CONFIG_EXT2_FS=y
769# CONFIG_EXT2_FS_XATTR is not set
770# CONFIG_EXT2_FS_XIP is not set
771CONFIG_EXT3_FS=y
772CONFIG_EXT3_FS_XATTR=y
773# CONFIG_EXT3_FS_POSIX_ACL is not set
774# CONFIG_EXT3_FS_SECURITY is not set
775CONFIG_JBD=y
776# CONFIG_JBD_DEBUG is not set
777CONFIG_FS_MBCACHE=y
778# CONFIG_REISERFS_FS is not set
779# CONFIG_JFS_FS is not set
780# CONFIG_FS_POSIX_ACL is not set
781# CONFIG_XFS_FS is not set
782# CONFIG_OCFS2_FS is not set
783# CONFIG_MINIX_FS is not set
784# CONFIG_ROMFS_FS is not set
785CONFIG_INOTIFY=y
786# CONFIG_QUOTA is not set
787CONFIG_DNOTIFY=y
788# CONFIG_AUTOFS_FS is not set
789# CONFIG_AUTOFS4_FS is not set
790# CONFIG_FUSE_FS is not set
791
792#
793# CD-ROM/DVD Filesystems
794#
795# CONFIG_ISO9660_FS is not set
796# CONFIG_UDF_FS is not set
797
798#
799# DOS/FAT/NT Filesystems
800#
801# CONFIG_MSDOS_FS is not set
802# CONFIG_VFAT_FS is not set
803# CONFIG_NTFS_FS is not set
804
805#
806# Pseudo filesystems
807#
808CONFIG_PROC_FS=y
809CONFIG_PROC_KCORE=y
810CONFIG_SYSFS=y
811CONFIG_TMPFS=y
812# CONFIG_HUGETLB_PAGE is not set
813CONFIG_RAMFS=y
814# CONFIG_CONFIGFS_FS is not set
815
816#
817# Miscellaneous filesystems
818#
819# CONFIG_ADFS_FS is not set
820# CONFIG_AFFS_FS is not set
821# CONFIG_HFS_FS is not set
822# CONFIG_HFSPLUS_FS is not set
823# CONFIG_BEFS_FS is not set
824# CONFIG_BFS_FS is not set
825# CONFIG_EFS_FS is not set
826# CONFIG_CRAMFS is not set
827# CONFIG_VXFS_FS is not set
828# CONFIG_HPFS_FS is not set
829# CONFIG_QNX4FS_FS is not set
830# CONFIG_SYSV_FS is not set
831# CONFIG_UFS_FS is not set
832
833#
834# Network File Systems
835#
836CONFIG_NFS_FS=y
837# CONFIG_NFS_V3 is not set
838# CONFIG_NFS_V4 is not set
839# CONFIG_NFS_DIRECTIO is not set
840# CONFIG_NFSD is not set
841CONFIG_ROOT_NFS=y
842CONFIG_LOCKD=y
843CONFIG_NFS_COMMON=y
844CONFIG_SUNRPC=y
845# CONFIG_RPCSEC_GSS_KRB5 is not set
846# CONFIG_RPCSEC_GSS_SPKM3 is not set
847# CONFIG_SMB_FS is not set
848# CONFIG_CIFS is not set
849# CONFIG_NCP_FS is not set
850# CONFIG_CODA_FS is not set
851# CONFIG_AFS_FS is not set
852# CONFIG_9P_FS is not set
853
854#
855# Partition Types
856#
857CONFIG_PARTITION_ADVANCED=y
858# CONFIG_ACORN_PARTITION is not set
859# CONFIG_OSF_PARTITION is not set
860# CONFIG_AMIGA_PARTITION is not set
861# CONFIG_ATARI_PARTITION is not set
862# CONFIG_MAC_PARTITION is not set
863CONFIG_MSDOS_PARTITION=y
864# CONFIG_BSD_DISKLABEL is not set
865# CONFIG_MINIX_SUBPARTITION is not set
866# CONFIG_SOLARIS_X86_PARTITION is not set
867# CONFIG_UNIXWARE_DISKLABEL is not set
868# CONFIG_LDM_PARTITION is not set
869# CONFIG_SGI_PARTITION is not set
870# CONFIG_ULTRIX_PARTITION is not set
871# CONFIG_SUN_PARTITION is not set
872# CONFIG_KARMA_PARTITION is not set
873# CONFIG_EFI_PARTITION is not set
874
875#
876# Native Language Support
877#
878# CONFIG_NLS is not set
879
880#
881# Library routines
882#
883# CONFIG_CRC_CCITT is not set
884# CONFIG_CRC16 is not set
885CONFIG_CRC32=y
886# CONFIG_LIBCRC32C is not set
887
888#
889# Instrumentation Support
890#
891# CONFIG_PROFILING is not set
892
893#
894# Kernel hacking
895#
896# CONFIG_PRINTK_TIME is not set
897# CONFIG_MAGIC_SYSRQ is not set
898# CONFIG_DEBUG_KERNEL is not set
899CONFIG_LOG_BUF_SHIFT=14
900# CONFIG_DEBUG_FS is not set
901# CONFIG_UNWIND_INFO is not set
902# CONFIG_BOOTX_TEXT is not set
903# CONFIG_SERIAL_TEXT_DEBUG is not set
904# CONFIG_PPC_EARLY_DEBUG_LPAR is not set
905# CONFIG_PPC_EARLY_DEBUG_G5 is not set
906# CONFIG_PPC_EARLY_DEBUG_RTAS is not set
907# CONFIG_PPC_EARLY_DEBUG_MAPLE is not set
908# CONFIG_PPC_EARLY_DEBUG_ISERIES is not set
909
910#
911# Security options
912#
913# CONFIG_KEYS is not set
914# CONFIG_SECURITY is not set
915
916#
917# Cryptographic options
918#
919# CONFIG_CRYPTO is not set
920
921#
922# Hardware crypto devices
923#
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 803858e86160..814f242aeb8c 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -50,7 +50,8 @@ extra-$(CONFIG_FSL_BOOKE) := head_fsl_booke.o
50extra-$(CONFIG_8xx) := head_8xx.o 50extra-$(CONFIG_8xx) := head_8xx.o
51extra-y += vmlinux.lds 51extra-y += vmlinux.lds
52 52
53obj-y += time.o prom.o traps.o setup-common.o udbg.o 53obj-y += time.o prom.o traps.o setup-common.o \
54 udbg.o misc.o
54obj-$(CONFIG_PPC32) += entry_32.o setup_32.o misc_32.o 55obj-$(CONFIG_PPC32) += entry_32.o setup_32.o misc_32.o
55obj-$(CONFIG_PPC64) += misc_64.o dma_64.o iommu.o 56obj-$(CONFIG_PPC64) += misc_64.o dma_64.o iommu.o
56obj-$(CONFIG_PPC_MULTIPLATFORM) += prom_init.o 57obj-$(CONFIG_PPC_MULTIPLATFORM) += prom_init.o
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index ff2940548929..7ee84968087b 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -13,7 +13,6 @@
13 * 2 of the License, or (at your option) any later version. 13 * 2 of the License, or (at your option) any later version.
14 */ 14 */
15 15
16#include <linux/config.h>
17#include <linux/signal.h> 16#include <linux/signal.h>
18#include <linux/sched.h> 17#include <linux/sched.h>
19#include <linux/kernel.h> 18#include <linux/kernel.h>
diff --git a/arch/powerpc/kernel/binfmt_elf32.c b/arch/powerpc/kernel/binfmt_elf32.c
index 8ad6b0f33651..5cb58757e1b1 100644
--- a/arch/powerpc/kernel/binfmt_elf32.c
+++ b/arch/powerpc/kernel/binfmt_elf32.c
@@ -19,7 +19,6 @@
19 19
20#include <asm/processor.h> 20#include <asm/processor.h>
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/config.h>
23#include <linux/elfcore.h> 22#include <linux/elfcore.h>
24#include <linux/compat.h> 23#include <linux/compat.h>
25 24
diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c
index 6223d39177cb..f4e5e14ee2b6 100644
--- a/arch/powerpc/kernel/btext.c
+++ b/arch/powerpc/kernel/btext.c
@@ -3,7 +3,6 @@
3 * 3 *
4 * Benjamin Herrenschmidt <benh@kernel.crashing.org> 4 * Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 */ 5 */
6#include <linux/config.h>
7#include <linux/kernel.h> 6#include <linux/kernel.h>
8#include <linux/string.h> 7#include <linux/string.h>
9#include <linux/init.h> 8#include <linux/init.h>
@@ -112,7 +111,7 @@ void __init btext_setup_display(int width, int height, int depth, int pitch,
112 logicalDisplayBase = (unsigned char *)address; 111 logicalDisplayBase = (unsigned char *)address;
113 dispDeviceBase = (unsigned char *)address; 112 dispDeviceBase = (unsigned char *)address;
114 dispDeviceRowBytes = pitch; 113 dispDeviceRowBytes = pitch;
115 dispDeviceDepth = depth; 114 dispDeviceDepth = depth == 15 ? 16 : depth;
116 dispDeviceRect[0] = dispDeviceRect[1] = 0; 115 dispDeviceRect[0] = dispDeviceRect[1] = 0;
117 dispDeviceRect[2] = width; 116 dispDeviceRect[2] = width;
118 dispDeviceRect[3] = height; 117 dispDeviceRect[3] = height;
@@ -161,20 +160,28 @@ int btext_initialize(struct device_node *np)
161 unsigned long address = 0; 160 unsigned long address = 0;
162 u32 *prop; 161 u32 *prop;
163 162
164 prop = (u32 *)get_property(np, "width", NULL); 163 prop = (u32 *)get_property(np, "linux,bootx-width", NULL);
164 if (prop == NULL)
165 prop = (u32 *)get_property(np, "width", NULL);
165 if (prop == NULL) 166 if (prop == NULL)
166 return -EINVAL; 167 return -EINVAL;
167 width = *prop; 168 width = *prop;
168 prop = (u32 *)get_property(np, "height", NULL); 169 prop = (u32 *)get_property(np, "linux,bootx-height", NULL);
170 if (prop == NULL)
171 prop = (u32 *)get_property(np, "height", NULL);
169 if (prop == NULL) 172 if (prop == NULL)
170 return -EINVAL; 173 return -EINVAL;
171 height = *prop; 174 height = *prop;
172 prop = (u32 *)get_property(np, "depth", NULL); 175 prop = (u32 *)get_property(np, "linux,bootx-depth", NULL);
176 if (prop == NULL)
177 prop = (u32 *)get_property(np, "depth", NULL);
173 if (prop == NULL) 178 if (prop == NULL)
174 return -EINVAL; 179 return -EINVAL;
175 depth = *prop; 180 depth = *prop;
176 pitch = width * ((depth + 7) / 8); 181 pitch = width * ((depth + 7) / 8);
177 prop = (u32 *)get_property(np, "linebytes", NULL); 182 prop = (u32 *)get_property(np, "linux,bootx-linebytes", NULL);
183 if (prop == NULL)
184 prop = (u32 *)get_property(np, "linebytes", NULL);
178 if (prop) 185 if (prop)
179 pitch = *prop; 186 pitch = *prop;
180 if (pitch == 1) 187 if (pitch == 1)
@@ -195,7 +202,7 @@ int btext_initialize(struct device_node *np)
195 g_max_loc_Y = height / 16; 202 g_max_loc_Y = height / 16;
196 dispDeviceBase = (unsigned char *)address; 203 dispDeviceBase = (unsigned char *)address;
197 dispDeviceRowBytes = pitch; 204 dispDeviceRowBytes = pitch;
198 dispDeviceDepth = depth; 205 dispDeviceDepth = depth == 15 ? 16 : depth;
199 dispDeviceRect[0] = dispDeviceRect[1] = 0; 206 dispDeviceRect[0] = dispDeviceRect[1] = 0;
200 dispDeviceRect[2] = width; 207 dispDeviceRect[2] = width;
201 dispDeviceRect[3] = height; 208 dispDeviceRect[3] = height;
diff --git a/arch/powerpc/kernel/cpu_setup_6xx.S b/arch/powerpc/kernel/cpu_setup_6xx.S
index 365381fcb27c..8b4a4ee85eca 100644
--- a/arch/powerpc/kernel/cpu_setup_6xx.S
+++ b/arch/powerpc/kernel/cpu_setup_6xx.S
@@ -9,7 +9,6 @@
9 * 9 *
10 */ 10 */
11 11
12#include <linux/config.h>
13#include <asm/processor.h> 12#include <asm/processor.h>
14#include <asm/page.h> 13#include <asm/page.h>
15#include <asm/cputable.h> 14#include <asm/cputable.h>
diff --git a/arch/powerpc/kernel/cpu_setup_power4.S b/arch/powerpc/kernel/cpu_setup_power4.S
index 271418308d53..f69af2c5d7b3 100644
--- a/arch/powerpc/kernel/cpu_setup_power4.S
+++ b/arch/powerpc/kernel/cpu_setup_power4.S
@@ -9,7 +9,6 @@
9 * 9 *
10 */ 10 */
11 11
12#include <linux/config.h>
13#include <asm/processor.h> 12#include <asm/processor.h>
14#include <asm/page.h> 13#include <asm/page.h>
15#include <asm/cputable.h> 14#include <asm/cputable.h>
@@ -125,7 +124,12 @@ _GLOBAL(__save_cpu_setup)
125 cmpwi r0,0x44 124 cmpwi r0,0x44
126 bne 2f 125 bne 2f
127 126
1281: /* Save HID0,1,4 and 5 */ 1271: /* skip if not running in HV mode */
128 mfmsr r0
129 rldicl. r0,r0,4,63
130 beq 2f
131
132 /* Save HID0,1,4 and 5 */
129 mfspr r3,SPRN_HID0 133 mfspr r3,SPRN_HID0
130 std r3,CS_HID0(r5) 134 std r3,CS_HID0(r5)
131 mfspr r3,SPRN_HID1 135 mfspr r3,SPRN_HID1
@@ -159,7 +163,12 @@ _GLOBAL(__restore_cpu_setup)
159 cmpwi r0,0x44 163 cmpwi r0,0x44
160 bnelr 164 bnelr
161 165
1621: /* Before accessing memory, we make sure rm_ci is clear */ 1661: /* skip if not running in HV mode */
167 mfmsr r0
168 rldicl. r0,r0,4,63
169 beqlr
170
171 /* Before accessing memory, we make sure rm_ci is clear */
163 li r0,0 172 li r0,0
164 mfspr r3,SPRN_HID4 173 mfspr r3,SPRN_HID4
165 rldimi r3,r0,40,23 /* clear bit 23 (rm_ci) */ 174 rldimi r3,r0,40,23 /* clear bit 23 (rm_ci) */
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 1c114880dc05..272e43622fd6 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -10,7 +10,6 @@
10 * 2 of the License, or (at your option) any later version. 10 * 2 of the License, or (at your option) any later version.
11 */ 11 */
12 12
13#include <linux/config.h>
14#include <linux/string.h> 13#include <linux/string.h>
15#include <linux/sched.h> 14#include <linux/sched.h>
16#include <linux/threads.h> 15#include <linux/threads.h>
@@ -722,18 +721,6 @@ struct cpu_spec cpu_specs[] = {
722 .oprofile_type = PPC_OPROFILE_G4, 721 .oprofile_type = PPC_OPROFILE_G4,
723 .platform = "ppc7450", 722 .platform = "ppc7450",
724 }, 723 },
725 { /* 8641 */
726 .pvr_mask = 0xffffffff,
727 .pvr_value = 0x80040010,
728 .cpu_name = "8641",
729 .cpu_features = CPU_FTRS_7447A,
730 .cpu_user_features = COMMON_USER | PPC_FEATURE_HAS_ALTIVEC_COMP,
731 .icache_bsize = 32,
732 .dcache_bsize = 32,
733 .num_pmcs = 6,
734 .cpu_setup = __setup_cpu_745x
735 },
736
737 { /* 82xx (8240, 8245, 8260 are all 603e cores) */ 724 { /* 82xx (8240, 8245, 8260 are all 603e cores) */
738 .pvr_mask = 0x7fff0000, 725 .pvr_mask = 0x7fff0000,
739 .pvr_value = 0x00810000, 726 .pvr_value = 0x00810000,
diff --git a/arch/powerpc/kernel/crash.c b/arch/powerpc/kernel/crash.c
index dbcb85994f46..358cecdc6aef 100644
--- a/arch/powerpc/kernel/crash.c
+++ b/arch/powerpc/kernel/crash.c
@@ -24,9 +24,11 @@
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/irq.h> 25#include <linux/irq.h>
26#include <linux/types.h> 26#include <linux/types.h>
27#include <linux/irq.h>
27 28
28#include <asm/processor.h> 29#include <asm/processor.h>
29#include <asm/machdep.h> 30#include <asm/machdep.h>
31#include <asm/kexec.h>
30#include <asm/kdump.h> 32#include <asm/kdump.h>
31#include <asm/lmb.h> 33#include <asm/lmb.h>
32#include <asm/firmware.h> 34#include <asm/firmware.h>
@@ -41,6 +43,7 @@
41 43
42/* This keeps a track of which one is crashing cpu. */ 44/* This keeps a track of which one is crashing cpu. */
43int crashing_cpu = -1; 45int crashing_cpu = -1;
46static cpumask_t cpus_in_crash = CPU_MASK_NONE;
44 47
45static u32 *append_elf_note(u32 *buf, char *name, unsigned type, void *data, 48static u32 *append_elf_note(u32 *buf, char *name, unsigned type, void *data,
46 size_t data_len) 49 size_t data_len)
@@ -98,34 +101,66 @@ static void crash_save_this_cpu(struct pt_regs *regs, int cpu)
98} 101}
99 102
100#ifdef CONFIG_SMP 103#ifdef CONFIG_SMP
101static atomic_t waiting_for_crash_ipi; 104static atomic_t enter_on_soft_reset = ATOMIC_INIT(0);
102 105
103void crash_ipi_callback(struct pt_regs *regs) 106void crash_ipi_callback(struct pt_regs *regs)
104{ 107{
105 int cpu = smp_processor_id(); 108 int cpu = smp_processor_id();
106 109
107 if (cpu == crashing_cpu)
108 return;
109
110 if (!cpu_online(cpu)) 110 if (!cpu_online(cpu))
111 return; 111 return;
112 112
113 if (ppc_md.kexec_cpu_down)
114 ppc_md.kexec_cpu_down(1, 1);
115
116 local_irq_disable(); 113 local_irq_disable();
114 if (!cpu_isset(cpu, cpus_in_crash))
115 crash_save_this_cpu(regs, cpu);
116 cpu_set(cpu, cpus_in_crash);
117 117
118 crash_save_this_cpu(regs, cpu); 118 /*
119 atomic_dec(&waiting_for_crash_ipi); 119 * Entered via soft-reset - could be the kdump
120 * process is invoked using soft-reset or user activated
121 * it if some CPU did not respond to an IPI.
122 * For soft-reset, the secondary CPU can enter this func
123 * twice. 1 - using IPI, and 2. soft-reset.
124 * Tell the kexec CPU that entered via soft-reset and ready
125 * to go down.
126 */
127 if (cpu_isset(cpu, cpus_in_sr)) {
128 cpu_clear(cpu, cpus_in_sr);
129 atomic_inc(&enter_on_soft_reset);
130 }
131
132 /*
133 * Starting the kdump boot.
134 * This barrier is needed to make sure that all CPUs are stopped.
135 * If not, soft-reset will be invoked to bring other CPUs.
136 */
137 while (!cpu_isset(crashing_cpu, cpus_in_crash))
138 cpu_relax();
139
140 if (ppc_md.kexec_cpu_down)
141 ppc_md.kexec_cpu_down(1, 1);
120 kexec_smp_wait(); 142 kexec_smp_wait();
121 /* NOTREACHED */ 143 /* NOTREACHED */
122} 144}
123 145
124static void crash_kexec_prepare_cpus(void) 146/*
147 * Wait until all CPUs are entered via soft-reset.
148 */
149static void crash_soft_reset_check(int cpu)
150{
151 unsigned int ncpus = num_online_cpus() - 1;/* Excluding the panic cpu */
152
153 cpu_clear(cpu, cpus_in_sr);
154 while (atomic_read(&enter_on_soft_reset) != ncpus)
155 cpu_relax();
156}
157
158
159static void crash_kexec_prepare_cpus(int cpu)
125{ 160{
126 unsigned int msecs; 161 unsigned int msecs;
127 162
128 atomic_set(&waiting_for_crash_ipi, num_online_cpus() - 1); 163 unsigned int ncpus = num_online_cpus() - 1;/* Excluding the panic cpu */
129 164
130 crash_send_ipi(crash_ipi_callback); 165 crash_send_ipi(crash_ipi_callback);
131 smp_wmb(); 166 smp_wmb();
@@ -133,14 +168,13 @@ static void crash_kexec_prepare_cpus(void)
133 /* 168 /*
134 * FIXME: Until we will have the way to stop other CPUSs reliabally, 169 * FIXME: Until we will have the way to stop other CPUSs reliabally,
135 * the crash CPU will send an IPI and wait for other CPUs to 170 * the crash CPU will send an IPI and wait for other CPUs to
136 * respond. If not, proceed the kexec boot even though we failed to 171 * respond.
137 * capture other CPU states.
138 * Delay of at least 10 seconds. 172 * Delay of at least 10 seconds.
139 */ 173 */
140 printk(KERN_ALERT "Sending IPI to other cpus...\n"); 174 printk(KERN_EMERG "Sending IPI to other cpus...\n");
141 msecs = 10000; 175 msecs = 10000;
142 while ((atomic_read(&waiting_for_crash_ipi) > 0) && (--msecs > 0)) { 176 while ((cpus_weight(cpus_in_crash) < ncpus) && (--msecs > 0)) {
143 barrier(); 177 cpu_relax();
144 mdelay(1); 178 mdelay(1);
145 } 179 }
146 180
@@ -149,18 +183,71 @@ static void crash_kexec_prepare_cpus(void)
149 /* 183 /*
150 * FIXME: In case if we do not get all CPUs, one possibility: ask the 184 * FIXME: In case if we do not get all CPUs, one possibility: ask the
151 * user to do soft reset such that we get all. 185 * user to do soft reset such that we get all.
152 * IPI handler is already set by the panic cpu initially. Therefore, 186 * Soft-reset will be used until better mechanism is implemented.
153 * all cpus could invoke this handler from die() and the panic CPU 187 */
154 * will call machine_kexec() directly from this handler to do 188 if (cpus_weight(cpus_in_crash) < ncpus) {
155 * kexec boot. 189 printk(KERN_EMERG "done waiting: %d cpu(s) not responding\n",
190 ncpus - cpus_weight(cpus_in_crash));
191 printk(KERN_EMERG "Activate soft-reset to stop other cpu(s)\n");
192 cpus_in_sr = CPU_MASK_NONE;
193 atomic_set(&enter_on_soft_reset, 0);
194 while (cpus_weight(cpus_in_crash) < ncpus)
195 cpu_relax();
196 }
197 /*
198 * Make sure all CPUs are entered via soft-reset if the kdump is
199 * invoked using soft-reset.
156 */ 200 */
157 if (atomic_read(&waiting_for_crash_ipi)) 201 if (cpu_isset(cpu, cpus_in_sr))
158 printk(KERN_ALERT "done waiting: %d cpus not responding\n", 202 crash_soft_reset_check(cpu);
159 atomic_read(&waiting_for_crash_ipi));
160 /* Leave the IPI callback set */ 203 /* Leave the IPI callback set */
161} 204}
205
206/*
207 * This function will be called by secondary cpus or by kexec cpu
208 * if soft-reset is activated to stop some CPUs.
209 */
210void crash_kexec_secondary(struct pt_regs *regs)
211{
212 int cpu = smp_processor_id();
213 unsigned long flags;
214 int msecs = 5;
215
216 local_irq_save(flags);
217 /* Wait 5ms if the kexec CPU is not entered yet. */
218 while (crashing_cpu < 0) {
219 if (--msecs < 0) {
220 /*
221 * Either kdump image is not loaded or
222 * kdump process is not started - Probably xmon
223 * exited using 'x'(exit and recover) or
224 * kexec_should_crash() failed for all running tasks.
225 */
226 cpu_clear(cpu, cpus_in_sr);
227 local_irq_restore(flags);
228 return;
229 }
230 mdelay(1);
231 cpu_relax();
232 }
233 if (cpu == crashing_cpu) {
234 /*
235 * Panic CPU will enter this func only via soft-reset.
236 * Wait until all secondary CPUs entered and
237 * then start kexec boot.
238 */
239 crash_soft_reset_check(cpu);
240 cpu_set(crashing_cpu, cpus_in_crash);
241 if (ppc_md.kexec_cpu_down)
242 ppc_md.kexec_cpu_down(1, 0);
243 machine_kexec(kexec_crash_image);
244 /* NOTREACHED */
245 }
246 crash_ipi_callback(regs);
247}
248
162#else 249#else
163static void crash_kexec_prepare_cpus(void) 250static void crash_kexec_prepare_cpus(int cpu)
164{ 251{
165 /* 252 /*
166 * move the secondarys to us so that we can copy 253 * move the secondarys to us so that we can copy
@@ -171,6 +258,10 @@ static void crash_kexec_prepare_cpus(void)
171 smp_release_cpus(); 258 smp_release_cpus();
172} 259}
173 260
261void crash_kexec_secondary(struct pt_regs *regs)
262{
263 cpus_in_sr = CPU_MASK_NONE;
264}
174#endif 265#endif
175 266
176void default_machine_crash_shutdown(struct pt_regs *regs) 267void default_machine_crash_shutdown(struct pt_regs *regs)
@@ -179,7 +270,7 @@ void default_machine_crash_shutdown(struct pt_regs *regs)
179 270
180 /* 271 /*
181 * This function is only called after the system 272 * This function is only called after the system
182 * has paniced or is otherwise in a critical state. 273 * has panicked or is otherwise in a critical state.
183 * The minimum amount of code to allow a kexec'd kernel 274 * The minimum amount of code to allow a kexec'd kernel
184 * to run successfully needs to happen here. 275 * to run successfully needs to happen here.
185 * 276 *
@@ -190,23 +281,23 @@ void default_machine_crash_shutdown(struct pt_regs *regs)
190 local_irq_disable(); 281 local_irq_disable();
191 282
192 for_each_irq(irq) { 283 for_each_irq(irq) {
193 struct irq_desc *desc = irq_descp(irq); 284 struct irq_desc *desc = irq_desc + irq;
194 285
195 if (desc->status & IRQ_INPROGRESS) 286 if (desc->status & IRQ_INPROGRESS)
196 desc->handler->end(irq); 287 desc->chip->end(irq);
197 288
198 if (!(desc->status & IRQ_DISABLED)) 289 if (!(desc->status & IRQ_DISABLED))
199 desc->handler->disable(irq); 290 desc->chip->disable(irq);
200 } 291 }
201 292
202 if (ppc_md.kexec_cpu_down)
203 ppc_md.kexec_cpu_down(1, 0);
204
205 /* 293 /*
206 * Make a note of crashing cpu. Will be used in machine_kexec 294 * Make a note of crashing cpu. Will be used in machine_kexec
207 * such that another IPI will not be sent. 295 * such that another IPI will not be sent.
208 */ 296 */
209 crashing_cpu = smp_processor_id(); 297 crashing_cpu = smp_processor_id();
210 crash_kexec_prepare_cpus();
211 crash_save_this_cpu(regs, crashing_cpu); 298 crash_save_this_cpu(regs, crashing_cpu);
299 crash_kexec_prepare_cpus(crashing_cpu);
300 cpu_set(crashing_cpu, cpus_in_crash);
301 if (ppc_md.kexec_cpu_down)
302 ppc_md.kexec_cpu_down(1, 0);
212} 303}
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index 8866fd26c6b9..c03e829fee3c 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -19,7 +19,6 @@
19 * 19 *
20 */ 20 */
21 21
22#include <linux/config.h>
23#include <linux/errno.h> 22#include <linux/errno.h>
24#include <linux/sys.h> 23#include <linux/sys.h>
25#include <linux/threads.h> 24#include <linux/threads.h>
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 221062c960c9..54d9f5cdaab4 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -18,7 +18,6 @@
18 * 2 of the License, or (at your option) any later version. 18 * 2 of the License, or (at your option) any later version.
19 */ 19 */
20 20
21#include <linux/config.h>
22#include <linux/errno.h> 21#include <linux/errno.h>
23#include <asm/unistd.h> 22#include <asm/unistd.h>
24#include <asm/processor.h> 23#include <asm/processor.h>
diff --git a/arch/powerpc/kernel/firmware.c b/arch/powerpc/kernel/firmware.c
index 0bfe9061720a..1679a70bbcad 100644
--- a/arch/powerpc/kernel/firmware.c
+++ b/arch/powerpc/kernel/firmware.c
@@ -13,7 +13,6 @@
13 * 2 of the License, or (at your option) any later version. 13 * 2 of the License, or (at your option) any later version.
14 */ 14 */
15 15
16#include <linux/config.h>
17#include <linux/module.h> 16#include <linux/module.h>
18 17
19#include <asm/firmware.h> 18#include <asm/firmware.h>
diff --git a/arch/powerpc/kernel/fpu.S b/arch/powerpc/kernel/fpu.S
index 01f71200c603..7e2c9fe44ac1 100644
--- a/arch/powerpc/kernel/fpu.S
+++ b/arch/powerpc/kernel/fpu.S
@@ -9,7 +9,6 @@
9 * 9 *
10 */ 10 */
11 11
12#include <linux/config.h>
13#include <asm/reg.h> 12#include <asm/reg.h>
14#include <asm/page.h> 13#include <asm/page.h>
15#include <asm/mmu.h> 14#include <asm/mmu.h>
diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
index b25b25902d15..d88e182e40b3 100644
--- a/arch/powerpc/kernel/head_32.S
+++ b/arch/powerpc/kernel/head_32.S
@@ -22,7 +22,6 @@
22 * 22 *
23 */ 23 */
24 24
25#include <linux/config.h>
26#include <asm/reg.h> 25#include <asm/reg.h>
27#include <asm/page.h> 26#include <asm/page.h>
28#include <asm/mmu.h> 27#include <asm/mmu.h>
diff --git a/arch/powerpc/kernel/head_44x.S b/arch/powerpc/kernel/head_44x.S
index 47c7fa148c9a..accb39d49911 100644
--- a/arch/powerpc/kernel/head_44x.S
+++ b/arch/powerpc/kernel/head_44x.S
@@ -28,7 +28,6 @@
28 * option) any later version. 28 * option) any later version.
29 */ 29 */
30 30
31#include <linux/config.h>
32#include <asm/processor.h> 31#include <asm/processor.h>
33#include <asm/page.h> 32#include <asm/page.h>
34#include <asm/mmu.h> 33#include <asm/mmu.h>
diff --git a/arch/powerpc/kernel/head_4xx.S b/arch/powerpc/kernel/head_4xx.S
index 2590e97f5539..adc7f8097cd4 100644
--- a/arch/powerpc/kernel/head_4xx.S
+++ b/arch/powerpc/kernel/head_4xx.S
@@ -31,7 +31,6 @@
31 * 31 *
32 */ 32 */
33 33
34#include <linux/config.h>
35#include <asm/processor.h> 34#include <asm/processor.h>
36#include <asm/page.h> 35#include <asm/page.h>
37#include <asm/mmu.h> 36#include <asm/mmu.h>
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 831acbdf2592..e16eb2a33173 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -21,7 +21,6 @@
21 * 2 of the License, or (at your option) any later version. 21 * 2 of the License, or (at your option) any later version.
22 */ 22 */
23 23
24#include <linux/config.h>
25#include <linux/threads.h> 24#include <linux/threads.h>
26#include <asm/reg.h> 25#include <asm/reg.h>
27#include <asm/page.h> 26#include <asm/page.h>
@@ -85,34 +84,6 @@ END_FTR_SECTION(0, 1)
85 /* Catch branch to 0 in real mode */ 84 /* Catch branch to 0 in real mode */
86 trap 85 trap
87 86
88#ifdef CONFIG_PPC_ISERIES
89 /*
90 * At offset 0x20, there is a pointer to iSeries LPAR data.
91 * This is required by the hypervisor
92 */
93 . = 0x20
94 .llong hvReleaseData-KERNELBASE
95
96 /*
97 * At offset 0x28 and 0x30 are offsets to the mschunks_map
98 * array (used by the iSeries LPAR debugger to do translation
99 * between physical addresses and absolute addresses) and
100 * to the pidhash table (also used by the debugger)
101 */
102 .llong mschunks_map-KERNELBASE
103 .llong 0 /* pidhash-KERNELBASE SFRXXX */
104
105 /* Offset 0x38 - Pointer to start of embedded System.map */
106 .globl embedded_sysmap_start
107embedded_sysmap_start:
108 .llong 0
109 /* Offset 0x40 - Pointer to end of embedded System.map */
110 .globl embedded_sysmap_end
111embedded_sysmap_end:
112 .llong 0
113
114#endif /* CONFIG_PPC_ISERIES */
115
116 /* Secondary processors spin on this value until it goes to 1. */ 87 /* Secondary processors spin on this value until it goes to 1. */
117 .globl __secondary_hold_spinloop 88 .globl __secondary_hold_spinloop
118__secondary_hold_spinloop: 89__secondary_hold_spinloop:
@@ -124,6 +95,15 @@ __secondary_hold_spinloop:
124__secondary_hold_acknowledge: 95__secondary_hold_acknowledge:
125 .llong 0x0 96 .llong 0x0
126 97
98#ifdef CONFIG_PPC_ISERIES
99 /*
100 * At offset 0x20, there is a pointer to iSeries LPAR data.
101 * This is required by the hypervisor
102 */
103 . = 0x20
104 .llong hvReleaseData-KERNELBASE
105#endif /* CONFIG_PPC_ISERIES */
106
127 . = 0x60 107 . = 0x60
128/* 108/*
129 * The following code is used on pSeries to hold secondary processors 109 * The following code is used on pSeries to hold secondary processors
@@ -1602,9 +1582,6 @@ _GLOBAL(__start_initialization_multiplatform)
1602 /* Setup some critical 970 SPRs before switching MMU off */ 1582 /* Setup some critical 970 SPRs before switching MMU off */
1603 bl .__970_cpu_preinit 1583 bl .__970_cpu_preinit
1604 1584
1605 /* cpu # */
1606 li r24,0
1607
1608 /* Switch off MMU if not already */ 1585 /* Switch off MMU if not already */
1609 LOAD_REG_IMMEDIATE(r4, .__after_prom_start - KERNELBASE) 1586 LOAD_REG_IMMEDIATE(r4, .__after_prom_start - KERNELBASE)
1610 add r4,r4,r30 1587 add r4,r4,r30
@@ -1683,6 +1660,9 @@ _STATIC(__after_prom_start)
1683 /* i.e. where we are running */ 1660 /* i.e. where we are running */
1684 /* the source addr */ 1661 /* the source addr */
1685 1662
1663 cmpdi r4,0 /* In some cases the loader may */
1664 beq .start_here_multiplatform /* have already put us at zero */
1665 /* so we can skip the copy. */
1686 LOAD_REG_IMMEDIATE(r5,copy_to_here) /* # bytes of memory to copy */ 1666 LOAD_REG_IMMEDIATE(r5,copy_to_here) /* # bytes of memory to copy */
1687 sub r5,r5,r27 1667 sub r5,r5,r27
1688 1668
@@ -1962,14 +1942,6 @@ _STATIC(start_here_common)
1962 li r3,0 1942 li r3,0
1963 bl .do_cpu_ftr_fixups 1943 bl .do_cpu_ftr_fixups
1964 1944
1965 LOAD_REG_IMMEDIATE(r26, boot_cpuid)
1966 lwz r26,0(r26)
1967
1968 LOAD_REG_IMMEDIATE(r24, paca) /* Get base vaddr of paca array */
1969 mulli r13,r26,PACA_SIZE /* Calculate vaddr of right paca */
1970 add r13,r13,r24 /* for this processor. */
1971 mtspr SPRN_SPRG3,r13
1972
1973 /* ptr to current */ 1945 /* ptr to current */
1974 LOAD_REG_IMMEDIATE(r4, init_task) 1946 LOAD_REG_IMMEDIATE(r4, init_task)
1975 std r4,PACACURRENT(r13) 1947 std r4,PACACURRENT(r13)
@@ -1995,17 +1967,6 @@ _STATIC(start_here_common)
1995 /* Not reached */ 1967 /* Not reached */
1996 BUG_OPCODE 1968 BUG_OPCODE
1997 1969
1998/* Put the paca pointer into r13 and SPRG3 */
1999_GLOBAL(setup_boot_paca)
2000 LOAD_REG_IMMEDIATE(r3, boot_cpuid)
2001 lwz r3,0(r3)
2002 LOAD_REG_IMMEDIATE(r4, paca) /* Get base vaddr of paca array */
2003 mulli r3,r3,PACA_SIZE /* Calculate vaddr of right paca */
2004 add r13,r3,r4 /* for this processor. */
2005 mtspr SPRN_SPRG3,r13
2006
2007 blr
2008
2009/* 1970/*
2010 * We put a few things here that have to be page-aligned. 1971 * We put a few things here that have to be page-aligned.
2011 * This stuff goes at the beginning of the bss, which is page-aligned. 1972 * This stuff goes at the beginning of the bss, which is page-aligned.
diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S
index 28941f5ce673..901be47a02a9 100644
--- a/arch/powerpc/kernel/head_8xx.S
+++ b/arch/powerpc/kernel/head_8xx.S
@@ -19,7 +19,6 @@
19 * 19 *
20 */ 20 */
21 21
22#include <linux/config.h>
23#include <asm/processor.h> 22#include <asm/processor.h>
24#include <asm/page.h> 23#include <asm/page.h>
25#include <asm/mmu.h> 24#include <asm/mmu.h>
diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
index dd86bbed7627..66877bdfe0b7 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -30,7 +30,6 @@
30 * option) any later version. 30 * option) any later version.
31 */ 31 */
32 32
33#include <linux/config.h>
34#include <linux/threads.h> 33#include <linux/threads.h>
35#include <asm/processor.h> 34#include <asm/processor.h>
36#include <asm/page.h> 35#include <asm/page.h>
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
index e47d40ac6f39..97ddc02a3d42 100644
--- a/arch/powerpc/kernel/ibmebus.c
+++ b/arch/powerpc/kernel/ibmebus.c
@@ -323,13 +323,11 @@ int ibmebus_request_irq(struct ibmebus_dev *dev,
323 unsigned long irq_flags, const char * devname, 323 unsigned long irq_flags, const char * devname,
324 void *dev_id) 324 void *dev_id)
325{ 325{
326 unsigned int irq = virt_irq_create_mapping(ist); 326 unsigned int irq = irq_create_mapping(NULL, ist, 0);
327 327
328 if (irq == NO_IRQ) 328 if (irq == NO_IRQ)
329 return -EINVAL; 329 return -EINVAL;
330 330
331 irq = irq_offset_up(irq);
332
333 return request_irq(irq, handler, 331 return request_irq(irq, handler,
334 irq_flags, devname, dev_id); 332 irq_flags, devname, dev_id);
335} 333}
@@ -337,12 +335,9 @@ EXPORT_SYMBOL(ibmebus_request_irq);
337 335
338void ibmebus_free_irq(struct ibmebus_dev *dev, u32 ist, void *dev_id) 336void ibmebus_free_irq(struct ibmebus_dev *dev, u32 ist, void *dev_id)
339{ 337{
340 unsigned int irq = virt_irq_create_mapping(ist); 338 unsigned int irq = irq_find_mapping(NULL, ist);
341 339
342 irq = irq_offset_up(irq);
343 free_irq(irq, dev_id); 340 free_irq(irq, dev_id);
344
345 return;
346} 341}
347EXPORT_SYMBOL(ibmebus_free_irq); 342EXPORT_SYMBOL(ibmebus_free_irq);
348 343
diff --git a/arch/powerpc/kernel/idle.c b/arch/powerpc/kernel/idle.c
index d491052c8e0c..4180c3998b39 100644
--- a/arch/powerpc/kernel/idle.c
+++ b/arch/powerpc/kernel/idle.c
@@ -19,7 +19,6 @@
19 * 2 of the License, or (at your option) any later version. 19 * 2 of the License, or (at your option) any later version.
20 */ 20 */
21 21
22#include <linux/config.h>
23#include <linux/sched.h> 22#include <linux/sched.h>
24#include <linux/kernel.h> 23#include <linux/kernel.h>
25#include <linux/smp.h> 24#include <linux/smp.h>
diff --git a/arch/powerpc/kernel/idle_6xx.S b/arch/powerpc/kernel/idle_6xx.S
index b45fa0e37212..01bcd52bbf8e 100644
--- a/arch/powerpc/kernel/idle_6xx.S
+++ b/arch/powerpc/kernel/idle_6xx.S
@@ -13,7 +13,6 @@
13 * 2 of the License, or (at your option) any later version. 13 * 2 of the License, or (at your option) any later version.
14 */ 14 */
15 15
16#include <linux/config.h>
17#include <linux/threads.h> 16#include <linux/threads.h>
18#include <asm/reg.h> 17#include <asm/reg.h>
19#include <asm/page.h> 18#include <asm/page.h>
diff --git a/arch/powerpc/kernel/idle_power4.S b/arch/powerpc/kernel/idle_power4.S
index d85c7c938eed..30de81da7b40 100644
--- a/arch/powerpc/kernel/idle_power4.S
+++ b/arch/powerpc/kernel/idle_power4.S
@@ -7,7 +7,6 @@
7 * 2 of the License, or (at your option) any later version. 7 * 2 of the License, or (at your option) any later version.
8 */ 8 */
9 9
10#include <linux/config.h>
11#include <linux/threads.h> 10#include <linux/threads.h>
12#include <asm/processor.h> 11#include <asm/processor.h>
13#include <asm/page.h> 12#include <asm/page.h>
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index 7cb77c20fc5d..ba0694071728 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -23,7 +23,6 @@
23 */ 23 */
24 24
25 25
26#include <linux/config.h>
27#include <linux/init.h> 26#include <linux/init.h>
28#include <linux/types.h> 27#include <linux/types.h>
29#include <linux/slab.h> 28#include <linux/slab.h>
@@ -38,6 +37,7 @@
38#include <asm/iommu.h> 37#include <asm/iommu.h>
39#include <asm/pci-bridge.h> 38#include <asm/pci-bridge.h>
40#include <asm/machdep.h> 39#include <asm/machdep.h>
40#include <asm/kdump.h>
41 41
42#define DBG(...) 42#define DBG(...)
43 43
@@ -440,8 +440,37 @@ struct iommu_table *iommu_init_table(struct iommu_table *tbl, int nid)
440 tbl->it_largehint = tbl->it_halfpoint; 440 tbl->it_largehint = tbl->it_halfpoint;
441 spin_lock_init(&tbl->it_lock); 441 spin_lock_init(&tbl->it_lock);
442 442
443#ifdef CONFIG_CRASH_DUMP
444 if (ppc_md.tce_get) {
445 unsigned long index, tceval;
446 unsigned long tcecount = 0;
447
448 /*
449 * Reserve the existing mappings left by the first kernel.
450 */
451 for (index = 0; index < tbl->it_size; index++) {
452 tceval = ppc_md.tce_get(tbl, index + tbl->it_offset);
453 /*
454 * Freed TCE entry contains 0x7fffffffffffffff on JS20
455 */
456 if (tceval && (tceval != 0x7fffffffffffffffUL)) {
457 __set_bit(index, tbl->it_map);
458 tcecount++;
459 }
460 }
461 if ((tbl->it_size - tcecount) < KDUMP_MIN_TCE_ENTRIES) {
462 printk(KERN_WARNING "TCE table is full; ");
463 printk(KERN_WARNING "freeing %d entries for the kdump boot\n",
464 KDUMP_MIN_TCE_ENTRIES);
465 for (index = tbl->it_size - KDUMP_MIN_TCE_ENTRIES;
466 index < tbl->it_size; index++)
467 __clear_bit(index, tbl->it_map);
468 }
469 }
470#else
443 /* Clear the hardware table in case firmware left allocations in it */ 471 /* Clear the hardware table in case firmware left allocations in it */
444 ppc_md.tce_free(tbl, tbl->it_offset, tbl->it_size); 472 ppc_md.tce_free(tbl, tbl->it_offset, tbl->it_size);
473#endif
445 474
446 if (!welcomed) { 475 if (!welcomed) {
447 printk(KERN_INFO "IOMMU table initialized, virtual merging %s\n", 476 printk(KERN_INFO "IOMMU table initialized, virtual merging %s\n",
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 40d4c14fde8f..05a700940f67 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -29,6 +29,8 @@
29 * to reduce code space and undefined function references. 29 * to reduce code space and undefined function references.
30 */ 30 */
31 31
32#undef DEBUG
33
32#include <linux/module.h> 34#include <linux/module.h>
33#include <linux/threads.h> 35#include <linux/threads.h>
34#include <linux/kernel_stat.h> 36#include <linux/kernel_stat.h>
@@ -38,7 +40,6 @@
38#include <linux/ioport.h> 40#include <linux/ioport.h>
39#include <linux/interrupt.h> 41#include <linux/interrupt.h>
40#include <linux/timex.h> 42#include <linux/timex.h>
41#include <linux/config.h>
42#include <linux/init.h> 43#include <linux/init.h>
43#include <linux/slab.h> 44#include <linux/slab.h>
44#include <linux/delay.h> 45#include <linux/delay.h>
@@ -47,7 +48,10 @@
47#include <linux/cpumask.h> 48#include <linux/cpumask.h>
48#include <linux/profile.h> 49#include <linux/profile.h>
49#include <linux/bitops.h> 50#include <linux/bitops.h>
50#include <linux/pci.h> 51#include <linux/list.h>
52#include <linux/radix-tree.h>
53#include <linux/mutex.h>
54#include <linux/bootmem.h>
51 55
52#include <asm/uaccess.h> 56#include <asm/uaccess.h>
53#include <asm/system.h> 57#include <asm/system.h>
@@ -58,39 +62,38 @@
58#include <asm/prom.h> 62#include <asm/prom.h>
59#include <asm/ptrace.h> 63#include <asm/ptrace.h>
60#include <asm/machdep.h> 64#include <asm/machdep.h>
65#include <asm/udbg.h>
61#ifdef CONFIG_PPC_ISERIES 66#ifdef CONFIG_PPC_ISERIES
62#include <asm/paca.h> 67#include <asm/paca.h>
63#endif 68#endif
64 69
65int __irq_offset_value; 70int __irq_offset_value;
66#ifdef CONFIG_PPC32
67EXPORT_SYMBOL(__irq_offset_value);
68#endif
69
70static int ppc_spurious_interrupts; 71static int ppc_spurious_interrupts;
71 72
72#ifdef CONFIG_PPC32 73#ifdef CONFIG_PPC32
73#define NR_MASK_WORDS ((NR_IRQS + 31) / 32) 74EXPORT_SYMBOL(__irq_offset_value);
75atomic_t ppc_n_lost_interrupts;
74 76
77#ifndef CONFIG_PPC_MERGE
78#define NR_MASK_WORDS ((NR_IRQS + 31) / 32)
75unsigned long ppc_cached_irq_mask[NR_MASK_WORDS]; 79unsigned long ppc_cached_irq_mask[NR_MASK_WORDS];
76atomic_t ppc_n_lost_interrupts; 80#endif
77 81
78#ifdef CONFIG_TAU_INT 82#ifdef CONFIG_TAU_INT
79extern int tau_initialized; 83extern int tau_initialized;
80extern int tau_interrupts(int); 84extern int tau_interrupts(int);
81#endif 85#endif
86#endif /* CONFIG_PPC32 */
82 87
83#if defined(CONFIG_SMP) && !defined(CONFIG_PPC_MERGE) 88#if defined(CONFIG_SMP) && !defined(CONFIG_PPC_MERGE)
84extern atomic_t ipi_recv; 89extern atomic_t ipi_recv;
85extern atomic_t ipi_sent; 90extern atomic_t ipi_sent;
86#endif 91#endif
87#endif /* CONFIG_PPC32 */
88 92
89#ifdef CONFIG_PPC64 93#ifdef CONFIG_PPC64
90EXPORT_SYMBOL(irq_desc); 94EXPORT_SYMBOL(irq_desc);
91 95
92int distribute_irqs = 1; 96int distribute_irqs = 1;
93u64 ppc64_interrupt_controller;
94#endif /* CONFIG_PPC64 */ 97#endif /* CONFIG_PPC64 */
95 98
96int show_interrupts(struct seq_file *p, void *v) 99int show_interrupts(struct seq_file *p, void *v)
@@ -120,8 +123,8 @@ int show_interrupts(struct seq_file *p, void *v)
120#else 123#else
121 seq_printf(p, "%10u ", kstat_irqs(i)); 124 seq_printf(p, "%10u ", kstat_irqs(i));
122#endif /* CONFIG_SMP */ 125#endif /* CONFIG_SMP */
123 if (desc->handler) 126 if (desc->chip)
124 seq_printf(p, " %s ", desc->handler->typename); 127 seq_printf(p, " %s ", desc->chip->typename);
125 else 128 else
126 seq_puts(p, " None "); 129 seq_puts(p, " None ");
127 seq_printf(p, "%s", (desc->status & IRQ_LEVEL) ? "Level " : "Edge "); 130 seq_printf(p, "%s", (desc->status & IRQ_LEVEL) ? "Level " : "Edge ");
@@ -164,13 +167,13 @@ void fixup_irqs(cpumask_t map)
164 if (irq_desc[irq].status & IRQ_PER_CPU) 167 if (irq_desc[irq].status & IRQ_PER_CPU)
165 continue; 168 continue;
166 169
167 cpus_and(mask, irq_affinity[irq], map); 170 cpus_and(mask, irq_desc[irq].affinity, map);
168 if (any_online_cpu(mask) == NR_CPUS) { 171 if (any_online_cpu(mask) == NR_CPUS) {
169 printk("Breaking affinity for irq %i\n", irq); 172 printk("Breaking affinity for irq %i\n", irq);
170 mask = map; 173 mask = map;
171 } 174 }
172 if (irq_desc[irq].handler->set_affinity) 175 if (irq_desc[irq].chip->set_affinity)
173 irq_desc[irq].handler->set_affinity(irq, mask); 176 irq_desc[irq].chip->set_affinity(irq, mask);
174 else if (irq_desc[irq].action && !(warned++)) 177 else if (irq_desc[irq].action && !(warned++))
175 printk("Cannot set affinity for irq %i\n", irq); 178 printk("Cannot set affinity for irq %i\n", irq);
176 } 179 }
@@ -183,7 +186,7 @@ void fixup_irqs(cpumask_t map)
183 186
184void do_IRQ(struct pt_regs *regs) 187void do_IRQ(struct pt_regs *regs)
185{ 188{
186 int irq; 189 unsigned int irq;
187#ifdef CONFIG_IRQSTACKS 190#ifdef CONFIG_IRQSTACKS
188 struct thread_info *curtp, *irqtp; 191 struct thread_info *curtp, *irqtp;
189#endif 192#endif
@@ -214,22 +217,26 @@ void do_IRQ(struct pt_regs *regs)
214 */ 217 */
215 irq = ppc_md.get_irq(regs); 218 irq = ppc_md.get_irq(regs);
216 219
217 if (irq >= 0) { 220 if (irq != NO_IRQ && irq != NO_IRQ_IGNORE) {
218#ifdef CONFIG_IRQSTACKS 221#ifdef CONFIG_IRQSTACKS
219 /* Switch to the irq stack to handle this */ 222 /* Switch to the irq stack to handle this */
220 curtp = current_thread_info(); 223 curtp = current_thread_info();
221 irqtp = hardirq_ctx[smp_processor_id()]; 224 irqtp = hardirq_ctx[smp_processor_id()];
222 if (curtp != irqtp) { 225 if (curtp != irqtp) {
226 struct irq_desc *desc = irq_desc + irq;
227 void *handler = desc->handle_irq;
228 if (handler == NULL)
229 handler = &__do_IRQ;
223 irqtp->task = curtp->task; 230 irqtp->task = curtp->task;
224 irqtp->flags = 0; 231 irqtp->flags = 0;
225 call___do_IRQ(irq, regs, irqtp); 232 call_handle_irq(irq, desc, regs, irqtp, handler);
226 irqtp->task = NULL; 233 irqtp->task = NULL;
227 if (irqtp->flags) 234 if (irqtp->flags)
228 set_bits(irqtp->flags, &curtp->flags); 235 set_bits(irqtp->flags, &curtp->flags);
229 } else 236 } else
230#endif 237#endif
231 __do_IRQ(irq, regs); 238 generic_handle_irq(irq, regs);
232 } else if (irq != -2) 239 } else if (irq != NO_IRQ_IGNORE)
233 /* That's not SMP safe ... but who cares ? */ 240 /* That's not SMP safe ... but who cares ? */
234 ppc_spurious_interrupts++; 241 ppc_spurious_interrupts++;
235 242
@@ -246,138 +253,12 @@ void do_IRQ(struct pt_regs *regs)
246 253
247void __init init_IRQ(void) 254void __init init_IRQ(void)
248{ 255{
249#ifdef CONFIG_PPC64
250 static int once = 0;
251
252 if (once)
253 return;
254
255 once++;
256
257#endif
258 ppc_md.init_IRQ(); 256 ppc_md.init_IRQ();
259#ifdef CONFIG_PPC64 257#ifdef CONFIG_PPC64
260 irq_ctx_init(); 258 irq_ctx_init();
261#endif 259#endif
262} 260}
263 261
264#ifdef CONFIG_PPC64
265/*
266 * Virtual IRQ mapping code, used on systems with XICS interrupt controllers.
267 */
268
269#define UNDEFINED_IRQ 0xffffffff
270unsigned int virt_irq_to_real_map[NR_IRQS];
271
272/*
273 * Don't use virtual irqs 0, 1, 2 for devices.
274 * The pcnet32 driver considers interrupt numbers < 2 to be invalid,
275 * and 2 is the XICS IPI interrupt.
276 * We limit virtual irqs to __irq_offet_value less than virt_irq_max so
277 * that when we offset them we don't end up with an interrupt
278 * number >= virt_irq_max.
279 */
280#define MIN_VIRT_IRQ 3
281
282unsigned int virt_irq_max;
283static unsigned int max_virt_irq;
284static unsigned int nr_virt_irqs;
285
286void
287virt_irq_init(void)
288{
289 int i;
290
291 if ((virt_irq_max == 0) || (virt_irq_max > (NR_IRQS - 1)))
292 virt_irq_max = NR_IRQS - 1;
293 max_virt_irq = virt_irq_max - __irq_offset_value;
294 nr_virt_irqs = max_virt_irq - MIN_VIRT_IRQ + 1;
295
296 for (i = 0; i < NR_IRQS; i++)
297 virt_irq_to_real_map[i] = UNDEFINED_IRQ;
298}
299
300/* Create a mapping for a real_irq if it doesn't already exist.
301 * Return the virtual irq as a convenience.
302 */
303int virt_irq_create_mapping(unsigned int real_irq)
304{
305 unsigned int virq, first_virq;
306 static int warned;
307
308 if (ppc64_interrupt_controller == IC_OPEN_PIC)
309 return real_irq; /* no mapping for openpic (for now) */
310
311 if (ppc64_interrupt_controller == IC_CELL_PIC)
312 return real_irq; /* no mapping for iic either */
313
314 /* don't map interrupts < MIN_VIRT_IRQ */
315 if (real_irq < MIN_VIRT_IRQ) {
316 virt_irq_to_real_map[real_irq] = real_irq;
317 return real_irq;
318 }
319
320 /* map to a number between MIN_VIRT_IRQ and max_virt_irq */
321 virq = real_irq;
322 if (virq > max_virt_irq)
323 virq = (virq % nr_virt_irqs) + MIN_VIRT_IRQ;
324
325 /* search for this number or a free slot */
326 first_virq = virq;
327 while (virt_irq_to_real_map[virq] != UNDEFINED_IRQ) {
328 if (virt_irq_to_real_map[virq] == real_irq)
329 return virq;
330 if (++virq > max_virt_irq)
331 virq = MIN_VIRT_IRQ;
332 if (virq == first_virq)
333 goto nospace; /* oops, no free slots */
334 }
335
336 virt_irq_to_real_map[virq] = real_irq;
337 return virq;
338
339 nospace:
340 if (!warned) {
341 printk(KERN_CRIT "Interrupt table is full\n");
342 printk(KERN_CRIT "Increase virt_irq_max (currently %d) "
343 "in your kernel sources and rebuild.\n", virt_irq_max);
344 warned = 1;
345 }
346 return NO_IRQ;
347}
348
349/*
350 * In most cases will get a hit on the very first slot checked in the
351 * virt_irq_to_real_map. Only when there are a large number of
352 * IRQs will this be expensive.
353 */
354unsigned int real_irq_to_virt_slowpath(unsigned int real_irq)
355{
356 unsigned int virq;
357 unsigned int first_virq;
358
359 virq = real_irq;
360
361 if (virq > max_virt_irq)
362 virq = (virq % nr_virt_irqs) + MIN_VIRT_IRQ;
363
364 first_virq = virq;
365
366 do {
367 if (virt_irq_to_real_map[virq] == real_irq)
368 return virq;
369
370 virq++;
371
372 if (virq >= max_virt_irq)
373 virq = 0;
374
375 } while (first_virq != virq);
376
377 return NO_IRQ;
378
379}
380#endif /* CONFIG_PPC64 */
381 262
382#ifdef CONFIG_IRQSTACKS 263#ifdef CONFIG_IRQSTACKS
383struct thread_info *softirq_ctx[NR_CPUS] __read_mostly; 264struct thread_info *softirq_ctx[NR_CPUS] __read_mostly;
@@ -437,6 +318,503 @@ void do_softirq(void)
437} 318}
438EXPORT_SYMBOL(do_softirq); 319EXPORT_SYMBOL(do_softirq);
439 320
321
322/*
323 * IRQ controller and virtual interrupts
324 */
325
326#ifdef CONFIG_PPC_MERGE
327
328static LIST_HEAD(irq_hosts);
329static spinlock_t irq_big_lock = SPIN_LOCK_UNLOCKED;
330
331struct irq_map_entry irq_map[NR_IRQS];
332static unsigned int irq_virq_count = NR_IRQS;
333static struct irq_host *irq_default_host;
334
335struct irq_host *irq_alloc_host(unsigned int revmap_type,
336 unsigned int revmap_arg,
337 struct irq_host_ops *ops,
338 irq_hw_number_t inval_irq)
339{
340 struct irq_host *host;
341 unsigned int size = sizeof(struct irq_host);
342 unsigned int i;
343 unsigned int *rmap;
344 unsigned long flags;
345
346 /* Allocate structure and revmap table if using linear mapping */
347 if (revmap_type == IRQ_HOST_MAP_LINEAR)
348 size += revmap_arg * sizeof(unsigned int);
349 if (mem_init_done)
350 host = kzalloc(size, GFP_KERNEL);
351 else {
352 host = alloc_bootmem(size);
353 if (host)
354 memset(host, 0, size);
355 }
356 if (host == NULL)
357 return NULL;
358
359 /* Fill structure */
360 host->revmap_type = revmap_type;
361 host->inval_irq = inval_irq;
362 host->ops = ops;
363
364 spin_lock_irqsave(&irq_big_lock, flags);
365
366 /* If it's a legacy controller, check for duplicates and
367 * mark it as allocated (we use irq 0 host pointer for that
368 */
369 if (revmap_type == IRQ_HOST_MAP_LEGACY) {
370 if (irq_map[0].host != NULL) {
371 spin_unlock_irqrestore(&irq_big_lock, flags);
372 /* If we are early boot, we can't free the structure,
373 * too bad...
374 * this will be fixed once slab is made available early
375 * instead of the current cruft
376 */
377 if (mem_init_done)
378 kfree(host);
379 return NULL;
380 }
381 irq_map[0].host = host;
382 }
383
384 list_add(&host->link, &irq_hosts);
385 spin_unlock_irqrestore(&irq_big_lock, flags);
386
387 /* Additional setups per revmap type */
388 switch(revmap_type) {
389 case IRQ_HOST_MAP_LEGACY:
390 /* 0 is always the invalid number for legacy */
391 host->inval_irq = 0;
392 /* setup us as the host for all legacy interrupts */
393 for (i = 1; i < NUM_ISA_INTERRUPTS; i++) {
394 irq_map[i].hwirq = 0;
395 smp_wmb();
396 irq_map[i].host = host;
397 smp_wmb();
398
399 /* Clear some flags */
400 get_irq_desc(i)->status
401 &= ~(IRQ_NOREQUEST | IRQ_LEVEL);
402
403 /* Legacy flags are left to default at this point,
404 * one can then use irq_create_mapping() to
405 * explicitely change them
406 */
407 ops->map(host, i, i, 0);
408 }
409 break;
410 case IRQ_HOST_MAP_LINEAR:
411 rmap = (unsigned int *)(host + 1);
412 for (i = 0; i < revmap_arg; i++)
413 rmap[i] = IRQ_NONE;
414 host->revmap_data.linear.size = revmap_arg;
415 smp_wmb();
416 host->revmap_data.linear.revmap = rmap;
417 break;
418 default:
419 break;
420 }
421
422 pr_debug("irq: Allocated host of type %d @0x%p\n", revmap_type, host);
423
424 return host;
425}
426
427struct irq_host *irq_find_host(struct device_node *node)
428{
429 struct irq_host *h, *found = NULL;
430 unsigned long flags;
431
432 /* We might want to match the legacy controller last since
433 * it might potentially be set to match all interrupts in
434 * the absence of a device node. This isn't a problem so far
435 * yet though...
436 */
437 spin_lock_irqsave(&irq_big_lock, flags);
438 list_for_each_entry(h, &irq_hosts, link)
439 if (h->ops->match == NULL || h->ops->match(h, node)) {
440 found = h;
441 break;
442 }
443 spin_unlock_irqrestore(&irq_big_lock, flags);
444 return found;
445}
446EXPORT_SYMBOL_GPL(irq_find_host);
447
448void irq_set_default_host(struct irq_host *host)
449{
450 pr_debug("irq: Default host set to @0x%p\n", host);
451
452 irq_default_host = host;
453}
454
455void irq_set_virq_count(unsigned int count)
456{
457 pr_debug("irq: Trying to set virq count to %d\n", count);
458
459 BUG_ON(count < NUM_ISA_INTERRUPTS);
460 if (count < NR_IRQS)
461 irq_virq_count = count;
462}
463
464unsigned int irq_create_mapping(struct irq_host *host,
465 irq_hw_number_t hwirq,
466 unsigned int flags)
467{
468 unsigned int virq, hint;
469
470 pr_debug("irq: irq_create_mapping(0x%p, 0x%lx, 0x%x)\n",
471 host, hwirq, flags);
472
473 /* Look for default host if nececssary */
474 if (host == NULL)
475 host = irq_default_host;
476 if (host == NULL) {
477 printk(KERN_WARNING "irq_create_mapping called for"
478 " NULL host, hwirq=%lx\n", hwirq);
479 WARN_ON(1);
480 return NO_IRQ;
481 }
482 pr_debug("irq: -> using host @%p\n", host);
483
484 /* Check if mapping already exist, if it does, call
485 * host->ops->map() to update the flags
486 */
487 virq = irq_find_mapping(host, hwirq);
488 if (virq != IRQ_NONE) {
489 pr_debug("irq: -> existing mapping on virq %d\n", virq);
490 host->ops->map(host, virq, hwirq, flags);
491 return virq;
492 }
493
494 /* Get a virtual interrupt number */
495 if (host->revmap_type == IRQ_HOST_MAP_LEGACY) {
496 /* Handle legacy */
497 virq = (unsigned int)hwirq;
498 if (virq == 0 || virq >= NUM_ISA_INTERRUPTS)
499 return NO_IRQ;
500 return virq;
501 } else {
502 /* Allocate a virtual interrupt number */
503 hint = hwirq % irq_virq_count;
504 virq = irq_alloc_virt(host, 1, hint);
505 if (virq == NO_IRQ) {
506 pr_debug("irq: -> virq allocation failed\n");
507 return NO_IRQ;
508 }
509 }
510 pr_debug("irq: -> obtained virq %d\n", virq);
511
512 /* Clear some flags */
513 get_irq_desc(virq)->status &= ~(IRQ_NOREQUEST | IRQ_LEVEL);
514
515 /* map it */
516 if (host->ops->map(host, virq, hwirq, flags)) {
517 pr_debug("irq: -> mapping failed, freeing\n");
518 irq_free_virt(virq, 1);
519 return NO_IRQ;
520 }
521 smp_wmb();
522 irq_map[virq].hwirq = hwirq;
523 smp_mb();
524 return virq;
525}
526EXPORT_SYMBOL_GPL(irq_create_mapping);
527
528extern unsigned int irq_create_of_mapping(struct device_node *controller,
529 u32 *intspec, unsigned int intsize)
530{
531 struct irq_host *host;
532 irq_hw_number_t hwirq;
533 unsigned int flags = IRQ_TYPE_NONE;
534
535 if (controller == NULL)
536 host = irq_default_host;
537 else
538 host = irq_find_host(controller);
539 if (host == NULL)
540 return NO_IRQ;
541
542 /* If host has no translation, then we assume interrupt line */
543 if (host->ops->xlate == NULL)
544 hwirq = intspec[0];
545 else {
546 if (host->ops->xlate(host, controller, intspec, intsize,
547 &hwirq, &flags))
548 return NO_IRQ;
549 }
550
551 return irq_create_mapping(host, hwirq, flags);
552}
553EXPORT_SYMBOL_GPL(irq_create_of_mapping);
554
555unsigned int irq_of_parse_and_map(struct device_node *dev, int index)
556{
557 struct of_irq oirq;
558
559 if (of_irq_map_one(dev, index, &oirq))
560 return NO_IRQ;
561
562 return irq_create_of_mapping(oirq.controller, oirq.specifier,
563 oirq.size);
564}
565EXPORT_SYMBOL_GPL(irq_of_parse_and_map);
566
567void irq_dispose_mapping(unsigned int virq)
568{
569 struct irq_host *host = irq_map[virq].host;
570 irq_hw_number_t hwirq;
571 unsigned long flags;
572
573 WARN_ON (host == NULL);
574 if (host == NULL)
575 return;
576
577 /* Never unmap legacy interrupts */
578 if (host->revmap_type == IRQ_HOST_MAP_LEGACY)
579 return;
580
581 /* remove chip and handler */
582 set_irq_chip_and_handler(virq, NULL, NULL);
583
584 /* Make sure it's completed */
585 synchronize_irq(virq);
586
587 /* Tell the PIC about it */
588 if (host->ops->unmap)
589 host->ops->unmap(host, virq);
590 smp_mb();
591
592 /* Clear reverse map */
593 hwirq = irq_map[virq].hwirq;
594 switch(host->revmap_type) {
595 case IRQ_HOST_MAP_LINEAR:
596 if (hwirq < host->revmap_data.linear.size)
597 host->revmap_data.linear.revmap[hwirq] = IRQ_NONE;
598 break;
599 case IRQ_HOST_MAP_TREE:
600 /* Check if radix tree allocated yet */
601 if (host->revmap_data.tree.gfp_mask == 0)
602 break;
603 /* XXX radix tree not safe ! remove lock whem it becomes safe
604 * and use some RCU sync to make sure everything is ok before we
605 * can re-use that map entry
606 */
607 spin_lock_irqsave(&irq_big_lock, flags);
608 radix_tree_delete(&host->revmap_data.tree, hwirq);
609 spin_unlock_irqrestore(&irq_big_lock, flags);
610 break;
611 }
612
613 /* Destroy map */
614 smp_mb();
615 irq_map[virq].hwirq = host->inval_irq;
616
617 /* Set some flags */
618 get_irq_desc(virq)->status |= IRQ_NOREQUEST;
619
620 /* Free it */
621 irq_free_virt(virq, 1);
622}
623EXPORT_SYMBOL_GPL(irq_dispose_mapping);
624
625unsigned int irq_find_mapping(struct irq_host *host,
626 irq_hw_number_t hwirq)
627{
628 unsigned int i;
629 unsigned int hint = hwirq % irq_virq_count;
630
631 /* Look for default host if nececssary */
632 if (host == NULL)
633 host = irq_default_host;
634 if (host == NULL)
635 return NO_IRQ;
636
637 /* legacy -> bail early */
638 if (host->revmap_type == IRQ_HOST_MAP_LEGACY)
639 return hwirq;
640
641 /* Slow path does a linear search of the map */
642 if (hint < NUM_ISA_INTERRUPTS)
643 hint = NUM_ISA_INTERRUPTS;
644 i = hint;
645 do {
646 if (irq_map[i].host == host &&
647 irq_map[i].hwirq == hwirq)
648 return i;
649 i++;
650 if (i >= irq_virq_count)
651 i = NUM_ISA_INTERRUPTS;
652 } while(i != hint);
653 return NO_IRQ;
654}
655EXPORT_SYMBOL_GPL(irq_find_mapping);
656
657
658unsigned int irq_radix_revmap(struct irq_host *host,
659 irq_hw_number_t hwirq)
660{
661 struct radix_tree_root *tree;
662 struct irq_map_entry *ptr;
663 unsigned int virq;
664 unsigned long flags;
665
666 WARN_ON(host->revmap_type != IRQ_HOST_MAP_TREE);
667
668 /* Check if the radix tree exist yet. We test the value of
669 * the gfp_mask for that. Sneaky but saves another int in the
670 * structure. If not, we fallback to slow mode
671 */
672 tree = &host->revmap_data.tree;
673 if (tree->gfp_mask == 0)
674 return irq_find_mapping(host, hwirq);
675
676 /* XXX Current radix trees are NOT SMP safe !!! Remove that lock
677 * when that is fixed (when Nick's patch gets in
678 */
679 spin_lock_irqsave(&irq_big_lock, flags);
680
681 /* Now try to resolve */
682 ptr = radix_tree_lookup(tree, hwirq);
683 /* Found it, return */
684 if (ptr) {
685 virq = ptr - irq_map;
686 goto bail;
687 }
688
689 /* If not there, try to insert it */
690 virq = irq_find_mapping(host, hwirq);
691 if (virq != NO_IRQ)
692 radix_tree_insert(tree, virq, &irq_map[virq]);
693 bail:
694 spin_unlock_irqrestore(&irq_big_lock, flags);
695 return virq;
696}
697
698unsigned int irq_linear_revmap(struct irq_host *host,
699 irq_hw_number_t hwirq)
700{
701 unsigned int *revmap;
702
703 WARN_ON(host->revmap_type != IRQ_HOST_MAP_LINEAR);
704
705 /* Check revmap bounds */
706 if (unlikely(hwirq >= host->revmap_data.linear.size))
707 return irq_find_mapping(host, hwirq);
708
709 /* Check if revmap was allocated */
710 revmap = host->revmap_data.linear.revmap;
711 if (unlikely(revmap == NULL))
712 return irq_find_mapping(host, hwirq);
713
714 /* Fill up revmap with slow path if no mapping found */
715 if (unlikely(revmap[hwirq] == NO_IRQ))
716 revmap[hwirq] = irq_find_mapping(host, hwirq);
717
718 return revmap[hwirq];
719}
720
721unsigned int irq_alloc_virt(struct irq_host *host,
722 unsigned int count,
723 unsigned int hint)
724{
725 unsigned long flags;
726 unsigned int i, j, found = NO_IRQ;
727 unsigned int limit = irq_virq_count - count;
728
729 if (count == 0 || count > (irq_virq_count - NUM_ISA_INTERRUPTS))
730 return NO_IRQ;
731
732 spin_lock_irqsave(&irq_big_lock, flags);
733
734 /* Use hint for 1 interrupt if any */
735 if (count == 1 && hint >= NUM_ISA_INTERRUPTS &&
736 hint < irq_virq_count && irq_map[hint].host == NULL) {
737 found = hint;
738 goto hint_found;
739 }
740
741 /* Look for count consecutive numbers in the allocatable
742 * (non-legacy) space
743 */
744 for (i = NUM_ISA_INTERRUPTS; i <= limit; ) {
745 for (j = i; j < (i + count); j++)
746 if (irq_map[j].host != NULL) {
747 i = j + 1;
748 continue;
749 }
750 found = i;
751 break;
752 }
753 if (found == NO_IRQ) {
754 spin_unlock_irqrestore(&irq_big_lock, flags);
755 return NO_IRQ;
756 }
757 hint_found:
758 for (i = found; i < (found + count); i++) {
759 irq_map[i].hwirq = host->inval_irq;
760 smp_wmb();
761 irq_map[i].host = host;
762 }
763 spin_unlock_irqrestore(&irq_big_lock, flags);
764 return found;
765}
766
767void irq_free_virt(unsigned int virq, unsigned int count)
768{
769 unsigned long flags;
770 unsigned int i;
771
772 WARN_ON (virq < NUM_ISA_INTERRUPTS);
773 WARN_ON (count == 0 || (virq + count) > irq_virq_count);
774
775 spin_lock_irqsave(&irq_big_lock, flags);
776 for (i = virq; i < (virq + count); i++) {
777 struct irq_host *host;
778
779 if (i < NUM_ISA_INTERRUPTS ||
780 (virq + count) > irq_virq_count)
781 continue;
782
783 host = irq_map[i].host;
784 irq_map[i].hwirq = host->inval_irq;
785 smp_wmb();
786 irq_map[i].host = NULL;
787 }
788 spin_unlock_irqrestore(&irq_big_lock, flags);
789}
790
791void irq_early_init(void)
792{
793 unsigned int i;
794
795 for (i = 0; i < NR_IRQS; i++)
796 get_irq_desc(i)->status |= IRQ_NOREQUEST;
797}
798
799/* We need to create the radix trees late */
800static int irq_late_init(void)
801{
802 struct irq_host *h;
803 unsigned long flags;
804
805 spin_lock_irqsave(&irq_big_lock, flags);
806 list_for_each_entry(h, &irq_hosts, link) {
807 if (h->revmap_type == IRQ_HOST_MAP_TREE)
808 INIT_RADIX_TREE(&h->revmap_data.tree, GFP_ATOMIC);
809 }
810 spin_unlock_irqrestore(&irq_big_lock, flags);
811
812 return 0;
813}
814arch_initcall(irq_late_init);
815
816#endif /* CONFIG_PPC_MERGE */
817
440#ifdef CONFIG_PCI_MSI 818#ifdef CONFIG_PCI_MSI
441int pci_enable_msi(struct pci_dev * pdev) 819int pci_enable_msi(struct pci_dev * pdev)
442{ 820{
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
index f78866367b70..9f0898c89759 100644
--- a/arch/powerpc/kernel/kprobes.c
+++ b/arch/powerpc/kernel/kprobes.c
@@ -26,7 +26,6 @@
26 * for PPC64 26 * for PPC64
27 */ 27 */
28 28
29#include <linux/config.h>
30#include <linux/kprobes.h> 29#include <linux/kprobes.h>
31#include <linux/ptrace.h> 30#include <linux/ptrace.h>
32#include <linux/preempt.h> 31#include <linux/preempt.h>
diff --git a/arch/powerpc/kernel/l2cr_6xx.S b/arch/powerpc/kernel/l2cr_6xx.S
index d7f4e982b539..858f28ac8a06 100644
--- a/arch/powerpc/kernel/l2cr_6xx.S
+++ b/arch/powerpc/kernel/l2cr_6xx.S
@@ -40,7 +40,6 @@
40 Author: Terry Greeniaus (tgree@phys.ualberta.ca) 40 Author: Terry Greeniaus (tgree@phys.ualberta.ca)
41 Please e-mail updates to this file to me, thanks! 41 Please e-mail updates to this file to me, thanks!
42*/ 42*/
43#include <linux/config.h>
44#include <asm/processor.h> 43#include <asm/processor.h>
45#include <asm/cputable.h> 44#include <asm/cputable.h>
46#include <asm/ppc_asm.h> 45#include <asm/ppc_asm.h>
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
index 6e67b5b49ba1..7e98e778b52f 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -1,4 +1,3 @@
1#include <linux/config.h>
2#include <linux/kernel.h> 1#include <linux/kernel.h>
3#include <linux/serial.h> 2#include <linux/serial.h>
4#include <linux/serial_8250.h> 3#include <linux/serial_8250.h>
@@ -29,6 +28,7 @@ static struct legacy_serial_info {
29 struct device_node *np; 28 struct device_node *np;
30 unsigned int speed; 29 unsigned int speed;
31 unsigned int clock; 30 unsigned int clock;
31 int irq_check_parent;
32 phys_addr_t taddr; 32 phys_addr_t taddr;
33} legacy_serial_infos[MAX_LEGACY_SERIAL_PORTS]; 33} legacy_serial_infos[MAX_LEGACY_SERIAL_PORTS];
34static unsigned int legacy_serial_count; 34static unsigned int legacy_serial_count;
@@ -37,7 +37,7 @@ static int legacy_serial_console = -1;
37static int __init add_legacy_port(struct device_node *np, int want_index, 37static int __init add_legacy_port(struct device_node *np, int want_index,
38 int iotype, phys_addr_t base, 38 int iotype, phys_addr_t base,
39 phys_addr_t taddr, unsigned long irq, 39 phys_addr_t taddr, unsigned long irq,
40 upf_t flags) 40 upf_t flags, int irq_check_parent)
41{ 41{
42 u32 *clk, *spd, clock = BASE_BAUD * 16; 42 u32 *clk, *spd, clock = BASE_BAUD * 16;
43 int index; 43 int index;
@@ -69,7 +69,7 @@ static int __init add_legacy_port(struct device_node *np, int want_index,
69 if (legacy_serial_infos[index].np != 0) { 69 if (legacy_serial_infos[index].np != 0) {
70 /* if we still have some room, move it, else override */ 70 /* if we still have some room, move it, else override */
71 if (legacy_serial_count < MAX_LEGACY_SERIAL_PORTS) { 71 if (legacy_serial_count < MAX_LEGACY_SERIAL_PORTS) {
72 printk(KERN_INFO "Moved legacy port %d -> %d\n", 72 printk(KERN_DEBUG "Moved legacy port %d -> %d\n",
73 index, legacy_serial_count); 73 index, legacy_serial_count);
74 legacy_serial_ports[legacy_serial_count] = 74 legacy_serial_ports[legacy_serial_count] =
75 legacy_serial_ports[index]; 75 legacy_serial_ports[index];
@@ -77,7 +77,7 @@ static int __init add_legacy_port(struct device_node *np, int want_index,
77 legacy_serial_infos[index]; 77 legacy_serial_infos[index];
78 legacy_serial_count++; 78 legacy_serial_count++;
79 } else { 79 } else {
80 printk(KERN_INFO "Replacing legacy port %d\n", index); 80 printk(KERN_DEBUG "Replacing legacy port %d\n", index);
81 } 81 }
82 } 82 }
83 83
@@ -96,10 +96,11 @@ static int __init add_legacy_port(struct device_node *np, int want_index,
96 legacy_serial_infos[index].np = of_node_get(np); 96 legacy_serial_infos[index].np = of_node_get(np);
97 legacy_serial_infos[index].clock = clock; 97 legacy_serial_infos[index].clock = clock;
98 legacy_serial_infos[index].speed = spd ? *spd : 0; 98 legacy_serial_infos[index].speed = spd ? *spd : 0;
99 legacy_serial_infos[index].irq_check_parent = irq_check_parent;
99 100
100 printk(KERN_INFO "Found legacy serial port %d for %s\n", 101 printk(KERN_DEBUG "Found legacy serial port %d for %s\n",
101 index, np->full_name); 102 index, np->full_name);
102 printk(KERN_INFO " %s=%llx, taddr=%llx, irq=%lx, clk=%d, speed=%d\n", 103 printk(KERN_DEBUG " %s=%llx, taddr=%llx, irq=%lx, clk=%d, speed=%d\n",
103 (iotype == UPIO_PORT) ? "port" : "mem", 104 (iotype == UPIO_PORT) ? "port" : "mem",
104 (unsigned long long)base, (unsigned long long)taddr, irq, 105 (unsigned long long)base, (unsigned long long)taddr, irq,
105 legacy_serial_ports[index].uartclk, 106 legacy_serial_ports[index].uartclk,
@@ -127,11 +128,13 @@ static int __init add_legacy_soc_port(struct device_node *np,
127 return -1; 128 return -1;
128 129
129 addr = of_translate_address(soc_dev, addrp); 130 addr = of_translate_address(soc_dev, addrp);
131 if (addr == OF_BAD_ADDR)
132 return -1;
130 133
131 /* Add port, irq will be dealt with later. We passed a translated 134 /* Add port, irq will be dealt with later. We passed a translated
132 * IO port value. It will be fixed up later along with the irq 135 * IO port value. It will be fixed up later along with the irq
133 */ 136 */
134 return add_legacy_port(np, -1, UPIO_MEM, addr, addr, NO_IRQ, flags); 137 return add_legacy_port(np, -1, UPIO_MEM, addr, addr, NO_IRQ, flags, 0);
135} 138}
136 139
137static int __init add_legacy_isa_port(struct device_node *np, 140static int __init add_legacy_isa_port(struct device_node *np,
@@ -142,6 +145,8 @@ static int __init add_legacy_isa_port(struct device_node *np,
142 int index = -1; 145 int index = -1;
143 phys_addr_t taddr; 146 phys_addr_t taddr;
144 147
148 DBG(" -> add_legacy_isa_port(%s)\n", np->full_name);
149
145 /* Get the ISA port number */ 150 /* Get the ISA port number */
146 reg = (u32 *)get_property(np, "reg", NULL); 151 reg = (u32 *)get_property(np, "reg", NULL);
147 if (reg == NULL) 152 if (reg == NULL)
@@ -162,9 +167,12 @@ static int __init add_legacy_isa_port(struct device_node *np,
162 167
163 /* Translate ISA address */ 168 /* Translate ISA address */
164 taddr = of_translate_address(np, reg); 169 taddr = of_translate_address(np, reg);
170 if (taddr == OF_BAD_ADDR)
171 return -1;
165 172
166 /* Add port, irq will be dealt with later */ 173 /* Add port, irq will be dealt with later */
167 return add_legacy_port(np, index, UPIO_PORT, reg[1], taddr, NO_IRQ, UPF_BOOT_AUTOCONF); 174 return add_legacy_port(np, index, UPIO_PORT, reg[1], taddr,
175 NO_IRQ, UPF_BOOT_AUTOCONF, 0);
168 176
169} 177}
170 178
@@ -177,6 +185,8 @@ static int __init add_legacy_pci_port(struct device_node *np,
177 unsigned int flags; 185 unsigned int flags;
178 int iotype, index = -1, lindex = 0; 186 int iotype, index = -1, lindex = 0;
179 187
188 DBG(" -> add_legacy_pci_port(%s)\n", np->full_name);
189
180 /* We only support ports that have a clock frequency properly 190 /* We only support ports that have a clock frequency properly
181 * encoded in the device-tree (that is have an fcode). Anything 191 * encoded in the device-tree (that is have an fcode). Anything
182 * else can't be used that early and will be normally probed by 192 * else can't be used that early and will be normally probed by
@@ -195,6 +205,8 @@ static int __init add_legacy_pci_port(struct device_node *np,
195 /* We only support BAR 0 for now */ 205 /* We only support BAR 0 for now */
196 iotype = (flags & IORESOURCE_MEM) ? UPIO_MEM : UPIO_PORT; 206 iotype = (flags & IORESOURCE_MEM) ? UPIO_MEM : UPIO_PORT;
197 addr = of_translate_address(pci_dev, addrp); 207 addr = of_translate_address(pci_dev, addrp);
208 if (addr == OF_BAD_ADDR)
209 return -1;
198 210
199 /* Set the IO base to the same as the translated address for MMIO, 211 /* Set the IO base to the same as the translated address for MMIO,
200 * or to the domain local IO base for PIO (it will be fixed up later) 212 * or to the domain local IO base for PIO (it will be fixed up later)
@@ -232,7 +244,8 @@ static int __init add_legacy_pci_port(struct device_node *np,
232 /* Add port, irq will be dealt with later. We passed a translated 244 /* Add port, irq will be dealt with later. We passed a translated
233 * IO port value. It will be fixed up later along with the irq 245 * IO port value. It will be fixed up later along with the irq
234 */ 246 */
235 return add_legacy_port(np, index, iotype, base, addr, NO_IRQ, UPF_BOOT_AUTOCONF); 247 return add_legacy_port(np, index, iotype, base, addr, NO_IRQ,
248 UPF_BOOT_AUTOCONF, np != pci_dev);
236} 249}
237#endif 250#endif
238 251
@@ -302,6 +315,17 @@ void __init find_legacy_serial_ports(void)
302 of_node_put(isa); 315 of_node_put(isa);
303 } 316 }
304 317
318 /* First fill our array with tsi-bridge ports */
319 for (np = NULL; (np = of_find_compatible_node(np, "serial", "ns16550")) != NULL;) {
320 struct device_node *tsi = of_get_parent(np);
321 if (tsi && !strcmp(tsi->type, "tsi-bridge")) {
322 index = add_legacy_soc_port(np, np);
323 if (index >= 0 && np == stdout)
324 legacy_serial_console = index;
325 }
326 of_node_put(tsi);
327 }
328
305#ifdef CONFIG_PCI 329#ifdef CONFIG_PCI
306 /* Next, try to locate PCI ports */ 330 /* Next, try to locate PCI ports */
307 for (np = NULL; (np = of_find_all_nodes(np));) { 331 for (np = NULL; (np = of_find_all_nodes(np));) {
@@ -352,27 +376,22 @@ static void __init fixup_port_irq(int index,
352 struct device_node *np, 376 struct device_node *np,
353 struct plat_serial8250_port *port) 377 struct plat_serial8250_port *port)
354{ 378{
379 unsigned int virq;
380
355 DBG("fixup_port_irq(%d)\n", index); 381 DBG("fixup_port_irq(%d)\n", index);
356 382
357 /* Check for interrupts in that node */ 383 virq = irq_of_parse_and_map(np, 0);
358 if (np->n_intrs > 0) { 384 if (virq == NO_IRQ && legacy_serial_infos[index].irq_check_parent) {
359 port->irq = np->intrs[0].line; 385 np = of_get_parent(np);
360 DBG(" port %d (%s), irq=%d\n", 386 if (np == NULL)
361 index, np->full_name, port->irq); 387 return;
362 return; 388 virq = irq_of_parse_and_map(np, 0);
389 of_node_put(np);
363 } 390 }
364 391 if (virq == NO_IRQ)
365 /* Check for interrupts in the parent */
366 np = of_get_parent(np);
367 if (np == NULL)
368 return; 392 return;
369 393
370 if (np->n_intrs > 0) { 394 port->irq = virq;
371 port->irq = np->intrs[0].line;
372 DBG(" port %d (%s), irq=%d\n",
373 index, np->full_name, port->irq);
374 }
375 of_node_put(np);
376} 395}
377 396
378static void __init fixup_port_pio(int index, 397static void __init fixup_port_pio(int index,
diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c
index c02deaab26c7..23f34daa044a 100644
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -18,7 +18,6 @@
18 * keyword - value pairs that specify the configuration of the partition. 18 * keyword - value pairs that specify the configuration of the partition.
19 */ 19 */
20 20
21#include <linux/config.h>
22#include <linux/module.h> 21#include <linux/module.h>
23#include <linux/types.h> 22#include <linux/types.h>
24#include <linux/errno.h> 23#include <linux/errno.h>
@@ -45,11 +44,9 @@
45static struct proc_dir_entry *proc_ppc64_lparcfg; 44static struct proc_dir_entry *proc_ppc64_lparcfg;
46#define LPARCFG_BUFF_SIZE 4096 45#define LPARCFG_BUFF_SIZE 4096
47 46
48#ifdef CONFIG_PPC_ISERIES
49
50/* 47/*
51 * For iSeries legacy systems, the PPA purr function is available from the 48 * Track sum of all purrs across all processors. This is used to further
52 * emulated_time_base field in the paca. 49 * calculate usage values by different applications
53 */ 50 */
54static unsigned long get_purr(void) 51static unsigned long get_purr(void)
55{ 52{
@@ -57,48 +54,31 @@ static unsigned long get_purr(void)
57 int cpu; 54 int cpu;
58 55
59 for_each_possible_cpu(cpu) { 56 for_each_possible_cpu(cpu) {
60 sum_purr += lppaca[cpu].emulated_time_base; 57 if (firmware_has_feature(FW_FEATURE_ISERIES))
58 sum_purr += lppaca[cpu].emulated_time_base;
59 else {
60 struct cpu_usage *cu;
61 61
62#ifdef PURR_DEBUG 62 cu = &per_cpu(cpu_usage_array, cpu);
63 printk(KERN_INFO "get_purr for cpu (%d) has value (%ld) \n", 63 sum_purr += cu->current_tb;
64 cpu, lppaca[cpu].emulated_time_base); 64 }
65#endif
66 } 65 }
67 return sum_purr; 66 return sum_purr;
68} 67}
69 68
70#define lparcfg_write NULL 69#ifdef CONFIG_PPC_ISERIES
71 70
72/* 71/*
73 * Methods used to fetch LPAR data when running on an iSeries platform. 72 * Methods used to fetch LPAR data when running on an iSeries platform.
74 */ 73 */
75static int lparcfg_data(struct seq_file *m, void *v) 74static int iseries_lparcfg_data(struct seq_file *m, void *v)
76{ 75{
77 unsigned long pool_id, lp_index; 76 unsigned long pool_id;
78 int shared, entitled_capacity, max_entitled_capacity; 77 int shared, entitled_capacity, max_entitled_capacity;
79 int processors, max_processors; 78 int processors, max_processors;
80 unsigned long purr = get_purr(); 79 unsigned long purr = get_purr();
81 80
82 seq_printf(m, "%s %s \n", MODULE_NAME, MODULE_VERS);
83
84 shared = (int)(get_lppaca()->shared_proc); 81 shared = (int)(get_lppaca()->shared_proc);
85 seq_printf(m, "serial_number=%c%c%c%c%c%c%c\n",
86 e2a(xItExtVpdPanel.mfgID[2]),
87 e2a(xItExtVpdPanel.mfgID[3]),
88 e2a(xItExtVpdPanel.systemSerial[1]),
89 e2a(xItExtVpdPanel.systemSerial[2]),
90 e2a(xItExtVpdPanel.systemSerial[3]),
91 e2a(xItExtVpdPanel.systemSerial[4]),
92 e2a(xItExtVpdPanel.systemSerial[5]));
93
94 seq_printf(m, "system_type=%c%c%c%c\n",
95 e2a(xItExtVpdPanel.machineType[0]),
96 e2a(xItExtVpdPanel.machineType[1]),
97 e2a(xItExtVpdPanel.machineType[2]),
98 e2a(xItExtVpdPanel.machineType[3]));
99
100 lp_index = HvLpConfig_getLpIndex();
101 seq_printf(m, "partition_id=%d\n", (int)lp_index);
102 82
103 seq_printf(m, "system_active_processors=%d\n", 83 seq_printf(m, "system_active_processors=%d\n",
104 (int)HvLpConfig_getSystemPhysicalProcessors()); 84 (int)HvLpConfig_getSystemPhysicalProcessors());
@@ -137,6 +117,14 @@ static int lparcfg_data(struct seq_file *m, void *v)
137 117
138 return 0; 118 return 0;
139} 119}
120
121#else /* CONFIG_PPC_ISERIES */
122
123static int iseries_lparcfg_data(struct seq_file *m, void *v)
124{
125 return 0;
126}
127
140#endif /* CONFIG_PPC_ISERIES */ 128#endif /* CONFIG_PPC_ISERIES */
141 129
142#ifdef CONFIG_PPC_PSERIES 130#ifdef CONFIG_PPC_PSERIES
@@ -213,22 +201,6 @@ static void h_pic(unsigned long *pool_idle_time, unsigned long *num_procs)
213 log_plpar_hcall_return(rc, "H_PIC"); 201 log_plpar_hcall_return(rc, "H_PIC");
214} 202}
215 203
216/* Track sum of all purrs across all processors. This is used to further */
217/* calculate usage values by different applications */
218
219static unsigned long get_purr(void)
220{
221 unsigned long sum_purr = 0;
222 int cpu;
223 struct cpu_usage *cu;
224
225 for_each_possible_cpu(cpu) {
226 cu = &per_cpu(cpu_usage_array, cpu);
227 sum_purr += cu->current_tb;
228 }
229 return sum_purr;
230}
231
232#define SPLPAR_CHARACTERISTICS_TOKEN 20 204#define SPLPAR_CHARACTERISTICS_TOKEN 20
233#define SPLPAR_MAXLENGTH 1026*(sizeof(char)) 205#define SPLPAR_MAXLENGTH 1026*(sizeof(char))
234 206
@@ -333,35 +305,13 @@ static int lparcfg_count_active_processors(void)
333 return count; 305 return count;
334} 306}
335 307
336static int lparcfg_data(struct seq_file *m, void *v) 308static int pseries_lparcfg_data(struct seq_file *m, void *v)
337{ 309{
338 int partition_potential_processors; 310 int partition_potential_processors;
339 int partition_active_processors; 311 int partition_active_processors;
340 struct device_node *rootdn;
341 const char *model = "";
342 const char *system_id = "";
343 unsigned int *lp_index_ptr, lp_index = 0;
344 struct device_node *rtas_node; 312 struct device_node *rtas_node;
345 int *lrdrp = NULL; 313 int *lrdrp = NULL;
346 314
347 rootdn = find_path_device("/");
348 if (rootdn) {
349 model = get_property(rootdn, "model", NULL);
350 system_id = get_property(rootdn, "system-id", NULL);
351 lp_index_ptr = (unsigned int *)
352 get_property(rootdn, "ibm,partition-no", NULL);
353 if (lp_index_ptr)
354 lp_index = *lp_index_ptr;
355 }
356
357 seq_printf(m, "%s %s \n", MODULE_NAME, MODULE_VERS);
358
359 seq_printf(m, "serial_number=%s\n", system_id);
360
361 seq_printf(m, "system_type=%s\n", model);
362
363 seq_printf(m, "partition_id=%d\n", (int)lp_index);
364
365 rtas_node = find_path_device("/rtas"); 315 rtas_node = find_path_device("/rtas");
366 if (rtas_node) 316 if (rtas_node)
367 lrdrp = (int *)get_property(rtas_node, "ibm,lrdr-capacity", 317 lrdrp = (int *)get_property(rtas_node, "ibm,lrdr-capacity",
@@ -549,8 +499,61 @@ out:
549 return retval; 499 return retval;
550} 500}
551 501
502#else /* CONFIG_PPC_PSERIES */
503
504static int pseries_lparcfg_data(struct seq_file *m, void *v)
505{
506 return 0;
507}
508
509static ssize_t lparcfg_write(struct file *file, const char __user * buf,
510 size_t count, loff_t * off)
511{
512 return count;
513}
514
552#endif /* CONFIG_PPC_PSERIES */ 515#endif /* CONFIG_PPC_PSERIES */
553 516
517static int lparcfg_data(struct seq_file *m, void *v)
518{
519 struct device_node *rootdn;
520 const char *model = "";
521 const char *system_id = "";
522 const char *tmp;
523 unsigned int *lp_index_ptr, lp_index = 0;
524
525 seq_printf(m, "%s %s \n", MODULE_NAME, MODULE_VERS);
526
527 rootdn = find_path_device("/");
528 if (rootdn) {
529 tmp = get_property(rootdn, "model", NULL);
530 if (tmp) {
531 model = tmp;
532 /* Skip "IBM," - see platforms/iseries/dt.c */
533 if (firmware_has_feature(FW_FEATURE_ISERIES))
534 model += 4;
535 }
536 tmp = get_property(rootdn, "system-id", NULL);
537 if (tmp) {
538 system_id = tmp;
539 /* Skip "IBM," - see platforms/iseries/dt.c */
540 if (firmware_has_feature(FW_FEATURE_ISERIES))
541 system_id += 4;
542 }
543 lp_index_ptr = (unsigned int *)
544 get_property(rootdn, "ibm,partition-no", NULL);
545 if (lp_index_ptr)
546 lp_index = *lp_index_ptr;
547 }
548 seq_printf(m, "serial_number=%s\n", system_id);
549 seq_printf(m, "system_type=%s\n", model);
550 seq_printf(m, "partition_id=%d\n", (int)lp_index);
551
552 if (firmware_has_feature(FW_FEATURE_ISERIES))
553 return iseries_lparcfg_data(m, v);
554 return pseries_lparcfg_data(m, v);
555}
556
554static int lparcfg_open(struct inode *inode, struct file *file) 557static int lparcfg_open(struct inode *inode, struct file *file)
555{ 558{
556 return single_open(file, lparcfg_data, NULL); 559 return single_open(file, lparcfg_data, NULL);
@@ -569,7 +572,8 @@ int __init lparcfg_init(void)
569 mode_t mode = S_IRUSR | S_IRGRP | S_IROTH; 572 mode_t mode = S_IRUSR | S_IRGRP | S_IROTH;
570 573
571 /* Allow writing if we have FW_FEATURE_SPLPAR */ 574 /* Allow writing if we have FW_FEATURE_SPLPAR */
572 if (firmware_has_feature(FW_FEATURE_SPLPAR)) { 575 if (firmware_has_feature(FW_FEATURE_SPLPAR) &&
576 !firmware_has_feature(FW_FEATURE_ISERIES)) {
573 lparcfg_fops.write = lparcfg_write; 577 lparcfg_fops.write = lparcfg_write;
574 mode |= S_IWUSR; 578 mode |= S_IWUSR;
575 } 579 }
diff --git a/arch/powerpc/kernel/machine_kexec_32.c b/arch/powerpc/kernel/machine_kexec_32.c
index 443606134dff..cbaa34196797 100644
--- a/arch/powerpc/kernel/machine_kexec_32.c
+++ b/arch/powerpc/kernel/machine_kexec_32.c
@@ -30,8 +30,8 @@ typedef NORET_TYPE void (*relocate_new_kernel_t)(
30 */ 30 */
31void default_machine_kexec(struct kimage *image) 31void default_machine_kexec(struct kimage *image)
32{ 32{
33 const extern unsigned char relocate_new_kernel[]; 33 extern const unsigned char relocate_new_kernel[];
34 const extern unsigned int relocate_new_kernel_size; 34 extern const unsigned int relocate_new_kernel_size;
35 unsigned long page_list; 35 unsigned long page_list;
36 unsigned long reboot_code_buffer, reboot_code_buffer_phys; 36 unsigned long reboot_code_buffer, reboot_code_buffer_phys;
37 relocate_new_kernel_t rnk; 37 relocate_new_kernel_t rnk;
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
index a8fa04ef27cd..b438d45a068c 100644
--- a/arch/powerpc/kernel/machine_kexec_64.c
+++ b/arch/powerpc/kernel/machine_kexec_64.c
@@ -378,11 +378,13 @@ static void __init export_crashk_values(void)
378 of_node_put(node); 378 of_node_put(node);
379} 379}
380 380
381void __init kexec_setup(void) 381static int __init kexec_setup(void)
382{ 382{
383 export_htab_values(); 383 export_htab_values();
384 export_crashk_values(); 384 export_crashk_values();
385 return 0;
385} 386}
387__initcall(kexec_setup);
386 388
387static int __init early_parse_crashk(char *p) 389static int __init early_parse_crashk(char *p)
388{ 390{
diff --git a/arch/powerpc/kernel/misc.S b/arch/powerpc/kernel/misc.S
new file mode 100644
index 000000000000..fc23040d5a26
--- /dev/null
+++ b/arch/powerpc/kernel/misc.S
@@ -0,0 +1,203 @@
1/*
2 * This file contains miscellaneous low-level functions.
3 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
4 *
5 * Largely rewritten by Cort Dougan (cort@cs.nmt.edu)
6 * and Paul Mackerras.
7 *
8 * Adapted for iSeries by Mike Corrigan (mikejc@us.ibm.com)
9 * PPC64 updates by Dave Engebretsen (engebret@us.ibm.com)
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version
14 * 2 of the License, or (at your option) any later version.
15 */
16#include <asm/ppc_asm.h>
17
18 .text
19
20#ifdef CONFIG_PPC64
21#define IN_SYNC twi 0,r5,0; isync
22#define EIEIO_32
23#define SYNC_64 sync
24#else /* CONFIG_PPC32 */
25#define IN_SYNC
26#define EIEIO_32 eieio
27#define SYNC_64
28#endif
29/*
30 * Returns (address we are running at) - (address we were linked at)
31 * for use before the text and data are mapped to KERNELBASE.
32 */
33
34_GLOBAL(reloc_offset)
35 mflr r0
36 bl 1f
371: mflr r3
38 LOAD_REG_IMMEDIATE(r4,1b)
39 subf r3,r4,r3
40 mtlr r0
41 blr
42
43/*
44 * add_reloc_offset(x) returns x + reloc_offset().
45 */
46_GLOBAL(add_reloc_offset)
47 mflr r0
48 bl 1f
491: mflr r5
50 LOAD_REG_IMMEDIATE(r4,1b)
51 subf r5,r4,r5
52 add r3,r3,r5
53 mtlr r0
54 blr
55
56/*
57 * I/O string operations
58 *
59 * insb(port, buf, len)
60 * outsb(port, buf, len)
61 * insw(port, buf, len)
62 * outsw(port, buf, len)
63 * insl(port, buf, len)
64 * outsl(port, buf, len)
65 * insw_ns(port, buf, len)
66 * outsw_ns(port, buf, len)
67 * insl_ns(port, buf, len)
68 * outsl_ns(port, buf, len)
69 *
70 * The *_ns versions don't do byte-swapping.
71 */
72_GLOBAL(_insb)
73 cmpwi 0,r5,0
74 mtctr r5
75 subi r4,r4,1
76 blelr-
7700: lbz r5,0(r3)
78 eieio
79 stbu r5,1(r4)
80 bdnz 00b
81 IN_SYNC
82 blr
83
84_GLOBAL(_outsb)
85 cmpwi 0,r5,0
86 mtctr r5
87 subi r4,r4,1
88 blelr-
8900: lbzu r5,1(r4)
90 stb r5,0(r3)
91 EIEIO_32
92 bdnz 00b
93 SYNC_64
94 blr
95
96_GLOBAL(_insw)
97 cmpwi 0,r5,0
98 mtctr r5
99 subi r4,r4,2
100 blelr-
10100: lhbrx r5,0,r3
102 eieio
103 sthu r5,2(r4)
104 bdnz 00b
105 IN_SYNC
106 blr
107
108_GLOBAL(_outsw)
109 cmpwi 0,r5,0
110 mtctr r5
111 subi r4,r4,2
112 blelr-
11300: lhzu r5,2(r4)
114 EIEIO_32
115 sthbrx r5,0,r3
116 bdnz 00b
117 SYNC_64
118 blr
119
120_GLOBAL(_insl)
121 cmpwi 0,r5,0
122 mtctr r5
123 subi r4,r4,4
124 blelr-
12500: lwbrx r5,0,r3
126 eieio
127 stwu r5,4(r4)
128 bdnz 00b
129 IN_SYNC
130 blr
131
132_GLOBAL(_outsl)
133 cmpwi 0,r5,0
134 mtctr r5
135 subi r4,r4,4
136 blelr-
13700: lwzu r5,4(r4)
138 stwbrx r5,0,r3
139 EIEIO_32
140 bdnz 00b
141 SYNC_64
142 blr
143
144#ifdef CONFIG_PPC32
145_GLOBAL(__ide_mm_insw)
146#endif
147_GLOBAL(_insw_ns)
148 cmpwi 0,r5,0
149 mtctr r5
150 subi r4,r4,2
151 blelr-
15200: lhz r5,0(r3)
153 eieio
154 sthu r5,2(r4)
155 bdnz 00b
156 IN_SYNC
157 blr
158
159#ifdef CONFIG_PPC32
160_GLOBAL(__ide_mm_outsw)
161#endif
162_GLOBAL(_outsw_ns)
163 cmpwi 0,r5,0
164 mtctr r5
165 subi r4,r4,2
166 blelr-
16700: lhzu r5,2(r4)
168 sth r5,0(r3)
169 EIEIO_32
170 bdnz 00b
171 SYNC_64
172 blr
173
174#ifdef CONFIG_PPC32
175_GLOBAL(__ide_mm_insl)
176#endif
177_GLOBAL(_insl_ns)
178 cmpwi 0,r5,0
179 mtctr r5
180 subi r4,r4,4
181 blelr-
18200: lwz r5,0(r3)
183 eieio
184 stwu r5,4(r4)
185 bdnz 00b
186 IN_SYNC
187 blr
188
189#ifdef CONFIG_PPC32
190_GLOBAL(__ide_mm_outsl)
191#endif
192_GLOBAL(_outsl_ns)
193 cmpwi 0,r5,0
194 mtctr r5
195 subi r4,r4,4
196 blelr-
19700: lwzu r5,4(r4)
198 stw r5,0(r3)
199 EIEIO_32
200 bdnz 00b
201 SYNC_64
202 blr
203
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index 01d3916c4cb1..58758d883361 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -16,7 +16,6 @@
16 * 16 *
17 */ 17 */
18 18
19#include <linux/config.h>
20#include <linux/sys.h> 19#include <linux/sys.h>
21#include <asm/unistd.h> 20#include <asm/unistd.h>
22#include <asm/errno.h> 21#include <asm/errno.h>
@@ -61,32 +60,6 @@ _GLOBAL(mulhdu)
61 blr 60 blr
62 61
63/* 62/*
64 * Returns (address we're running at) - (address we were linked at)
65 * for use before the text and data are mapped to KERNELBASE.
66 */
67_GLOBAL(reloc_offset)
68 mflr r0
69 bl 1f
701: mflr r3
71 LOAD_REG_IMMEDIATE(r4,1b)
72 subf r3,r4,r3
73 mtlr r0
74 blr
75
76/*
77 * add_reloc_offset(x) returns x + reloc_offset().
78 */
79_GLOBAL(add_reloc_offset)
80 mflr r0
81 bl 1f
821: mflr r5
83 LOAD_REG_IMMEDIATE(r4,1b)
84 subf r5,r4,r5
85 add r3,r3,r5
86 mtlr r0
87 blr
88
89/*
90 * sub_reloc_offset(x) returns x - reloc_offset(). 63 * sub_reloc_offset(x) returns x - reloc_offset().
91 */ 64 */
92_GLOBAL(sub_reloc_offset) 65_GLOBAL(sub_reloc_offset)
@@ -781,136 +754,6 @@ _GLOBAL(atomic_set_mask)
781 blr 754 blr
782 755
783/* 756/*
784 * I/O string operations
785 *
786 * insb(port, buf, len)
787 * outsb(port, buf, len)
788 * insw(port, buf, len)
789 * outsw(port, buf, len)
790 * insl(port, buf, len)
791 * outsl(port, buf, len)
792 * insw_ns(port, buf, len)
793 * outsw_ns(port, buf, len)
794 * insl_ns(port, buf, len)
795 * outsl_ns(port, buf, len)
796 *
797 * The *_ns versions don't do byte-swapping.
798 */
799_GLOBAL(_insb)
800 cmpwi 0,r5,0
801 mtctr r5
802 subi r4,r4,1
803 blelr-
80400: lbz r5,0(r3)
805 eieio
806 stbu r5,1(r4)
807 bdnz 00b
808 blr
809
810_GLOBAL(_outsb)
811 cmpwi 0,r5,0
812 mtctr r5
813 subi r4,r4,1
814 blelr-
81500: lbzu r5,1(r4)
816 stb r5,0(r3)
817 eieio
818 bdnz 00b
819 blr
820
821_GLOBAL(_insw)
822 cmpwi 0,r5,0
823 mtctr r5
824 subi r4,r4,2
825 blelr-
82600: lhbrx r5,0,r3
827 eieio
828 sthu r5,2(r4)
829 bdnz 00b
830 blr
831
832_GLOBAL(_outsw)
833 cmpwi 0,r5,0
834 mtctr r5
835 subi r4,r4,2
836 blelr-
83700: lhzu r5,2(r4)
838 eieio
839 sthbrx r5,0,r3
840 bdnz 00b
841 blr
842
843_GLOBAL(_insl)
844 cmpwi 0,r5,0
845 mtctr r5
846 subi r4,r4,4
847 blelr-
84800: lwbrx r5,0,r3
849 eieio
850 stwu r5,4(r4)
851 bdnz 00b
852 blr
853
854_GLOBAL(_outsl)
855 cmpwi 0,r5,0
856 mtctr r5
857 subi r4,r4,4
858 blelr-
85900: lwzu r5,4(r4)
860 stwbrx r5,0,r3
861 eieio
862 bdnz 00b
863 blr
864
865_GLOBAL(__ide_mm_insw)
866_GLOBAL(_insw_ns)
867 cmpwi 0,r5,0
868 mtctr r5
869 subi r4,r4,2
870 blelr-
87100: lhz r5,0(r3)
872 eieio
873 sthu r5,2(r4)
874 bdnz 00b
875 blr
876
877_GLOBAL(__ide_mm_outsw)
878_GLOBAL(_outsw_ns)
879 cmpwi 0,r5,0
880 mtctr r5
881 subi r4,r4,2
882 blelr-
88300: lhzu r5,2(r4)
884 sth r5,0(r3)
885 eieio
886 bdnz 00b
887 blr
888
889_GLOBAL(__ide_mm_insl)
890_GLOBAL(_insl_ns)
891 cmpwi 0,r5,0
892 mtctr r5
893 subi r4,r4,4
894 blelr-
89500: lwz r5,0(r3)
896 eieio
897 stwu r5,4(r4)
898 bdnz 00b
899 blr
900
901_GLOBAL(__ide_mm_outsl)
902_GLOBAL(_outsl_ns)
903 cmpwi 0,r5,0
904 mtctr r5
905 subi r4,r4,4
906 blelr-
90700: lwzu r5,4(r4)
908 stw r5,0(r3)
909 eieio
910 bdnz 00b
911 blr
912
913/*
914 * Extended precision shifts. 757 * Extended precision shifts.
915 * 758 *
916 * Updated to be valid for shift counts from 0 to 63 inclusive. 759 * Updated to be valid for shift counts from 0 to 63 inclusive.
diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
index e8883d42c43c..bfb407fc1aa1 100644
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -1,14 +1,12 @@
1/* 1/*
2 * arch/powerpc/kernel/misc64.S
3 *
4 * This file contains miscellaneous low-level functions. 2 * This file contains miscellaneous low-level functions.
5 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) 3 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
6 * 4 *
7 * Largely rewritten by Cort Dougan (cort@cs.nmt.edu) 5 * Largely rewritten by Cort Dougan (cort@cs.nmt.edu)
8 * and Paul Mackerras. 6 * and Paul Mackerras.
9 * Adapted for iSeries by Mike Corrigan (mikejc@us.ibm.com) 7 * Adapted for iSeries by Mike Corrigan (mikejc@us.ibm.com)
10 * PPC64 updates by Dave Engebretsen (engebret@us.ibm.com) 8 * PPC64 updates by Dave Engebretsen (engebret@us.ibm.com)
11 * 9 *
12 * This program is free software; you can redistribute it and/or 10 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License 11 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 12 * as published by the Free Software Foundation; either version
@@ -16,7 +14,6 @@
16 * 14 *
17 */ 15 */
18 16
19#include <linux/config.h>
20#include <linux/sys.h> 17#include <linux/sys.h>
21#include <asm/unistd.h> 18#include <asm/unistd.h>
22#include <asm/errno.h> 19#include <asm/errno.h>
@@ -30,41 +27,10 @@
30 27
31 .text 28 .text
32 29
33/*
34 * Returns (address we are running at) - (address we were linked at)
35 * for use before the text and data are mapped to KERNELBASE.
36 */
37
38_GLOBAL(reloc_offset)
39 mflr r0
40 bl 1f
411: mflr r3
42 LOAD_REG_IMMEDIATE(r4,1b)
43 subf r3,r4,r3
44 mtlr r0
45 blr
46
47/*
48 * add_reloc_offset(x) returns x + reloc_offset().
49 */
50_GLOBAL(add_reloc_offset)
51 mflr r0
52 bl 1f
531: mflr r5
54 LOAD_REG_IMMEDIATE(r4,1b)
55 subf r5,r4,r5
56 add r3,r3,r5
57 mtlr r0
58 blr
59
60_GLOBAL(get_msr) 30_GLOBAL(get_msr)
61 mfmsr r3 31 mfmsr r3
62 blr 32 blr
63 33
64_GLOBAL(get_dar)
65 mfdar r3
66 blr
67
68_GLOBAL(get_srr0) 34_GLOBAL(get_srr0)
69 mfsrr0 r3 35 mfsrr0 r3
70 blr 36 blr
@@ -72,10 +38,6 @@ _GLOBAL(get_srr0)
72_GLOBAL(get_srr1) 38_GLOBAL(get_srr1)
73 mfsrr1 r3 39 mfsrr1 r3
74 blr 40 blr
75
76_GLOBAL(get_sp)
77 mr r3,r1
78 blr
79 41
80#ifdef CONFIG_IRQSTACKS 42#ifdef CONFIG_IRQSTACKS
81_GLOBAL(call_do_softirq) 43_GLOBAL(call_do_softirq)
@@ -89,60 +51,20 @@ _GLOBAL(call_do_softirq)
89 mtlr r0 51 mtlr r0
90 blr 52 blr
91 53
92_GLOBAL(call___do_IRQ) 54_GLOBAL(call_handle_irq)
55 ld r8,0(r7)
93 mflr r0 56 mflr r0
94 std r0,16(r1) 57 std r0,16(r1)
95 stdu r1,THREAD_SIZE-112(r5) 58 mtctr r8
96 mr r1,r5 59 stdu r1,THREAD_SIZE-112(r6)
97 bl .__do_IRQ 60 mr r1,r6
61 bctrl
98 ld r1,0(r1) 62 ld r1,0(r1)
99 ld r0,16(r1) 63 ld r0,16(r1)
100 mtlr r0 64 mtlr r0
101 blr 65 blr
102#endif /* CONFIG_IRQSTACKS */ 66#endif /* CONFIG_IRQSTACKS */
103 67
104 /*
105 * To be called by C code which needs to do some operations with MMU
106 * disabled. Note that interrupts have to be disabled by the caller
107 * prior to calling us. The code called _MUST_ be in the RMO of course
108 * and part of the linear mapping as we don't attempt to translate the
109 * stack pointer at all. The function is called with the stack switched
110 * to this CPU emergency stack
111 *
112 * prototype is void *call_with_mmu_off(void *func, void *data);
113 *
114 * the called function is expected to be of the form
115 *
116 * void *called(void *data);
117 */
118_GLOBAL(call_with_mmu_off)
119 mflr r0 /* get link, save it on stackframe */
120 std r0,16(r1)
121 mr r1,r5 /* save old stack ptr */
122 ld r1,PACAEMERGSP(r13) /* get emerg. stack */
123 subi r1,r1,STACK_FRAME_OVERHEAD
124 std r0,16(r1) /* save link on emerg. stack */
125 std r5,0(r1) /* save old stack ptr in backchain */
126 ld r3,0(r3) /* get to real function ptr (assume same TOC) */
127 bl 2f /* we need LR to return, continue at label 2 */
128
129 ld r0,16(r1) /* we return here from the call, get LR and */
130 ld r1,0(r1) /* .. old stack ptr */
131 mtspr SPRN_SRR0,r0 /* and get back to virtual mode with these */
132 mfmsr r4
133 ori r4,r4,MSR_IR|MSR_DR
134 mtspr SPRN_SRR1,r4
135 rfid
136
1372: mtspr SPRN_SRR0,r3 /* coming from above, enter real mode */
138 mr r3,r4 /* get parameter */
139 mfmsr r0
140 ori r0,r0,MSR_IR|MSR_DR
141 xori r0,r0,MSR_IR|MSR_DR
142 mtspr SPRN_SRR1,r0
143 rfid
144
145
146 .section ".toc","aw" 68 .section ".toc","aw"
147PPC64_CACHES: 69PPC64_CACHES:
148 .tc ppc64_caches[TC],ppc64_caches 70 .tc ppc64_caches[TC],ppc64_caches
@@ -323,144 +245,6 @@ _GLOBAL(__flush_dcache_icache)
323 bdnz 1b 245 bdnz 1b
324 isync 246 isync
325 blr 247 blr
326
327/*
328 * I/O string operations
329 *
330 * insb(port, buf, len)
331 * outsb(port, buf, len)
332 * insw(port, buf, len)
333 * outsw(port, buf, len)
334 * insl(port, buf, len)
335 * outsl(port, buf, len)
336 * insw_ns(port, buf, len)
337 * outsw_ns(port, buf, len)
338 * insl_ns(port, buf, len)
339 * outsl_ns(port, buf, len)
340 *
341 * The *_ns versions don't do byte-swapping.
342 */
343_GLOBAL(_insb)
344 cmpwi 0,r5,0
345 mtctr r5
346 subi r4,r4,1
347 blelr-
34800: lbz r5,0(r3)
349 eieio
350 stbu r5,1(r4)
351 bdnz 00b
352 twi 0,r5,0
353 isync
354 blr
355
356_GLOBAL(_outsb)
357 cmpwi 0,r5,0
358 mtctr r5
359 subi r4,r4,1
360 blelr-
36100: lbzu r5,1(r4)
362 stb r5,0(r3)
363 bdnz 00b
364 sync
365 blr
366
367_GLOBAL(_insw)
368 cmpwi 0,r5,0
369 mtctr r5
370 subi r4,r4,2
371 blelr-
37200: lhbrx r5,0,r3
373 eieio
374 sthu r5,2(r4)
375 bdnz 00b
376 twi 0,r5,0
377 isync
378 blr
379
380_GLOBAL(_outsw)
381 cmpwi 0,r5,0
382 mtctr r5
383 subi r4,r4,2
384 blelr-
38500: lhzu r5,2(r4)
386 sthbrx r5,0,r3
387 bdnz 00b
388 sync
389 blr
390
391_GLOBAL(_insl)
392 cmpwi 0,r5,0
393 mtctr r5
394 subi r4,r4,4
395 blelr-
39600: lwbrx r5,0,r3
397 eieio
398 stwu r5,4(r4)
399 bdnz 00b
400 twi 0,r5,0
401 isync
402 blr
403
404_GLOBAL(_outsl)
405 cmpwi 0,r5,0
406 mtctr r5
407 subi r4,r4,4
408 blelr-
40900: lwzu r5,4(r4)
410 stwbrx r5,0,r3
411 bdnz 00b
412 sync
413 blr
414
415/* _GLOBAL(ide_insw) now in drivers/ide/ide-iops.c */
416_GLOBAL(_insw_ns)
417 cmpwi 0,r5,0
418 mtctr r5
419 subi r4,r4,2
420 blelr-
42100: lhz r5,0(r3)
422 eieio
423 sthu r5,2(r4)
424 bdnz 00b
425 twi 0,r5,0
426 isync
427 blr
428
429/* _GLOBAL(ide_outsw) now in drivers/ide/ide-iops.c */
430_GLOBAL(_outsw_ns)
431 cmpwi 0,r5,0
432 mtctr r5
433 subi r4,r4,2
434 blelr-
43500: lhzu r5,2(r4)
436 sth r5,0(r3)
437 bdnz 00b
438 sync
439 blr
440
441_GLOBAL(_insl_ns)
442 cmpwi 0,r5,0
443 mtctr r5
444 subi r4,r4,4
445 blelr-
44600: lwz r5,0(r3)
447 eieio
448 stwu r5,4(r4)
449 bdnz 00b
450 twi 0,r5,0
451 isync
452 blr
453
454_GLOBAL(_outsl_ns)
455 cmpwi 0,r5,0
456 mtctr r5
457 subi r4,r4,4
458 blelr-
45900: lwzu r5,4(r4)
460 stw r5,0(r3)
461 bdnz 00b
462 sync
463 blr
464 248
465/* 249/*
466 * identify_cpu and calls setup_cpu 250 * identify_cpu and calls setup_cpu
@@ -605,6 +389,7 @@ _GLOBAL(real_writeb)
605 blr 389 blr
606#endif /* defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_MAPLE) */ 390#endif /* defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_MAPLE) */
607 391
392#ifdef CONFIG_CPU_FREQ_PMAC64
608/* 393/*
609 * SCOM access functions for 970 (FX only for now) 394 * SCOM access functions for 970 (FX only for now)
610 * 395 *
@@ -673,6 +458,7 @@ _GLOBAL(scom970_write)
673 /* restore interrupts */ 458 /* restore interrupts */
674 mtmsrd r5,1 459 mtmsrd r5,1
675 blr 460 blr
461#endif /* CONFIG_CPU_FREQ_PMAC64 */
676 462
677 463
678/* 464/*
diff --git a/arch/powerpc/kernel/of_device.c b/arch/powerpc/kernel/of_device.c
index 9feeeef5a875..3262b73a3a68 100644
--- a/arch/powerpc/kernel/of_device.c
+++ b/arch/powerpc/kernel/of_device.c
@@ -1,4 +1,3 @@
1#include <linux/config.h>
2#include <linux/string.h> 1#include <linux/string.h>
3#include <linux/kernel.h> 2#include <linux/kernel.h>
4#include <linux/init.h> 3#include <linux/init.h>
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index f505a8827e3e..c68741fed14b 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -7,7 +7,6 @@
7 * 2 of the License, or (at your option) any later version. 7 * 2 of the License, or (at your option) any later version.
8 */ 8 */
9 9
10#include <linux/config.h>
11#include <linux/types.h> 10#include <linux/types.h>
12#include <linux/threads.h> 11#include <linux/threads.h>
13#include <linux/module.h> 12#include <linux/module.h>
@@ -16,7 +15,6 @@
16#include <asm/ptrace.h> 15#include <asm/ptrace.h>
17#include <asm/page.h> 16#include <asm/page.h>
18#include <asm/lppaca.h> 17#include <asm/lppaca.h>
19#include <asm/iseries/it_lp_queue.h>
20#include <asm/iseries/it_lp_reg_save.h> 18#include <asm/iseries/it_lp_reg_save.h>
21#include <asm/paca.h> 19#include <asm/paca.h>
22 20
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index b5431ccf1147..898dae8ab6d9 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -2,7 +2,6 @@
2 * Common pmac/prep/chrp pci routines. -- Cort 2 * Common pmac/prep/chrp pci routines. -- Cort
3 */ 3 */
4 4
5#include <linux/config.h>
6#include <linux/kernel.h> 5#include <linux/kernel.h>
7#include <linux/pci.h> 6#include <linux/pci.h>
8#include <linux/delay.h> 7#include <linux/delay.h>
@@ -99,7 +98,7 @@ pcibios_fixup_resources(struct pci_dev *dev)
99 if (!res->flags) 98 if (!res->flags)
100 continue; 99 continue;
101 if (res->end == 0xffffffff) { 100 if (res->end == 0xffffffff) {
102 DBG("PCI:%s Resource %d [%08lx-%08lx] is unassigned\n", 101 DBG("PCI:%s Resource %d [%016llx-%016llx] is unassigned\n",
103 pci_name(dev), i, res->start, res->end); 102 pci_name(dev), i, res->start, res->end);
104 res->end -= res->start; 103 res->end -= res->start;
105 res->start = 0; 104 res->start = 0;
@@ -117,7 +116,7 @@ pcibios_fixup_resources(struct pci_dev *dev)
117 res->start += offset; 116 res->start += offset;
118 res->end += offset; 117 res->end += offset;
119#ifdef DEBUG 118#ifdef DEBUG
120 printk("Fixup res %d (%lx) of dev %s: %lx -> %lx\n", 119 printk("Fixup res %d (%lx) of dev %s: %llx -> %llx\n",
121 i, res->flags, pci_name(dev), 120 i, res->flags, pci_name(dev),
122 res->start - offset, res->start); 121 res->start - offset, res->start);
123#endif 122#endif
@@ -173,18 +172,18 @@ EXPORT_SYMBOL(pcibios_bus_to_resource);
173 * but we want to try to avoid allocating at 0x2900-0x2bff 172 * but we want to try to avoid allocating at 0x2900-0x2bff
174 * which might have be mirrored at 0x0100-0x03ff.. 173 * which might have be mirrored at 0x0100-0x03ff..
175 */ 174 */
176void pcibios_align_resource(void *data, struct resource *res, unsigned long size, 175void pcibios_align_resource(void *data, struct resource *res,
177 unsigned long align) 176 resource_size_t size, resource_size_t align)
178{ 177{
179 struct pci_dev *dev = data; 178 struct pci_dev *dev = data;
180 179
181 if (res->flags & IORESOURCE_IO) { 180 if (res->flags & IORESOURCE_IO) {
182 unsigned long start = res->start; 181 resource_size_t start = res->start;
183 182
184 if (size > 0x100) { 183 if (size > 0x100) {
185 printk(KERN_ERR "PCI: I/O Region %s/%d too large" 184 printk(KERN_ERR "PCI: I/O Region %s/%d too large"
186 " (%ld bytes)\n", pci_name(dev), 185 " (%lld bytes)\n", pci_name(dev),
187 dev->resource - res, size); 186 dev->resource - res, (unsigned long long)size);
188 } 187 }
189 188
190 if (start & 0x300) { 189 if (start & 0x300) {
@@ -255,8 +254,8 @@ pcibios_allocate_bus_resources(struct list_head *bus_list)
255 } 254 }
256 } 255 }
257 256
258 DBG("PCI: bridge rsrc %lx..%lx (%lx), parent %p\n", 257 DBG("PCI: bridge rsrc %llx..%llx (%lx), parent %p\n",
259 res->start, res->end, res->flags, pr); 258 res->start, res->end, res->flags, pr);
260 if (pr) { 259 if (pr) {
261 if (request_resource(pr, res) == 0) 260 if (request_resource(pr, res) == 0)
262 continue; 261 continue;
@@ -306,7 +305,7 @@ reparent_resources(struct resource *parent, struct resource *res)
306 *pp = NULL; 305 *pp = NULL;
307 for (p = res->child; p != NULL; p = p->sibling) { 306 for (p = res->child; p != NULL; p = p->sibling) {
308 p->parent = res; 307 p->parent = res;
309 DBG(KERN_INFO "PCI: reparented %s [%lx..%lx] under %s\n", 308 DBG(KERN_INFO "PCI: reparented %s [%llx..%llx] under %s\n",
310 p->name, p->start, p->end, res->name); 309 p->name, p->start, p->end, res->name);
311 } 310 }
312 return 0; 311 return 0;
@@ -362,13 +361,14 @@ pci_relocate_bridge_resource(struct pci_bus *bus, int i)
362 try = conflict->start - 1; 361 try = conflict->start - 1;
363 } 362 }
364 if (request_resource(pr, res)) { 363 if (request_resource(pr, res)) {
365 DBG(KERN_ERR "PCI: huh? couldn't move to %lx..%lx\n", 364 DBG(KERN_ERR "PCI: huh? couldn't move to %llx..%llx\n",
366 res->start, res->end); 365 res->start, res->end);
367 return -1; /* "can't happen" */ 366 return -1; /* "can't happen" */
368 } 367 }
369 update_bridge_base(bus, i); 368 update_bridge_base(bus, i);
370 printk(KERN_INFO "PCI: bridge %d resource %d moved to %lx..%lx\n", 369 printk(KERN_INFO "PCI: bridge %d resource %d moved to %llx..%llx\n",
371 bus->number, i, res->start, res->end); 370 bus->number, i, (unsigned long long)res->start,
371 (unsigned long long)res->end);
372 return 0; 372 return 0;
373} 373}
374 374
@@ -479,14 +479,14 @@ static inline void alloc_resource(struct pci_dev *dev, int idx)
479{ 479{
480 struct resource *pr, *r = &dev->resource[idx]; 480 struct resource *pr, *r = &dev->resource[idx];
481 481
482 DBG("PCI:%s: Resource %d: %08lx-%08lx (f=%lx)\n", 482 DBG("PCI:%s: Resource %d: %016llx-%016llx (f=%lx)\n",
483 pci_name(dev), idx, r->start, r->end, r->flags); 483 pci_name(dev), idx, r->start, r->end, r->flags);
484 pr = pci_find_parent_resource(dev, r); 484 pr = pci_find_parent_resource(dev, r);
485 if (!pr || request_resource(pr, r) < 0) { 485 if (!pr || request_resource(pr, r) < 0) {
486 printk(KERN_ERR "PCI: Cannot allocate resource region %d" 486 printk(KERN_ERR "PCI: Cannot allocate resource region %d"
487 " of device %s\n", idx, pci_name(dev)); 487 " of device %s\n", idx, pci_name(dev));
488 if (pr) 488 if (pr)
489 DBG("PCI: parent is %p: %08lx-%08lx (f=%lx)\n", 489 DBG("PCI: parent is %p: %016llx-%016llx (f=%lx)\n",
490 pr, pr->start, pr->end, pr->flags); 490 pr, pr->start, pr->end, pr->flags);
491 /* We'll assign a new address later */ 491 /* We'll assign a new address later */
492 r->flags |= IORESOURCE_UNSET; 492 r->flags |= IORESOURCE_UNSET;
@@ -956,7 +956,7 @@ pci_process_bridge_OF_ranges(struct pci_controller *hose,
956 res = &hose->io_resource; 956 res = &hose->io_resource;
957 res->flags = IORESOURCE_IO; 957 res->flags = IORESOURCE_IO;
958 res->start = ranges[2]; 958 res->start = ranges[2];
959 DBG("PCI: IO 0x%lx -> 0x%lx\n", 959 DBG("PCI: IO 0x%llx -> 0x%llx\n",
960 res->start, res->start + size - 1); 960 res->start, res->start + size - 1);
961 break; 961 break;
962 case 2: /* memory space */ 962 case 2: /* memory space */
@@ -978,7 +978,7 @@ pci_process_bridge_OF_ranges(struct pci_controller *hose,
978 if(ranges[0] & 0x40000000) 978 if(ranges[0] & 0x40000000)
979 res->flags |= IORESOURCE_PREFETCH; 979 res->flags |= IORESOURCE_PREFETCH;
980 res->start = ranges[na+2]; 980 res->start = ranges[na+2];
981 DBG("PCI: MEM[%d] 0x%lx -> 0x%lx\n", memno, 981 DBG("PCI: MEM[%d] 0x%llx -> 0x%llx\n", memno,
982 res->start, res->start + size - 1); 982 res->start, res->start + size - 1);
983 } 983 }
984 break; 984 break;
@@ -1074,7 +1074,7 @@ do_update_p2p_io_resource(struct pci_bus *bus, int enable_vga)
1074 DBG("Remapping Bus %d, bridge: %s\n", bus->number, pci_name(bridge)); 1074 DBG("Remapping Bus %d, bridge: %s\n", bus->number, pci_name(bridge));
1075 res.start -= ((unsigned long) hose->io_base_virt - isa_io_base); 1075 res.start -= ((unsigned long) hose->io_base_virt - isa_io_base);
1076 res.end -= ((unsigned long) hose->io_base_virt - isa_io_base); 1076 res.end -= ((unsigned long) hose->io_base_virt - isa_io_base);
1077 DBG(" IO window: %08lx-%08lx\n", res.start, res.end); 1077 DBG(" IO window: %016llx-%016llx\n", res.start, res.end);
1078 1078
1079 /* Set up the top and bottom of the PCI I/O segment for this bus. */ 1079 /* Set up the top and bottom of the PCI I/O segment for this bus. */
1080 pci_read_config_dword(bridge, PCI_IO_BASE, &l); 1080 pci_read_config_dword(bridge, PCI_IO_BASE, &l);
@@ -1223,8 +1223,8 @@ do_fixup_p2p_level(struct pci_bus *bus)
1223 continue; 1223 continue;
1224 if ((r->flags & IORESOURCE_IO) == 0) 1224 if ((r->flags & IORESOURCE_IO) == 0)
1225 continue; 1225 continue;
1226 DBG("Trying to allocate from %08lx, size %08lx from parent" 1226 DBG("Trying to allocate from %016llx, size %016llx from parent"
1227 " res %d: %08lx -> %08lx\n", 1227 " res %d: %016llx -> %016llx\n",
1228 res->start, res->end, i, r->start, r->end); 1228 res->start, res->end, i, r->start, r->end);
1229 1229
1230 if (allocate_resource(r, res, res->end + 1, res->start, max, 1230 if (allocate_resource(r, res, res->end + 1, res->start, max,
@@ -1404,6 +1404,43 @@ pcibios_update_irq(struct pci_dev *dev, int irq)
1404 /* XXX FIXME - update OF device tree node interrupt property */ 1404 /* XXX FIXME - update OF device tree node interrupt property */
1405} 1405}
1406 1406
1407#ifdef CONFIG_PPC_MERGE
1408/* XXX This is a copy of the ppc64 version. This is temporary until we start
1409 * merging the 2 PCI layers
1410 */
1411/*
1412 * Reads the interrupt pin to determine if interrupt is use by card.
1413 * If the interrupt is used, then gets the interrupt line from the
1414 * openfirmware and sets it in the pci_dev and pci_config line.
1415 */
1416int pci_read_irq_line(struct pci_dev *pci_dev)
1417{
1418 struct of_irq oirq;
1419 unsigned int virq;
1420
1421 DBG("Try to map irq for %s...\n", pci_name(pci_dev));
1422
1423 if (of_irq_map_pci(pci_dev, &oirq)) {
1424 DBG(" -> failed !\n");
1425 return -1;
1426 }
1427
1428 DBG(" -> got one, spec %d cells (0x%08x...) on %s\n",
1429 oirq.size, oirq.specifier[0], oirq.controller->full_name);
1430
1431 virq = irq_create_of_mapping(oirq.controller, oirq.specifier, oirq.size);
1432 if(virq == NO_IRQ) {
1433 DBG(" -> failed to map !\n");
1434 return -1;
1435 }
1436 pci_dev->irq = virq;
1437 pci_write_config_byte(pci_dev, PCI_INTERRUPT_LINE, virq);
1438
1439 return 0;
1440}
1441EXPORT_SYMBOL(pci_read_irq_line);
1442#endif /* CONFIG_PPC_MERGE */
1443
1407int pcibios_enable_device(struct pci_dev *dev, int mask) 1444int pcibios_enable_device(struct pci_dev *dev, int mask)
1408{ 1445{
1409 u16 cmd, old_cmd; 1446 u16 cmd, old_cmd;
@@ -1574,8 +1611,8 @@ static pgprot_t __pci_mmap_set_pgprot(struct pci_dev *dev, struct resource *rp,
1574 else 1611 else
1575 prot |= _PAGE_GUARDED; 1612 prot |= _PAGE_GUARDED;
1576 1613
1577 printk("PCI map for %s:%lx, prot: %lx\n", pci_name(dev), rp->start, 1614 printk("PCI map for %s:%llx, prot: %lx\n", pci_name(dev),
1578 prot); 1615 (unsigned long long)rp->start, prot);
1579 1616
1580 return __pgprot(prot); 1617 return __pgprot(prot);
1581} 1618}
@@ -1755,7 +1792,7 @@ long sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn)
1755 1792
1756void pci_resource_to_user(const struct pci_dev *dev, int bar, 1793void pci_resource_to_user(const struct pci_dev *dev, int bar,
1757 const struct resource *rsrc, 1794 const struct resource *rsrc,
1758 u64 *start, u64 *end) 1795 resource_size_t *start, resource_size_t *end)
1759{ 1796{
1760 struct pci_controller *hose = pci_bus_to_hose(dev->bus->number); 1797 struct pci_controller *hose = pci_bus_to_hose(dev->bus->number);
1761 unsigned long offset = 0; 1798 unsigned long offset = 0;
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 247937dd8b73..efc0b5559ee0 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -13,7 +13,6 @@
13 13
14#undef DEBUG 14#undef DEBUG
15 15
16#include <linux/config.h>
17#include <linux/kernel.h> 16#include <linux/kernel.h>
18#include <linux/pci.h> 17#include <linux/pci.h>
19#include <linux/string.h> 18#include <linux/string.h>
@@ -138,11 +137,11 @@ EXPORT_SYMBOL(pcibios_bus_to_resource);
138 * which might have be mirrored at 0x0100-0x03ff.. 137 * which might have be mirrored at 0x0100-0x03ff..
139 */ 138 */
140void pcibios_align_resource(void *data, struct resource *res, 139void pcibios_align_resource(void *data, struct resource *res,
141 unsigned long size, unsigned long align) 140 resource_size_t size, resource_size_t align)
142{ 141{
143 struct pci_dev *dev = data; 142 struct pci_dev *dev = data;
144 struct pci_controller *hose = pci_bus_to_host(dev->bus); 143 struct pci_controller *hose = pci_bus_to_host(dev->bus);
145 unsigned long start = res->start; 144 resource_size_t start = res->start;
146 unsigned long alignto; 145 unsigned long alignto;
147 146
148 if (res->flags & IORESOURCE_IO) { 147 if (res->flags & IORESOURCE_IO) {
@@ -399,12 +398,8 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
399 } else { 398 } else {
400 dev->hdr_type = PCI_HEADER_TYPE_NORMAL; 399 dev->hdr_type = PCI_HEADER_TYPE_NORMAL;
401 dev->rom_base_reg = PCI_ROM_ADDRESS; 400 dev->rom_base_reg = PCI_ROM_ADDRESS;
401 /* Maybe do a default OF mapping here */
402 dev->irq = NO_IRQ; 402 dev->irq = NO_IRQ;
403 if (node->n_intrs > 0) {
404 dev->irq = node->intrs[0].line;
405 pci_write_config_byte(dev, PCI_INTERRUPT_LINE,
406 dev->irq);
407 }
408 } 403 }
409 404
410 pci_parse_of_addrs(node, dev); 405 pci_parse_of_addrs(node, dev);
@@ -1289,23 +1284,26 @@ EXPORT_SYMBOL(pcibios_fixup_bus);
1289 */ 1284 */
1290int pci_read_irq_line(struct pci_dev *pci_dev) 1285int pci_read_irq_line(struct pci_dev *pci_dev)
1291{ 1286{
1292 u8 intpin; 1287 struct of_irq oirq;
1293 struct device_node *node; 1288 unsigned int virq;
1294
1295 pci_read_config_byte(pci_dev, PCI_INTERRUPT_PIN, &intpin);
1296 if (intpin == 0)
1297 return 0;
1298 1289
1299 node = pci_device_to_OF_node(pci_dev); 1290 DBG("Try to map irq for %s...\n", pci_name(pci_dev));
1300 if (node == NULL)
1301 return -1;
1302 1291
1303 if (node->n_intrs == 0) 1292 if (of_irq_map_pci(pci_dev, &oirq)) {
1293 DBG(" -> failed !\n");
1304 return -1; 1294 return -1;
1295 }
1305 1296
1306 pci_dev->irq = node->intrs[0].line; 1297 DBG(" -> got one, spec %d cells (0x%08x...) on %s\n",
1298 oirq.size, oirq.specifier[0], oirq.controller->full_name);
1307 1299
1308 pci_write_config_byte(pci_dev, PCI_INTERRUPT_LINE, pci_dev->irq); 1300 virq = irq_create_of_mapping(oirq.controller, oirq.specifier, oirq.size);
1301 if(virq == NO_IRQ) {
1302 DBG(" -> failed to map !\n");
1303 return -1;
1304 }
1305 pci_dev->irq = virq;
1306 pci_write_config_byte(pci_dev, PCI_INTERRUPT_LINE, virq);
1309 1307
1310 return 0; 1308 return 0;
1311} 1309}
diff --git a/arch/powerpc/kernel/perfmon_fsl_booke.c b/arch/powerpc/kernel/perfmon_fsl_booke.c
index 32455dfcc36b..bdc3977a7b06 100644
--- a/arch/powerpc/kernel/perfmon_fsl_booke.c
+++ b/arch/powerpc/kernel/perfmon_fsl_booke.c
@@ -21,7 +21,6 @@
21#include <linux/user.h> 21#include <linux/user.h>
22#include <linux/a.out.h> 22#include <linux/a.out.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/config.h>
25#include <linux/init.h> 24#include <linux/init.h>
26#include <linux/module.h> 25#include <linux/module.h>
27#include <linux/prctl.h> 26#include <linux/prctl.h>
diff --git a/arch/powerpc/kernel/pmc.c b/arch/powerpc/kernel/pmc.c
index e6fb194fe537..a0a2efadeabf 100644
--- a/arch/powerpc/kernel/pmc.c
+++ b/arch/powerpc/kernel/pmc.c
@@ -12,7 +12,6 @@
12 * 2 of the License, or (at your option) any later version. 12 * 2 of the License, or (at your option) any later version.
13 */ 13 */
14 14
15#include <linux/config.h>
16#include <linux/errno.h> 15#include <linux/errno.h>
17#include <linux/spinlock.h> 16#include <linux/spinlock.h>
18#include <linux/module.h> 17#include <linux/module.h>
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
index 4b052ae5dc34..e3b80f71748e 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -1,4 +1,3 @@
1#include <linux/config.h>
2#include <linux/module.h> 1#include <linux/module.h>
3#include <linux/threads.h> 2#include <linux/threads.h>
4#include <linux/smp.h> 3#include <linux/smp.h>
diff --git a/arch/powerpc/kernel/proc_ppc64.c b/arch/powerpc/kernel/proc_ppc64.c
index 2ab8f2be911e..f598cb519539 100644
--- a/arch/powerpc/kernel/proc_ppc64.c
+++ b/arch/powerpc/kernel/proc_ppc64.c
@@ -16,7 +16,6 @@
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */ 17 */
18 18
19#include <linux/config.h>
20#include <linux/init.h> 19#include <linux/init.h>
21#include <linux/mm.h> 20#include <linux/mm.h>
22#include <linux/proc_fs.h> 21#include <linux/proc_fs.h>
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index e4732459c485..a127a1e3c097 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -14,7 +14,6 @@
14 * 2 of the License, or (at your option) any later version. 14 * 2 of the License, or (at your option) any later version.
15 */ 15 */
16 16
17#include <linux/config.h>
18#include <linux/errno.h> 17#include <linux/errno.h>
19#include <linux/sched.h> 18#include <linux/sched.h>
20#include <linux/kernel.h> 19#include <linux/kernel.h>
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 483455c5bb02..a1787ffb6319 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -16,7 +16,6 @@
16#undef DEBUG 16#undef DEBUG
17 17
18#include <stdarg.h> 18#include <stdarg.h>
19#include <linux/config.h>
20#include <linux/kernel.h> 19#include <linux/kernel.h>
21#include <linux/string.h> 20#include <linux/string.h>
22#include <linux/init.h> 21#include <linux/init.h>
@@ -30,6 +29,8 @@
30#include <linux/bitops.h> 29#include <linux/bitops.h>
31#include <linux/module.h> 30#include <linux/module.h>
32#include <linux/kexec.h> 31#include <linux/kexec.h>
32#include <linux/debugfs.h>
33#include <linux/irq.h>
33 34
34#include <asm/prom.h> 35#include <asm/prom.h>
35#include <asm/rtas.h> 36#include <asm/rtas.h>
@@ -86,424 +87,6 @@ static DEFINE_RWLOCK(devtree_lock);
86/* export that to outside world */ 87/* export that to outside world */
87struct device_node *of_chosen; 88struct device_node *of_chosen;
88 89
89struct device_node *dflt_interrupt_controller;
90int num_interrupt_controllers;
91
92/*
93 * Wrapper for allocating memory for various data that needs to be
94 * attached to device nodes as they are processed at boot or when
95 * added to the device tree later (e.g. DLPAR). At boot there is
96 * already a region reserved so we just increment *mem_start by size;
97 * otherwise we call kmalloc.
98 */
99static void * prom_alloc(unsigned long size, unsigned long *mem_start)
100{
101 unsigned long tmp;
102
103 if (!mem_start)
104 return kmalloc(size, GFP_KERNEL);
105
106 tmp = *mem_start;
107 *mem_start += size;
108 return (void *)tmp;
109}
110
111/*
112 * Find the device_node with a given phandle.
113 */
114static struct device_node * find_phandle(phandle ph)
115{
116 struct device_node *np;
117
118 for (np = allnodes; np != 0; np = np->allnext)
119 if (np->linux_phandle == ph)
120 return np;
121 return NULL;
122}
123
124/*
125 * Find the interrupt parent of a node.
126 */
127static struct device_node * __devinit intr_parent(struct device_node *p)
128{
129 phandle *parp;
130
131 parp = (phandle *) get_property(p, "interrupt-parent", NULL);
132 if (parp == NULL)
133 return p->parent;
134 p = find_phandle(*parp);
135 if (p != NULL)
136 return p;
137 /*
138 * On a powermac booted with BootX, we don't get to know the
139 * phandles for any nodes, so find_phandle will return NULL.
140 * Fortunately these machines only have one interrupt controller
141 * so there isn't in fact any ambiguity. -- paulus
142 */
143 if (num_interrupt_controllers == 1)
144 p = dflt_interrupt_controller;
145 return p;
146}
147
148/*
149 * Find out the size of each entry of the interrupts property
150 * for a node.
151 */
152int __devinit prom_n_intr_cells(struct device_node *np)
153{
154 struct device_node *p;
155 unsigned int *icp;
156
157 for (p = np; (p = intr_parent(p)) != NULL; ) {
158 icp = (unsigned int *)
159 get_property(p, "#interrupt-cells", NULL);
160 if (icp != NULL)
161 return *icp;
162 if (get_property(p, "interrupt-controller", NULL) != NULL
163 || get_property(p, "interrupt-map", NULL) != NULL) {
164 printk("oops, node %s doesn't have #interrupt-cells\n",
165 p->full_name);
166 return 1;
167 }
168 }
169#ifdef DEBUG_IRQ
170 printk("prom_n_intr_cells failed for %s\n", np->full_name);
171#endif
172 return 1;
173}
174
175/*
176 * Map an interrupt from a device up to the platform interrupt
177 * descriptor.
178 */
179static int __devinit map_interrupt(unsigned int **irq, struct device_node **ictrler,
180 struct device_node *np, unsigned int *ints,
181 int nintrc)
182{
183 struct device_node *p, *ipar;
184 unsigned int *imap, *imask, *ip;
185 int i, imaplen, match;
186 int newintrc = 0, newaddrc = 0;
187 unsigned int *reg;
188 int naddrc;
189
190 reg = (unsigned int *) get_property(np, "reg", NULL);
191 naddrc = prom_n_addr_cells(np);
192 p = intr_parent(np);
193 while (p != NULL) {
194 if (get_property(p, "interrupt-controller", NULL) != NULL)
195 /* this node is an interrupt controller, stop here */
196 break;
197 imap = (unsigned int *)
198 get_property(p, "interrupt-map", &imaplen);
199 if (imap == NULL) {
200 p = intr_parent(p);
201 continue;
202 }
203 imask = (unsigned int *)
204 get_property(p, "interrupt-map-mask", NULL);
205 if (imask == NULL) {
206 printk("oops, %s has interrupt-map but no mask\n",
207 p->full_name);
208 return 0;
209 }
210 imaplen /= sizeof(unsigned int);
211 match = 0;
212 ipar = NULL;
213 while (imaplen > 0 && !match) {
214 /* check the child-interrupt field */
215 match = 1;
216 for (i = 0; i < naddrc && match; ++i)
217 match = ((reg[i] ^ imap[i]) & imask[i]) == 0;
218 for (; i < naddrc + nintrc && match; ++i)
219 match = ((ints[i-naddrc] ^ imap[i]) & imask[i]) == 0;
220 imap += naddrc + nintrc;
221 imaplen -= naddrc + nintrc;
222 /* grab the interrupt parent */
223 ipar = find_phandle((phandle) *imap++);
224 --imaplen;
225 if (ipar == NULL && num_interrupt_controllers == 1)
226 /* cope with BootX not giving us phandles */
227 ipar = dflt_interrupt_controller;
228 if (ipar == NULL) {
229 printk("oops, no int parent %x in map of %s\n",
230 imap[-1], p->full_name);
231 return 0;
232 }
233 /* find the parent's # addr and intr cells */
234 ip = (unsigned int *)
235 get_property(ipar, "#interrupt-cells", NULL);
236 if (ip == NULL) {
237 printk("oops, no #interrupt-cells on %s\n",
238 ipar->full_name);
239 return 0;
240 }
241 newintrc = *ip;
242 ip = (unsigned int *)
243 get_property(ipar, "#address-cells", NULL);
244 newaddrc = (ip == NULL)? 0: *ip;
245 imap += newaddrc + newintrc;
246 imaplen -= newaddrc + newintrc;
247 }
248 if (imaplen < 0) {
249 printk("oops, error decoding int-map on %s, len=%d\n",
250 p->full_name, imaplen);
251 return 0;
252 }
253 if (!match) {
254#ifdef DEBUG_IRQ
255 printk("oops, no match in %s int-map for %s\n",
256 p->full_name, np->full_name);
257#endif
258 return 0;
259 }
260 p = ipar;
261 naddrc = newaddrc;
262 nintrc = newintrc;
263 ints = imap - nintrc;
264 reg = ints - naddrc;
265 }
266 if (p == NULL) {
267#ifdef DEBUG_IRQ
268 printk("hmmm, int tree for %s doesn't have ctrler\n",
269 np->full_name);
270#endif
271 return 0;
272 }
273 *irq = ints;
274 *ictrler = p;
275 return nintrc;
276}
277
278static unsigned char map_isa_senses[4] = {
279 IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE,
280 IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE,
281 IRQ_SENSE_EDGE | IRQ_POLARITY_NEGATIVE,
282 IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE
283};
284
285static unsigned char map_mpic_senses[4] = {
286 IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE,
287 IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE,
288 /* 2 seems to be used for the 8259 cascade... */
289 IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE,
290 IRQ_SENSE_EDGE | IRQ_POLARITY_NEGATIVE,
291};
292
293static int __devinit finish_node_interrupts(struct device_node *np,
294 unsigned long *mem_start,
295 int measure_only)
296{
297 unsigned int *ints;
298 int intlen, intrcells, intrcount;
299 int i, j, n, sense;
300 unsigned int *irq, virq;
301 struct device_node *ic;
302 int trace = 0;
303
304 //#define TRACE(fmt...) do { if (trace) { printk(fmt); mdelay(1000); } } while(0)
305#define TRACE(fmt...)
306
307 if (!strcmp(np->name, "smu-doorbell"))
308 trace = 1;
309
310 TRACE("Finishing SMU doorbell ! num_interrupt_controllers = %d\n",
311 num_interrupt_controllers);
312
313 if (num_interrupt_controllers == 0) {
314 /*
315 * Old machines just have a list of interrupt numbers
316 * and no interrupt-controller nodes.
317 */
318 ints = (unsigned int *) get_property(np, "AAPL,interrupts",
319 &intlen);
320 /* XXX old interpret_pci_props looked in parent too */
321 /* XXX old interpret_macio_props looked for interrupts
322 before AAPL,interrupts */
323 if (ints == NULL)
324 ints = (unsigned int *) get_property(np, "interrupts",
325 &intlen);
326 if (ints == NULL)
327 return 0;
328
329 np->n_intrs = intlen / sizeof(unsigned int);
330 np->intrs = prom_alloc(np->n_intrs * sizeof(np->intrs[0]),
331 mem_start);
332 if (!np->intrs)
333 return -ENOMEM;
334 if (measure_only)
335 return 0;
336
337 for (i = 0; i < np->n_intrs; ++i) {
338 np->intrs[i].line = *ints++;
339 np->intrs[i].sense = IRQ_SENSE_LEVEL
340 | IRQ_POLARITY_NEGATIVE;
341 }
342 return 0;
343 }
344
345 ints = (unsigned int *) get_property(np, "interrupts", &intlen);
346 TRACE("ints=%p, intlen=%d\n", ints, intlen);
347 if (ints == NULL)
348 return 0;
349 intrcells = prom_n_intr_cells(np);
350 intlen /= intrcells * sizeof(unsigned int);
351 TRACE("intrcells=%d, new intlen=%d\n", intrcells, intlen);
352 np->intrs = prom_alloc(intlen * sizeof(*(np->intrs)), mem_start);
353 if (!np->intrs)
354 return -ENOMEM;
355
356 if (measure_only)
357 return 0;
358
359 intrcount = 0;
360 for (i = 0; i < intlen; ++i, ints += intrcells) {
361 n = map_interrupt(&irq, &ic, np, ints, intrcells);
362 TRACE("map, irq=%d, ic=%p, n=%d\n", irq, ic, n);
363 if (n <= 0)
364 continue;
365
366 /* don't map IRQ numbers under a cascaded 8259 controller */
367 if (ic && device_is_compatible(ic, "chrp,iic")) {
368 np->intrs[intrcount].line = irq[0];
369 sense = (n > 1)? (irq[1] & 3): 3;
370 np->intrs[intrcount].sense = map_isa_senses[sense];
371 } else {
372 virq = virt_irq_create_mapping(irq[0]);
373 TRACE("virq=%d\n", virq);
374#ifdef CONFIG_PPC64
375 if (virq == NO_IRQ) {
376 printk(KERN_CRIT "Could not allocate interrupt"
377 " number for %s\n", np->full_name);
378 continue;
379 }
380#endif
381 np->intrs[intrcount].line = irq_offset_up(virq);
382 sense = (n > 1)? (irq[1] & 3): 1;
383
384 /* Apple uses bits in there in a different way, let's
385 * only keep the real sense bit on macs
386 */
387 if (machine_is(powermac))
388 sense &= 0x1;
389 np->intrs[intrcount].sense = map_mpic_senses[sense];
390 }
391
392#ifdef CONFIG_PPC64
393 /* We offset irq numbers for the u3 MPIC by 128 in PowerMac */
394 if (machine_is(powermac) && ic && ic->parent) {
395 char *name = get_property(ic->parent, "name", NULL);
396 if (name && !strcmp(name, "u3"))
397 np->intrs[intrcount].line += 128;
398 else if (!(name && (!strcmp(name, "mac-io") ||
399 !strcmp(name, "u4"))))
400 /* ignore other cascaded controllers, such as
401 the k2-sata-root */
402 break;
403 }
404#endif /* CONFIG_PPC64 */
405 if (n > 2) {
406 printk("hmmm, got %d intr cells for %s:", n,
407 np->full_name);
408 for (j = 0; j < n; ++j)
409 printk(" %d", irq[j]);
410 printk("\n");
411 }
412 ++intrcount;
413 }
414 np->n_intrs = intrcount;
415
416 return 0;
417}
418
419static int __devinit finish_node(struct device_node *np,
420 unsigned long *mem_start,
421 int measure_only)
422{
423 struct device_node *child;
424 int rc = 0;
425
426 rc = finish_node_interrupts(np, mem_start, measure_only);
427 if (rc)
428 goto out;
429
430 for (child = np->child; child != NULL; child = child->sibling) {
431 rc = finish_node(child, mem_start, measure_only);
432 if (rc)
433 goto out;
434 }
435out:
436 return rc;
437}
438
439static void __init scan_interrupt_controllers(void)
440{
441 struct device_node *np;
442 int n = 0;
443 char *name, *ic;
444 int iclen;
445
446 for (np = allnodes; np != NULL; np = np->allnext) {
447 ic = get_property(np, "interrupt-controller", &iclen);
448 name = get_property(np, "name", NULL);
449 /* checking iclen makes sure we don't get a false
450 match on /chosen.interrupt_controller */
451 if ((name != NULL
452 && strcmp(name, "interrupt-controller") == 0)
453 || (ic != NULL && iclen == 0
454 && strcmp(name, "AppleKiwi"))) {
455 if (n == 0)
456 dflt_interrupt_controller = np;
457 ++n;
458 }
459 }
460 num_interrupt_controllers = n;
461}
462
463/**
464 * finish_device_tree is called once things are running normally
465 * (i.e. with text and data mapped to the address they were linked at).
466 * It traverses the device tree and fills in some of the additional,
467 * fields in each node like {n_}addrs and {n_}intrs, the virt interrupt
468 * mapping is also initialized at this point.
469 */
470void __init finish_device_tree(void)
471{
472 unsigned long start, end, size = 0;
473
474 DBG(" -> finish_device_tree\n");
475
476#ifdef CONFIG_PPC64
477 /* Initialize virtual IRQ map */
478 virt_irq_init();
479#endif
480 scan_interrupt_controllers();
481
482 /*
483 * Finish device-tree (pre-parsing some properties etc...)
484 * We do this in 2 passes. One with "measure_only" set, which
485 * will only measure the amount of memory needed, then we can
486 * allocate that memory, and call finish_node again. However,
487 * we must be careful as most routines will fail nowadays when
488 * prom_alloc() returns 0, so we must make sure our first pass
489 * doesn't start at 0. We pre-initialize size to 16 for that
490 * reason and then remove those additional 16 bytes
491 */
492 size = 16;
493 finish_node(allnodes, &size, 1);
494 size -= 16;
495
496 if (0 == size)
497 end = start = 0;
498 else
499 end = start = (unsigned long)__va(lmb_alloc(size, 128));
500
501 finish_node(allnodes, &end, 0);
502 BUG_ON(end != start + size);
503
504 DBG(" <- finish_device_tree\n");
505}
506
507static inline char *find_flat_dt_string(u32 offset) 90static inline char *find_flat_dt_string(u32 offset)
508{ 91{
509 return ((char *)initial_boot_params) + 92 return ((char *)initial_boot_params) +
@@ -952,6 +535,7 @@ static struct ibm_pa_feature {
952 /* put this back once we know how to test if firmware does 64k IO */ 535 /* put this back once we know how to test if firmware does 64k IO */
953 {CPU_FTR_CI_LARGE_PAGE, 0, 1, 2, 0}, 536 {CPU_FTR_CI_LARGE_PAGE, 0, 1, 2, 0},
954#endif 537#endif
538 {CPU_FTR_REAL_LE, PPC_FEATURE_TRUE_LE, 5, 0, 0},
955}; 539};
956 540
957static void __init check_cpu_pa_features(unsigned long node) 541static void __init check_cpu_pa_features(unsigned long node)
@@ -1124,24 +708,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
1124 tce_alloc_end = *lprop; 708 tce_alloc_end = *lprop;
1125#endif 709#endif
1126 710
1127#ifdef CONFIG_PPC_RTAS
1128 /* To help early debugging via the front panel, we retrieve a minimal
1129 * set of RTAS infos now if available
1130 */
1131 {
1132 u64 *basep, *entryp, *sizep;
1133
1134 basep = of_get_flat_dt_prop(node, "linux,rtas-base", NULL);
1135 entryp = of_get_flat_dt_prop(node, "linux,rtas-entry", NULL);
1136 sizep = of_get_flat_dt_prop(node, "linux,rtas-size", NULL);
1137 if (basep && entryp && sizep) {
1138 rtas.base = *basep;
1139 rtas.entry = *entryp;
1140 rtas.size = *sizep;
1141 }
1142 }
1143#endif /* CONFIG_PPC_RTAS */
1144
1145#ifdef CONFIG_KEXEC 711#ifdef CONFIG_KEXEC
1146 lprop = (u64*)of_get_flat_dt_prop(node, "linux,crashkernel-base", NULL); 712 lprop = (u64*)of_get_flat_dt_prop(node, "linux,crashkernel-base", NULL);
1147 if (lprop) 713 if (lprop)
@@ -1326,6 +892,11 @@ void __init early_init_devtree(void *params)
1326 /* Setup flat device-tree pointer */ 892 /* Setup flat device-tree pointer */
1327 initial_boot_params = params; 893 initial_boot_params = params;
1328 894
895#ifdef CONFIG_PPC_RTAS
896 /* Some machines might need RTAS info for debugging, grab it now. */
897 of_scan_flat_dt(early_init_dt_scan_rtas, NULL);
898#endif
899
1329 /* Retrieve various informations from the /chosen node of the 900 /* Retrieve various informations from the /chosen node of the
1330 * device-tree, including the platform type, initrd location and 901 * device-tree, including the platform type, initrd location and
1331 * size, TCE reserve, and more ... 902 * size, TCE reserve, and more ...
@@ -1401,27 +972,6 @@ prom_n_size_cells(struct device_node* np)
1401EXPORT_SYMBOL(prom_n_size_cells); 972EXPORT_SYMBOL(prom_n_size_cells);
1402 973
1403/** 974/**
1404 * Work out the sense (active-low level / active-high edge)
1405 * of each interrupt from the device tree.
1406 */
1407void __init prom_get_irq_senses(unsigned char *senses, int off, int max)
1408{
1409 struct device_node *np;
1410 int i, j;
1411
1412 /* default to level-triggered */
1413 memset(senses, IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE, max - off);
1414
1415 for (np = allnodes; np != 0; np = np->allnext) {
1416 for (j = 0; j < np->n_intrs; j++) {
1417 i = np->intrs[j].line;
1418 if (i >= off && i < max)
1419 senses[i-off] = np->intrs[j].sense;
1420 }
1421 }
1422}
1423
1424/**
1425 * Construct and return a list of the device_nodes with a given name. 975 * Construct and return a list of the device_nodes with a given name.
1426 */ 976 */
1427struct device_node *find_devices(const char *name) 977struct device_node *find_devices(const char *name)
@@ -1820,7 +1370,6 @@ static void of_node_release(struct kref *kref)
1820 node->deadprops = NULL; 1370 node->deadprops = NULL;
1821 } 1371 }
1822 } 1372 }
1823 kfree(node->intrs);
1824 kfree(node->full_name); 1373 kfree(node->full_name);
1825 kfree(node->data); 1374 kfree(node->data);
1826 kfree(node); 1375 kfree(node);
@@ -1893,13 +1442,7 @@ void of_detach_node(const struct device_node *np)
1893#ifdef CONFIG_PPC_PSERIES 1442#ifdef CONFIG_PPC_PSERIES
1894/* 1443/*
1895 * Fix up the uninitialized fields in a new device node: 1444 * Fix up the uninitialized fields in a new device node:
1896 * name, type, n_addrs, addrs, n_intrs, intrs, and pci-specific fields 1445 * name, type and pci-specific fields
1897 *
1898 * A lot of boot-time code is duplicated here, because functions such
1899 * as finish_node_interrupts, interpret_pci_props, etc. cannot use the
1900 * slab allocator.
1901 *
1902 * This should probably be split up into smaller chunks.
1903 */ 1446 */
1904 1447
1905static int of_finish_dynamic_node(struct device_node *node) 1448static int of_finish_dynamic_node(struct device_node *node)
@@ -1940,8 +1483,6 @@ static int prom_reconfig_notifier(struct notifier_block *nb,
1940 switch (action) { 1483 switch (action) {
1941 case PSERIES_RECONFIG_ADD: 1484 case PSERIES_RECONFIG_ADD:
1942 err = of_finish_dynamic_node(node); 1485 err = of_finish_dynamic_node(node);
1943 if (!err)
1944 finish_node(node, NULL, 0);
1945 if (err < 0) { 1486 if (err < 0) {
1946 printk(KERN_ERR "finish_node returned %d\n", err); 1487 printk(KERN_ERR "finish_node returned %d\n", err);
1947 err = NOTIFY_BAD; 1488 err = NOTIFY_BAD;
@@ -1987,8 +1528,7 @@ struct property *of_find_property(struct device_node *np, const char *name,
1987 * Find a property with a given name for a given node 1528 * Find a property with a given name for a given node
1988 * and return the value. 1529 * and return the value.
1989 */ 1530 */
1990unsigned char *get_property(struct device_node *np, const char *name, 1531void *get_property(struct device_node *np, const char *name, int *lenp)
1991 int *lenp)
1992{ 1532{
1993 struct property *pp = of_find_property(np,name,lenp); 1533 struct property *pp = of_find_property(np,name,lenp);
1994 return pp ? pp->value : NULL; 1534 return pp ? pp->value : NULL;
@@ -2148,3 +1688,27 @@ struct device_node *of_get_cpu_node(int cpu, unsigned int *thread)
2148 } 1688 }
2149 return NULL; 1689 return NULL;
2150} 1690}
1691
1692#ifdef DEBUG
1693static struct debugfs_blob_wrapper flat_dt_blob;
1694
1695static int __init export_flat_device_tree(void)
1696{
1697 struct dentry *d;
1698
1699 d = debugfs_create_dir("powerpc", NULL);
1700 if (!d)
1701 return 1;
1702
1703 flat_dt_blob.data = initial_boot_params;
1704 flat_dt_blob.size = initial_boot_params->totalsize;
1705
1706 d = debugfs_create_blob("flat-device-tree", S_IFREG | S_IRUSR,
1707 d, &flat_dt_blob);
1708 if (!d)
1709 return 1;
1710
1711 return 0;
1712}
1713__initcall(export_flat_device_tree);
1714#endif
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 8c28eb0cbdac..ebd501a59abd 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -16,7 +16,6 @@
16#undef DEBUG_PROM 16#undef DEBUG_PROM
17 17
18#include <stdarg.h> 18#include <stdarg.h>
19#include <linux/config.h>
20#include <linux/kernel.h> 19#include <linux/kernel.h>
21#include <linux/string.h> 20#include <linux/string.h>
22#include <linux/init.h> 21#include <linux/init.h>
@@ -988,7 +987,7 @@ static void reserve_mem(u64 base, u64 size)
988} 987}
989 988
990/* 989/*
991 * Initialize memory allocation mecanism, parse "memory" nodes and 990 * Initialize memory allocation mechanism, parse "memory" nodes and
992 * obtain that way the top of memory and RMO to setup out local allocator 991 * obtain that way the top of memory and RMO to setup out local allocator
993 */ 992 */
994static void __init prom_init_mem(void) 993static void __init prom_init_mem(void)
@@ -1991,12 +1990,22 @@ static void __init flatten_device_tree(void)
1991static void __init fixup_device_tree_maple(void) 1990static void __init fixup_device_tree_maple(void)
1992{ 1991{
1993 phandle isa; 1992 phandle isa;
1993 u32 rloc = 0x01002000; /* IO space; PCI device = 4 */
1994 u32 isa_ranges[6]; 1994 u32 isa_ranges[6];
1995 1995 char *name;
1996 isa = call_prom("finddevice", 1, 1, ADDR("/ht@0/isa@4")); 1996
1997 name = "/ht@0/isa@4";
1998 isa = call_prom("finddevice", 1, 1, ADDR(name));
1999 if (!PHANDLE_VALID(isa)) {
2000 name = "/ht@0/isa@6";
2001 isa = call_prom("finddevice", 1, 1, ADDR(name));
2002 rloc = 0x01003000; /* IO space; PCI device = 6 */
2003 }
1997 if (!PHANDLE_VALID(isa)) 2004 if (!PHANDLE_VALID(isa))
1998 return; 2005 return;
1999 2006
2007 if (prom_getproplen(isa, "ranges") != 12)
2008 return;
2000 if (prom_getprop(isa, "ranges", isa_ranges, sizeof(isa_ranges)) 2009 if (prom_getprop(isa, "ranges", isa_ranges, sizeof(isa_ranges))
2001 == PROM_ERROR) 2010 == PROM_ERROR)
2002 return; 2011 return;
@@ -2006,15 +2015,15 @@ static void __init fixup_device_tree_maple(void)
2006 isa_ranges[2] != 0x00010000) 2015 isa_ranges[2] != 0x00010000)
2007 return; 2016 return;
2008 2017
2009 prom_printf("fixing up bogus ISA range on Maple...\n"); 2018 prom_printf("Fixing up bogus ISA range on Maple/Apache...\n");
2010 2019
2011 isa_ranges[0] = 0x1; 2020 isa_ranges[0] = 0x1;
2012 isa_ranges[1] = 0x0; 2021 isa_ranges[1] = 0x0;
2013 isa_ranges[2] = 0x01002000; /* IO space; PCI device = 4 */ 2022 isa_ranges[2] = rloc;
2014 isa_ranges[3] = 0x0; 2023 isa_ranges[3] = 0x0;
2015 isa_ranges[4] = 0x0; 2024 isa_ranges[4] = 0x0;
2016 isa_ranges[5] = 0x00010000; 2025 isa_ranges[5] = 0x00010000;
2017 prom_setprop(isa, "/ht@0/isa@4", "ranges", 2026 prom_setprop(isa, name, "ranges",
2018 isa_ranges, sizeof(isa_ranges)); 2027 isa_ranges, sizeof(isa_ranges));
2019} 2028}
2020#else 2029#else
diff --git a/arch/powerpc/kernel/prom_parse.c b/arch/powerpc/kernel/prom_parse.c
index 45df420383cc..21009b1f7869 100644
--- a/arch/powerpc/kernel/prom_parse.c
+++ b/arch/powerpc/kernel/prom_parse.c
@@ -38,14 +38,6 @@ static void of_dump_addr(const char *s, u32 *addr, int na)
38static void of_dump_addr(const char *s, u32 *addr, int na) { } 38static void of_dump_addr(const char *s, u32 *addr, int na) { }
39#endif 39#endif
40 40
41/* Read a big address */
42static inline u64 of_read_addr(u32 *cell, int size)
43{
44 u64 r = 0;
45 while (size--)
46 r = (r << 32) | *(cell++);
47 return r;
48}
49 41
50/* Callbacks for bus specific translators */ 42/* Callbacks for bus specific translators */
51struct of_bus { 43struct of_bus {
@@ -77,9 +69,9 @@ static u64 of_bus_default_map(u32 *addr, u32 *range, int na, int ns, int pna)
77{ 69{
78 u64 cp, s, da; 70 u64 cp, s, da;
79 71
80 cp = of_read_addr(range, na); 72 cp = of_read_number(range, na);
81 s = of_read_addr(range + na + pna, ns); 73 s = of_read_number(range + na + pna, ns);
82 da = of_read_addr(addr, na); 74 da = of_read_number(addr, na);
83 75
84 DBG("OF: default map, cp="PRu64", s="PRu64", da="PRu64"\n", 76 DBG("OF: default map, cp="PRu64", s="PRu64", da="PRu64"\n",
85 cp, s, da); 77 cp, s, da);
@@ -91,7 +83,7 @@ static u64 of_bus_default_map(u32 *addr, u32 *range, int na, int ns, int pna)
91 83
92static int of_bus_default_translate(u32 *addr, u64 offset, int na) 84static int of_bus_default_translate(u32 *addr, u64 offset, int na)
93{ 85{
94 u64 a = of_read_addr(addr, na); 86 u64 a = of_read_number(addr, na);
95 memset(addr, 0, na * 4); 87 memset(addr, 0, na * 4);
96 a += offset; 88 a += offset;
97 if (na > 1) 89 if (na > 1)
@@ -135,9 +127,9 @@ static u64 of_bus_pci_map(u32 *addr, u32 *range, int na, int ns, int pna)
135 return OF_BAD_ADDR; 127 return OF_BAD_ADDR;
136 128
137 /* Read address values, skipping high cell */ 129 /* Read address values, skipping high cell */
138 cp = of_read_addr(range + 1, na - 1); 130 cp = of_read_number(range + 1, na - 1);
139 s = of_read_addr(range + na + pna, ns); 131 s = of_read_number(range + na + pna, ns);
140 da = of_read_addr(addr + 1, na - 1); 132 da = of_read_number(addr + 1, na - 1);
141 133
142 DBG("OF: PCI map, cp="PRu64", s="PRu64", da="PRu64"\n", cp, s, da); 134 DBG("OF: PCI map, cp="PRu64", s="PRu64", da="PRu64"\n", cp, s, da);
143 135
@@ -195,9 +187,9 @@ static u64 of_bus_isa_map(u32 *addr, u32 *range, int na, int ns, int pna)
195 return OF_BAD_ADDR; 187 return OF_BAD_ADDR;
196 188
197 /* Read address values, skipping high cell */ 189 /* Read address values, skipping high cell */
198 cp = of_read_addr(range + 1, na - 1); 190 cp = of_read_number(range + 1, na - 1);
199 s = of_read_addr(range + na + pna, ns); 191 s = of_read_number(range + na + pna, ns);
200 da = of_read_addr(addr + 1, na - 1); 192 da = of_read_number(addr + 1, na - 1);
201 193
202 DBG("OF: ISA map, cp="PRu64", s="PRu64", da="PRu64"\n", cp, s, da); 194 DBG("OF: ISA map, cp="PRu64", s="PRu64", da="PRu64"\n", cp, s, da);
203 195
@@ -295,7 +287,7 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus,
295 */ 287 */
296 ranges = (u32 *)get_property(parent, "ranges", &rlen); 288 ranges = (u32 *)get_property(parent, "ranges", &rlen);
297 if (ranges == NULL || rlen == 0) { 289 if (ranges == NULL || rlen == 0) {
298 offset = of_read_addr(addr, na); 290 offset = of_read_number(addr, na);
299 memset(addr, 0, pna * 4); 291 memset(addr, 0, pna * 4);
300 DBG("OF: no ranges, 1:1 translation\n"); 292 DBG("OF: no ranges, 1:1 translation\n");
301 goto finish; 293 goto finish;
@@ -378,7 +370,7 @@ u64 of_translate_address(struct device_node *dev, u32 *in_addr)
378 /* If root, we have finished */ 370 /* If root, we have finished */
379 if (parent == NULL) { 371 if (parent == NULL) {
380 DBG("OF: reached root node\n"); 372 DBG("OF: reached root node\n");
381 result = of_read_addr(addr, na); 373 result = of_read_number(addr, na);
382 break; 374 break;
383 } 375 }
384 376
@@ -442,7 +434,7 @@ u32 *of_get_address(struct device_node *dev, int index, u64 *size,
442 for (i = 0; psize >= onesize; psize -= onesize, prop += onesize, i++) 434 for (i = 0; psize >= onesize; psize -= onesize, prop += onesize, i++)
443 if (i == index) { 435 if (i == index) {
444 if (size) 436 if (size)
445 *size = of_read_addr(prop + na, ns); 437 *size = of_read_number(prop + na, ns);
446 if (flags) 438 if (flags)
447 *flags = bus->get_flags(prop); 439 *flags = bus->get_flags(prop);
448 return prop; 440 return prop;
@@ -484,7 +476,7 @@ u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size,
484 for (i = 0; psize >= onesize; psize -= onesize, prop += onesize, i++) 476 for (i = 0; psize >= onesize; psize -= onesize, prop += onesize, i++)
485 if ((prop[0] & 0xff) == ((bar_no * 4) + PCI_BASE_ADDRESS_0)) { 477 if ((prop[0] & 0xff) == ((bar_no * 4) + PCI_BASE_ADDRESS_0)) {
486 if (size) 478 if (size)
487 *size = of_read_addr(prop + na, ns); 479 *size = of_read_number(prop + na, ns);
488 if (flags) 480 if (flags)
489 *flags = bus->get_flags(prop); 481 *flags = bus->get_flags(prop);
490 return prop; 482 return prop;
@@ -565,11 +557,414 @@ void of_parse_dma_window(struct device_node *dn, unsigned char *dma_window_prop,
565 prop = get_property(dn, "#address-cells", NULL); 557 prop = get_property(dn, "#address-cells", NULL);
566 558
567 cells = prop ? *(u32 *)prop : prom_n_addr_cells(dn); 559 cells = prop ? *(u32 *)prop : prom_n_addr_cells(dn);
568 *phys = of_read_addr(dma_window, cells); 560 *phys = of_read_number(dma_window, cells);
569 561
570 dma_window += cells; 562 dma_window += cells;
571 563
572 prop = get_property(dn, "ibm,#dma-size-cells", NULL); 564 prop = get_property(dn, "ibm,#dma-size-cells", NULL);
573 cells = prop ? *(u32 *)prop : prom_n_size_cells(dn); 565 cells = prop ? *(u32 *)prop : prom_n_size_cells(dn);
574 *size = of_read_addr(dma_window, cells); 566 *size = of_read_number(dma_window, cells);
567}
568
569/*
570 * Interrupt remapper
571 */
572
573static unsigned int of_irq_workarounds;
574static struct device_node *of_irq_dflt_pic;
575
576static struct device_node *of_irq_find_parent(struct device_node *child)
577{
578 struct device_node *p;
579 phandle *parp;
580
581 if (!of_node_get(child))
582 return NULL;
583
584 do {
585 parp = (phandle *)get_property(child, "interrupt-parent", NULL);
586 if (parp == NULL)
587 p = of_get_parent(child);
588 else {
589 if (of_irq_workarounds & OF_IMAP_NO_PHANDLE)
590 p = of_node_get(of_irq_dflt_pic);
591 else
592 p = of_find_node_by_phandle(*parp);
593 }
594 of_node_put(child);
595 child = p;
596 } while (p && get_property(p, "#interrupt-cells", NULL) == NULL);
597
598 return p;
599}
600
601static u8 of_irq_pci_swizzle(u8 slot, u8 pin)
602{
603 return (((pin - 1) + slot) % 4) + 1;
575} 604}
605
606/* This doesn't need to be called if you don't have any special workaround
607 * flags to pass
608 */
609void of_irq_map_init(unsigned int flags)
610{
611 of_irq_workarounds = flags;
612
613 /* OldWorld, don't bother looking at other things */
614 if (flags & OF_IMAP_OLDWORLD_MAC)
615 return;
616
617 /* If we don't have phandles, let's try to locate a default interrupt
618 * controller (happens when booting with BootX). We do a first match
619 * here, hopefully, that only ever happens on machines with one
620 * controller.
621 */
622 if (flags & OF_IMAP_NO_PHANDLE) {
623 struct device_node *np;
624
625 for(np = NULL; (np = of_find_all_nodes(np)) != NULL;) {
626 if (get_property(np, "interrupt-controller", NULL)
627 == NULL)
628 continue;
629 /* Skip /chosen/interrupt-controller */
630 if (strcmp(np->name, "chosen") == 0)
631 continue;
632 /* It seems like at least one person on this planet wants
633 * to use BootX on a machine with an AppleKiwi controller
634 * which happens to pretend to be an interrupt
635 * controller too.
636 */
637 if (strcmp(np->name, "AppleKiwi") == 0)
638 continue;
639 /* I think we found one ! */
640 of_irq_dflt_pic = np;
641 break;
642 }
643 }
644
645}
646
647int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 *addr,
648 struct of_irq *out_irq)
649{
650 struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL;
651 u32 *tmp, *imap, *imask;
652 u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0;
653 int imaplen, match, i;
654
655 ipar = of_node_get(parent);
656
657 /* First get the #interrupt-cells property of the current cursor
658 * that tells us how to interpret the passed-in intspec. If there
659 * is none, we are nice and just walk up the tree
660 */
661 do {
662 tmp = (u32 *)get_property(ipar, "#interrupt-cells", NULL);
663 if (tmp != NULL) {
664 intsize = *tmp;
665 break;
666 }
667 tnode = ipar;
668 ipar = of_irq_find_parent(ipar);
669 of_node_put(tnode);
670 } while (ipar);
671 if (ipar == NULL) {
672 DBG(" -> no parent found !\n");
673 goto fail;
674 }
675
676 DBG("of_irq_map_raw: ipar=%s, size=%d\n", ipar->full_name, intsize);
677
678 /* Look for this #address-cells. We have to implement the old linux
679 * trick of looking for the parent here as some device-trees rely on it
680 */
681 old = of_node_get(ipar);
682 do {
683 tmp = (u32 *)get_property(old, "#address-cells", NULL);
684 tnode = of_get_parent(old);
685 of_node_put(old);
686 old = tnode;
687 } while(old && tmp == NULL);
688 of_node_put(old);
689 old = NULL;
690 addrsize = (tmp == NULL) ? 2 : *tmp;
691
692 DBG(" -> addrsize=%d\n", addrsize);
693
694 /* Now start the actual "proper" walk of the interrupt tree */
695 while (ipar != NULL) {
696 /* Now check if cursor is an interrupt-controller and if it is
697 * then we are done
698 */
699 if (get_property(ipar, "interrupt-controller", NULL) != NULL) {
700 DBG(" -> got it !\n");
701 memcpy(out_irq->specifier, intspec,
702 intsize * sizeof(u32));
703 out_irq->size = intsize;
704 out_irq->controller = ipar;
705 of_node_put(old);
706 return 0;
707 }
708
709 /* Now look for an interrupt-map */
710 imap = (u32 *)get_property(ipar, "interrupt-map", &imaplen);
711 /* No interrupt map, check for an interrupt parent */
712 if (imap == NULL) {
713 DBG(" -> no map, getting parent\n");
714 newpar = of_irq_find_parent(ipar);
715 goto skiplevel;
716 }
717 imaplen /= sizeof(u32);
718
719 /* Look for a mask */
720 imask = (u32 *)get_property(ipar, "interrupt-map-mask", NULL);
721
722 /* If we were passed no "reg" property and we attempt to parse
723 * an interrupt-map, then #address-cells must be 0.
724 * Fail if it's not.
725 */
726 if (addr == NULL && addrsize != 0) {
727 DBG(" -> no reg passed in when needed !\n");
728 goto fail;
729 }
730
731 /* Parse interrupt-map */
732 match = 0;
733 while (imaplen > (addrsize + intsize + 1) && !match) {
734 /* Compare specifiers */
735 match = 1;
736 for (i = 0; i < addrsize && match; ++i) {
737 u32 mask = imask ? imask[i] : 0xffffffffu;
738 match = ((addr[i] ^ imap[i]) & mask) == 0;
739 }
740 for (; i < (addrsize + intsize) && match; ++i) {
741 u32 mask = imask ? imask[i] : 0xffffffffu;
742 match =
743 ((intspec[i-addrsize] ^ imap[i]) & mask) == 0;
744 }
745 imap += addrsize + intsize;
746 imaplen -= addrsize + intsize;
747
748 DBG(" -> match=%d (imaplen=%d)\n", match, imaplen);
749
750 /* Get the interrupt parent */
751 if (of_irq_workarounds & OF_IMAP_NO_PHANDLE)
752 newpar = of_node_get(of_irq_dflt_pic);
753 else
754 newpar = of_find_node_by_phandle((phandle)*imap);
755 imap++;
756 --imaplen;
757
758 /* Check if not found */
759 if (newpar == NULL) {
760 DBG(" -> imap parent not found !\n");
761 goto fail;
762 }
763
764 /* Get #interrupt-cells and #address-cells of new
765 * parent
766 */
767 tmp = (u32 *)get_property(newpar, "#interrupt-cells",
768 NULL);
769 if (tmp == NULL) {
770 DBG(" -> parent lacks #interrupt-cells !\n");
771 goto fail;
772 }
773 newintsize = *tmp;
774 tmp = (u32 *)get_property(newpar, "#address-cells",
775 NULL);
776 newaddrsize = (tmp == NULL) ? 0 : *tmp;
777
778 DBG(" -> newintsize=%d, newaddrsize=%d\n",
779 newintsize, newaddrsize);
780
781 /* Check for malformed properties */
782 if (imaplen < (newaddrsize + newintsize))
783 goto fail;
784
785 imap += newaddrsize + newintsize;
786 imaplen -= newaddrsize + newintsize;
787
788 DBG(" -> imaplen=%d\n", imaplen);
789 }
790 if (!match)
791 goto fail;
792
793 of_node_put(old);
794 old = of_node_get(newpar);
795 addrsize = newaddrsize;
796 intsize = newintsize;
797 intspec = imap - intsize;
798 addr = intspec - addrsize;
799
800 skiplevel:
801 /* Iterate again with new parent */
802 DBG(" -> new parent: %s\n", newpar ? newpar->full_name : "<>");
803 of_node_put(ipar);
804 ipar = newpar;
805 newpar = NULL;
806 }
807 fail:
808 of_node_put(ipar);
809 of_node_put(old);
810 of_node_put(newpar);
811
812 return -EINVAL;
813}
814EXPORT_SYMBOL_GPL(of_irq_map_raw);
815
816#if defined(CONFIG_PPC_PMAC) && defined(CONFIG_PPC32)
817static int of_irq_map_oldworld(struct device_node *device, int index,
818 struct of_irq *out_irq)
819{
820 u32 *ints;
821 int intlen;
822
823 /*
824 * Old machines just have a list of interrupt numbers
825 * and no interrupt-controller nodes.
826 */
827 ints = (u32 *) get_property(device, "AAPL,interrupts", &intlen);
828 if (ints == NULL)
829 return -EINVAL;
830 intlen /= sizeof(u32);
831
832 if (index >= intlen)
833 return -EINVAL;
834
835 out_irq->controller = NULL;
836 out_irq->specifier[0] = ints[index];
837 out_irq->size = 1;
838
839 return 0;
840}
841#else /* defined(CONFIG_PPC_PMAC) && defined(CONFIG_PPC32) */
842static int of_irq_map_oldworld(struct device_node *device, int index,
843 struct of_irq *out_irq)
844{
845 return -EINVAL;
846}
847#endif /* !(defined(CONFIG_PPC_PMAC) && defined(CONFIG_PPC32)) */
848
849int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq)
850{
851 struct device_node *p;
852 u32 *intspec, *tmp, intsize, intlen, *addr;
853 int res;
854
855 DBG("of_irq_map_one: dev=%s, index=%d\n", device->full_name, index);
856
857 /* OldWorld mac stuff is "special", handle out of line */
858 if (of_irq_workarounds & OF_IMAP_OLDWORLD_MAC)
859 return of_irq_map_oldworld(device, index, out_irq);
860
861 /* Get the interrupts property */
862 intspec = (u32 *)get_property(device, "interrupts", &intlen);
863 if (intspec == NULL)
864 return -EINVAL;
865 intlen /= sizeof(u32);
866
867 /* Get the reg property (if any) */
868 addr = (u32 *)get_property(device, "reg", NULL);
869
870 /* Look for the interrupt parent. */
871 p = of_irq_find_parent(device);
872 if (p == NULL)
873 return -EINVAL;
874
875 /* Get size of interrupt specifier */
876 tmp = (u32 *)get_property(p, "#interrupt-cells", NULL);
877 if (tmp == NULL) {
878 of_node_put(p);
879 return -EINVAL;
880 }
881 intsize = *tmp;
882
883 /* Check index */
884 if (index * intsize >= intlen)
885 return -EINVAL;
886
887 /* Get new specifier and map it */
888 res = of_irq_map_raw(p, intspec + index * intsize, addr, out_irq);
889 of_node_put(p);
890 return res;
891}
892EXPORT_SYMBOL_GPL(of_irq_map_one);
893
894int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq)
895{
896 struct device_node *dn, *ppnode;
897 struct pci_dev *ppdev;
898 u32 lspec;
899 u32 laddr[3];
900 u8 pin;
901 int rc;
902
903 /* Check if we have a device node, if yes, fallback to standard OF
904 * parsing
905 */
906 dn = pci_device_to_OF_node(pdev);
907 if (dn)
908 return of_irq_map_one(dn, 0, out_irq);
909
910 /* Ok, we don't, time to have fun. Let's start by building up an
911 * interrupt spec. we assume #interrupt-cells is 1, which is standard
912 * for PCI. If you do different, then don't use that routine.
913 */
914 rc = pci_read_config_byte(pdev, PCI_INTERRUPT_PIN, &pin);
915 if (rc != 0)
916 return rc;
917 /* No pin, exit */
918 if (pin == 0)
919 return -ENODEV;
920
921 /* Now we walk up the PCI tree */
922 lspec = pin;
923 for (;;) {
924 /* Get the pci_dev of our parent */
925 ppdev = pdev->bus->self;
926
927 /* Ouch, it's a host bridge... */
928 if (ppdev == NULL) {
929#ifdef CONFIG_PPC64
930 ppnode = pci_bus_to_OF_node(pdev->bus);
931#else
932 struct pci_controller *host;
933 host = pci_bus_to_host(pdev->bus);
934 ppnode = host ? host->arch_data : NULL;
935#endif
936 /* No node for host bridge ? give up */
937 if (ppnode == NULL)
938 return -EINVAL;
939 } else
940 /* We found a P2P bridge, check if it has a node */
941 ppnode = pci_device_to_OF_node(ppdev);
942
943 /* Ok, we have found a parent with a device-node, hand over to
944 * the OF parsing code.
945 * We build a unit address from the linux device to be used for
946 * resolution. Note that we use the linux bus number which may
947 * not match your firmware bus numbering.
948 * Fortunately, in most cases, interrupt-map-mask doesn't include
949 * the bus number as part of the matching.
950 * You should still be careful about that though if you intend
951 * to rely on this function (you ship a firmware that doesn't
952 * create device nodes for all PCI devices).
953 */
954 if (ppnode)
955 break;
956
957 /* We can only get here if we hit a P2P bridge with no node,
958 * let's do standard swizzling and try again
959 */
960 lspec = of_irq_pci_swizzle(PCI_SLOT(pdev->devfn), lspec);
961 pdev = ppdev;
962 }
963
964 laddr[0] = (pdev->bus->number << 16)
965 | (pdev->devfn << 8);
966 laddr[1] = laddr[2] = 0;
967 return of_irq_map_raw(ppnode, &lspec, laddr, out_irq);
968}
969EXPORT_SYMBOL_GPL(of_irq_map_pci);
970
diff --git a/arch/powerpc/kernel/ptrace-common.h b/arch/powerpc/kernel/ptrace-common.h
index c42a860c8d25..8797ae737a7b 100644
--- a/arch/powerpc/kernel/ptrace-common.h
+++ b/arch/powerpc/kernel/ptrace-common.h
@@ -10,7 +10,6 @@
10#ifndef _PPC64_PTRACE_COMMON_H 10#ifndef _PPC64_PTRACE_COMMON_H
11#define _PPC64_PTRACE_COMMON_H 11#define _PPC64_PTRACE_COMMON_H
12 12
13#include <linux/config.h>
14#include <asm/system.h> 13#include <asm/system.h>
15 14
16/* 15/*
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index 5563e2e7d89c..dea75d73f983 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -15,7 +15,6 @@
15 * this archive for more details. 15 * this archive for more details.
16 */ 16 */
17 17
18#include <linux/config.h>
19#include <linux/kernel.h> 18#include <linux/kernel.h>
20#include <linux/sched.h> 19#include <linux/sched.h>
21#include <linux/mm.h> 20#include <linux/mm.h>
diff --git a/arch/powerpc/kernel/ptrace32.c b/arch/powerpc/kernel/ptrace32.c
index 826ee3d056de..9b9a230349bc 100644
--- a/arch/powerpc/kernel/ptrace32.c
+++ b/arch/powerpc/kernel/ptrace32.c
@@ -17,7 +17,6 @@
17 * this archive for more details. 17 * this archive for more details.
18 */ 18 */
19 19
20#include <linux/config.h>
21#include <linux/kernel.h> 20#include <linux/kernel.h>
22#include <linux/sched.h> 21#include <linux/sched.h>
23#include <linux/mm.h> 22#include <linux/mm.h>
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 17dc79198515..4a4cb5598402 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -38,16 +38,19 @@
38struct rtas_t rtas = { 38struct rtas_t rtas = {
39 .lock = SPIN_LOCK_UNLOCKED 39 .lock = SPIN_LOCK_UNLOCKED
40}; 40};
41EXPORT_SYMBOL(rtas);
41 42
42struct rtas_suspend_me_data { 43struct rtas_suspend_me_data {
43 long waiting; 44 long waiting;
44 struct rtas_args *args; 45 struct rtas_args *args;
45}; 46};
46 47
47EXPORT_SYMBOL(rtas);
48
49DEFINE_SPINLOCK(rtas_data_buf_lock); 48DEFINE_SPINLOCK(rtas_data_buf_lock);
49EXPORT_SYMBOL(rtas_data_buf_lock);
50
50char rtas_data_buf[RTAS_DATA_BUF_SIZE] __cacheline_aligned; 51char rtas_data_buf[RTAS_DATA_BUF_SIZE] __cacheline_aligned;
52EXPORT_SYMBOL(rtas_data_buf);
53
51unsigned long rtas_rmo_buf; 54unsigned long rtas_rmo_buf;
52 55
53/* 56/*
@@ -106,11 +109,71 @@ static void call_rtas_display_status_delay(char c)
106 } 109 }
107} 110}
108 111
109void __init udbg_init_rtas(void) 112void __init udbg_init_rtas_panel(void)
110{ 113{
111 udbg_putc = call_rtas_display_status_delay; 114 udbg_putc = call_rtas_display_status_delay;
112} 115}
113 116
117#ifdef CONFIG_UDBG_RTAS_CONSOLE
118
119/* If you think you're dying before early_init_dt_scan_rtas() does its
120 * work, you can hard code the token values for your firmware here and
121 * hardcode rtas.base/entry etc.
122 */
123static unsigned int rtas_putchar_token = RTAS_UNKNOWN_SERVICE;
124static unsigned int rtas_getchar_token = RTAS_UNKNOWN_SERVICE;
125
126static void udbg_rtascon_putc(char c)
127{
128 int tries;
129
130 if (!rtas.base)
131 return;
132
133 /* Add CRs before LFs */
134 if (c == '\n')
135 udbg_rtascon_putc('\r');
136
137 /* if there is more than one character to be displayed, wait a bit */
138 for (tries = 0; tries < 16; tries++) {
139 if (rtas_call(rtas_putchar_token, 1, 1, NULL, c) == 0)
140 break;
141 udelay(1000);
142 }
143}
144
145static int udbg_rtascon_getc_poll(void)
146{
147 int c;
148
149 if (!rtas.base)
150 return -1;
151
152 if (rtas_call(rtas_getchar_token, 0, 2, &c))
153 return -1;
154
155 return c;
156}
157
158static int udbg_rtascon_getc(void)
159{
160 int c;
161
162 while ((c = udbg_rtascon_getc_poll()) == -1)
163 ;
164
165 return c;
166}
167
168
169void __init udbg_init_rtas_console(void)
170{
171 udbg_putc = udbg_rtascon_putc;
172 udbg_getc = udbg_rtascon_getc;
173 udbg_getc_poll = udbg_rtascon_getc_poll;
174}
175#endif /* CONFIG_UDBG_RTAS_CONSOLE */
176
114void rtas_progress(char *s, unsigned short hex) 177void rtas_progress(char *s, unsigned short hex)
115{ 178{
116 struct device_node *root; 179 struct device_node *root;
@@ -236,6 +299,7 @@ int rtas_token(const char *service)
236 tokp = (int *) get_property(rtas.dev, service, NULL); 299 tokp = (int *) get_property(rtas.dev, service, NULL);
237 return tokp ? *tokp : RTAS_UNKNOWN_SERVICE; 300 return tokp ? *tokp : RTAS_UNKNOWN_SERVICE;
238} 301}
302EXPORT_SYMBOL(rtas_token);
239 303
240#ifdef CONFIG_RTAS_ERROR_LOGGING 304#ifdef CONFIG_RTAS_ERROR_LOGGING
241/* 305/*
@@ -328,7 +392,7 @@ int rtas_call(int token, int nargs, int nret, int *outputs, ...)
328 char *buff_copy = NULL; 392 char *buff_copy = NULL;
329 int ret; 393 int ret;
330 394
331 if (token == RTAS_UNKNOWN_SERVICE) 395 if (!rtas.entry || token == RTAS_UNKNOWN_SERVICE)
332 return -1; 396 return -1;
333 397
334 /* Gotta do something different here, use global lock for now... */ 398 /* Gotta do something different here, use global lock for now... */
@@ -369,6 +433,7 @@ int rtas_call(int token, int nargs, int nret, int *outputs, ...)
369 } 433 }
370 return ret; 434 return ret;
371} 435}
436EXPORT_SYMBOL(rtas_call);
372 437
373/* For RTAS_BUSY (-2), delay for 1 millisecond. For an extended busy status 438/* For RTAS_BUSY (-2), delay for 1 millisecond. For an extended busy status
374 * code of 990n, perform the hinted delay of 10^n (last digit) milliseconds. 439 * code of 990n, perform the hinted delay of 10^n (last digit) milliseconds.
@@ -388,6 +453,7 @@ unsigned int rtas_busy_delay_time(int status)
388 453
389 return ms; 454 return ms;
390} 455}
456EXPORT_SYMBOL(rtas_busy_delay_time);
391 457
392/* For an RTAS busy status code, perform the hinted delay. */ 458/* For an RTAS busy status code, perform the hinted delay. */
393unsigned int rtas_busy_delay(int status) 459unsigned int rtas_busy_delay(int status)
@@ -401,6 +467,7 @@ unsigned int rtas_busy_delay(int status)
401 467
402 return ms; 468 return ms;
403} 469}
470EXPORT_SYMBOL(rtas_busy_delay);
404 471
405int rtas_error_rc(int rtas_rc) 472int rtas_error_rc(int rtas_rc)
406{ 473{
@@ -446,6 +513,7 @@ int rtas_get_power_level(int powerdomain, int *level)
446 return rtas_error_rc(rc); 513 return rtas_error_rc(rc);
447 return rc; 514 return rc;
448} 515}
516EXPORT_SYMBOL(rtas_get_power_level);
449 517
450int rtas_set_power_level(int powerdomain, int level, int *setlevel) 518int rtas_set_power_level(int powerdomain, int level, int *setlevel)
451{ 519{
@@ -463,6 +531,7 @@ int rtas_set_power_level(int powerdomain, int level, int *setlevel)
463 return rtas_error_rc(rc); 531 return rtas_error_rc(rc);
464 return rc; 532 return rc;
465} 533}
534EXPORT_SYMBOL(rtas_set_power_level);
466 535
467int rtas_get_sensor(int sensor, int index, int *state) 536int rtas_get_sensor(int sensor, int index, int *state)
468{ 537{
@@ -480,6 +549,7 @@ int rtas_get_sensor(int sensor, int index, int *state)
480 return rtas_error_rc(rc); 549 return rtas_error_rc(rc);
481 return rc; 550 return rc;
482} 551}
552EXPORT_SYMBOL(rtas_get_sensor);
483 553
484int rtas_set_indicator(int indicator, int index, int new_value) 554int rtas_set_indicator(int indicator, int index, int new_value)
485{ 555{
@@ -497,6 +567,7 @@ int rtas_set_indicator(int indicator, int index, int new_value)
497 return rtas_error_rc(rc); 567 return rtas_error_rc(rc);
498 return rc; 568 return rc;
499} 569}
570EXPORT_SYMBOL(rtas_set_indicator);
500 571
501void rtas_restart(char *cmd) 572void rtas_restart(char *cmd)
502{ 573{
@@ -791,14 +862,34 @@ void __init rtas_initialize(void)
791#endif 862#endif
792} 863}
793 864
865int __init early_init_dt_scan_rtas(unsigned long node,
866 const char *uname, int depth, void *data)
867{
868 u32 *basep, *entryp, *sizep;
794 869
795EXPORT_SYMBOL(rtas_token); 870 if (depth != 1 || strcmp(uname, "rtas") != 0)
796EXPORT_SYMBOL(rtas_call); 871 return 0;
797EXPORT_SYMBOL(rtas_data_buf); 872
798EXPORT_SYMBOL(rtas_data_buf_lock); 873 basep = of_get_flat_dt_prop(node, "linux,rtas-base", NULL);
799EXPORT_SYMBOL(rtas_busy_delay_time); 874 entryp = of_get_flat_dt_prop(node, "linux,rtas-entry", NULL);
800EXPORT_SYMBOL(rtas_busy_delay); 875 sizep = of_get_flat_dt_prop(node, "rtas-size", NULL);
801EXPORT_SYMBOL(rtas_get_sensor); 876
802EXPORT_SYMBOL(rtas_get_power_level); 877 if (basep && entryp && sizep) {
803EXPORT_SYMBOL(rtas_set_power_level); 878 rtas.base = *basep;
804EXPORT_SYMBOL(rtas_set_indicator); 879 rtas.entry = *entryp;
880 rtas.size = *sizep;
881 }
882
883#ifdef CONFIG_UDBG_RTAS_CONSOLE
884 basep = of_get_flat_dt_prop(node, "put-term-char", NULL);
885 if (basep)
886 rtas_putchar_token = *basep;
887
888 basep = of_get_flat_dt_prop(node, "get-term-char", NULL);
889 if (basep)
890 rtas_getchar_token = *basep;
891#endif
892
893 /* break now */
894 return 1;
895}
diff --git a/arch/powerpc/kernel/rtas_pci.c b/arch/powerpc/kernel/rtas_pci.c
index 6eb7e49b394a..cda022657324 100644
--- a/arch/powerpc/kernel/rtas_pci.c
+++ b/arch/powerpc/kernel/rtas_pci.c
@@ -297,19 +297,9 @@ unsigned long __init find_and_init_phbs(void)
297 struct device_node *node; 297 struct device_node *node;
298 struct pci_controller *phb; 298 struct pci_controller *phb;
299 unsigned int index; 299 unsigned int index;
300 unsigned int root_size_cells = 0;
301 unsigned int *opprop = NULL;
302 struct device_node *root = of_find_node_by_path("/"); 300 struct device_node *root = of_find_node_by_path("/");
303 301
304 if (ppc64_interrupt_controller == IC_OPEN_PIC) {
305 opprop = (unsigned int *)get_property(root,
306 "platform-open-pic", NULL);
307 }
308
309 root_size_cells = prom_n_size_cells(root);
310
311 index = 0; 302 index = 0;
312
313 for (node = of_get_next_child(root, NULL); 303 for (node = of_get_next_child(root, NULL);
314 node != NULL; 304 node != NULL;
315 node = of_get_next_child(root, node)) { 305 node = of_get_next_child(root, node)) {
@@ -324,13 +314,6 @@ unsigned long __init find_and_init_phbs(void)
324 setup_phb(node, phb); 314 setup_phb(node, phb);
325 pci_process_bridge_OF_ranges(phb, node, 0); 315 pci_process_bridge_OF_ranges(phb, node, 0);
326 pci_setup_phb_io(phb, index == 0); 316 pci_setup_phb_io(phb, index == 0);
327#ifdef CONFIG_PPC_PSERIES
328 /* XXX This code need serious fixing ... --BenH */
329 if (ppc64_interrupt_controller == IC_OPEN_PIC && pSeries_mpic) {
330 int addr = root_size_cells * (index + 2) - 1;
331 mpic_assign_isu(pSeries_mpic, index, opprop[addr]);
332 }
333#endif
334 index++; 317 index++;
335 } 318 }
336 319
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index bd328123af75..c6d7b98af7d5 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -12,7 +12,6 @@
12 12
13#undef DEBUG 13#undef DEBUG
14 14
15#include <linux/config.h>
16#include <linux/module.h> 15#include <linux/module.h>
17#include <linux/string.h> 16#include <linux/string.h>
18#include <linux/sched.h> 17#include <linux/sched.h>
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index e5a44812441a..e0df2ba1ab9f 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -2,7 +2,6 @@
2 * Common prep/pmac/chrp boot and setup code. 2 * Common prep/pmac/chrp boot and setup code.
3 */ 3 */
4 4
5#include <linux/config.h>
6#include <linux/module.h> 5#include <linux/module.h>
7#include <linux/string.h> 6#include <linux/string.h>
8#include <linux/sched.h> 7#include <linux/sched.h>
@@ -52,7 +51,6 @@
52 51
53extern void bootx_init(unsigned long r4, unsigned long phys); 52extern void bootx_init(unsigned long r4, unsigned long phys);
54 53
55boot_infos_t *boot_infos;
56struct ide_machdep_calls ppc_ide_md; 54struct ide_machdep_calls ppc_ide_md;
57 55
58int boot_cpuid; 56int boot_cpuid;
@@ -215,7 +213,7 @@ int __init ppc_init(void)
215 213
216 /* register CPU devices */ 214 /* register CPU devices */
217 for_each_possible_cpu(i) 215 for_each_possible_cpu(i)
218 register_cpu(&cpu_devices[i], i, NULL); 216 register_cpu(&cpu_devices[i], i);
219 217
220 /* call platform init */ 218 /* call platform init */
221 if (ppc_md.init != NULL) { 219 if (ppc_md.init != NULL) {
@@ -241,7 +239,6 @@ void __init setup_arch(char **cmdline_p)
241 ppc_md.init_early(); 239 ppc_md.init_early();
242 240
243 find_legacy_serial_ports(); 241 find_legacy_serial_ports();
244 finish_device_tree();
245 242
246 smp_setup_cpu_maps(); 243 smp_setup_cpu_maps();
247 244
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 78f3a5fd43f6..fd1785e4c9bb 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -12,7 +12,6 @@
12 12
13#undef DEBUG 13#undef DEBUG
14 14
15#include <linux/config.h>
16#include <linux/module.h> 15#include <linux/module.h>
17#include <linux/string.h> 16#include <linux/string.h>
18#include <linux/sched.h> 17#include <linux/sched.h>
@@ -149,6 +148,13 @@ early_param("smt-enabled", early_smt_enabled);
149#define check_smt_enabled() 148#define check_smt_enabled()
150#endif /* CONFIG_SMP */ 149#endif /* CONFIG_SMP */
151 150
151/* Put the paca pointer into r13 and SPRG3 */
152void __init setup_paca(int cpu)
153{
154 local_paca = &paca[cpu];
155 mtspr(SPRN_SPRG3, local_paca);
156}
157
152/* 158/*
153 * Early initialization entry point. This is called by head.S 159 * Early initialization entry point. This is called by head.S
154 * with MMU translation disabled. We rely on the "feature" of 160 * with MMU translation disabled. We rely on the "feature" of
@@ -170,6 +176,9 @@ early_param("smt-enabled", early_smt_enabled);
170 176
171void __init early_setup(unsigned long dt_ptr) 177void __init early_setup(unsigned long dt_ptr)
172{ 178{
179 /* Assume we're on cpu 0 for now. Don't write to the paca yet! */
180 setup_paca(0);
181
173 /* Enable early debugging if any specified (see udbg.h) */ 182 /* Enable early debugging if any specified (see udbg.h) */
174 udbg_early_init(); 183 udbg_early_init();
175 184
@@ -183,7 +192,7 @@ void __init early_setup(unsigned long dt_ptr)
183 early_init_devtree(__va(dt_ptr)); 192 early_init_devtree(__va(dt_ptr));
184 193
185 /* Now we know the logical id of our boot cpu, setup the paca. */ 194 /* Now we know the logical id of our boot cpu, setup the paca. */
186 setup_boot_paca(); 195 setup_paca(boot_cpuid);
187 196
188 /* Fix up paca fields required for the boot cpu */ 197 /* Fix up paca fields required for the boot cpu */
189 get_paca()->cpu_start = 1; 198 get_paca()->cpu_start = 1;
@@ -350,22 +359,17 @@ void __init setup_system(void)
350 */ 359 */
351 unflatten_device_tree(); 360 unflatten_device_tree();
352 361
353#ifdef CONFIG_KEXEC
354 kexec_setup(); /* requires unflattened device tree. */
355#endif
356
357 /* 362 /*
358 * Fill the ppc64_caches & systemcfg structures with informations 363 * Fill the ppc64_caches & systemcfg structures with informations
359 * retrieved from the device-tree. Need to be called before 364 * retrieved from the device-tree.
360 * finish_device_tree() since the later requires some of the
361 * informations filled up here to properly parse the interrupt
362 * tree.
363 * It also sets up the cache line sizes which allows to call
364 * routines like flush_icache_range (used by the hash init
365 * later on).
366 */ 365 */
367 initialize_cache_info(); 366 initialize_cache_info();
368 367
368 /*
369 * Initialize irq remapping subsystem
370 */
371 irq_early_init();
372
369#ifdef CONFIG_PPC_RTAS 373#ifdef CONFIG_PPC_RTAS
370 /* 374 /*
371 * Initialize RTAS if available 375 * Initialize RTAS if available
@@ -393,12 +397,6 @@ void __init setup_system(void)
393 find_legacy_serial_ports(); 397 find_legacy_serial_ports();
394 398
395 /* 399 /*
396 * "Finish" the device-tree, that is do the actual parsing of
397 * some of the properties like the interrupt map
398 */
399 finish_device_tree();
400
401 /*
402 * Initialize xmon 400 * Initialize xmon
403 */ 401 */
404#ifdef CONFIG_XMON_DEFAULT 402#ifdef CONFIG_XMON_DEFAULT
@@ -426,8 +424,6 @@ void __init setup_system(void)
426 424
427 printk("-----------------------------------------------------\n"); 425 printk("-----------------------------------------------------\n");
428 printk("ppc64_pft_size = 0x%lx\n", ppc64_pft_size); 426 printk("ppc64_pft_size = 0x%lx\n", ppc64_pft_size);
429 printk("ppc64_interrupt_controller = 0x%ld\n",
430 ppc64_interrupt_controller);
431 printk("physicalMemorySize = 0x%lx\n", lmb_phys_mem_size()); 427 printk("physicalMemorySize = 0x%lx\n", lmb_phys_mem_size());
432 printk("ppc64_caches.dcache_line_size = 0x%x\n", 428 printk("ppc64_caches.dcache_line_size = 0x%x\n",
433 ppc64_caches.dline_size); 429 ppc64_caches.dline_size);
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index d73b25e22fca..320353f0926f 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -17,7 +17,6 @@
17 * 2 of the License, or (at your option) any later version. 17 * 2 of the License, or (at your option) any later version.
18 */ 18 */
19 19
20#include <linux/config.h>
21#include <linux/sched.h> 20#include <linux/sched.h>
22#include <linux/mm.h> 21#include <linux/mm.h>
23#include <linux/smp.h> 22#include <linux/smp.h>
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index 6e75d7ab6d4d..f72e8e823d78 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -12,7 +12,6 @@
12 * 2 of the License, or (at your option) any later version. 12 * 2 of the License, or (at your option) any later version.
13 */ 13 */
14 14
15#include <linux/config.h>
16#include <linux/sched.h> 15#include <linux/sched.h>
17#include <linux/mm.h> 16#include <linux/mm.h>
18#include <linux/smp.h> 17#include <linux/smp.h>
diff --git a/arch/powerpc/kernel/smp-tbsync.c b/arch/powerpc/kernel/smp-tbsync.c
index 9adef3bddad4..f19e2e0e61e7 100644
--- a/arch/powerpc/kernel/smp-tbsync.c
+++ b/arch/powerpc/kernel/smp-tbsync.c
@@ -5,7 +5,6 @@
5 * 5 *
6 */ 6 */
7 7
8#include <linux/config.h>
9#include <linux/kernel.h> 8#include <linux/kernel.h>
10#include <linux/sched.h> 9#include <linux/sched.h>
11#include <linux/smp.h> 10#include <linux/smp.h>
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index c5d179d4f818..46c56cfd1b2f 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -17,7 +17,6 @@
17 17
18#undef DEBUG 18#undef DEBUG
19 19
20#include <linux/config.h>
21#include <linux/kernel.h> 20#include <linux/kernel.h>
22#include <linux/module.h> 21#include <linux/module.h>
23#include <linux/sched.h> 22#include <linux/sched.h>
diff --git a/arch/powerpc/kernel/swsusp_32.S b/arch/powerpc/kernel/swsusp_32.S
index 69773cc1a85f..7369f9a6ad25 100644
--- a/arch/powerpc/kernel/swsusp_32.S
+++ b/arch/powerpc/kernel/swsusp_32.S
@@ -1,4 +1,3 @@
1#include <linux/config.h>
2#include <linux/threads.h> 1#include <linux/threads.h>
3#include <asm/processor.h> 2#include <asm/processor.h>
4#include <asm/page.h> 3#include <asm/page.h>
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index ec274e688816..2e292863e982 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -14,7 +14,6 @@
14 * 2 of the License, or (at your option) any later version. 14 * 2 of the License, or (at your option) any later version.
15 */ 15 */
16 16
17#include <linux/config.h>
18#include <linux/kernel.h> 17#include <linux/kernel.h>
19#include <linux/sched.h> 18#include <linux/sched.h>
20#include <linux/fs.h> 19#include <linux/fs.h>
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index 5bc2585c8036..010435095550 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -1,4 +1,3 @@
1#include <linux/config.h>
2#include <linux/sysdev.h> 1#include <linux/sysdev.h>
3#include <linux/cpu.h> 2#include <linux/cpu.h>
4#include <linux/smp.h> 3#include <linux/smp.h>
@@ -279,7 +278,7 @@ static void unregister_cpu_online(unsigned int cpu)
279} 278}
280#endif /* CONFIG_HOTPLUG_CPU */ 279#endif /* CONFIG_HOTPLUG_CPU */
281 280
282static int sysfs_cpu_notify(struct notifier_block *self, 281static int __devinit sysfs_cpu_notify(struct notifier_block *self,
283 unsigned long action, void *hcpu) 282 unsigned long action, void *hcpu)
284{ 283{
285 unsigned int cpu = (unsigned int)(long)hcpu; 284 unsigned int cpu = (unsigned int)(long)hcpu;
@@ -297,30 +296,19 @@ static int sysfs_cpu_notify(struct notifier_block *self,
297 return NOTIFY_OK; 296 return NOTIFY_OK;
298} 297}
299 298
300static struct notifier_block sysfs_cpu_nb = { 299static struct notifier_block __devinitdata sysfs_cpu_nb = {
301 .notifier_call = sysfs_cpu_notify, 300 .notifier_call = sysfs_cpu_notify,
302}; 301};
303 302
304/* NUMA stuff */ 303/* NUMA stuff */
305 304
306#ifdef CONFIG_NUMA 305#ifdef CONFIG_NUMA
307static struct node node_devices[MAX_NUMNODES];
308
309static void register_nodes(void) 306static void register_nodes(void)
310{ 307{
311 int i; 308 int i;
312 309
313 for (i = 0; i < MAX_NUMNODES; i++) { 310 for (i = 0; i < MAX_NUMNODES; i++)
314 if (node_online(i)) { 311 register_one_node(i);
315 int p_node = parent_node(i);
316 struct node *parent = NULL;
317
318 if (p_node != i)
319 parent = &node_devices[p_node];
320
321 register_node(&node_devices[i], i, parent);
322 }
323 }
324} 312}
325 313
326int sysfs_add_device_to_node(struct sys_device *dev, int nid) 314int sysfs_add_device_to_node(struct sys_device *dev, int nid)
@@ -359,23 +347,13 @@ static SYSDEV_ATTR(physical_id, 0444, show_physical_id, NULL);
359static int __init topology_init(void) 347static int __init topology_init(void)
360{ 348{
361 int cpu; 349 int cpu;
362 struct node *parent = NULL;
363 350
364 register_nodes(); 351 register_nodes();
365
366 register_cpu_notifier(&sysfs_cpu_nb); 352 register_cpu_notifier(&sysfs_cpu_nb);
367 353
368 for_each_possible_cpu(cpu) { 354 for_each_possible_cpu(cpu) {
369 struct cpu *c = &per_cpu(cpu_devices, cpu); 355 struct cpu *c = &per_cpu(cpu_devices, cpu);
370 356
371#ifdef CONFIG_NUMA
372 /* The node to which a cpu belongs can't be known
373 * until the cpu is made present.
374 */
375 parent = NULL;
376 if (cpu_present(cpu))
377 parent = &node_devices[cpu_to_node(cpu)];
378#endif
379 /* 357 /*
380 * For now, we just see if the system supports making 358 * For now, we just see if the system supports making
381 * the RTAS calls for CPU hotplug. But, there may be a 359 * the RTAS calls for CPU hotplug. But, there may be a
@@ -387,7 +365,7 @@ static int __init topology_init(void)
387 c->no_control = 1; 365 c->no_control = 1;
388 366
389 if (cpu_online(cpu) || (c->no_control == 0)) { 367 if (cpu_online(cpu) || (c->no_control == 0)) {
390 register_cpu(c, cpu, parent); 368 register_cpu(c, cpu);
391 369
392 sysdev_create_file(&c->sysdev, &attr_physical_id); 370 sysdev_create_file(&c->sysdev, &attr_physical_id);
393 } 371 }
diff --git a/arch/powerpc/kernel/systbl.S b/arch/powerpc/kernel/systbl.S
index ee75ccf1a802..579de70e0b4d 100644
--- a/arch/powerpc/kernel/systbl.S
+++ b/arch/powerpc/kernel/systbl.S
@@ -14,7 +14,6 @@
14 * 2 of the License, or (at your option) any later version. 14 * 2 of the License, or (at your option) any later version.
15 */ 15 */
16 16
17#include <linux/config.h>
18#include <asm/ppc_asm.h> 17#include <asm/ppc_asm.h>
19 18
20#ifdef CONFIG_PPC64 19#ifdef CONFIG_PPC64
diff --git a/arch/powerpc/kernel/tau_6xx.c b/arch/powerpc/kernel/tau_6xx.c
index 26bd8ea35a4e..368a4934f7ee 100644
--- a/arch/powerpc/kernel/tau_6xx.c
+++ b/arch/powerpc/kernel/tau_6xx.c
@@ -11,7 +11,6 @@
11 * life in portables, and add a 'performance/watt' metric somewhere in /proc 11 * life in portables, and add a 'performance/watt' metric somewhere in /proc
12 */ 12 */
13 13
14#include <linux/config.h>
15#include <linux/errno.h> 14#include <linux/errno.h>
16#include <linux/jiffies.h> 15#include <linux/jiffies.h>
17#include <linux/kernel.h> 16#include <linux/kernel.h>
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index d20907561f46..774c0a3c5019 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -32,7 +32,6 @@
32 * 2 of the License, or (at your option) any later version. 32 * 2 of the License, or (at your option) any later version.
33 */ 33 */
34 34
35#include <linux/config.h>
36#include <linux/errno.h> 35#include <linux/errno.h>
37#include <linux/module.h> 36#include <linux/module.h>
38#include <linux/sched.h> 37#include <linux/sched.h>
@@ -102,7 +101,7 @@ EXPORT_SYMBOL(tb_ticks_per_sec); /* for cputime_t conversions */
102u64 tb_to_xs; 101u64 tb_to_xs;
103unsigned tb_to_us; 102unsigned tb_to_us;
104 103
105#define TICKLEN_SCALE (SHIFT_SCALE - 10) 104#define TICKLEN_SCALE TICK_LENGTH_SHIFT
106u64 last_tick_len; /* units are ns / 2^TICKLEN_SCALE */ 105u64 last_tick_len; /* units are ns / 2^TICKLEN_SCALE */
107u64 ticklen_to_xs; /* 0.64 fraction */ 106u64 ticklen_to_xs; /* 0.64 fraction */
108 107
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 52f5659534f4..3c668078e524 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -14,7 +14,6 @@
14 * This file handles the architecture-dependent parts of hardware exceptions 14 * This file handles the architecture-dependent parts of hardware exceptions
15 */ 15 */
16 16
17#include <linux/config.h>
18#include <linux/errno.h> 17#include <linux/errno.h>
19#include <linux/sched.h> 18#include <linux/sched.h>
20#include <linux/kernel.h> 19#include <linux/kernel.h>
@@ -52,9 +51,13 @@
52#include <asm/firmware.h> 51#include <asm/firmware.h>
53#include <asm/processor.h> 52#include <asm/processor.h>
54#endif 53#endif
54#include <asm/kexec.h>
55 55
56#ifdef CONFIG_PPC64 /* XXX */ 56#ifdef CONFIG_PPC64 /* XXX */
57#define _IO_BASE pci_io_base 57#define _IO_BASE pci_io_base
58#ifdef CONFIG_KEXEC
59cpumask_t cpus_in_sr = CPU_MASK_NONE;
60#endif
58#endif 61#endif
59 62
60#ifdef CONFIG_DEBUGGER 63#ifdef CONFIG_DEBUGGER
@@ -97,7 +100,7 @@ static DEFINE_SPINLOCK(die_lock);
97 100
98int die(const char *str, struct pt_regs *regs, long err) 101int die(const char *str, struct pt_regs *regs, long err)
99{ 102{
100 static int die_counter, crash_dump_start = 0; 103 static int die_counter;
101 104
102 if (debugger(regs)) 105 if (debugger(regs))
103 return 1; 106 return 1;
@@ -137,21 +140,12 @@ int die(const char *str, struct pt_regs *regs, long err)
137 print_modules(); 140 print_modules();
138 show_regs(regs); 141 show_regs(regs);
139 bust_spinlocks(0); 142 bust_spinlocks(0);
143 spin_unlock_irq(&die_lock);
140 144
141 if (!crash_dump_start && kexec_should_crash(current)) { 145 if (kexec_should_crash(current) ||
142 crash_dump_start = 1; 146 kexec_sr_activated(smp_processor_id()))
143 spin_unlock_irq(&die_lock);
144 crash_kexec(regs); 147 crash_kexec(regs);
145 /* NOTREACHED */ 148 crash_kexec_secondary(regs);
146 }
147 spin_unlock_irq(&die_lock);
148 if (crash_dump_start)
149 /*
150 * Only for soft-reset: Other CPUs will be responded to an IPI
151 * sent by first kexec CPU.
152 */
153 for(;;)
154 ;
155 149
156 if (in_interrupt()) 150 if (in_interrupt())
157 panic("Fatal exception in interrupt"); 151 panic("Fatal exception in interrupt");
@@ -215,6 +209,10 @@ void system_reset_exception(struct pt_regs *regs)
215 return; 209 return;
216 } 210 }
217 211
212#ifdef CONFIG_KEXEC
213 cpu_set(smp_processor_id(), cpus_in_sr);
214#endif
215
218 die("System Reset", regs, SIGABRT); 216 die("System Reset", regs, SIGABRT);
219 217
220 /* Must die if the interrupt is not recoverable */ 218 /* Must die if the interrupt is not recoverable */
diff --git a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c
index 67d9fd9ae2b5..5730906b23d5 100644
--- a/arch/powerpc/kernel/udbg.c
+++ b/arch/powerpc/kernel/udbg.c
@@ -10,7 +10,6 @@
10 */ 10 */
11 11
12#include <stdarg.h> 12#include <stdarg.h>
13#include <linux/config.h>
14#include <linux/types.h> 13#include <linux/types.h>
15#include <linux/sched.h> 14#include <linux/sched.h>
16#include <linux/console.h> 15#include <linux/console.h>
@@ -34,9 +33,12 @@ void __init udbg_early_init(void)
34#elif defined(CONFIG_PPC_EARLY_DEBUG_G5) 33#elif defined(CONFIG_PPC_EARLY_DEBUG_G5)
35 /* For use on Apple G5 machines */ 34 /* For use on Apple G5 machines */
36 udbg_init_pmac_realmode(); 35 udbg_init_pmac_realmode();
37#elif defined(CONFIG_PPC_EARLY_DEBUG_RTAS) 36#elif defined(CONFIG_PPC_EARLY_DEBUG_RTAS_PANEL)
38 /* RTAS panel debug */ 37 /* RTAS panel debug */
39 udbg_init_rtas(); 38 udbg_init_rtas_panel();
39#elif defined(CONFIG_PPC_EARLY_DEBUG_RTAS_CONSOLE)
40 /* RTAS console debug */
41 udbg_init_rtas_console();
40#elif defined(CONFIG_PPC_EARLY_DEBUG_MAPLE) 42#elif defined(CONFIG_PPC_EARLY_DEBUG_MAPLE)
41 /* Maple real mode debug */ 43 /* Maple real mode debug */
42 udbg_init_maple_realmode(); 44 udbg_init_maple_realmode();
diff --git a/arch/powerpc/kernel/udbg_16550.c b/arch/powerpc/kernel/udbg_16550.c
index 5d29dcca523c..0835b4841dea 100644
--- a/arch/powerpc/kernel/udbg_16550.c
+++ b/arch/powerpc/kernel/udbg_16550.c
@@ -8,7 +8,6 @@
8 * as published by the Free Software Foundation; either version 8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11#include <linux/config.h>
12#include <linux/types.h> 11#include <linux/types.h>
13#include <asm/udbg.h> 12#include <asm/udbg.h>
14#include <asm/io.h> 13#include <asm/io.h>
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index bc3e15be3087..1a7e19cdab39 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -8,7 +8,6 @@
8 * 2 of the License, or (at your option) any later version. 8 * 2 of the License, or (at your option) any later version.
9 */ 9 */
10 10
11#include <linux/config.h>
12#include <linux/module.h> 11#include <linux/module.h>
13#include <linux/errno.h> 12#include <linux/errno.h>
14#include <linux/sched.h> 13#include <linux/sched.h>
diff --git a/arch/powerpc/kernel/vdso32/cacheflush.S b/arch/powerpc/kernel/vdso32/cacheflush.S
index 09629aea3e47..9cb319992c38 100644
--- a/arch/powerpc/kernel/vdso32/cacheflush.S
+++ b/arch/powerpc/kernel/vdso32/cacheflush.S
@@ -9,7 +9,6 @@
9 * as published by the Free Software Foundation; either version 9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version. 10 * 2 of the License, or (at your option) any later version.
11 */ 11 */
12#include <linux/config.h>
13#include <asm/processor.h> 12#include <asm/processor.h>
14#include <asm/ppc_asm.h> 13#include <asm/ppc_asm.h>
15#include <asm/vdso.h> 14#include <asm/vdso.h>
diff --git a/arch/powerpc/kernel/vdso32/datapage.S b/arch/powerpc/kernel/vdso32/datapage.S
index 4709f1d9542c..dc21e891d2e7 100644
--- a/arch/powerpc/kernel/vdso32/datapage.S
+++ b/arch/powerpc/kernel/vdso32/datapage.S
@@ -9,7 +9,6 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11
12#include <linux/config.h>
13#include <asm/processor.h> 12#include <asm/processor.h>
14#include <asm/ppc_asm.h> 13#include <asm/ppc_asm.h>
15#include <asm/asm-offsets.h> 14#include <asm/asm-offsets.h>
diff --git a/arch/powerpc/kernel/vdso32/gettimeofday.S b/arch/powerpc/kernel/vdso32/gettimeofday.S
index 7eebff03a041..05909f754307 100644
--- a/arch/powerpc/kernel/vdso32/gettimeofday.S
+++ b/arch/powerpc/kernel/vdso32/gettimeofday.S
@@ -10,7 +10,6 @@
10 * as published by the Free Software Foundation; either version 10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version. 11 * 2 of the License, or (at your option) any later version.
12 */ 12 */
13#include <linux/config.h>
14#include <asm/processor.h> 13#include <asm/processor.h>
15#include <asm/ppc_asm.h> 14#include <asm/ppc_asm.h>
16#include <asm/vdso.h> 15#include <asm/vdso.h>
diff --git a/arch/powerpc/kernel/vdso32/sigtramp.S b/arch/powerpc/kernel/vdso32/sigtramp.S
index 0c6a37b29dde..68d49dd71dcc 100644
--- a/arch/powerpc/kernel/vdso32/sigtramp.S
+++ b/arch/powerpc/kernel/vdso32/sigtramp.S
@@ -10,7 +10,6 @@
10 * as published by the Free Software Foundation; either version 10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version. 11 * 2 of the License, or (at your option) any later version.
12 */ 12 */
13#include <linux/config.h>
14#include <asm/processor.h> 13#include <asm/processor.h>
15#include <asm/ppc_asm.h> 14#include <asm/ppc_asm.h>
16#include <asm/unistd.h> 15#include <asm/unistd.h>
diff --git a/arch/powerpc/kernel/vdso64/cacheflush.S b/arch/powerpc/kernel/vdso64/cacheflush.S
index cb4ae0a5edd0..66a36d3cc6ad 100644
--- a/arch/powerpc/kernel/vdso64/cacheflush.S
+++ b/arch/powerpc/kernel/vdso64/cacheflush.S
@@ -9,7 +9,6 @@
9 * as published by the Free Software Foundation; either version 9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version. 10 * 2 of the License, or (at your option) any later version.
11 */ 11 */
12#include <linux/config.h>
13#include <asm/processor.h> 12#include <asm/processor.h>
14#include <asm/ppc_asm.h> 13#include <asm/ppc_asm.h>
15#include <asm/vdso.h> 14#include <asm/vdso.h>
diff --git a/arch/powerpc/kernel/vdso64/datapage.S b/arch/powerpc/kernel/vdso64/datapage.S
index 3b2dd7d0c1eb..79796de11737 100644
--- a/arch/powerpc/kernel/vdso64/datapage.S
+++ b/arch/powerpc/kernel/vdso64/datapage.S
@@ -9,7 +9,6 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11
12#include <linux/config.h>
13#include <asm/processor.h> 12#include <asm/processor.h>
14#include <asm/ppc_asm.h> 13#include <asm/ppc_asm.h>
15#include <asm/asm-offsets.h> 14#include <asm/asm-offsets.h>
diff --git a/arch/powerpc/kernel/vdso64/gettimeofday.S b/arch/powerpc/kernel/vdso64/gettimeofday.S
index 4ee871f1cadb..56e76ff5498f 100644
--- a/arch/powerpc/kernel/vdso64/gettimeofday.S
+++ b/arch/powerpc/kernel/vdso64/gettimeofday.S
@@ -11,7 +11,6 @@
11 * as published by the Free Software Foundation; either version 11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version. 12 * 2 of the License, or (at your option) any later version.
13 */ 13 */
14#include <linux/config.h>
15#include <asm/processor.h> 14#include <asm/processor.h>
16#include <asm/ppc_asm.h> 15#include <asm/ppc_asm.h>
17#include <asm/vdso.h> 16#include <asm/vdso.h>
diff --git a/arch/powerpc/kernel/vdso64/sigtramp.S b/arch/powerpc/kernel/vdso64/sigtramp.S
index 7479edb101b8..17a83fa6dc52 100644
--- a/arch/powerpc/kernel/vdso64/sigtramp.S
+++ b/arch/powerpc/kernel/vdso64/sigtramp.S
@@ -10,7 +10,6 @@
10 * as published by the Free Software Foundation; either version 10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version. 11 * 2 of the License, or (at your option) any later version.
12 */ 12 */
13#include <linux/config.h>
14#include <asm/processor.h> 13#include <asm/processor.h>
15#include <asm/ppc_asm.h> 14#include <asm/ppc_asm.h>
16#include <asm/unistd.h> 15#include <asm/unistd.h>
diff --git a/arch/powerpc/kernel/vector.S b/arch/powerpc/kernel/vector.S
index 9416b4ab92ec..49ac3d6e1399 100644
--- a/arch/powerpc/kernel/vector.S
+++ b/arch/powerpc/kernel/vector.S
@@ -1,4 +1,3 @@
1#include <linux/config.h>
2#include <asm/ppc_asm.h> 1#include <asm/ppc_asm.h>
3#include <asm/reg.h> 2#include <asm/reg.h>
4 3
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index cdf5867838a6..fad8580f9081 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -218,7 +218,6 @@ struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node)
218{ 218{
219 struct vio_dev *viodev; 219 struct vio_dev *viodev;
220 unsigned int *unit_address; 220 unsigned int *unit_address;
221 unsigned int *irq_p;
222 221
223 /* we need the 'device_type' property, in order to match with drivers */ 222 /* we need the 'device_type' property, in order to match with drivers */
224 if (of_node->type == NULL) { 223 if (of_node->type == NULL) {
@@ -243,16 +242,7 @@ struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node)
243 242
244 viodev->dev.platform_data = of_node_get(of_node); 243 viodev->dev.platform_data = of_node_get(of_node);
245 244
246 viodev->irq = NO_IRQ; 245 viodev->irq = irq_of_parse_and_map(of_node, 0);
247 irq_p = (unsigned int *)get_property(of_node, "interrupts", NULL);
248 if (irq_p) {
249 int virq = virt_irq_create_mapping(*irq_p);
250 if (virq == NO_IRQ) {
251 printk(KERN_ERR "Unable to allocate interrupt "
252 "number for %s\n", of_node->full_name);
253 } else
254 viodev->irq = irq_offset_up(virq);
255 }
256 246
257 snprintf(viodev->dev.bus_id, BUS_ID_SIZE, "%x", *unit_address); 247 snprintf(viodev->dev.bus_id, BUS_ID_SIZE, "%x", *unit_address);
258 viodev->name = of_node->name; 248 viodev->name = of_node->name;
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index 8b25953dc4f0..02665a02130d 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -1,4 +1,3 @@
1#include <linux/config.h>
2#ifdef CONFIG_PPC64 1#ifdef CONFIG_PPC64
3#include <asm/page.h> 2#include <asm/page.h>
4#define PROVIDE32(x) PROVIDE(__unused__##x) 3#define PROVIDE32(x) PROVIDE(__unused__##x)
diff --git a/arch/powerpc/lib/copy_32.S b/arch/powerpc/lib/copy_32.S
index bee51414812e..c657de59abca 100644
--- a/arch/powerpc/lib/copy_32.S
+++ b/arch/powerpc/lib/copy_32.S
@@ -8,7 +8,6 @@
8 * as published by the Free Software Foundation; either version 8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11#include <linux/config.h>
12#include <asm/processor.h> 11#include <asm/processor.h>
13#include <asm/cache.h> 12#include <asm/cache.h>
14#include <asm/errno.h> 13#include <asm/errno.h>
diff --git a/arch/powerpc/lib/locks.c b/arch/powerpc/lib/locks.c
index 8362fa272ca5..077bed7dc52b 100644
--- a/arch/powerpc/lib/locks.c
+++ b/arch/powerpc/lib/locks.c
@@ -12,7 +12,6 @@
12 * 2 of the License, or (at your option) any later version. 12 * 2 of the License, or (at your option) any later version.
13 */ 13 */
14 14
15#include <linux/config.h>
16#include <linux/kernel.h> 15#include <linux/kernel.h>
17#include <linux/spinlock.h> 16#include <linux/spinlock.h>
18#include <linux/module.h> 17#include <linux/module.h>
diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
index c251d9936612..9590ba780b98 100644
--- a/arch/powerpc/lib/sstep.c
+++ b/arch/powerpc/lib/sstep.c
@@ -10,7 +10,6 @@
10 */ 10 */
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/ptrace.h> 12#include <linux/ptrace.h>
13#include <linux/config.h>
14#include <asm/sstep.h> 13#include <asm/sstep.h>
15#include <asm/processor.h> 14#include <asm/processor.h>
16 15
diff --git a/arch/powerpc/lib/string.S b/arch/powerpc/lib/string.S
index b9ca84ed8927..c4c622d8e6ac 100644
--- a/arch/powerpc/lib/string.S
+++ b/arch/powerpc/lib/string.S
@@ -8,7 +8,6 @@
8 * as published by the Free Software Foundation; either version 8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11#include <linux/config.h>
12#include <asm/processor.h> 11#include <asm/processor.h>
13#include <asm/errno.h> 12#include <asm/errno.h>
14#include <asm/ppc_asm.h> 13#include <asm/ppc_asm.h>
diff --git a/arch/powerpc/math-emu/math.c b/arch/powerpc/math-emu/math.c
index 589153472761..69058b2873de 100644
--- a/arch/powerpc/math-emu/math.c
+++ b/arch/powerpc/math-emu/math.c
@@ -2,7 +2,6 @@
2 * Copyright (C) 1999 Eddie C. Dost (ecd@atecom.com) 2 * Copyright (C) 1999 Eddie C. Dost (ecd@atecom.com)
3 */ 3 */
4 4
5#include <linux/config.h>
6#include <linux/types.h> 5#include <linux/types.h>
7#include <linux/sched.h> 6#include <linux/sched.h>
8 7
diff --git a/arch/powerpc/mm/44x_mmu.c b/arch/powerpc/mm/44x_mmu.c
index 3d79ce281b67..376829ed2211 100644
--- a/arch/powerpc/mm/44x_mmu.c
+++ b/arch/powerpc/mm/44x_mmu.c
@@ -24,7 +24,6 @@
24 * 24 *
25 */ 25 */
26 26
27#include <linux/config.h>
28#include <linux/signal.h> 27#include <linux/signal.h>
29#include <linux/sched.h> 28#include <linux/sched.h>
30#include <linux/kernel.h> 29#include <linux/kernel.h>
diff --git a/arch/powerpc/mm/4xx_mmu.c b/arch/powerpc/mm/4xx_mmu.c
index 4d006aa1a0d1..838e09db71d9 100644
--- a/arch/powerpc/mm/4xx_mmu.c
+++ b/arch/powerpc/mm/4xx_mmu.c
@@ -21,7 +21,6 @@
21 * 21 *
22 */ 22 */
23 23
24#include <linux/config.h>
25#include <linux/signal.h> 24#include <linux/signal.h>
26#include <linux/sched.h> 25#include <linux/sched.h>
27#include <linux/kernel.h> 26#include <linux/kernel.h>
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index fdbba4206d59..78a0d59903ee 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -15,7 +15,6 @@
15 * 2 of the License, or (at your option) any later version. 15 * 2 of the License, or (at your option) any later version.
16 */ 16 */
17 17
18#include <linux/config.h>
19#include <linux/signal.h> 18#include <linux/signal.h>
20#include <linux/sched.h> 19#include <linux/sched.h>
21#include <linux/kernel.h> 20#include <linux/kernel.h>
@@ -40,6 +39,40 @@
40#include <asm/kdebug.h> 39#include <asm/kdebug.h>
41#include <asm/siginfo.h> 40#include <asm/siginfo.h>
42 41
42#ifdef CONFIG_KPROBES
43ATOMIC_NOTIFIER_HEAD(notify_page_fault_chain);
44
45/* Hook to register for page fault notifications */
46int register_page_fault_notifier(struct notifier_block *nb)
47{
48 return atomic_notifier_chain_register(&notify_page_fault_chain, nb);
49}
50
51int unregister_page_fault_notifier(struct notifier_block *nb)
52{
53 return atomic_notifier_chain_unregister(&notify_page_fault_chain, nb);
54}
55
56static inline int notify_page_fault(enum die_val val, const char *str,
57 struct pt_regs *regs, long err, int trap, int sig)
58{
59 struct die_args args = {
60 .regs = regs,
61 .str = str,
62 .err = err,
63 .trapnr = trap,
64 .signr = sig
65 };
66 return atomic_notifier_call_chain(&notify_page_fault_chain, val, &args);
67}
68#else
69static inline int notify_page_fault(enum die_val val, const char *str,
70 struct pt_regs *regs, long err, int trap, int sig)
71{
72 return NOTIFY_DONE;
73}
74#endif
75
43/* 76/*
44 * Check whether the instruction at regs->nip is a store using 77 * Check whether the instruction at regs->nip is a store using
45 * an update addressing form which will update r1. 78 * an update addressing form which will update r1.
@@ -142,7 +175,7 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
142 is_write = error_code & ESR_DST; 175 is_write = error_code & ESR_DST;
143#endif /* CONFIG_4xx || CONFIG_BOOKE */ 176#endif /* CONFIG_4xx || CONFIG_BOOKE */
144 177
145 if (notify_die(DIE_PAGE_FAULT, "page_fault", regs, error_code, 178 if (notify_page_fault(DIE_PAGE_FAULT, "page_fault", regs, error_code,
146 11, SIGSEGV) == NOTIFY_STOP) 179 11, SIGSEGV) == NOTIFY_STOP)
147 return 0; 180 return 0;
148 181
diff --git a/arch/powerpc/mm/fsl_booke_mmu.c b/arch/powerpc/mm/fsl_booke_mmu.c
index 5d581bb3aa12..123da03ab118 100644
--- a/arch/powerpc/mm/fsl_booke_mmu.c
+++ b/arch/powerpc/mm/fsl_booke_mmu.c
@@ -26,7 +26,6 @@
26 * 26 *
27 */ 27 */
28 28
29#include <linux/config.h>
30#include <linux/signal.h> 29#include <linux/signal.h>
31#include <linux/sched.h> 30#include <linux/sched.h>
32#include <linux/kernel.h> 31#include <linux/kernel.h>
diff --git a/arch/powerpc/mm/hash_low_32.S b/arch/powerpc/mm/hash_low_32.S
index 94255beeecd3..bd68df5fa78a 100644
--- a/arch/powerpc/mm/hash_low_32.S
+++ b/arch/powerpc/mm/hash_low_32.S
@@ -21,7 +21,6 @@
21 * 21 *
22 */ 22 */
23 23
24#include <linux/config.h>
25#include <asm/reg.h> 24#include <asm/reg.h>
26#include <asm/page.h> 25#include <asm/page.h>
27#include <asm/pgtable.h> 26#include <asm/pgtable.h>
diff --git a/arch/powerpc/mm/hash_low_64.S b/arch/powerpc/mm/hash_low_64.S
index 52e914238959..9bc0a9c2b9bc 100644
--- a/arch/powerpc/mm/hash_low_64.S
+++ b/arch/powerpc/mm/hash_low_64.S
@@ -10,7 +10,6 @@
10 * described in the kernel's COPYING file. 10 * described in the kernel's COPYING file.
11 */ 11 */
12 12
13#include <linux/config.h>
14#include <asm/reg.h> 13#include <asm/reg.h>
15#include <asm/pgtable.h> 14#include <asm/pgtable.h>
16#include <asm/mmu.h> 15#include <asm/mmu.h>
diff --git a/arch/powerpc/mm/hash_native_64.c b/arch/powerpc/mm/hash_native_64.c
index a0f3cbd00d39..c90f124f3c71 100644
--- a/arch/powerpc/mm/hash_native_64.c
+++ b/arch/powerpc/mm/hash_native_64.c
@@ -520,7 +520,7 @@ static inline int tlb_batching_enabled(void)
520} 520}
521#endif 521#endif
522 522
523void hpte_init_native(void) 523void __init hpte_init_native(void)
524{ 524{
525 ppc_md.hpte_invalidate = native_hpte_invalidate; 525 ppc_md.hpte_invalidate = native_hpte_invalidate;
526 ppc_md.hpte_updatepp = native_hpte_updatepp; 526 ppc_md.hpte_updatepp = native_hpte_updatepp;
@@ -530,5 +530,4 @@ void hpte_init_native(void)
530 ppc_md.hpte_clear_all = native_hpte_clear; 530 ppc_md.hpte_clear_all = native_hpte_clear;
531 if (tlb_batching_enabled()) 531 if (tlb_batching_enabled())
532 ppc_md.flush_hash_range = native_flush_hash_range; 532 ppc_md.flush_hash_range = native_flush_hash_range;
533 htab_finish_init();
534} 533}
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index d03fd2b4445e..1915661c2c81 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -21,7 +21,6 @@
21#undef DEBUG 21#undef DEBUG
22#undef DEBUG_LOW 22#undef DEBUG_LOW
23 23
24#include <linux/config.h>
25#include <linux/spinlock.h> 24#include <linux/spinlock.h>
26#include <linux/errno.h> 25#include <linux/errno.h>
27#include <linux/sched.h> 26#include <linux/sched.h>
@@ -167,34 +166,12 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
167 hash = hpt_hash(va, shift); 166 hash = hpt_hash(va, shift);
168 hpteg = ((hash & htab_hash_mask) * HPTES_PER_GROUP); 167 hpteg = ((hash & htab_hash_mask) * HPTES_PER_GROUP);
169 168
170 /* The crap below can be cleaned once ppd_md.probe() can 169 DBG("htab_bolt_mapping: calling %p\n", ppc_md.hpte_insert);
171 * set up the hash callbacks, thus we can just used the 170
172 * normal insert callback here. 171 BUG_ON(!ppc_md.hpte_insert);
173 */ 172 ret = ppc_md.hpte_insert(hpteg, va, paddr,
174#ifdef CONFIG_PPC_ISERIES 173 tmp_mode, HPTE_V_BOLTED, psize);
175 if (machine_is(iseries)) 174
176 ret = iSeries_hpte_insert(hpteg, va,
177 paddr,
178 tmp_mode,
179 HPTE_V_BOLTED,
180 psize);
181 else
182#endif
183#ifdef CONFIG_PPC_PSERIES
184 if (machine_is(pseries) && firmware_has_feature(FW_FEATURE_LPAR))
185 ret = pSeries_lpar_hpte_insert(hpteg, va,
186 paddr,
187 tmp_mode,
188 HPTE_V_BOLTED,
189 psize);
190 else
191#endif
192#ifdef CONFIG_PPC_MULTIPLATFORM
193 ret = native_hpte_insert(hpteg, va,
194 paddr,
195 tmp_mode, HPTE_V_BOLTED,
196 psize);
197#endif
198 if (ret < 0) 175 if (ret < 0)
199 break; 176 break;
200 } 177 }
@@ -413,6 +390,41 @@ void create_section_mapping(unsigned long start, unsigned long end)
413} 390}
414#endif /* CONFIG_MEMORY_HOTPLUG */ 391#endif /* CONFIG_MEMORY_HOTPLUG */
415 392
393static inline void make_bl(unsigned int *insn_addr, void *func)
394{
395 unsigned long funcp = *((unsigned long *)func);
396 int offset = funcp - (unsigned long)insn_addr;
397
398 *insn_addr = (unsigned int)(0x48000001 | (offset & 0x03fffffc));
399 flush_icache_range((unsigned long)insn_addr, 4+
400 (unsigned long)insn_addr);
401}
402
403static void __init htab_finish_init(void)
404{
405 extern unsigned int *htab_call_hpte_insert1;
406 extern unsigned int *htab_call_hpte_insert2;
407 extern unsigned int *htab_call_hpte_remove;
408 extern unsigned int *htab_call_hpte_updatepp;
409
410#ifdef CONFIG_PPC_64K_PAGES
411 extern unsigned int *ht64_call_hpte_insert1;
412 extern unsigned int *ht64_call_hpte_insert2;
413 extern unsigned int *ht64_call_hpte_remove;
414 extern unsigned int *ht64_call_hpte_updatepp;
415
416 make_bl(ht64_call_hpte_insert1, ppc_md.hpte_insert);
417 make_bl(ht64_call_hpte_insert2, ppc_md.hpte_insert);
418 make_bl(ht64_call_hpte_remove, ppc_md.hpte_remove);
419 make_bl(ht64_call_hpte_updatepp, ppc_md.hpte_updatepp);
420#endif /* CONFIG_PPC_64K_PAGES */
421
422 make_bl(htab_call_hpte_insert1, ppc_md.hpte_insert);
423 make_bl(htab_call_hpte_insert2, ppc_md.hpte_insert);
424 make_bl(htab_call_hpte_remove, ppc_md.hpte_remove);
425 make_bl(htab_call_hpte_updatepp, ppc_md.hpte_updatepp);
426}
427
416void __init htab_initialize(void) 428void __init htab_initialize(void)
417{ 429{
418 unsigned long table; 430 unsigned long table;
@@ -525,6 +537,8 @@ void __init htab_initialize(void)
525 mmu_linear_psize)); 537 mmu_linear_psize));
526 } 538 }
527 539
540 htab_finish_init();
541
528 DBG(" <- htab_initialize()\n"); 542 DBG(" <- htab_initialize()\n");
529} 543}
530#undef KB 544#undef KB
@@ -787,16 +801,6 @@ void flush_hash_range(unsigned long number, int local)
787 } 801 }
788} 802}
789 803
790static inline void make_bl(unsigned int *insn_addr, void *func)
791{
792 unsigned long funcp = *((unsigned long *)func);
793 int offset = funcp - (unsigned long)insn_addr;
794
795 *insn_addr = (unsigned int)(0x48000001 | (offset & 0x03fffffc));
796 flush_icache_range((unsigned long)insn_addr, 4+
797 (unsigned long)insn_addr);
798}
799
800/* 804/*
801 * low_hash_fault is called when we the low level hash code failed 805 * low_hash_fault is called when we the low level hash code failed
802 * to instert a PTE due to an hypervisor error 806 * to instert a PTE due to an hypervisor error
@@ -815,28 +819,3 @@ void low_hash_fault(struct pt_regs *regs, unsigned long address)
815 } 819 }
816 bad_page_fault(regs, address, SIGBUS); 820 bad_page_fault(regs, address, SIGBUS);
817} 821}
818
819void __init htab_finish_init(void)
820{
821 extern unsigned int *htab_call_hpte_insert1;
822 extern unsigned int *htab_call_hpte_insert2;
823 extern unsigned int *htab_call_hpte_remove;
824 extern unsigned int *htab_call_hpte_updatepp;
825
826#ifdef CONFIG_PPC_64K_PAGES
827 extern unsigned int *ht64_call_hpte_insert1;
828 extern unsigned int *ht64_call_hpte_insert2;
829 extern unsigned int *ht64_call_hpte_remove;
830 extern unsigned int *ht64_call_hpte_updatepp;
831
832 make_bl(ht64_call_hpte_insert1, ppc_md.hpte_insert);
833 make_bl(ht64_call_hpte_insert2, ppc_md.hpte_insert);
834 make_bl(ht64_call_hpte_remove, ppc_md.hpte_remove);
835 make_bl(ht64_call_hpte_updatepp, ppc_md.hpte_updatepp);
836#endif /* CONFIG_PPC_64K_PAGES */
837
838 make_bl(htab_call_hpte_insert1, ppc_md.hpte_insert);
839 make_bl(htab_call_hpte_insert2, ppc_md.hpte_insert);
840 make_bl(htab_call_hpte_remove, ppc_md.hpte_remove);
841 make_bl(htab_call_hpte_updatepp, ppc_md.hpte_updatepp);
842}
diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c
index b57fb3a2b7bb..0e53ca8f02fb 100644
--- a/arch/powerpc/mm/init_32.c
+++ b/arch/powerpc/mm/init_32.c
@@ -18,7 +18,6 @@
18 * 18 *
19 */ 19 */
20 20
21#include <linux/config.h>
22#include <linux/module.h> 21#include <linux/module.h>
23#include <linux/sched.h> 22#include <linux/sched.h>
24#include <linux/kernel.h> 23#include <linux/kernel.h>
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index 9e30f968c184..3ff374697e34 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -22,7 +22,6 @@
22 22
23#undef DEBUG 23#undef DEBUG
24 24
25#include <linux/config.h>
26#include <linux/signal.h> 25#include <linux/signal.h>
27#include <linux/sched.h> 26#include <linux/sched.h>
28#include <linux/kernel.h> 27#include <linux/kernel.h>
@@ -41,6 +40,7 @@
41#include <linux/idr.h> 40#include <linux/idr.h>
42#include <linux/nodemask.h> 41#include <linux/nodemask.h>
43#include <linux/module.h> 42#include <linux/module.h>
43#include <linux/poison.h>
44 44
45#include <asm/pgalloc.h> 45#include <asm/pgalloc.h>
46#include <asm/page.h> 46#include <asm/page.h>
@@ -90,7 +90,7 @@ void free_initmem(void)
90 90
91 addr = (unsigned long)__init_begin; 91 addr = (unsigned long)__init_begin;
92 for (; addr < (unsigned long)__init_end; addr += PAGE_SIZE) { 92 for (; addr < (unsigned long)__init_end; addr += PAGE_SIZE) {
93 memset((void *)addr, 0xcc, PAGE_SIZE); 93 memset((void *)addr, POISON_FREE_INITMEM, PAGE_SIZE);
94 ClearPageReserved(virt_to_page(addr)); 94 ClearPageReserved(virt_to_page(addr));
95 init_page_count(virt_to_page(addr)); 95 init_page_count(virt_to_page(addr));
96 free_page(addr); 96 free_page(addr);
diff --git a/arch/powerpc/mm/lmb.c b/arch/powerpc/mm/lmb.c
index 8b6f522655a6..4b17a7359924 100644
--- a/arch/powerpc/mm/lmb.c
+++ b/arch/powerpc/mm/lmb.c
@@ -10,7 +10,6 @@
10 * 2 of the License, or (at your option) any later version. 10 * 2 of the License, or (at your option) any later version.
11 */ 11 */
12 12
13#include <linux/config.h>
14#include <linux/kernel.h> 13#include <linux/kernel.h>
15#include <linux/init.h> 14#include <linux/init.h>
16#include <linux/bitops.h> 15#include <linux/bitops.h>
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 69f3b9a20beb..eebd8b83a6b0 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -18,7 +18,6 @@
18 * 18 *
19 */ 19 */
20 20
21#include <linux/config.h>
22#include <linux/module.h> 21#include <linux/module.h>
23#include <linux/sched.h> 22#include <linux/sched.h>
24#include <linux/kernel.h> 23#include <linux/kernel.h>
@@ -114,15 +113,20 @@ void online_page(struct page *page)
114 num_physpages++; 113 num_physpages++;
115} 114}
116 115
117int __devinit add_memory(u64 start, u64 size) 116#ifdef CONFIG_NUMA
117int memory_add_physaddr_to_nid(u64 start)
118{
119 return hot_add_scn_to_nid(start);
120}
121#endif
122
123int __devinit arch_add_memory(int nid, u64 start, u64 size)
118{ 124{
119 struct pglist_data *pgdata; 125 struct pglist_data *pgdata;
120 struct zone *zone; 126 struct zone *zone;
121 int nid;
122 unsigned long start_pfn = start >> PAGE_SHIFT; 127 unsigned long start_pfn = start >> PAGE_SHIFT;
123 unsigned long nr_pages = size >> PAGE_SHIFT; 128 unsigned long nr_pages = size >> PAGE_SHIFT;
124 129
125 nid = hot_add_scn_to_nid(start);
126 pgdata = NODE_DATA(nid); 130 pgdata = NODE_DATA(nid);
127 131
128 start = (unsigned long)__va(start); 132 start = (unsigned long)__va(start);
diff --git a/arch/powerpc/mm/mmu_context_32.c b/arch/powerpc/mm/mmu_context_32.c
index e326e4249e1a..792086b01000 100644
--- a/arch/powerpc/mm/mmu_context_32.c
+++ b/arch/powerpc/mm/mmu_context_32.c
@@ -23,7 +23,6 @@
23 * 23 *
24 */ 24 */
25 25
26#include <linux/config.h>
27#include <linux/mm.h> 26#include <linux/mm.h>
28#include <linux/init.h> 27#include <linux/init.h>
29 28
diff --git a/arch/powerpc/mm/mmu_context_64.c b/arch/powerpc/mm/mmu_context_64.c
index 65d18dca266f..90a06ac02d5e 100644
--- a/arch/powerpc/mm/mmu_context_64.c
+++ b/arch/powerpc/mm/mmu_context_64.c
@@ -10,7 +10,6 @@
10 * 10 *
11 */ 11 */
12 12
13#include <linux/config.h>
14#include <linux/sched.h> 13#include <linux/sched.h>
15#include <linux/kernel.h> 14#include <linux/kernel.h>
16#include <linux/errno.h> 15#include <linux/errno.h>
@@ -44,7 +43,9 @@ again:
44 return err; 43 return err;
45 44
46 if (index > MAX_CONTEXT) { 45 if (index > MAX_CONTEXT) {
46 spin_lock(&mmu_context_lock);
47 idr_remove(&mmu_context_idr, index); 47 idr_remove(&mmu_context_idr, index);
48 spin_unlock(&mmu_context_lock);
48 return -ENOMEM; 49 return -ENOMEM;
49 } 50 }
50 51
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index aa98cb3b59d8..fbe23933f731 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -334,7 +334,7 @@ out:
334 return nid; 334 return nid;
335} 335}
336 336
337static int cpu_numa_callback(struct notifier_block *nfb, 337static int __cpuinit cpu_numa_callback(struct notifier_block *nfb,
338 unsigned long action, 338 unsigned long action,
339 void *hcpu) 339 void *hcpu)
340{ 340{
@@ -609,14 +609,15 @@ static void __init *careful_allocation(int nid, unsigned long size,
609 return (void *)ret; 609 return (void *)ret;
610} 610}
611 611
612static struct notifier_block __cpuinitdata ppc64_numa_nb = {
613 .notifier_call = cpu_numa_callback,
614 .priority = 1 /* Must run before sched domains notifier. */
615};
616
612void __init do_init_bootmem(void) 617void __init do_init_bootmem(void)
613{ 618{
614 int nid; 619 int nid;
615 unsigned int i; 620 unsigned int i;
616 static struct notifier_block ppc64_numa_nb = {
617 .notifier_call = cpu_numa_callback,
618 .priority = 1 /* Must run before sched domains notifier. */
619 };
620 621
621 min_low_pfn = 0; 622 min_low_pfn = 0;
622 max_low_pfn = lmb_end_of_DRAM() >> PAGE_SHIFT; 623 max_low_pfn = lmb_end_of_DRAM() >> PAGE_SHIFT;
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index 90628601fac7..8fcacb0239da 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -20,7 +20,6 @@
20 * 20 *
21 */ 21 */
22 22
23#include <linux/config.h>
24#include <linux/kernel.h> 23#include <linux/kernel.h>
25#include <linux/module.h> 24#include <linux/module.h>
26#include <linux/types.h> 25#include <linux/types.h>
diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c
index 7b278d83739e..b1da03165496 100644
--- a/arch/powerpc/mm/pgtable_64.c
+++ b/arch/powerpc/mm/pgtable_64.c
@@ -22,7 +22,6 @@
22 * 22 *
23 */ 23 */
24 24
25#include <linux/config.h>
26#include <linux/signal.h> 25#include <linux/signal.h>
27#include <linux/sched.h> 26#include <linux/sched.h>
28#include <linux/kernel.h> 27#include <linux/kernel.h>
diff --git a/arch/powerpc/mm/ppc_mmu_32.c b/arch/powerpc/mm/ppc_mmu_32.c
index 2ed43a493b31..7cceb2c44cb9 100644
--- a/arch/powerpc/mm/ppc_mmu_32.c
+++ b/arch/powerpc/mm/ppc_mmu_32.c
@@ -23,7 +23,6 @@
23 * 23 *
24 */ 24 */
25 25
26#include <linux/config.h>
27#include <linux/kernel.h> 26#include <linux/kernel.h>
28#include <linux/mm.h> 27#include <linux/mm.h>
29#include <linux/init.h> 28#include <linux/init.h>
diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c
index 6a8bf6c6000e..de0c8842415c 100644
--- a/arch/powerpc/mm/slb.c
+++ b/arch/powerpc/mm/slb.c
@@ -16,7 +16,6 @@
16 16
17#undef DEBUG 17#undef DEBUG
18 18
19#include <linux/config.h>
20#include <asm/pgtable.h> 19#include <asm/pgtable.h>
21#include <asm/mmu.h> 20#include <asm/mmu.h>
22#include <asm/mmu_context.h> 21#include <asm/mmu_context.h>
diff --git a/arch/powerpc/mm/slb_low.S b/arch/powerpc/mm/slb_low.S
index 8548dcf8ef8b..dbc1abbde038 100644
--- a/arch/powerpc/mm/slb_low.S
+++ b/arch/powerpc/mm/slb_low.S
@@ -14,7 +14,6 @@
14 * 2 of the License, or (at your option) any later version. 14 * 2 of the License, or (at your option) any later version.
15 */ 15 */
16 16
17#include <linux/config.h>
18#include <asm/processor.h> 17#include <asm/processor.h>
19#include <asm/ppc_asm.h> 18#include <asm/ppc_asm.h>
20#include <asm/asm-offsets.h> 19#include <asm/asm-offsets.h>
diff --git a/arch/powerpc/mm/stab.c b/arch/powerpc/mm/stab.c
index 691320c90b78..eeeacab548e6 100644
--- a/arch/powerpc/mm/stab.c
+++ b/arch/powerpc/mm/stab.c
@@ -12,7 +12,6 @@
12 * 2 of the License, or (at your option) any later version. 12 * 2 of the License, or (at your option) any later version.
13 */ 13 */
14 14
15#include <linux/config.h>
16#include <asm/pgtable.h> 15#include <asm/pgtable.h>
17#include <asm/mmu.h> 16#include <asm/mmu.h>
18#include <asm/mmu_context.h> 17#include <asm/mmu_context.h>
diff --git a/arch/powerpc/mm/tlb_32.c b/arch/powerpc/mm/tlb_32.c
index 02eb23e036d5..925ff70be8ba 100644
--- a/arch/powerpc/mm/tlb_32.c
+++ b/arch/powerpc/mm/tlb_32.c
@@ -23,7 +23,6 @@
23 * 23 *
24 */ 24 */
25 25
26#include <linux/config.h>
27#include <linux/kernel.h> 26#include <linux/kernel.h>
28#include <linux/mm.h> 27#include <linux/mm.h>
29#include <linux/init.h> 28#include <linux/init.h>
diff --git a/arch/powerpc/mm/tlb_64.c b/arch/powerpc/mm/tlb_64.c
index e7449b068c82..f6eef78efd29 100644
--- a/arch/powerpc/mm/tlb_64.c
+++ b/arch/powerpc/mm/tlb_64.c
@@ -22,7 +22,6 @@
22 * 2 of the License, or (at your option) any later version. 22 * 2 of the License, or (at your option) any later version.
23 */ 23 */
24 24
25#include <linux/config.h>
26#include <linux/kernel.h> 25#include <linux/kernel.h>
27#include <linux/mm.h> 26#include <linux/mm.h>
28#include <linux/init.h> 27#include <linux/init.h>
diff --git a/arch/powerpc/oprofile/common.c b/arch/powerpc/oprofile/common.c
index 27ad56bd227e..fd0bbbe7a4de 100644
--- a/arch/powerpc/oprofile/common.c
+++ b/arch/powerpc/oprofile/common.c
@@ -94,7 +94,7 @@ static int op_powerpc_create_files(struct super_block *sb, struct dentry *root)
94 94
95 for (i = 0; i < model->num_counters; ++i) { 95 for (i = 0; i < model->num_counters; ++i) {
96 struct dentry *dir; 96 struct dentry *dir;
97 char buf[3]; 97 char buf[4];
98 98
99 snprintf(buf, sizeof buf, "%d", i); 99 snprintf(buf, sizeof buf, "%d", i);
100 dir = oprofilefs_mkdir(sb, root, buf); 100 dir = oprofilefs_mkdir(sb, root, buf);
diff --git a/arch/powerpc/platforms/83xx/misc.c b/arch/powerpc/platforms/83xx/misc.c
index 1455bcef4892..f0c6df61faa9 100644
--- a/arch/powerpc/platforms/83xx/misc.c
+++ b/arch/powerpc/platforms/83xx/misc.c
@@ -9,7 +9,6 @@
9 * option) any later version. 9 * option) any later version.
10 */ 10 */
11 11
12#include <linux/config.h>
13#include <linux/stddef.h> 12#include <linux/stddef.h>
14#include <linux/kernel.h> 13#include <linux/kernel.h>
15 14
diff --git a/arch/powerpc/platforms/83xx/mpc834x_sys.c b/arch/powerpc/platforms/83xx/mpc834x_sys.c
index 7e789d2420ba..3e1c16eb4a63 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_sys.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_sys.c
@@ -11,7 +11,6 @@
11 * option) any later version. 11 * option) any later version.
12 */ 12 */
13 13
14#include <linux/config.h>
15#include <linux/stddef.h> 14#include <linux/stddef.h>
16#include <linux/kernel.h> 15#include <linux/kernel.h>
17#include <linux/init.h> 16#include <linux/init.h>
diff --git a/arch/powerpc/platforms/83xx/pci.c b/arch/powerpc/platforms/83xx/pci.c
index 16f7d3b30e1d..3b5e563c279f 100644
--- a/arch/powerpc/platforms/83xx/pci.c
+++ b/arch/powerpc/platforms/83xx/pci.c
@@ -9,7 +9,6 @@
9 * option) any later version. 9 * option) any later version.
10 */ 10 */
11 11
12#include <linux/config.h>
13#include <linux/stddef.h> 12#include <linux/stddef.h>
14#include <linux/kernel.h> 13#include <linux/kernel.h>
15#include <linux/init.h> 14#include <linux/init.h>
@@ -91,9 +90,10 @@ int __init add_bridge(struct device_node *dev)
91 mpc83xx_pci2_busno = hose->first_busno; 90 mpc83xx_pci2_busno = hose->first_busno;
92 } 91 }
93 92
94 printk(KERN_INFO "Found MPC83xx PCI host bridge at 0x%08lx. " 93 printk(KERN_INFO "Found MPC83xx PCI host bridge at 0x%016llx. "
95 "Firmware bus number: %d->%d\n", 94 "Firmware bus number: %d->%d\n",
96 rsrc.start, hose->first_busno, hose->last_busno); 95 (unsigned long long)rsrc.start, hose->first_busno,
96 hose->last_busno);
97 97
98 DBG(" ->Hose at 0x%p, cfg_addr=0x%p,cfg_data=0x%p\n", 98 DBG(" ->Hose at 0x%p, cfg_addr=0x%p,cfg_data=0x%p\n",
99 hose, hose->cfg_addr, hose->cfg_data); 99 hose, hose->cfg_addr, hose->cfg_data);
diff --git a/arch/powerpc/platforms/85xx/mpc8540_ads.h b/arch/powerpc/platforms/85xx/mpc8540_ads.h
index f770cadb2080..c0d56d2bb5a5 100644
--- a/arch/powerpc/platforms/85xx/mpc8540_ads.h
+++ b/arch/powerpc/platforms/85xx/mpc8540_ads.h
@@ -17,7 +17,6 @@
17#ifndef __MACH_MPC8540ADS_H__ 17#ifndef __MACH_MPC8540ADS_H__
18#define __MACH_MPC8540ADS_H__ 18#define __MACH_MPC8540ADS_H__
19 19
20#include <linux/config.h>
21#include <linux/initrd.h> 20#include <linux/initrd.h>
22 21
23#define BOARD_CCSRBAR ((uint)0xe0000000) 22#define BOARD_CCSRBAR ((uint)0xe0000000)
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ads.c b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
index 5eeff370f5fc..06a497676c99 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ads.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
@@ -11,7 +11,6 @@
11 * option) any later version. 11 * option) any later version.
12 */ 12 */
13 13
14#include <linux/config.h>
15#include <linux/stddef.h> 14#include <linux/stddef.h>
16#include <linux/kernel.h> 15#include <linux/kernel.h>
17#include <linux/pci.h> 16#include <linux/pci.h>
diff --git a/arch/powerpc/platforms/85xx/pci.c b/arch/powerpc/platforms/85xx/pci.c
index bad290110ed1..1d51f3242ab1 100644
--- a/arch/powerpc/platforms/85xx/pci.c
+++ b/arch/powerpc/platforms/85xx/pci.c
@@ -9,7 +9,6 @@
9 * option) any later version. 9 * option) any later version.
10 */ 10 */
11 11
12#include <linux/config.h>
13#include <linux/stddef.h> 12#include <linux/stddef.h>
14#include <linux/kernel.h> 13#include <linux/kernel.h>
15#include <linux/init.h> 14#include <linux/init.h>
@@ -79,9 +78,10 @@ int __init add_bridge(struct device_node *dev)
79 mpc85xx_pci2_busno = hose->first_busno; 78 mpc85xx_pci2_busno = hose->first_busno;
80 } 79 }
81 80
82 printk(KERN_INFO "Found MPC85xx PCI host bridge at 0x%08lx. " 81 printk(KERN_INFO "Found MPC85xx PCI host bridge at 0x%016llx. "
83 "Firmware bus number: %d->%d\n", 82 "Firmware bus number: %d->%d\n",
84 rsrc.start, hose->first_busno, hose->last_busno); 83 (unsigned long long)rsrc.start, hose->first_busno,
84 hose->last_busno);
85 85
86 DBG(" ->Hose at 0x%p, cfg_addr=0x%p,cfg_data=0x%p\n", 86 DBG(" ->Hose at 0x%p, cfg_addr=0x%p,cfg_data=0x%p\n",
87 hose, hose->cfg_addr, hose->cfg_data); 87 hose, hose->cfg_addr, hose->cfg_data);
diff --git a/arch/powerpc/platforms/86xx/Kconfig b/arch/powerpc/platforms/86xx/Kconfig
index 3a87863d2876..d1ecc0f9ab58 100644
--- a/arch/powerpc/platforms/86xx/Kconfig
+++ b/arch/powerpc/platforms/86xx/Kconfig
@@ -7,6 +7,7 @@ choice
7 7
8config MPC8641_HPCN 8config MPC8641_HPCN
9 bool "Freescale MPC8641 HPCN" 9 bool "Freescale MPC8641 HPCN"
10 select PPC_I8259
10 help 11 help
11 This option enables support for the MPC8641 HPCN board. 12 This option enables support for the MPC8641 HPCN board.
12 13
@@ -28,9 +29,4 @@ config PPC_INDIRECT_PCI_BE
28 depends on PPC_86xx 29 depends on PPC_86xx
29 default y 30 default y
30 31
31config PPC_STD_MMU
32 bool
33 depends on PPC_86xx
34 default y
35
36endmenu 32endmenu
diff --git a/arch/powerpc/platforms/86xx/Makefile b/arch/powerpc/platforms/86xx/Makefile
index 7be796c5d5c9..476a6eeee710 100644
--- a/arch/powerpc/platforms/86xx/Makefile
+++ b/arch/powerpc/platforms/86xx/Makefile
@@ -2,9 +2,6 @@
2# Makefile for the PowerPC 86xx linux kernel. 2# Makefile for the PowerPC 86xx linux kernel.
3# 3#
4 4
5
6ifeq ($(CONFIG_PPC_86xx),y)
7obj-$(CONFIG_SMP) += mpc86xx_smp.o 5obj-$(CONFIG_SMP) += mpc86xx_smp.o
8endif
9obj-$(CONFIG_MPC8641_HPCN) += mpc86xx_hpcn.o 6obj-$(CONFIG_MPC8641_HPCN) += mpc86xx_hpcn.o
10obj-$(CONFIG_PCI) += pci.o mpc86xx_pcie.o 7obj-$(CONFIG_PCI) += pci.o mpc86xx_pcie.o
diff --git a/arch/powerpc/platforms/86xx/mpc8641_hpcn.h b/arch/powerpc/platforms/86xx/mpc8641_hpcn.h
index 5042253758b7..5d2bcf78cef7 100644
--- a/arch/powerpc/platforms/86xx/mpc8641_hpcn.h
+++ b/arch/powerpc/platforms/86xx/mpc8641_hpcn.h
@@ -14,7 +14,6 @@
14#ifndef __MPC8641_HPCN_H__ 14#ifndef __MPC8641_HPCN_H__
15#define __MPC8641_HPCN_H__ 15#define __MPC8641_HPCN_H__
16 16
17#include <linux/config.h>
18#include <linux/init.h> 17#include <linux/init.h>
19 18
20/* PCI interrupt controller */ 19/* PCI interrupt controller */
diff --git a/arch/powerpc/platforms/86xx/mpc86xx.h b/arch/powerpc/platforms/86xx/mpc86xx.h
index e3c9e4f417d3..2834462590b8 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx.h
+++ b/arch/powerpc/platforms/86xx/mpc86xx.h
@@ -15,11 +15,13 @@
15 * mpc86xx_* files. Mostly for use by mpc86xx_setup(). 15 * mpc86xx_* files. Mostly for use by mpc86xx_setup().
16 */ 16 */
17 17
18extern int __init add_bridge(struct device_node *dev); 18extern int add_bridge(struct device_node *dev);
19 19
20extern void __init setup_indirect_pcie(struct pci_controller *hose, 20extern int mpc86xx_exclude_device(u_char bus, u_char devfn);
21
22extern void setup_indirect_pcie(struct pci_controller *hose,
21 u32 cfg_addr, u32 cfg_data); 23 u32 cfg_addr, u32 cfg_data);
22extern void __init setup_indirect_pcie_nomap(struct pci_controller *hose, 24extern void setup_indirect_pcie_nomap(struct pci_controller *hose,
23 void __iomem *cfg_addr, 25 void __iomem *cfg_addr,
24 void __iomem *cfg_data); 26 void __iomem *cfg_data);
25 27
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index 483c21df181e..ebae73eb0063 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -12,7 +12,6 @@
12 * option) any later version. 12 * option) any later version.
13 */ 13 */
14 14
15#include <linux/config.h>
16#include <linux/stddef.h> 15#include <linux/stddef.h>
17#include <linux/kernel.h> 16#include <linux/kernel.h>
18#include <linux/pci.h> 17#include <linux/pci.h>
@@ -36,6 +35,7 @@
36#include <sysdev/fsl_soc.h> 35#include <sysdev/fsl_soc.h>
37 36
38#include "mpc86xx.h" 37#include "mpc86xx.h"
38#include "mpc8641_hpcn.h"
39 39
40#ifndef CONFIG_PCI 40#ifndef CONFIG_PCI
41unsigned long isa_io_base = 0; 41unsigned long isa_io_base = 0;
@@ -186,17 +186,130 @@ mpc86xx_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
186 return PCI_IRQ_TABLE_LOOKUP + I8259_OFFSET; 186 return PCI_IRQ_TABLE_LOOKUP + I8259_OFFSET;
187} 187}
188 188
189static void __devinit quirk_ali1575(struct pci_dev *dev)
190{
191 unsigned short temp;
192
193 /*
194 * ALI1575 interrupts route table setup:
195 *
196 * IRQ pin IRQ#
197 * PIRQA ---- 3
198 * PIRQB ---- 4
199 * PIRQC ---- 5
200 * PIRQD ---- 6
201 * PIRQE ---- 9
202 * PIRQF ---- 10
203 * PIRQG ---- 11
204 * PIRQH ---- 12
205 *
206 * interrupts for PCI slot0 -- PIRQA / PIRQB / PIRQC / PIRQD
207 * PCI slot1 -- PIRQB / PIRQC / PIRQD / PIRQA
208 */
209 pci_write_config_dword(dev, 0x48, 0xb9317542);
210
211 /* USB 1.1 OHCI controller 1, interrupt: PIRQE */
212 pci_write_config_byte(dev, 0x86, 0x0c);
213
214 /* USB 1.1 OHCI controller 2, interrupt: PIRQF */
215 pci_write_config_byte(dev, 0x87, 0x0d);
216
217 /* USB 1.1 OHCI controller 3, interrupt: PIRQH */
218 pci_write_config_byte(dev, 0x88, 0x0f);
219
220 /* USB 2.0 controller, interrupt: PIRQ7 */
221 pci_write_config_byte(dev, 0x74, 0x06);
222
223 /* Audio controller, interrupt: PIRQE */
224 pci_write_config_byte(dev, 0x8a, 0x0c);
225
226 /* Modem controller, interrupt: PIRQF */
227 pci_write_config_byte(dev, 0x8b, 0x0d);
228
229 /* HD audio controller, interrupt: PIRQG */
230 pci_write_config_byte(dev, 0x8c, 0x0e);
231
232 /* Serial ATA interrupt: PIRQD */
233 pci_write_config_byte(dev, 0x8d, 0x0b);
234
235 /* SMB interrupt: PIRQH */
236 pci_write_config_byte(dev, 0x8e, 0x0f);
237
238 /* PMU ACPI SCI interrupt: PIRQH */
239 pci_write_config_byte(dev, 0x8f, 0x0f);
240
241 /* Primary PATA IDE IRQ: 14
242 * Secondary PATA IDE IRQ: 15
243 */
244 pci_write_config_byte(dev, 0x44, 0x3d);
245 pci_write_config_byte(dev, 0x75, 0x0f);
246
247 /* Set IRQ14 and IRQ15 to legacy IRQs */
248 pci_read_config_word(dev, 0x46, &temp);
249 temp |= 0xc000;
250 pci_write_config_word(dev, 0x46, temp);
251
252 /* Set i8259 interrupt trigger
253 * IRQ 3: Level
254 * IRQ 4: Level
255 * IRQ 5: Level
256 * IRQ 6: Level
257 * IRQ 7: Level
258 * IRQ 9: Level
259 * IRQ 10: Level
260 * IRQ 11: Level
261 * IRQ 12: Level
262 * IRQ 14: Edge
263 * IRQ 15: Edge
264 */
265 outb(0xfa, 0x4d0);
266 outb(0x1e, 0x4d1);
267}
189 268
190int 269static void __devinit quirk_uli5288(struct pci_dev *dev)
191mpc86xx_exclude_device(u_char bus, u_char devfn)
192{ 270{
193#if !defined(CONFIG_PCI) 271 unsigned char c;
194 if (bus == 0 && PCI_SLOT(devfn) == 0) 272
195 return PCIBIOS_DEVICE_NOT_FOUND; 273 pci_read_config_byte(dev,0x83,&c);
196#endif 274 c |= 0x80;
275 pci_write_config_byte(dev, 0x83, c);
276
277 pci_write_config_byte(dev, 0x09, 0x01);
278 pci_write_config_byte(dev, 0x0a, 0x06);
279
280 pci_read_config_byte(dev,0x83,&c);
281 c &= 0x7f;
282 pci_write_config_byte(dev, 0x83, c);
197 283
198 return PCIBIOS_SUCCESSFUL; 284 pci_read_config_byte(dev,0x84,&c);
285 c |= 0x01;
286 pci_write_config_byte(dev, 0x84, c);
199} 287}
288
289static void __devinit quirk_uli5229(struct pci_dev *dev)
290{
291 unsigned short temp;
292 pci_write_config_word(dev, 0x04, 0x0405);
293 pci_read_config_word(dev, 0x4a, &temp);
294 temp |= 0x1000;
295 pci_write_config_word(dev, 0x4a, temp);
296}
297
298static void __devinit early_uli5249(struct pci_dev *dev)
299{
300 unsigned char temp;
301 pci_write_config_word(dev, 0x04, 0x0007);
302 pci_read_config_byte(dev, 0x7c, &temp);
303 pci_write_config_byte(dev, 0x7c, 0x80);
304 pci_write_config_byte(dev, 0x09, 0x01);
305 pci_write_config_byte(dev, 0x7c, temp);
306 dev->class |= 0x1;
307}
308
309DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575, quirk_ali1575);
310DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5288, quirk_uli5288);
311DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5229, quirk_uli5229);
312DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AL, 0x5249, early_uli5249);
200#endif /* CONFIG_PCI */ 313#endif /* CONFIG_PCI */
201 314
202 315
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_smp.c b/arch/powerpc/platforms/86xx/mpc86xx_smp.c
index 944ec4b71416..bb7fb41933ad 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_smp.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_smp.c
@@ -10,7 +10,6 @@
10 * option) any later version. 10 * option) any later version.
11 */ 11 */
12 12
13#include <linux/config.h>
14#include <linux/stddef.h> 13#include <linux/stddef.h>
15#include <linux/kernel.h> 14#include <linux/kernel.h>
16#include <linux/init.h> 15#include <linux/init.h>
@@ -34,8 +33,8 @@ extern unsigned long __secondary_hold_acknowledge;
34static void __init 33static void __init
35smp_86xx_release_core(int nr) 34smp_86xx_release_core(int nr)
36{ 35{
37 void *mcm_vaddr; 36 __be32 __iomem *mcm_vaddr;
38 unsigned long vaddr, pcr; 37 unsigned long pcr;
39 38
40 if (nr < 0 || nr >= NR_CPUS) 39 if (nr < 0 || nr >= NR_CPUS)
41 return; 40 return;
@@ -45,10 +44,9 @@ smp_86xx_release_core(int nr)
45 */ 44 */
46 mcm_vaddr = ioremap(get_immrbase() + MPC86xx_MCM_OFFSET, 45 mcm_vaddr = ioremap(get_immrbase() + MPC86xx_MCM_OFFSET,
47 MPC86xx_MCM_SIZE); 46 MPC86xx_MCM_SIZE);
48 vaddr = (unsigned long)mcm_vaddr + MCM_PORT_CONFIG_OFFSET; 47 pcr = in_be32(mcm_vaddr + (MCM_PORT_CONFIG_OFFSET >> 2));
49 pcr = in_be32((volatile unsigned *)vaddr);
50 pcr |= 1 << (nr + 24); 48 pcr |= 1 << (nr + 24);
51 out_be32((volatile unsigned *)vaddr, pcr); 49 out_be32(mcm_vaddr + (MCM_PORT_CONFIG_OFFSET >> 2), pcr);
52} 50}
53 51
54 52
diff --git a/arch/powerpc/platforms/86xx/pci.c b/arch/powerpc/platforms/86xx/pci.c
index 5180df7c75bc..bc5139043112 100644
--- a/arch/powerpc/platforms/86xx/pci.c
+++ b/arch/powerpc/platforms/86xx/pci.c
@@ -12,7 +12,6 @@
12 * option) any later version. 12 * option) any later version.
13 */ 13 */
14 14
15#include <linux/config.h>
16#include <linux/types.h> 15#include <linux/types.h>
17#include <linux/module.h> 16#include <linux/module.h>
18#include <linux/init.h> 17#include <linux/init.h>
@@ -122,15 +121,12 @@ static void __init setup_pcie_atmu(struct pci_controller *hose, struct resource
122static void __init 121static void __init
123mpc86xx_setup_pcie(struct pci_controller *hose, u32 pcie_offset, u32 pcie_size) 122mpc86xx_setup_pcie(struct pci_controller *hose, u32 pcie_offset, u32 pcie_size)
124{ 123{
125 volatile struct ccsr_pex *pcie;
126 u16 cmd; 124 u16 cmd;
127 unsigned int temps; 125 unsigned int temps;
128 126
129 DBG("PCIE host controller register offset 0x%08x, size 0x%08x.\n", 127 DBG("PCIE host controller register offset 0x%08x, size 0x%08x.\n",
130 pcie_offset, pcie_size); 128 pcie_offset, pcie_size);
131 129
132 pcie = ioremap(pcie_offset, pcie_size);
133
134 early_read_config_word(hose, 0, 0, PCI_COMMAND, &cmd); 130 early_read_config_word(hose, 0, 0, PCI_COMMAND, &cmd);
135 cmd |= PCI_COMMAND_SERR | PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY 131 cmd |= PCI_COMMAND_SERR | PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY
136 | PCI_COMMAND_IO; 132 | PCI_COMMAND_IO;
@@ -144,6 +140,14 @@ mpc86xx_setup_pcie(struct pci_controller *hose, u32 pcie_offset, u32 pcie_size)
144 early_write_config_dword(hose, 0, 0, PCI_PRIMARY_BUS, temps); 140 early_write_config_dword(hose, 0, 0, PCI_PRIMARY_BUS, temps);
145} 141}
146 142
143int mpc86xx_exclude_device(u_char bus, u_char devfn)
144{
145 if (bus == 0 && PCI_SLOT(devfn) == 0)
146 return PCIBIOS_DEVICE_NOT_FOUND;
147
148 return PCIBIOS_SUCCESSFUL;
149}
150
147int __init add_bridge(struct device_node *dev) 151int __init add_bridge(struct device_node *dev)
148{ 152{
149 int len; 153 int len;
@@ -198,128 +202,3 @@ int __init add_bridge(struct device_node *dev)
198 202
199 return 0; 203 return 0;
200} 204}
201
202static void __devinit quirk_ali1575(struct pci_dev *dev)
203{
204 unsigned short temp;
205
206 /*
207 * ALI1575 interrupts route table setup:
208 *
209 * IRQ pin IRQ#
210 * PIRQA ---- 3
211 * PIRQB ---- 4
212 * PIRQC ---- 5
213 * PIRQD ---- 6
214 * PIRQE ---- 9
215 * PIRQF ---- 10
216 * PIRQG ---- 11
217 * PIRQH ---- 12
218 *
219 * interrupts for PCI slot0 -- PIRQA / PIRQB / PIRQC / PIRQD
220 * PCI slot1 -- PIRQB / PIRQC / PIRQD / PIRQA
221 */
222 pci_write_config_dword(dev, 0x48, 0xb9317542);
223
224 /* USB 1.1 OHCI controller 1, interrupt: PIRQE */
225 pci_write_config_byte(dev, 0x86, 0x0c);
226
227 /* USB 1.1 OHCI controller 2, interrupt: PIRQF */
228 pci_write_config_byte(dev, 0x87, 0x0d);
229
230 /* USB 1.1 OHCI controller 3, interrupt: PIRQH */
231 pci_write_config_byte(dev, 0x88, 0x0f);
232
233 /* USB 2.0 controller, interrupt: PIRQ7 */
234 pci_write_config_byte(dev, 0x74, 0x06);
235
236 /* Audio controller, interrupt: PIRQE */
237 pci_write_config_byte(dev, 0x8a, 0x0c);
238
239 /* Modem controller, interrupt: PIRQF */
240 pci_write_config_byte(dev, 0x8b, 0x0d);
241
242 /* HD audio controller, interrupt: PIRQG */
243 pci_write_config_byte(dev, 0x8c, 0x0e);
244
245 /* Serial ATA interrupt: PIRQD */
246 pci_write_config_byte(dev, 0x8d, 0x0b);
247
248 /* SMB interrupt: PIRQH */
249 pci_write_config_byte(dev, 0x8e, 0x0f);
250
251 /* PMU ACPI SCI interrupt: PIRQH */
252 pci_write_config_byte(dev, 0x8f, 0x0f);
253
254 /* Primary PATA IDE IRQ: 14
255 * Secondary PATA IDE IRQ: 15
256 */
257 pci_write_config_byte(dev, 0x44, 0x3d);
258 pci_write_config_byte(dev, 0x75, 0x0f);
259
260 /* Set IRQ14 and IRQ15 to legacy IRQs */
261 pci_read_config_word(dev, 0x46, &temp);
262 temp |= 0xc000;
263 pci_write_config_word(dev, 0x46, temp);
264
265 /* Set i8259 interrupt trigger
266 * IRQ 3: Level
267 * IRQ 4: Level
268 * IRQ 5: Level
269 * IRQ 6: Level
270 * IRQ 7: Level
271 * IRQ 9: Level
272 * IRQ 10: Level
273 * IRQ 11: Level
274 * IRQ 12: Level
275 * IRQ 14: Edge
276 * IRQ 15: Edge
277 */
278 outb(0xfa, 0x4d0);
279 outb(0x1e, 0x4d1);
280}
281
282static void __devinit quirk_uli5288(struct pci_dev *dev)
283{
284 unsigned char c;
285
286 pci_read_config_byte(dev,0x83,&c);
287 c |= 0x80;
288 pci_write_config_byte(dev, 0x83, c);
289
290 pci_write_config_byte(dev, 0x09, 0x01);
291 pci_write_config_byte(dev, 0x0a, 0x06);
292
293 pci_read_config_byte(dev,0x83,&c);
294 c &= 0x7f;
295 pci_write_config_byte(dev, 0x83, c);
296
297 pci_read_config_byte(dev,0x84,&c);
298 c |= 0x01;
299 pci_write_config_byte(dev, 0x84, c);
300}
301
302static void __devinit quirk_uli5229(struct pci_dev *dev)
303{
304 unsigned short temp;
305 pci_write_config_word(dev, 0x04, 0x0405);
306 pci_read_config_word(dev, 0x4a, &temp);
307 temp |= 0x1000;
308 pci_write_config_word(dev, 0x4a, temp);
309}
310
311static void __devinit early_uli5249(struct pci_dev *dev)
312{
313 unsigned char temp;
314 pci_write_config_word(dev, 0x04, 0x0007);
315 pci_read_config_byte(dev, 0x7c, &temp);
316 pci_write_config_byte(dev, 0x7c, 0x80);
317 pci_write_config_byte(dev, 0x09, 0x01);
318 pci_write_config_byte(dev, 0x7c, temp);
319 dev->class |= 0x1;
320}
321
322DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575, quirk_ali1575);
323DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5288, quirk_uli5288);
324DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5229, quirk_uli5229);
325DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AL, 0x5249, early_uli5249);
diff --git a/arch/powerpc/platforms/Makefile b/arch/powerpc/platforms/Makefile
index 292863694562..5cf46dc57895 100644
--- a/arch/powerpc/platforms/Makefile
+++ b/arch/powerpc/platforms/Makefile
@@ -14,3 +14,4 @@ obj-$(CONFIG_PPC_PSERIES) += pseries/
14obj-$(CONFIG_PPC_ISERIES) += iseries/ 14obj-$(CONFIG_PPC_ISERIES) += iseries/
15obj-$(CONFIG_PPC_MAPLE) += maple/ 15obj-$(CONFIG_PPC_MAPLE) += maple/
16obj-$(CONFIG_PPC_CELL) += cell/ 16obj-$(CONFIG_PPC_CELL) += cell/
17obj-$(CONFIG_EMBEDDED6xx) += embedded6xx/
diff --git a/arch/powerpc/platforms/cell/Kconfig b/arch/powerpc/platforms/cell/Kconfig
index 352bbbacde9a..0c8c7b6ab897 100644
--- a/arch/powerpc/platforms/cell/Kconfig
+++ b/arch/powerpc/platforms/cell/Kconfig
@@ -6,6 +6,7 @@ config SPU_FS
6 default m 6 default m
7 depends on PPC_CELL 7 depends on PPC_CELL
8 select SPU_BASE 8 select SPU_BASE
9 select MEMORY_HOTPLUG
9 help 10 help
10 The SPU file system is used to access Synergistic Processing 11 The SPU file system is used to access Synergistic Processing
11 Units on machines implementing the Broadband Processor 12 Units on machines implementing the Broadband Processor
@@ -18,7 +19,6 @@ config SPU_BASE
18config SPUFS_MMAP 19config SPUFS_MMAP
19 bool 20 bool
20 depends on SPU_FS && SPARSEMEM 21 depends on SPU_FS && SPARSEMEM
21 select MEMORY_HOTPLUG
22 default y 22 default y
23 23
24config CBE_RAS 24config CBE_RAS
diff --git a/arch/powerpc/platforms/cell/interrupt.c b/arch/powerpc/platforms/cell/interrupt.c
index 1bbf822b4efc..9d5da7896892 100644
--- a/arch/powerpc/platforms/cell/interrupt.c
+++ b/arch/powerpc/platforms/cell/interrupt.c
@@ -1,6 +1,9 @@
1/* 1/*
2 * Cell Internal Interrupt Controller 2 * Cell Internal Interrupt Controller
3 * 3 *
4 * Copyright (C) 2006 Benjamin Herrenschmidt (benh@kernel.crashing.org)
5 * IBM, Corp.
6 *
4 * (C) Copyright IBM Deutschland Entwicklung GmbH 2005 7 * (C) Copyright IBM Deutschland Entwicklung GmbH 2005
5 * 8 *
6 * Author: Arnd Bergmann <arndb@de.ibm.com> 9 * Author: Arnd Bergmann <arndb@de.ibm.com>
@@ -20,17 +23,18 @@
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */ 24 */
22 25
23#include <linux/config.h>
24#include <linux/interrupt.h> 26#include <linux/interrupt.h>
25#include <linux/irq.h> 27#include <linux/irq.h>
26#include <linux/module.h> 28#include <linux/module.h>
27#include <linux/percpu.h> 29#include <linux/percpu.h>
28#include <linux/types.h> 30#include <linux/types.h>
31#include <linux/ioport.h>
29 32
30#include <asm/io.h> 33#include <asm/io.h>
31#include <asm/pgtable.h> 34#include <asm/pgtable.h>
32#include <asm/prom.h> 35#include <asm/prom.h>
33#include <asm/ptrace.h> 36#include <asm/ptrace.h>
37#include <asm/machdep.h>
34 38
35#include "interrupt.h" 39#include "interrupt.h"
36#include "cbe_regs.h" 40#include "cbe_regs.h"
@@ -38,231 +42,65 @@
38struct iic { 42struct iic {
39 struct cbe_iic_thread_regs __iomem *regs; 43 struct cbe_iic_thread_regs __iomem *regs;
40 u8 target_id; 44 u8 target_id;
45 u8 eoi_stack[16];
46 int eoi_ptr;
47 struct irq_host *host;
41}; 48};
42 49
43static DEFINE_PER_CPU(struct iic, iic); 50static DEFINE_PER_CPU(struct iic, iic);
51#define IIC_NODE_COUNT 2
52static struct irq_host *iic_hosts[IIC_NODE_COUNT];
44 53
45void iic_local_enable(void) 54/* Convert between "pending" bits and hw irq number */
55static irq_hw_number_t iic_pending_to_hwnum(struct cbe_iic_pending_bits bits)
46{ 56{
47 struct iic *iic = &__get_cpu_var(iic); 57 unsigned char unit = bits.source & 0xf;
48 u64 tmp;
49
50 /*
51 * There seems to be a bug that is present in DD2.x CPUs
52 * and still only partially fixed in DD3.1.
53 * This bug causes a value written to the priority register
54 * not to make it there, resulting in a system hang unless we
55 * write it again.
56 * Masking with 0xf0 is done because the Cell BE does not
57 * implement the lower four bits of the interrupt priority,
58 * they always read back as zeroes, although future CPUs
59 * might implement different bits.
60 */
61 do {
62 out_be64(&iic->regs->prio, 0xff);
63 tmp = in_be64(&iic->regs->prio);
64 } while ((tmp & 0xf0) != 0xf0);
65}
66
67void iic_local_disable(void)
68{
69 out_be64(&__get_cpu_var(iic).regs->prio, 0x0);
70}
71 58
72static unsigned int iic_startup(unsigned int irq) 59 if (bits.flags & CBE_IIC_IRQ_IPI)
73{ 60 return IIC_IRQ_IPI0 | (bits.prio >> 4);
74 return 0; 61 else if (bits.class <= 3)
62 return (bits.class << 4) | unit;
63 else
64 return IIC_IRQ_INVALID;
75} 65}
76 66
77static void iic_enable(unsigned int irq) 67static void iic_mask(unsigned int irq)
78{ 68{
79 iic_local_enable();
80} 69}
81 70
82static void iic_disable(unsigned int irq) 71static void iic_unmask(unsigned int irq)
83{ 72{
84} 73}
85 74
86static void iic_end(unsigned int irq) 75static void iic_eoi(unsigned int irq)
87{ 76{
88 iic_local_enable(); 77 struct iic *iic = &__get_cpu_var(iic);
78 out_be64(&iic->regs->prio, iic->eoi_stack[--iic->eoi_ptr]);
79 BUG_ON(iic->eoi_ptr < 0);
89} 80}
90 81
91static struct hw_interrupt_type iic_pic = { 82static struct irq_chip iic_chip = {
92 .typename = " CELL-IIC ", 83 .typename = " CELL-IIC ",
93 .startup = iic_startup, 84 .mask = iic_mask,
94 .enable = iic_enable, 85 .unmask = iic_unmask,
95 .disable = iic_disable, 86 .eoi = iic_eoi,
96 .end = iic_end,
97}; 87};
98 88
99static int iic_external_get_irq(struct cbe_iic_pending_bits pending)
100{
101 int irq;
102 unsigned char node, unit;
103
104 node = pending.source >> 4;
105 unit = pending.source & 0xf;
106 irq = -1;
107
108 /*
109 * This mapping is specific to the Cell Broadband
110 * Engine. We might need to get the numbers
111 * from the device tree to support future CPUs.
112 */
113 switch (unit) {
114 case 0x00:
115 case 0x0b:
116 /*
117 * One of these units can be connected
118 * to an external interrupt controller.
119 */
120 if (pending.class != 2)
121 break;
122 irq = IIC_EXT_OFFSET
123 + spider_get_irq(node)
124 + node * IIC_NODE_STRIDE;
125 break;
126 case 0x01 ... 0x04:
127 case 0x07 ... 0x0a:
128 /*
129 * These units are connected to the SPEs
130 */
131 if (pending.class > 2)
132 break;
133 irq = IIC_SPE_OFFSET
134 + pending.class * IIC_CLASS_STRIDE
135 + node * IIC_NODE_STRIDE
136 + unit;
137 break;
138 }
139 if (irq == -1)
140 printk(KERN_WARNING "Unexpected interrupt class %02x, "
141 "source %02x, prio %02x, cpu %02x\n", pending.class,
142 pending.source, pending.prio, smp_processor_id());
143 return irq;
144}
145
146/* Get an IRQ number from the pending state register of the IIC */ 89/* Get an IRQ number from the pending state register of the IIC */
147int iic_get_irq(struct pt_regs *regs) 90static unsigned int iic_get_irq(struct pt_regs *regs)
148{ 91{
149 struct iic *iic; 92 struct cbe_iic_pending_bits pending;
150 int irq; 93 struct iic *iic;
151 struct cbe_iic_pending_bits pending; 94
152 95 iic = &__get_cpu_var(iic);
153 iic = &__get_cpu_var(iic); 96 *(unsigned long *) &pending =
154 *(unsigned long *) &pending = 97 in_be64((unsigned long __iomem *) &iic->regs->pending_destr);
155 in_be64((unsigned long __iomem *) &iic->regs->pending_destr); 98 iic->eoi_stack[++iic->eoi_ptr] = pending.prio;
156 99 BUG_ON(iic->eoi_ptr > 15);
157 irq = -1; 100 if (pending.flags & CBE_IIC_IRQ_VALID)
158 if (pending.flags & CBE_IIC_IRQ_VALID) { 101 return irq_linear_revmap(iic->host,
159 if (pending.flags & CBE_IIC_IRQ_IPI) { 102 iic_pending_to_hwnum(pending));
160 irq = IIC_IPI_OFFSET + (pending.prio >> 4); 103 return NO_IRQ;
161/*
162 if (irq > 0x80)
163 printk(KERN_WARNING "Unexpected IPI prio %02x"
164 "on CPU %02x\n", pending.prio,
165 smp_processor_id());
166*/
167 } else {
168 irq = iic_external_get_irq(pending);
169 }
170 }
171 return irq;
172}
173
174/* hardcoded part to be compatible with older firmware */
175
176static int setup_iic_hardcoded(void)
177{
178 struct device_node *np;
179 int nodeid, cpu;
180 unsigned long regs;
181 struct iic *iic;
182
183 for_each_possible_cpu(cpu) {
184 iic = &per_cpu(iic, cpu);
185 nodeid = cpu/2;
186
187 for (np = of_find_node_by_type(NULL, "cpu");
188 np;
189 np = of_find_node_by_type(np, "cpu")) {
190 if (nodeid == *(int *)get_property(np, "node-id", NULL))
191 break;
192 }
193
194 if (!np) {
195 printk(KERN_WARNING "IIC: CPU %d not found\n", cpu);
196 iic->regs = NULL;
197 iic->target_id = 0xff;
198 return -ENODEV;
199 }
200
201 regs = *(long *)get_property(np, "iic", NULL);
202
203 /* hack until we have decided on the devtree info */
204 regs += 0x400;
205 if (cpu & 1)
206 regs += 0x20;
207
208 printk(KERN_INFO "IIC for CPU %d at %lx\n", cpu, regs);
209 iic->regs = ioremap(regs, sizeof(struct cbe_iic_thread_regs));
210 iic->target_id = (nodeid << 4) + ((cpu & 1) ? 0xf : 0xe);
211 }
212
213 return 0;
214}
215
216static int setup_iic(void)
217{
218 struct device_node *dn;
219 unsigned long *regs;
220 char *compatible;
221 unsigned *np, found = 0;
222 struct iic *iic = NULL;
223
224 for (dn = NULL; (dn = of_find_node_by_name(dn, "interrupt-controller"));) {
225 compatible = (char *)get_property(dn, "compatible", NULL);
226
227 if (!compatible) {
228 printk(KERN_WARNING "no compatible property found !\n");
229 continue;
230 }
231
232 if (strstr(compatible, "IBM,CBEA-Internal-Interrupt-Controller"))
233 regs = (unsigned long *)get_property(dn,"reg", NULL);
234 else
235 continue;
236
237 if (!regs)
238 printk(KERN_WARNING "IIC: no reg property\n");
239
240 np = (unsigned int *)get_property(dn, "ibm,interrupt-server-ranges", NULL);
241
242 if (!np) {
243 printk(KERN_WARNING "IIC: CPU association not found\n");
244 iic->regs = NULL;
245 iic->target_id = 0xff;
246 return -ENODEV;
247 }
248
249 iic = &per_cpu(iic, np[0]);
250 iic->regs = ioremap(regs[0], sizeof(struct cbe_iic_thread_regs));
251 iic->target_id = ((np[0] & 2) << 3) + ((np[0] & 1) ? 0xf : 0xe);
252 printk("IIC for CPU %d at %lx mapped to %p\n", np[0], regs[0], iic->regs);
253
254 iic = &per_cpu(iic, np[1]);
255 iic->regs = ioremap(regs[2], sizeof(struct cbe_iic_thread_regs));
256 iic->target_id = ((np[1] & 2) << 3) + ((np[1] & 1) ? 0xf : 0xe);
257 printk("IIC for CPU %d at %lx mapped to %p\n", np[1], regs[2], iic->regs);
258
259 found++;
260 }
261
262 if (found)
263 return 0;
264 else
265 return -ENODEV;
266} 104}
267 105
268#ifdef CONFIG_SMP 106#ifdef CONFIG_SMP
@@ -270,12 +108,12 @@ static int setup_iic(void)
270/* Use the highest interrupt priorities for IPI */ 108/* Use the highest interrupt priorities for IPI */
271static inline int iic_ipi_to_irq(int ipi) 109static inline int iic_ipi_to_irq(int ipi)
272{ 110{
273 return IIC_IPI_OFFSET + IIC_NUM_IPIS - 1 - ipi; 111 return IIC_IRQ_IPI0 + IIC_NUM_IPIS - 1 - ipi;
274} 112}
275 113
276static inline int iic_irq_to_ipi(int irq) 114static inline int iic_irq_to_ipi(int irq)
277{ 115{
278 return IIC_NUM_IPIS - 1 - (irq - IIC_IPI_OFFSET); 116 return IIC_NUM_IPIS - 1 - (irq - IIC_IRQ_IPI0);
279} 117}
280 118
281void iic_setup_cpu(void) 119void iic_setup_cpu(void)
@@ -294,22 +132,51 @@ u8 iic_get_target_id(int cpu)
294} 132}
295EXPORT_SYMBOL_GPL(iic_get_target_id); 133EXPORT_SYMBOL_GPL(iic_get_target_id);
296 134
135struct irq_host *iic_get_irq_host(int node)
136{
137 if (node < 0 || node >= IIC_NODE_COUNT)
138 return NULL;
139 return iic_hosts[node];
140}
141EXPORT_SYMBOL_GPL(iic_get_irq_host);
142
143
297static irqreturn_t iic_ipi_action(int irq, void *dev_id, struct pt_regs *regs) 144static irqreturn_t iic_ipi_action(int irq, void *dev_id, struct pt_regs *regs)
298{ 145{
299 smp_message_recv(iic_irq_to_ipi(irq), regs); 146 int ipi = (int)(long)dev_id;
147
148 smp_message_recv(ipi, regs);
149
300 return IRQ_HANDLED; 150 return IRQ_HANDLED;
301} 151}
302 152
303static void iic_request_ipi(int ipi, const char *name) 153static void iic_request_ipi(int ipi, const char *name)
304{ 154{
305 int irq; 155 int node, virq;
306 156
307 irq = iic_ipi_to_irq(ipi); 157 for (node = 0; node < IIC_NODE_COUNT; node++) {
308 /* IPIs are marked SA_INTERRUPT as they must run with irqs 158 char *rname;
309 * disabled */ 159 if (iic_hosts[node] == NULL)
310 get_irq_desc(irq)->handler = &iic_pic; 160 continue;
311 get_irq_desc(irq)->status |= IRQ_PER_CPU; 161 virq = irq_create_mapping(iic_hosts[node],
312 request_irq(irq, iic_ipi_action, SA_INTERRUPT, name, NULL); 162 iic_ipi_to_irq(ipi), 0);
163 if (virq == NO_IRQ) {
164 printk(KERN_ERR
165 "iic: failed to map IPI %s on node %d\n",
166 name, node);
167 continue;
168 }
169 rname = kzalloc(strlen(name) + 16, GFP_KERNEL);
170 if (rname)
171 sprintf(rname, "%s node %d", name, node);
172 else
173 rname = (char *)name;
174 if (request_irq(virq, iic_ipi_action, IRQF_DISABLED,
175 rname, (void *)(long)ipi))
176 printk(KERN_ERR
177 "iic: failed to request IPI %s on node %d\n",
178 name, node);
179 }
313} 180}
314 181
315void iic_request_IPIs(void) 182void iic_request_IPIs(void)
@@ -320,34 +187,119 @@ void iic_request_IPIs(void)
320 iic_request_ipi(PPC_MSG_DEBUGGER_BREAK, "IPI-debug"); 187 iic_request_ipi(PPC_MSG_DEBUGGER_BREAK, "IPI-debug");
321#endif /* CONFIG_DEBUGGER */ 188#endif /* CONFIG_DEBUGGER */
322} 189}
190
323#endif /* CONFIG_SMP */ 191#endif /* CONFIG_SMP */
324 192
325static void iic_setup_spe_handlers(void) 193
194static int iic_host_match(struct irq_host *h, struct device_node *node)
195{
196 return h->host_data != NULL && node == h->host_data;
197}
198
199static int iic_host_map(struct irq_host *h, unsigned int virq,
200 irq_hw_number_t hw, unsigned int flags)
201{
202 if (hw < IIC_IRQ_IPI0)
203 set_irq_chip_and_handler(virq, &iic_chip, handle_fasteoi_irq);
204 else
205 set_irq_chip_and_handler(virq, &iic_chip, handle_percpu_irq);
206 return 0;
207}
208
209static int iic_host_xlate(struct irq_host *h, struct device_node *ct,
210 u32 *intspec, unsigned int intsize,
211 irq_hw_number_t *out_hwirq, unsigned int *out_flags)
212
213{
214 /* Currently, we don't translate anything. That needs to be fixed as
215 * we get better defined device-trees. iic interrupts have to be
216 * explicitely mapped by whoever needs them
217 */
218 return -ENODEV;
219}
220
221static struct irq_host_ops iic_host_ops = {
222 .match = iic_host_match,
223 .map = iic_host_map,
224 .xlate = iic_host_xlate,
225};
226
227static void __init init_one_iic(unsigned int hw_cpu, unsigned long addr,
228 struct irq_host *host)
326{ 229{
327 int be, isrc; 230 /* XXX FIXME: should locate the linux CPU number from the HW cpu
231 * number properly. We are lucky for now
232 */
233 struct iic *iic = &per_cpu(iic, hw_cpu);
234
235 iic->regs = ioremap(addr, sizeof(struct cbe_iic_thread_regs));
236 BUG_ON(iic->regs == NULL);
328 237
329 /* Assume two threads per BE are present */ 238 iic->target_id = ((hw_cpu & 2) << 3) | ((hw_cpu & 1) ? 0xf : 0xe);
330 for (be=0; be < num_present_cpus() / 2; be++) { 239 iic->eoi_stack[0] = 0xff;
331 for (isrc = 0; isrc < IIC_CLASS_STRIDE * 3; isrc++) { 240 iic->host = host;
332 int irq = IIC_NODE_STRIDE * be + IIC_SPE_OFFSET + isrc; 241 out_be64(&iic->regs->prio, 0);
333 get_irq_desc(irq)->handler = &iic_pic; 242
243 printk(KERN_INFO "IIC for CPU %d at %lx mapped to %p, target id 0x%x\n",
244 hw_cpu, addr, iic->regs, iic->target_id);
245}
246
247static int __init setup_iic(void)
248{
249 struct device_node *dn;
250 struct resource r0, r1;
251 struct irq_host *host;
252 int found = 0;
253 u32 *np;
254
255 for (dn = NULL;
256 (dn = of_find_node_by_name(dn,"interrupt-controller")) != NULL;) {
257 if (!device_is_compatible(dn,
258 "IBM,CBEA-Internal-Interrupt-Controller"))
259 continue;
260 np = (u32 *)get_property(dn, "ibm,interrupt-server-ranges",
261 NULL);
262 if (np == NULL) {
263 printk(KERN_WARNING "IIC: CPU association not found\n");
264 of_node_put(dn);
265 return -ENODEV;
266 }
267 if (of_address_to_resource(dn, 0, &r0) ||
268 of_address_to_resource(dn, 1, &r1)) {
269 printk(KERN_WARNING "IIC: Can't resolve addresses\n");
270 of_node_put(dn);
271 return -ENODEV;
334 } 272 }
273 host = NULL;
274 if (found < IIC_NODE_COUNT) {
275 host = irq_alloc_host(IRQ_HOST_MAP_LINEAR,
276 IIC_SOURCE_COUNT,
277 &iic_host_ops,
278 IIC_IRQ_INVALID);
279 iic_hosts[found] = host;
280 BUG_ON(iic_hosts[found] == NULL);
281 iic_hosts[found]->host_data = of_node_get(dn);
282 found++;
283 }
284 init_one_iic(np[0], r0.start, host);
285 init_one_iic(np[1], r1.start, host);
335 } 286 }
287
288 if (found)
289 return 0;
290 else
291 return -ENODEV;
336} 292}
337 293
338void iic_init_IRQ(void) 294void __init iic_init_IRQ(void)
339{ 295{
340 int cpu, irq_offset; 296 /* Discover and initialize iics */
341 struct iic *iic;
342
343 if (setup_iic() < 0) 297 if (setup_iic() < 0)
344 setup_iic_hardcoded(); 298 panic("IIC: Failed to initialize !\n");
345 299
346 irq_offset = 0; 300 /* Set master interrupt handling function */
347 for_each_possible_cpu(cpu) { 301 ppc_md.get_irq = iic_get_irq;
348 iic = &per_cpu(iic, cpu); 302
349 if (iic->regs) 303 /* Enable on current CPU */
350 out_be64(&iic->regs->prio, 0xff); 304 iic_setup_cpu();
351 }
352 iic_setup_spe_handlers();
353} 305}
diff --git a/arch/powerpc/platforms/cell/interrupt.h b/arch/powerpc/platforms/cell/interrupt.h
index 799f77d98f96..5560a92ec3ab 100644
--- a/arch/powerpc/platforms/cell/interrupt.h
+++ b/arch/powerpc/platforms/cell/interrupt.h
@@ -37,27 +37,24 @@
37 */ 37 */
38 38
39enum { 39enum {
40 IIC_EXT_OFFSET = 0x00, /* Start of south bridge IRQs */ 40 IIC_IRQ_INVALID = 0xff,
41 IIC_NUM_EXT = 0x40, /* Number of south bridge IRQs */ 41 IIC_IRQ_MAX = 0x3f,
42 IIC_SPE_OFFSET = 0x40, /* Start of SPE interrupts */ 42 IIC_IRQ_EXT_IOIF0 = 0x20,
43 IIC_CLASS_STRIDE = 0x10, /* SPE IRQs per class */ 43 IIC_IRQ_EXT_IOIF1 = 0x2b,
44 IIC_IPI_OFFSET = 0x70, /* Start of IPI IRQs */ 44 IIC_IRQ_IPI0 = 0x40,
45 IIC_NUM_IPIS = 0x10, /* IRQs reserved for IPI */ 45 IIC_NUM_IPIS = 0x10, /* IRQs reserved for IPI */
46 IIC_NODE_STRIDE = 0x80, /* Total IRQs per node */ 46 IIC_SOURCE_COUNT = 0x50,
47}; 47};
48 48
49extern void iic_init_IRQ(void); 49extern void iic_init_IRQ(void);
50extern int iic_get_irq(struct pt_regs *regs);
51extern void iic_cause_IPI(int cpu, int mesg); 50extern void iic_cause_IPI(int cpu, int mesg);
52extern void iic_request_IPIs(void); 51extern void iic_request_IPIs(void);
53extern void iic_setup_cpu(void); 52extern void iic_setup_cpu(void);
54extern void iic_local_enable(void);
55extern void iic_local_disable(void);
56 53
57extern u8 iic_get_target_id(int cpu); 54extern u8 iic_get_target_id(int cpu);
55extern struct irq_host *iic_get_irq_host(int node);
58 56
59extern void spider_init_IRQ(void); 57extern void spider_init_IRQ(void);
60extern int spider_get_irq(int node);
61 58
62#endif 59#endif
63#endif /* ASM_CELL_PIC_H */ 60#endif /* ASM_CELL_PIC_H */
diff --git a/arch/powerpc/platforms/cell/pervasive.c b/arch/powerpc/platforms/cell/pervasive.c
index 695ac4e1617e..9f2e4ed20a57 100644
--- a/arch/powerpc/platforms/cell/pervasive.c
+++ b/arch/powerpc/platforms/cell/pervasive.c
@@ -23,7 +23,6 @@
23 23
24#undef DEBUG 24#undef DEBUG
25 25
26#include <linux/config.h>
27#include <linux/interrupt.h> 26#include <linux/interrupt.h>
28#include <linux/irq.h> 27#include <linux/irq.h>
29#include <linux/percpu.h> 28#include <linux/percpu.h>
diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c
index 3d1831d331e5..282987d6d4a2 100644
--- a/arch/powerpc/platforms/cell/setup.c
+++ b/arch/powerpc/platforms/cell/setup.c
@@ -14,7 +14,6 @@
14 */ 14 */
15#undef DEBUG 15#undef DEBUG
16 16
17#include <linux/config.h>
18#include <linux/sched.h> 17#include <linux/sched.h>
19#include <linux/kernel.h> 18#include <linux/kernel.h>
20#include <linux/mm.h> 19#include <linux/mm.h>
@@ -50,6 +49,7 @@
50#include <asm/irq.h> 49#include <asm/irq.h>
51#include <asm/spu.h> 50#include <asm/spu.h>
52#include <asm/spu_priv1.h> 51#include <asm/spu_priv1.h>
52#include <asm/udbg.h>
53 53
54#include "interrupt.h" 54#include "interrupt.h"
55#include "iommu.h" 55#include "iommu.h"
@@ -80,10 +80,22 @@ static void cell_progress(char *s, unsigned short hex)
80 printk("*** %04x : %s\n", hex, s ? s : ""); 80 printk("*** %04x : %s\n", hex, s ? s : "");
81} 81}
82 82
83static void __init cell_pcibios_fixup(void)
84{
85 struct pci_dev *dev = NULL;
86
87 for_each_pci_dev(dev)
88 pci_read_irq_line(dev);
89}
90
91static void __init cell_init_irq(void)
92{
93 iic_init_IRQ();
94 spider_init_IRQ();
95}
96
83static void __init cell_setup_arch(void) 97static void __init cell_setup_arch(void)
84{ 98{
85 ppc_md.init_IRQ = iic_init_IRQ;
86 ppc_md.get_irq = iic_get_irq;
87#ifdef CONFIG_SPU_BASE 99#ifdef CONFIG_SPU_BASE
88 spu_priv1_ops = &spu_priv1_mmio_ops; 100 spu_priv1_ops = &spu_priv1_mmio_ops;
89#endif 101#endif
@@ -109,7 +121,6 @@ static void __init cell_setup_arch(void)
109 /* Find and initialize PCI host bridges */ 121 /* Find and initialize PCI host bridges */
110 init_pci_config_tokens(); 122 init_pci_config_tokens();
111 find_and_init_phbs(); 123 find_and_init_phbs();
112 spider_init_IRQ();
113 cbe_pervasive_init(); 124 cbe_pervasive_init();
114#ifdef CONFIG_DUMMY_CONSOLE 125#ifdef CONFIG_DUMMY_CONSOLE
115 conswitchp = &dummy_con; 126 conswitchp = &dummy_con;
@@ -125,12 +136,8 @@ static void __init cell_init_early(void)
125{ 136{
126 DBG(" -> cell_init_early()\n"); 137 DBG(" -> cell_init_early()\n");
127 138
128 hpte_init_native();
129
130 cell_init_iommu(); 139 cell_init_iommu();
131 140
132 ppc64_interrupt_controller = IC_CELL_PIC;
133
134 DBG(" <- cell_init_early()\n"); 141 DBG(" <- cell_init_early()\n");
135} 142}
136 143
@@ -139,11 +146,17 @@ static int __init cell_probe(void)
139{ 146{
140 unsigned long root = of_get_flat_dt_root(); 147 unsigned long root = of_get_flat_dt_root();
141 148
142 if (of_flat_dt_is_compatible(root, "IBM,CBEA") || 149 if (!of_flat_dt_is_compatible(root, "IBM,CBEA") &&
143 of_flat_dt_is_compatible(root, "IBM,CPBW-1.0")) 150 !of_flat_dt_is_compatible(root, "IBM,CPBW-1.0"))
144 return 1; 151 return 0;
152
153#ifdef CONFIG_UDBG_RTAS_CONSOLE
154 udbg_init_rtas_console();
155#endif
156
157 hpte_init_native();
145 158
146 return 0; 159 return 1;
147} 160}
148 161
149/* 162/*
@@ -170,6 +183,8 @@ define_machine(cell) {
170 .calibrate_decr = generic_calibrate_decr, 183 .calibrate_decr = generic_calibrate_decr,
171 .check_legacy_ioport = cell_check_legacy_ioport, 184 .check_legacy_ioport = cell_check_legacy_ioport,
172 .progress = cell_progress, 185 .progress = cell_progress,
186 .init_IRQ = cell_init_irq,
187 .pcibios_fixup = cell_pcibios_fixup,
173#ifdef CONFIG_KEXEC 188#ifdef CONFIG_KEXEC
174 .machine_kexec = default_machine_kexec, 189 .machine_kexec = default_machine_kexec,
175 .machine_kexec_prepare = default_machine_kexec_prepare, 190 .machine_kexec_prepare = default_machine_kexec_prepare,
diff --git a/arch/powerpc/platforms/cell/smp.c b/arch/powerpc/platforms/cell/smp.c
index bdf6c5fe58c0..46aef0640742 100644
--- a/arch/powerpc/platforms/cell/smp.c
+++ b/arch/powerpc/platforms/cell/smp.c
@@ -14,7 +14,6 @@
14 14
15#undef DEBUG 15#undef DEBUG
16 16
17#include <linux/config.h>
18#include <linux/kernel.h> 17#include <linux/kernel.h>
19#include <linux/module.h> 18#include <linux/module.h>
20#include <linux/sched.h> 19#include <linux/sched.h>
diff --git a/arch/powerpc/platforms/cell/spider-pic.c b/arch/powerpc/platforms/cell/spider-pic.c
index 55cbdd77a62d..ae7ef88f1a37 100644
--- a/arch/powerpc/platforms/cell/spider-pic.c
+++ b/arch/powerpc/platforms/cell/spider-pic.c
@@ -22,6 +22,7 @@
22 22
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/irq.h> 24#include <linux/irq.h>
25#include <linux/ioport.h>
25 26
26#include <asm/pgtable.h> 27#include <asm/pgtable.h>
27#include <asm/prom.h> 28#include <asm/prom.h>
@@ -56,184 +57,313 @@ enum {
56 REISWAITEN = 0x508, /* Reissue Wait Control*/ 57 REISWAITEN = 0x508, /* Reissue Wait Control*/
57}; 58};
58 59
59static void __iomem *spider_pics[4]; 60#define SPIDER_CHIP_COUNT 4
61#define SPIDER_SRC_COUNT 64
62#define SPIDER_IRQ_INVALID 63
60 63
61static void __iomem *spider_get_pic(int irq) 64struct spider_pic {
62{ 65 struct irq_host *host;
63 int node = irq / IIC_NODE_STRIDE; 66 struct device_node *of_node;
64 irq %= IIC_NODE_STRIDE; 67 void __iomem *regs;
65 68 unsigned int node_id;
66 if (irq >= IIC_EXT_OFFSET && 69};
67 irq < IIC_EXT_OFFSET + IIC_NUM_EXT && 70static struct spider_pic spider_pics[SPIDER_CHIP_COUNT];
68 spider_pics)
69 return spider_pics[node];
70 return NULL;
71}
72 71
73static int spider_get_nr(unsigned int irq) 72static struct spider_pic *spider_virq_to_pic(unsigned int virq)
74{ 73{
75 return (irq % IIC_NODE_STRIDE) - IIC_EXT_OFFSET; 74 return irq_map[virq].host->host_data;
76} 75}
77 76
78static void __iomem *spider_get_irq_config(int irq) 77static void __iomem *spider_get_irq_config(struct spider_pic *pic,
78 unsigned int src)
79{ 79{
80 void __iomem *pic; 80 return pic->regs + TIR_CFGA + 8 * src;
81 pic = spider_get_pic(irq);
82 return pic + TIR_CFGA + 8 * spider_get_nr(irq);
83} 81}
84 82
85static void spider_enable_irq(unsigned int irq) 83static void spider_unmask_irq(unsigned int virq)
86{ 84{
87 int nodeid = (irq / IIC_NODE_STRIDE) * 0x10; 85 struct spider_pic *pic = spider_virq_to_pic(virq);
88 void __iomem *cfg = spider_get_irq_config(irq); 86 void __iomem *cfg = spider_get_irq_config(pic, irq_map[virq].hwirq);
89 irq = spider_get_nr(irq);
90 87
91 out_be32(cfg, (in_be32(cfg) & ~0xf0)| 0x3107000eu | nodeid); 88 /* We use no locking as we should be covered by the descriptor lock
92 out_be32(cfg + 4, in_be32(cfg + 4) | 0x00020000u | irq); 89 * for access to invidual source configuration registers
90 */
91 out_be32(cfg, in_be32(cfg) | 0x30000000u);
93} 92}
94 93
95static void spider_disable_irq(unsigned int irq) 94static void spider_mask_irq(unsigned int virq)
96{ 95{
97 void __iomem *cfg = spider_get_irq_config(irq); 96 struct spider_pic *pic = spider_virq_to_pic(virq);
98 irq = spider_get_nr(irq); 97 void __iomem *cfg = spider_get_irq_config(pic, irq_map[virq].hwirq);
99 98
99 /* We use no locking as we should be covered by the descriptor lock
100 * for access to invidual source configuration registers
101 */
100 out_be32(cfg, in_be32(cfg) & ~0x30000000u); 102 out_be32(cfg, in_be32(cfg) & ~0x30000000u);
101} 103}
102 104
103static unsigned int spider_startup_irq(unsigned int irq) 105static void spider_ack_irq(unsigned int virq)
104{ 106{
105 spider_enable_irq(irq); 107 struct spider_pic *pic = spider_virq_to_pic(virq);
106 return 0; 108 unsigned int src = irq_map[virq].hwirq;
107}
108 109
109static void spider_shutdown_irq(unsigned int irq) 110 /* Reset edge detection logic if necessary
110{ 111 */
111 spider_disable_irq(irq); 112 if (get_irq_desc(virq)->status & IRQ_LEVEL)
112} 113 return;
113 114
114static void spider_end_irq(unsigned int irq) 115 /* Only interrupts 47 to 50 can be set to edge */
115{ 116 if (src < 47 || src > 50)
116 spider_enable_irq(irq); 117 return;
117}
118 118
119static void spider_ack_irq(unsigned int irq) 119 /* Perform the clear of the edge logic */
120{ 120 out_be32(pic->regs + TIR_EDC, 0x100 | (src & 0xf));
121 spider_disable_irq(irq);
122 iic_local_enable();
123} 121}
124 122
125static struct hw_interrupt_type spider_pic = { 123static struct irq_chip spider_pic = {
126 .typename = " SPIDER ", 124 .typename = " SPIDER ",
127 .startup = spider_startup_irq, 125 .unmask = spider_unmask_irq,
128 .shutdown = spider_shutdown_irq, 126 .mask = spider_mask_irq,
129 .enable = spider_enable_irq,
130 .disable = spider_disable_irq,
131 .ack = spider_ack_irq, 127 .ack = spider_ack_irq,
132 .end = spider_end_irq,
133}; 128};
134 129
135int spider_get_irq(int node) 130static int spider_host_match(struct irq_host *h, struct device_node *node)
136{ 131{
137 unsigned long cs; 132 struct spider_pic *pic = h->host_data;
138 void __iomem *regs = spider_pics[node]; 133 return node == pic->of_node;
139
140 cs = in_be32(regs + TIR_CS) >> 24;
141
142 if (cs == 63)
143 return -1;
144 else
145 return cs;
146} 134}
147 135
148/* hardcoded part to be compatible with older firmware */ 136static int spider_host_map(struct irq_host *h, unsigned int virq,
149 137 irq_hw_number_t hw, unsigned int flags)
150void spider_init_IRQ_hardcoded(void)
151{ 138{
152 int node; 139 unsigned int sense = flags & IRQ_TYPE_SENSE_MASK;
153 long spiderpic; 140 struct spider_pic *pic = h->host_data;
154 long pics[] = { 0x24000008000, 0x34000008000 }; 141 void __iomem *cfg = spider_get_irq_config(pic, hw);
155 int n; 142 int level = 0;
156 143 u32 ic;
157 pr_debug("%s(%d): Using hardcoded defaults\n", __FUNCTION__, __LINE__); 144
158 145 /* Note that only level high is supported for most interrupts */
159 for (node = 0; node < num_present_cpus()/2; node++) { 146 if (sense != IRQ_TYPE_NONE && sense != IRQ_TYPE_LEVEL_HIGH &&
160 spiderpic = pics[node]; 147 (hw < 47 || hw > 50))
161 printk(KERN_DEBUG "SPIDER addr: %lx\n", spiderpic); 148 return -EINVAL;
162 spider_pics[node] = ioremap(spiderpic, 0x800); 149
163 for (n = 0; n < IIC_NUM_EXT; n++) { 150 /* Decode sense type */
164 int irq = n + IIC_EXT_OFFSET + node * IIC_NODE_STRIDE; 151 switch(sense) {
165 get_irq_desc(irq)->handler = &spider_pic; 152 case IRQ_TYPE_EDGE_RISING:
166 } 153 ic = 0x3;
167 154 break;
168 /* do not mask any interrupts because of level */ 155 case IRQ_TYPE_EDGE_FALLING:
169 out_be32(spider_pics[node] + TIR_MSK, 0x0); 156 ic = 0x2;
170 157 break;
171 /* disable edge detection clear */ 158 case IRQ_TYPE_LEVEL_LOW:
172 /* out_be32(spider_pics[node] + TIR_EDC, 0x0); */ 159 ic = 0x0;
173 160 level = 1;
174 /* enable interrupt packets to be output */ 161 break;
175 out_be32(spider_pics[node] + TIR_PIEN, 162 case IRQ_TYPE_LEVEL_HIGH:
176 in_be32(spider_pics[node] + TIR_PIEN) | 0x1); 163 case IRQ_TYPE_NONE:
177 164 ic = 0x1;
178 /* Enable the interrupt detection enable bit. Do this last! */ 165 level = 1;
179 out_be32(spider_pics[node] + TIR_DEN, 166 break;
180 in_be32(spider_pics[node] + TIR_DEN) | 0x1); 167 default:
168 return -EINVAL;
181 } 169 }
182}
183 170
184void spider_init_IRQ(void) 171 /* Configure the source. One gross hack that was there before and
185{ 172 * that I've kept around is the priority to the BE which I set to
186 long spider_reg; 173 * be the same as the interrupt source number. I don't know wether
187 struct device_node *dn; 174 * that's supposed to make any kind of sense however, we'll have to
188 char *compatible; 175 * decide that, but for now, I'm not changing the behaviour.
189 int n, node = 0; 176 */
177 out_be32(cfg, (ic << 24) | (0x7 << 16) | (pic->node_id << 4) | 0xe);
178 out_be32(cfg + 4, (0x2 << 16) | (hw & 0xff));
179
180 if (level)
181 get_irq_desc(virq)->status |= IRQ_LEVEL;
182 set_irq_chip_and_handler(virq, &spider_pic, handle_level_irq);
183 return 0;
184}
190 185
191 for (dn = NULL; (dn = of_find_node_by_name(dn, "interrupt-controller"));) { 186static int spider_host_xlate(struct irq_host *h, struct device_node *ct,
192 compatible = (char *)get_property(dn, "compatible", NULL); 187 u32 *intspec, unsigned int intsize,
188 irq_hw_number_t *out_hwirq, unsigned int *out_flags)
193 189
194 if (!compatible) 190{
195 continue; 191 /* Spider interrupts have 2 cells, first is the interrupt source,
192 * second, well, I don't know for sure yet ... We mask the top bits
193 * because old device-trees encode a node number in there
194 */
195 *out_hwirq = intspec[0] & 0x3f;
196 *out_flags = IRQ_TYPE_LEVEL_HIGH;
197 return 0;
198}
196 199
197 if (strstr(compatible, "CBEA,platform-spider-pic")) 200static struct irq_host_ops spider_host_ops = {
198 spider_reg = *(long *)get_property(dn,"reg", NULL); 201 .match = spider_host_match,
199 else if (strstr(compatible, "sti,platform-spider-pic")) { 202 .map = spider_host_map,
200 spider_init_IRQ_hardcoded(); 203 .xlate = spider_host_xlate,
201 return; 204};
202 } else
203 continue;
204 205
205 if (!spider_reg) 206static void spider_irq_cascade(unsigned int irq, struct irq_desc *desc,
206 printk("interrupt controller does not have reg property !\n"); 207 struct pt_regs *regs)
208{
209 struct spider_pic *pic = desc->handler_data;
210 unsigned int cs, virq;
207 211
208 n = prom_n_addr_cells(dn); 212 cs = in_be32(pic->regs + TIR_CS) >> 24;
213 if (cs == SPIDER_IRQ_INVALID)
214 virq = NO_IRQ;
215 else
216 virq = irq_linear_revmap(pic->host, cs);
217 if (virq != NO_IRQ)
218 generic_handle_irq(virq, regs);
219 desc->chip->eoi(irq);
220}
209 221
210 if ( n != 2) 222/* For hooking up the cascace we have a problem. Our device-tree is
211 printk("reg property with invalid number of elements \n"); 223 * crap and we don't know on which BE iic interrupt we are hooked on at
224 * least not the "standard" way. We can reconstitute it based on two
225 * informations though: which BE node we are connected to and wether
226 * we are connected to IOIF0 or IOIF1. Right now, we really only care
227 * about the IBM cell blade and we know that its firmware gives us an
228 * interrupt-map property which is pretty strange.
229 */
230static unsigned int __init spider_find_cascade_and_node(struct spider_pic *pic)
231{
232 unsigned int virq;
233 u32 *imap, *tmp;
234 int imaplen, intsize, unit;
235 struct device_node *iic;
236 struct irq_host *iic_host;
237
238#if 0 /* Enable that when we have a way to retreive the node as well */
239 /* First, we check wether we have a real "interrupts" in the device
240 * tree in case the device-tree is ever fixed
241 */
242 struct of_irq oirq;
243 if (of_irq_map_one(pic->of_node, 0, &oirq) == 0) {
244 virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
245 oirq.size);
246 goto bail;
247 }
248#endif
249
250 /* Now do the horrible hacks */
251 tmp = (u32 *)get_property(pic->of_node, "#interrupt-cells", NULL);
252 if (tmp == NULL)
253 return NO_IRQ;
254 intsize = *tmp;
255 imap = (u32 *)get_property(pic->of_node, "interrupt-map", &imaplen);
256 if (imap == NULL || imaplen < (intsize + 1))
257 return NO_IRQ;
258 iic = of_find_node_by_phandle(imap[intsize]);
259 if (iic == NULL)
260 return NO_IRQ;
261 imap += intsize + 1;
262 tmp = (u32 *)get_property(iic, "#interrupt-cells", NULL);
263 if (tmp == NULL)
264 return NO_IRQ;
265 intsize = *tmp;
266 /* Assume unit is last entry of interrupt specifier */
267 unit = imap[intsize - 1];
268 /* Ok, we have a unit, now let's try to get the node */
269 tmp = (u32 *)get_property(iic, "ibm,interrupt-server-ranges", NULL);
270 if (tmp == NULL) {
271 of_node_put(iic);
272 return NO_IRQ;
273 }
274 /* ugly as hell but works for now */
275 pic->node_id = (*tmp) >> 1;
276 of_node_put(iic);
277
278 /* Ok, now let's get cracking. You may ask me why I just didn't match
279 * the iic host from the iic OF node, but that way I'm still compatible
280 * with really really old old firmwares for which we don't have a node
281 */
282 iic_host = iic_get_irq_host(pic->node_id);
283 if (iic_host == NULL)
284 return NO_IRQ;
285 /* Manufacture an IIC interrupt number of class 2 */
286 virq = irq_create_mapping(iic_host, 0x20 | unit, 0);
287 if (virq == NO_IRQ)
288 printk(KERN_ERR "spider_pic: failed to map cascade !");
289 return virq;
290}
212 291
213 spider_pics[node] = ioremap(spider_reg, 0x800);
214 292
215 printk("SPIDER addr: %lx with %i addr_cells mapped to %p\n", 293static void __init spider_init_one(struct device_node *of_node, int chip,
216 spider_reg, n, spider_pics[node]); 294 unsigned long addr)
295{
296 struct spider_pic *pic = &spider_pics[chip];
297 int i, virq;
298
299 /* Map registers */
300 pic->regs = ioremap(addr, 0x1000);
301 if (pic->regs == NULL)
302 panic("spider_pic: can't map registers !");
303
304 /* Allocate a host */
305 pic->host = irq_alloc_host(IRQ_HOST_MAP_LINEAR, SPIDER_SRC_COUNT,
306 &spider_host_ops, SPIDER_IRQ_INVALID);
307 if (pic->host == NULL)
308 panic("spider_pic: can't allocate irq host !");
309 pic->host->host_data = pic;
310
311 /* Fill out other bits */
312 pic->of_node = of_node_get(of_node);
313
314 /* Go through all sources and disable them */
315 for (i = 0; i < SPIDER_SRC_COUNT; i++) {
316 void __iomem *cfg = pic->regs + TIR_CFGA + 8 * i;
317 out_be32(cfg, in_be32(cfg) & ~0x30000000u);
318 }
217 319
218 for (n = 0; n < IIC_NUM_EXT; n++) { 320 /* do not mask any interrupts because of level */
219 int irq = n + IIC_EXT_OFFSET + node * IIC_NODE_STRIDE; 321 out_be32(pic->regs + TIR_MSK, 0x0);
220 get_irq_desc(irq)->handler = &spider_pic;
221 }
222 322
223 /* do not mask any interrupts because of level */ 323 /* enable interrupt packets to be output */
224 out_be32(spider_pics[node] + TIR_MSK, 0x0); 324 out_be32(pic->regs + TIR_PIEN, in_be32(pic->regs + TIR_PIEN) | 0x1);
225 325
226 /* disable edge detection clear */ 326 /* Hook up the cascade interrupt to the iic and nodeid */
227 /* out_be32(spider_pics[node] + TIR_EDC, 0x0); */ 327 virq = spider_find_cascade_and_node(pic);
328 if (virq == NO_IRQ)
329 return;
330 set_irq_data(virq, pic);
331 set_irq_chained_handler(virq, spider_irq_cascade);
228 332
229 /* enable interrupt packets to be output */ 333 printk(KERN_INFO "spider_pic: node %d, addr: 0x%lx %s\n",
230 out_be32(spider_pics[node] + TIR_PIEN, 334 pic->node_id, addr, of_node->full_name);
231 in_be32(spider_pics[node] + TIR_PIEN) | 0x1);
232 335
233 /* Enable the interrupt detection enable bit. Do this last! */ 336 /* Enable the interrupt detection enable bit. Do this last! */
234 out_be32(spider_pics[node] + TIR_DEN, 337 out_be32(pic->regs + TIR_DEN, in_be32(pic->regs + TIR_DEN) | 0x1);
235 in_be32(spider_pics[node] + TIR_DEN) | 0x1); 338}
236 339
237 node++; 340void __init spider_init_IRQ(void)
341{
342 struct resource r;
343 struct device_node *dn;
344 int chip = 0;
345
346 /* XXX node numbers are totally bogus. We _hope_ we get the device
347 * nodes in the right order here but that's definitely not guaranteed,
348 * we need to get the node from the device tree instead.
349 * There is currently no proper property for it (but our whole
350 * device-tree is bogus anyway) so all we can do is pray or maybe test
351 * the address and deduce the node-id
352 */
353 for (dn = NULL;
354 (dn = of_find_node_by_name(dn, "interrupt-controller"));) {
355 if (device_is_compatible(dn, "CBEA,platform-spider-pic")) {
356 if (of_address_to_resource(dn, 0, &r)) {
357 printk(KERN_WARNING "spider-pic: Failed\n");
358 continue;
359 }
360 } else if (device_is_compatible(dn, "sti,platform-spider-pic")
361 && (chip < 2)) {
362 static long hard_coded_pics[] =
363 { 0x24000008000, 0x34000008000 };
364 r.start = hard_coded_pics[chip];
365 } else
366 continue;
367 spider_init_one(dn, chip++, r.start);
238 } 368 }
239} 369}
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
index db82f503ba2c..5d2313a6c82b 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -168,12 +168,12 @@ spu_irq_class_0_bottom(struct spu *spu)
168 168
169 stat &= mask; 169 stat &= mask;
170 170
171 if (stat & 1) /* invalid MFC DMA */ 171 if (stat & 1) /* invalid DMA alignment */
172 __spu_trap_invalid_dma(spu);
173
174 if (stat & 2) /* invalid DMA alignment */
175 __spu_trap_dma_align(spu); 172 __spu_trap_dma_align(spu);
176 173
174 if (stat & 2) /* invalid MFC DMA */
175 __spu_trap_invalid_dma(spu);
176
177 if (stat & 4) /* error on SPU */ 177 if (stat & 4) /* error on SPU */
178 __spu_trap_error(spu); 178 __spu_trap_error(spu);
179 179
@@ -264,51 +264,57 @@ spu_irq_class_2(int irq, void *data, struct pt_regs *regs)
264 return stat ? IRQ_HANDLED : IRQ_NONE; 264 return stat ? IRQ_HANDLED : IRQ_NONE;
265} 265}
266 266
267static int 267static int spu_request_irqs(struct spu *spu)
268spu_request_irqs(struct spu *spu)
269{ 268{
270 int ret; 269 int ret = 0;
271 int irq_base;
272
273 irq_base = IIC_NODE_STRIDE * spu->node + IIC_SPE_OFFSET;
274
275 snprintf(spu->irq_c0, sizeof (spu->irq_c0), "spe%02d.0", spu->number);
276 ret = request_irq(irq_base + spu->isrc,
277 spu_irq_class_0, SA_INTERRUPT, spu->irq_c0, spu);
278 if (ret)
279 goto out;
280
281 snprintf(spu->irq_c1, sizeof (spu->irq_c1), "spe%02d.1", spu->number);
282 ret = request_irq(irq_base + IIC_CLASS_STRIDE + spu->isrc,
283 spu_irq_class_1, SA_INTERRUPT, spu->irq_c1, spu);
284 if (ret)
285 goto out1;
286 270
287 snprintf(spu->irq_c2, sizeof (spu->irq_c2), "spe%02d.2", spu->number); 271 if (spu->irqs[0] != NO_IRQ) {
288 ret = request_irq(irq_base + 2*IIC_CLASS_STRIDE + spu->isrc, 272 snprintf(spu->irq_c0, sizeof (spu->irq_c0), "spe%02d.0",
289 spu_irq_class_2, SA_INTERRUPT, spu->irq_c2, spu); 273 spu->number);
290 if (ret) 274 ret = request_irq(spu->irqs[0], spu_irq_class_0,
291 goto out2; 275 IRQF_DISABLED,
292 goto out; 276 spu->irq_c0, spu);
277 if (ret)
278 goto bail0;
279 }
280 if (spu->irqs[1] != NO_IRQ) {
281 snprintf(spu->irq_c1, sizeof (spu->irq_c1), "spe%02d.1",
282 spu->number);
283 ret = request_irq(spu->irqs[1], spu_irq_class_1,
284 IRQF_DISABLED,
285 spu->irq_c1, spu);
286 if (ret)
287 goto bail1;
288 }
289 if (spu->irqs[2] != NO_IRQ) {
290 snprintf(spu->irq_c2, sizeof (spu->irq_c2), "spe%02d.2",
291 spu->number);
292 ret = request_irq(spu->irqs[2], spu_irq_class_2,
293 IRQF_DISABLED,
294 spu->irq_c2, spu);
295 if (ret)
296 goto bail2;
297 }
298 return 0;
293 299
294out2: 300bail2:
295 free_irq(irq_base + IIC_CLASS_STRIDE + spu->isrc, spu); 301 if (spu->irqs[1] != NO_IRQ)
296out1: 302 free_irq(spu->irqs[1], spu);
297 free_irq(irq_base + spu->isrc, spu); 303bail1:
298out: 304 if (spu->irqs[0] != NO_IRQ)
305 free_irq(spu->irqs[0], spu);
306bail0:
299 return ret; 307 return ret;
300} 308}
301 309
302static void 310static void spu_free_irqs(struct spu *spu)
303spu_free_irqs(struct spu *spu)
304{ 311{
305 int irq_base; 312 if (spu->irqs[0] != NO_IRQ)
306 313 free_irq(spu->irqs[0], spu);
307 irq_base = IIC_NODE_STRIDE * spu->node + IIC_SPE_OFFSET; 314 if (spu->irqs[1] != NO_IRQ)
308 315 free_irq(spu->irqs[1], spu);
309 free_irq(irq_base + spu->isrc, spu); 316 if (spu->irqs[2] != NO_IRQ)
310 free_irq(irq_base + IIC_CLASS_STRIDE + spu->isrc, spu); 317 free_irq(spu->irqs[2], spu);
311 free_irq(irq_base + 2*IIC_CLASS_STRIDE + spu->isrc, spu);
312} 318}
313 319
314static LIST_HEAD(spu_list); 320static LIST_HEAD(spu_list);
@@ -559,17 +565,38 @@ static void spu_unmap(struct spu *spu)
559 iounmap((u8 __iomem *)spu->local_store); 565 iounmap((u8 __iomem *)spu->local_store);
560} 566}
561 567
568/* This function shall be abstracted for HV platforms */
569static int __init spu_map_interrupts(struct spu *spu, struct device_node *np)
570{
571 struct irq_host *host;
572 unsigned int isrc;
573 u32 *tmp;
574
575 host = iic_get_irq_host(spu->node);
576 if (host == NULL)
577 return -ENODEV;
578
579 /* Get the interrupt source from the device-tree */
580 tmp = (u32 *)get_property(np, "isrc", NULL);
581 if (!tmp)
582 return -ENODEV;
583 spu->isrc = isrc = tmp[0];
584
585 /* Now map interrupts of all 3 classes */
586 spu->irqs[0] = irq_create_mapping(host, 0x00 | isrc, 0);
587 spu->irqs[1] = irq_create_mapping(host, 0x10 | isrc, 0);
588 spu->irqs[2] = irq_create_mapping(host, 0x20 | isrc, 0);
589
590 /* Right now, we only fail if class 2 failed */
591 return spu->irqs[2] == NO_IRQ ? -EINVAL : 0;
592}
593
562static int __init spu_map_device(struct spu *spu, struct device_node *node) 594static int __init spu_map_device(struct spu *spu, struct device_node *node)
563{ 595{
564 char *prop; 596 char *prop;
565 int ret; 597 int ret;
566 598
567 ret = -ENODEV; 599 ret = -ENODEV;
568 prop = get_property(node, "isrc", NULL);
569 if (!prop)
570 goto out;
571 spu->isrc = *(unsigned int *)prop;
572
573 spu->name = get_property(node, "name", NULL); 600 spu->name = get_property(node, "name", NULL);
574 if (!spu->name) 601 if (!spu->name)
575 goto out; 602 goto out;
@@ -636,7 +663,8 @@ static int spu_create_sysdev(struct spu *spu)
636 return ret; 663 return ret;
637 } 664 }
638 665
639 sysdev_create_file(&spu->sysdev, &attr_isrc); 666 if (spu->isrc != 0)
667 sysdev_create_file(&spu->sysdev, &attr_isrc);
640 sysfs_add_device_to_node(&spu->sysdev, spu->nid); 668 sysfs_add_device_to_node(&spu->sysdev, spu->nid);
641 669
642 return 0; 670 return 0;
@@ -668,6 +696,9 @@ static int __init create_spu(struct device_node *spe)
668 spu->nid = of_node_to_nid(spe); 696 spu->nid = of_node_to_nid(spe);
669 if (spu->nid == -1) 697 if (spu->nid == -1)
670 spu->nid = 0; 698 spu->nid = 0;
699 ret = spu_map_interrupts(spu, spe);
700 if (ret)
701 goto out_unmap;
671 spin_lock_init(&spu->register_lock); 702 spin_lock_init(&spu->register_lock);
672 spu_mfc_sdr_set(spu, mfspr(SPRN_SDR1)); 703 spu_mfc_sdr_set(spu, mfspr(SPRN_SDR1));
673 spu_mfc_sr1_set(spu, 0x33); 704 spu_mfc_sr1_set(spu, 0x33);
diff --git a/arch/powerpc/platforms/cell/spufs/backing_ops.c b/arch/powerpc/platforms/cell/spufs/backing_ops.c
index f1d35ddc9df3..2d22cd59d6fc 100644
--- a/arch/powerpc/platforms/cell/spufs/backing_ops.c
+++ b/arch/powerpc/platforms/cell/spufs/backing_ops.c
@@ -21,7 +21,6 @@
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */ 22 */
23 23
24#include <linux/config.h>
25#include <linux/module.h> 24#include <linux/module.h>
26#include <linux/errno.h> 25#include <linux/errno.h>
27#include <linux/sched.h> 26#include <linux/sched.h>
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index 7854a380dce2..58e794f9da1b 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -204,7 +204,7 @@ static int spufs_cntl_mmap(struct file *file, struct vm_area_struct *vma)
204 204
205 vma->vm_flags |= VM_RESERVED; 205 vma->vm_flags |= VM_RESERVED;
206 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot) 206 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
207 | _PAGE_NO_CACHE); 207 | _PAGE_NO_CACHE | _PAGE_GUARDED);
208 208
209 vma->vm_ops = &spufs_cntl_mmap_vmops; 209 vma->vm_ops = &spufs_cntl_mmap_vmops;
210 return 0; 210 return 0;
@@ -675,7 +675,7 @@ static int spufs_signal1_mmap(struct file *file, struct vm_area_struct *vma)
675 675
676 vma->vm_flags |= VM_RESERVED; 676 vma->vm_flags |= VM_RESERVED;
677 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot) 677 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
678 | _PAGE_NO_CACHE); 678 | _PAGE_NO_CACHE | _PAGE_GUARDED);
679 679
680 vma->vm_ops = &spufs_signal1_mmap_vmops; 680 vma->vm_ops = &spufs_signal1_mmap_vmops;
681 return 0; 681 return 0;
@@ -762,7 +762,7 @@ static int spufs_signal2_mmap(struct file *file, struct vm_area_struct *vma)
762 /* FIXME: */ 762 /* FIXME: */
763 vma->vm_flags |= VM_RESERVED; 763 vma->vm_flags |= VM_RESERVED;
764 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot) 764 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
765 | _PAGE_NO_CACHE); 765 | _PAGE_NO_CACHE | _PAGE_GUARDED);
766 766
767 vma->vm_ops = &spufs_signal2_mmap_vmops; 767 vma->vm_ops = &spufs_signal2_mmap_vmops;
768 return 0; 768 return 0;
@@ -850,7 +850,7 @@ static int spufs_mss_mmap(struct file *file, struct vm_area_struct *vma)
850 850
851 vma->vm_flags |= VM_RESERVED; 851 vma->vm_flags |= VM_RESERVED;
852 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot) 852 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
853 | _PAGE_NO_CACHE); 853 | _PAGE_NO_CACHE | _PAGE_GUARDED);
854 854
855 vma->vm_ops = &spufs_mss_mmap_vmops; 855 vma->vm_ops = &spufs_mss_mmap_vmops;
856 return 0; 856 return 0;
@@ -899,7 +899,7 @@ static int spufs_mfc_mmap(struct file *file, struct vm_area_struct *vma)
899 899
900 vma->vm_flags |= VM_RESERVED; 900 vma->vm_flags |= VM_RESERVED;
901 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot) 901 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
902 | _PAGE_NO_CACHE); 902 | _PAGE_NO_CACHE | _PAGE_GUARDED);
903 903
904 vma->vm_ops = &spufs_mfc_mmap_vmops; 904 vma->vm_ops = &spufs_mfc_mmap_vmops;
905 return 0; 905 return 0;
diff --git a/arch/powerpc/platforms/cell/spufs/hw_ops.c b/arch/powerpc/platforms/cell/spufs/hw_ops.c
index ede2cac46b6d..c8670f519734 100644
--- a/arch/powerpc/platforms/cell/spufs/hw_ops.c
+++ b/arch/powerpc/platforms/cell/spufs/hw_ops.c
@@ -18,7 +18,6 @@
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */ 19 */
20 20
21#include <linux/config.h>
22#include <linux/module.h> 21#include <linux/module.h>
23#include <linux/errno.h> 22#include <linux/errno.h>
24#include <linux/sched.h> 23#include <linux/sched.h>
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
index 3dcc5d8d66b9..1350294484b6 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -26,7 +26,6 @@
26 26
27#undef DEBUG 27#undef DEBUG
28 28
29#include <linux/config.h>
30#include <linux/module.h> 29#include <linux/module.h>
31#include <linux/errno.h> 30#include <linux/errno.h>
32#include <linux/sched.h> 31#include <linux/sched.h>
diff --git a/arch/powerpc/platforms/cell/spufs/switch.c b/arch/powerpc/platforms/cell/spufs/switch.c
index b30e55dab832..9d9d82dd32ba 100644
--- a/arch/powerpc/platforms/cell/spufs/switch.c
+++ b/arch/powerpc/platforms/cell/spufs/switch.c
@@ -32,7 +32,6 @@
32 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 32 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
33 */ 33 */
34 34
35#include <linux/config.h>
36#include <linux/module.h> 35#include <linux/module.h>
37#include <linux/errno.h> 36#include <linux/errno.h>
38#include <linux/sched.h> 37#include <linux/sched.h>
@@ -464,7 +463,8 @@ static inline void wait_purge_complete(struct spu_state *csa, struct spu *spu)
464 * Poll MFC_CNTL[Ps] until value '11' is read 463 * Poll MFC_CNTL[Ps] until value '11' is read
465 * (purge complete). 464 * (purge complete).
466 */ 465 */
467 POLL_WHILE_FALSE(in_be64(&priv2->mfc_control_RW) & 466 POLL_WHILE_FALSE((in_be64(&priv2->mfc_control_RW) &
467 MFC_CNTL_PURGE_DMA_STATUS_MASK) ==
468 MFC_CNTL_PURGE_DMA_COMPLETE); 468 MFC_CNTL_PURGE_DMA_COMPLETE);
469} 469}
470 470
@@ -1028,7 +1028,8 @@ static inline void wait_suspend_mfc_complete(struct spu_state *csa,
1028 * Restore, Step 47. 1028 * Restore, Step 47.
1029 * Poll MFC_CNTL[Ss] until 11 is returned. 1029 * Poll MFC_CNTL[Ss] until 11 is returned.
1030 */ 1030 */
1031 POLL_WHILE_FALSE(in_be64(&priv2->mfc_control_RW) & 1031 POLL_WHILE_FALSE((in_be64(&priv2->mfc_control_RW) &
1032 MFC_CNTL_SUSPEND_DMA_STATUS_MASK) ==
1032 MFC_CNTL_SUSPEND_COMPLETE); 1033 MFC_CNTL_SUSPEND_COMPLETE);
1033} 1034}
1034 1035
@@ -2100,7 +2101,7 @@ EXPORT_SYMBOL_GPL(spu_save);
2100 * @spu: pointer to SPU iomem structure. 2101 * @spu: pointer to SPU iomem structure.
2101 * 2102 *
2102 * Perform harvest + restore, as we may not be coming 2103 * Perform harvest + restore, as we may not be coming
2103 * from a previous succesful save operation, and the 2104 * from a previous successful save operation, and the
2104 * hardware state is unknown. 2105 * hardware state is unknown.
2105 */ 2106 */
2106int spu_restore(struct spu_state *new, struct spu *spu) 2107int spu_restore(struct spu_state *new, struct spu *spu)
@@ -2203,7 +2204,7 @@ void spu_init_csa(struct spu_state *csa)
2203 2204
2204 memset(lscsa, 0, sizeof(struct spu_lscsa)); 2205 memset(lscsa, 0, sizeof(struct spu_lscsa));
2205 csa->lscsa = lscsa; 2206 csa->lscsa = lscsa;
2206 csa->register_lock = SPIN_LOCK_UNLOCKED; 2207 spin_lock_init(&csa->register_lock);
2207 2208
2208 /* Set LS pages reserved to allow for user-space mapping. */ 2209 /* Set LS pages reserved to allow for user-space mapping. */
2209 for (p = lscsa->ls; p < lscsa->ls + LS_SIZE; p += PAGE_SIZE) 2210 for (p = lscsa->ls; p < lscsa->ls + LS_SIZE; p += PAGE_SIZE)
diff --git a/arch/powerpc/platforms/chrp/pci.c b/arch/powerpc/platforms/chrp/pci.c
index ac224876ce59..6802cdc3168a 100644
--- a/arch/powerpc/platforms/chrp/pci.c
+++ b/arch/powerpc/platforms/chrp/pci.c
@@ -2,7 +2,6 @@
2 * CHRP pci routines. 2 * CHRP pci routines.
3 */ 3 */
4 4
5#include <linux/config.h>
6#include <linux/kernel.h> 5#include <linux/kernel.h>
7#include <linux/pci.h> 6#include <linux/pci.h>
8#include <linux/delay.h> 7#include <linux/delay.h>
@@ -19,7 +18,6 @@
19#include <asm/machdep.h> 18#include <asm/machdep.h>
20#include <asm/sections.h> 19#include <asm/sections.h>
21#include <asm/pci-bridge.h> 20#include <asm/pci-bridge.h>
22#include <asm/open_pic.h>
23#include <asm/grackle.h> 21#include <asm/grackle.h>
24#include <asm/rtas.h> 22#include <asm/rtas.h>
25 23
@@ -143,7 +141,7 @@ hydra_init(void)
143 if (np == NULL || of_address_to_resource(np, 0, &r)) 141 if (np == NULL || of_address_to_resource(np, 0, &r))
144 return 0; 142 return 0;
145 Hydra = ioremap(r.start, r.end-r.start); 143 Hydra = ioremap(r.start, r.end-r.start);
146 printk("Hydra Mac I/O at %lx\n", r.start); 144 printk("Hydra Mac I/O at %llx\n", (unsigned long long)r.start);
147 printk("Hydra Feature_Control was %x", 145 printk("Hydra Feature_Control was %x",
148 in_le32(&Hydra->Feature_Control)); 146 in_le32(&Hydra->Feature_Control));
149 out_le32(&Hydra->Feature_Control, (HYDRA_FC_SCC_CELL_EN | 147 out_le32(&Hydra->Feature_Control, (HYDRA_FC_SCC_CELL_EN |
@@ -162,15 +160,9 @@ void __init
162chrp_pcibios_fixup(void) 160chrp_pcibios_fixup(void)
163{ 161{
164 struct pci_dev *dev = NULL; 162 struct pci_dev *dev = NULL;
165 struct device_node *np;
166 163
167 /* PCI interrupts are controlled by the OpenPIC */ 164 for_each_pci_dev(dev)
168 for_each_pci_dev(dev) { 165 pci_read_irq_line(dev);
169 np = pci_device_to_OF_node(dev);
170 if ((np != 0) && (np->n_intrs > 0) && (np->intrs[0].line != 0))
171 dev->irq = np->intrs[0].line;
172 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
173 }
174} 166}
175 167
176#define PRG_CL_RESET_VALID 0x00010000 168#define PRG_CL_RESET_VALID 0x00010000
@@ -267,7 +259,7 @@ chrp_find_bridges(void)
267 bus_range[0], bus_range[1]); 259 bus_range[0], bus_range[1]);
268 printk(" controlled by %s", dev->type); 260 printk(" controlled by %s", dev->type);
269 if (!is_longtrail) 261 if (!is_longtrail)
270 printk(" at %lx", r.start); 262 printk(" at %llx", (unsigned long long)r.start);
271 printk("\n"); 263 printk("\n");
272 264
273 hose = pcibios_alloc_controller(); 265 hose = pcibios_alloc_controller();
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index 18d89f38796b..bb10171132fa 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -8,7 +8,6 @@
8 * bootup setup stuff.. 8 * bootup setup stuff..
9 */ 9 */
10 10
11#include <linux/config.h>
12#include <linux/errno.h> 11#include <linux/errno.h>
13#include <linux/sched.h> 12#include <linux/sched.h>
14#include <linux/kernel.h> 13#include <linux/kernel.h>
@@ -60,7 +59,7 @@ void rtas_indicator_progress(char *, unsigned short);
60int _chrp_type; 59int _chrp_type;
61EXPORT_SYMBOL(_chrp_type); 60EXPORT_SYMBOL(_chrp_type);
62 61
63struct mpic *chrp_mpic; 62static struct mpic *chrp_mpic;
64 63
65/* Used for doing CHRP event-scans */ 64/* Used for doing CHRP event-scans */
66DEFINE_PER_CPU(struct timer_list, heartbeat_timer); 65DEFINE_PER_CPU(struct timer_list, heartbeat_timer);
@@ -316,24 +315,32 @@ chrp_event_scan(unsigned long unused)
316 jiffies + event_scan_interval); 315 jiffies + event_scan_interval);
317} 316}
318 317
318static void chrp_8259_cascade(unsigned int irq, struct irq_desc *desc,
319 struct pt_regs *regs)
320{
321 unsigned int cascade_irq = i8259_irq(regs);
322 if (cascade_irq != NO_IRQ)
323 generic_handle_irq(cascade_irq, regs);
324 desc->chip->eoi(irq);
325}
326
319/* 327/*
320 * Finds the open-pic node and sets up the mpic driver. 328 * Finds the open-pic node and sets up the mpic driver.
321 */ 329 */
322static void __init chrp_find_openpic(void) 330static void __init chrp_find_openpic(void)
323{ 331{
324 struct device_node *np, *root; 332 struct device_node *np, *root;
325 int len, i, j, irq_count; 333 int len, i, j;
326 int isu_size, idu_size; 334 int isu_size, idu_size;
327 unsigned int *iranges, *opprop = NULL; 335 unsigned int *iranges, *opprop = NULL;
328 int oplen = 0; 336 int oplen = 0;
329 unsigned long opaddr; 337 unsigned long opaddr;
330 int na = 1; 338 int na = 1;
331 unsigned char init_senses[NR_IRQS - NUM_8259_INTERRUPTS];
332 339
333 np = find_type_devices("open-pic"); 340 np = of_find_node_by_type(NULL, "open-pic");
334 if (np == NULL) 341 if (np == NULL)
335 return; 342 return;
336 root = find_path_device("/"); 343 root = of_find_node_by_path("/");
337 if (root) { 344 if (root) {
338 opprop = (unsigned int *) get_property 345 opprop = (unsigned int *) get_property
339 (root, "platform-open-pic", &oplen); 346 (root, "platform-open-pic", &oplen);
@@ -344,19 +351,15 @@ static void __init chrp_find_openpic(void)
344 oplen /= na * sizeof(unsigned int); 351 oplen /= na * sizeof(unsigned int);
345 } else { 352 } else {
346 struct resource r; 353 struct resource r;
347 if (of_address_to_resource(np, 0, &r)) 354 if (of_address_to_resource(np, 0, &r)) {
348 return; 355 goto bail;
356 }
349 opaddr = r.start; 357 opaddr = r.start;
350 oplen = 0; 358 oplen = 0;
351 } 359 }
352 360
353 printk(KERN_INFO "OpenPIC at %lx\n", opaddr); 361 printk(KERN_INFO "OpenPIC at %lx\n", opaddr);
354 362
355 irq_count = NR_IRQS - NUM_ISA_INTERRUPTS - 4; /* leave room for IPIs */
356 prom_get_irq_senses(init_senses, NUM_ISA_INTERRUPTS, NR_IRQS - 4);
357 /* i8259 cascade is always positive level */
358 init_senses[0] = IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE;
359
360 iranges = (unsigned int *) get_property(np, "interrupt-ranges", &len); 363 iranges = (unsigned int *) get_property(np, "interrupt-ranges", &len);
361 if (iranges == NULL) 364 if (iranges == NULL)
362 len = 0; /* non-distributed mpic */ 365 len = 0; /* non-distributed mpic */
@@ -383,15 +386,12 @@ static void __init chrp_find_openpic(void)
383 if (len > 1) 386 if (len > 1)
384 isu_size = iranges[3]; 387 isu_size = iranges[3];
385 388
386 chrp_mpic = mpic_alloc(opaddr, MPIC_PRIMARY, 389 chrp_mpic = mpic_alloc(np, opaddr, MPIC_PRIMARY,
387 isu_size, NUM_ISA_INTERRUPTS, irq_count, 390 isu_size, 0, " MPIC ");
388 NR_IRQS - 4, init_senses, irq_count,
389 " MPIC ");
390 if (chrp_mpic == NULL) { 391 if (chrp_mpic == NULL) {
391 printk(KERN_ERR "Failed to allocate MPIC structure\n"); 392 printk(KERN_ERR "Failed to allocate MPIC structure\n");
392 return; 393 goto bail;
393 } 394 }
394
395 j = na - 1; 395 j = na - 1;
396 for (i = 1; i < len; ++i) { 396 for (i = 1; i < len; ++i) {
397 iranges += 2; 397 iranges += 2;
@@ -403,7 +403,10 @@ static void __init chrp_find_openpic(void)
403 } 403 }
404 404
405 mpic_init(chrp_mpic); 405 mpic_init(chrp_mpic);
406 mpic_setup_cascade(NUM_ISA_INTERRUPTS, i8259_irq_cascade, NULL); 406 ppc_md.get_irq = mpic_get_irq;
407 bail:
408 of_node_put(root);
409 of_node_put(np);
407} 410}
408 411
409#if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(XMON) 412#if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(XMON)
@@ -414,14 +417,34 @@ static struct irqaction xmon_irqaction = {
414}; 417};
415#endif 418#endif
416 419
417void __init chrp_init_IRQ(void) 420static void __init chrp_find_8259(void)
418{ 421{
419 struct device_node *np; 422 struct device_node *np, *pic = NULL;
420 unsigned long chrp_int_ack = 0; 423 unsigned long chrp_int_ack = 0;
421#if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(XMON) 424 unsigned int cascade_irq;
422 struct device_node *kbd; 425
423#endif 426 /* Look for cascade */
427 for_each_node_by_type(np, "interrupt-controller")
428 if (device_is_compatible(np, "chrp,iic")) {
429 pic = np;
430 break;
431 }
432 /* Ok, 8259 wasn't found. We need to handle the case where
433 * we have a pegasos that claims to be chrp but doesn't have
434 * a proper interrupt tree
435 */
436 if (pic == NULL && chrp_mpic != NULL) {
437 printk(KERN_ERR "i8259: Not found in device-tree"
438 " assuming no legacy interrupts\n");
439 return;
440 }
424 441
442 /* Look for intack. In a perfect world, we would look for it on
443 * the ISA bus that holds the 8259 but heh... Works that way. If
444 * we ever see a problem, we can try to re-use the pSeries code here.
445 * Also, Pegasos-type platforms don't have a proper node to start
446 * from anyway
447 */
425 for (np = find_devices("pci"); np != NULL; np = np->next) { 448 for (np = find_devices("pci"); np != NULL; np = np->next) {
426 unsigned int *addrp = (unsigned int *) 449 unsigned int *addrp = (unsigned int *)
427 get_property(np, "8259-interrupt-acknowledge", NULL); 450 get_property(np, "8259-interrupt-acknowledge", NULL);
@@ -432,11 +455,29 @@ void __init chrp_init_IRQ(void)
432 break; 455 break;
433 } 456 }
434 if (np == NULL) 457 if (np == NULL)
435 printk(KERN_ERR "Cannot find PCI interrupt acknowledge address\n"); 458 printk(KERN_WARNING "Cannot find PCI interrupt acknowledge"
459 " address, polling\n");
460
461 i8259_init(pic, chrp_int_ack);
462 if (ppc_md.get_irq == NULL)
463 ppc_md.get_irq = i8259_irq;
464 if (chrp_mpic != NULL) {
465 cascade_irq = irq_of_parse_and_map(pic, 0);
466 if (cascade_irq == NO_IRQ)
467 printk(KERN_ERR "i8259: failed to map cascade irq\n");
468 else
469 set_irq_chained_handler(cascade_irq,
470 chrp_8259_cascade);
471 }
472}
436 473
474void __init chrp_init_IRQ(void)
475{
476#if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(XMON)
477 struct device_node *kbd;
478#endif
437 chrp_find_openpic(); 479 chrp_find_openpic();
438 480 chrp_find_8259();
439 i8259_init(chrp_int_ack, 0);
440 481
441 if (_chrp_type == _CHRP_Pegasos) 482 if (_chrp_type == _CHRP_Pegasos)
442 ppc_md.get_irq = i8259_irq; 483 ppc_md.get_irq = i8259_irq;
@@ -521,10 +562,6 @@ static int __init chrp_probe(void)
521 DMA_MODE_READ = 0x44; 562 DMA_MODE_READ = 0x44;
522 DMA_MODE_WRITE = 0x48; 563 DMA_MODE_WRITE = 0x48;
523 isa_io_base = CHRP_ISA_IO_BASE; /* default value */ 564 isa_io_base = CHRP_ISA_IO_BASE; /* default value */
524 ppc_do_canonicalize_irqs = 1;
525
526 /* Assume we have an 8259... */
527 __irq_offset_value = NUM_ISA_INTERRUPTS;
528 565
529 return 1; 566 return 1;
530} 567}
@@ -536,7 +573,6 @@ define_machine(chrp) {
536 .init = chrp_init2, 573 .init = chrp_init2,
537 .show_cpuinfo = chrp_show_cpuinfo, 574 .show_cpuinfo = chrp_show_cpuinfo,
538 .init_IRQ = chrp_init_IRQ, 575 .init_IRQ = chrp_init_IRQ,
539 .get_irq = mpic_get_irq,
540 .pcibios_fixup = chrp_pcibios_fixup, 576 .pcibios_fixup = chrp_pcibios_fixup,
541 .restart = rtas_restart, 577 .restart = rtas_restart,
542 .power_off = rtas_power_off, 578 .power_off = rtas_power_off,
diff --git a/arch/powerpc/platforms/chrp/smp.c b/arch/powerpc/platforms/chrp/smp.c
index b616053bc331..1d2307e87c30 100644
--- a/arch/powerpc/platforms/chrp/smp.c
+++ b/arch/powerpc/platforms/chrp/smp.c
@@ -8,7 +8,6 @@
8 * 8 *
9 */ 9 */
10 10
11#include <linux/config.h>
12#include <linux/kernel.h> 11#include <linux/kernel.h>
13#include <linux/sched.h> 12#include <linux/sched.h>
14#include <linux/smp.h> 13#include <linux/smp.h>
@@ -30,7 +29,6 @@
30#include <asm/smp.h> 29#include <asm/smp.h>
31#include <asm/residual.h> 30#include <asm/residual.h>
32#include <asm/time.h> 31#include <asm/time.h>
33#include <asm/open_pic.h>
34#include <asm/machdep.h> 32#include <asm/machdep.h>
35#include <asm/smp.h> 33#include <asm/smp.h>
36#include <asm/mpic.h> 34#include <asm/mpic.h>
diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig
index 4fdbc9ae876b..ba07a9a7c039 100644
--- a/arch/powerpc/platforms/embedded6xx/Kconfig
+++ b/arch/powerpc/platforms/embedded6xx/Kconfig
@@ -74,6 +74,16 @@ config SANDPOINT
74 Select SANDPOINT if configuring for a Motorola Sandpoint X3 74 Select SANDPOINT if configuring for a Motorola Sandpoint X3
75 (any flavor). 75 (any flavor).
76 76
77config MPC7448HPC2
78 bool "Freescale MPC7448HPC2(Taiga)"
79 select TSI108_BRIDGE
80 select DEFAULT_UIMAGE
81 select PPC_UDBG_16550
82 select MPIC
83 help
84 Select MPC7448HPC2 if configuring for Freescale MPC7448HPC2 (Taiga)
85 platform
86
77config RADSTONE_PPC7D 87config RADSTONE_PPC7D
78 bool "Radstone Technology PPC7D board" 88 bool "Radstone Technology PPC7D board"
79 select PPC_I8259 89 select PPC_I8259
@@ -221,6 +231,11 @@ config MV64X60
221 select PPC_INDIRECT_PCI 231 select PPC_INDIRECT_PCI
222 default y 232 default y
223 233
234config TSI108_BRIDGE
235 bool
236 depends on MPC7448HPC2
237 default y
238
224menu "Set bridge options" 239menu "Set bridge options"
225 depends on MV64X60 240 depends on MV64X60
226 241
diff --git a/arch/powerpc/platforms/embedded6xx/Makefile b/arch/powerpc/platforms/embedded6xx/Makefile
new file mode 100644
index 000000000000..fa499fe59291
--- /dev/null
+++ b/arch/powerpc/platforms/embedded6xx/Makefile
@@ -0,0 +1,4 @@
1#
2# Makefile for the 6xx/7xx/7xxxx linux kernel.
3#
4obj-$(CONFIG_MPC7448HPC2) += mpc7448_hpc2.o
diff --git a/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
new file mode 100644
index 000000000000..d7a4fc7ca238
--- /dev/null
+++ b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
@@ -0,0 +1,335 @@
1/*
2 * mpc7448_hpc2.c
3 *
4 * Board setup routines for the Freescale Taiga platform
5 *
6 * Author: Jacob Pan
7 * jacob.pan@freescale.com
8 * Author: Xianghua Xiao
9 * x.xiao@freescale.com
10 * Maintainer: Roy Zang <tie-fei.zang@freescale.com>
11 * Add Flat Device Tree support fot mpc7448hpc2 board
12 *
13 * Copyright 2004-2006 Freescale Semiconductor, Inc.
14 *
15 * This file is licensed under
16 * the terms of the GNU General Public License version 2. This program
17 * is licensed "as is" without any warranty of any kind, whether express
18 * or implied.
19 */
20
21#include <linux/config.h>
22#include <linux/stddef.h>
23#include <linux/kernel.h>
24#include <linux/pci.h>
25#include <linux/kdev_t.h>
26#include <linux/console.h>
27#include <linux/delay.h>
28#include <linux/irq.h>
29#include <linux/ide.h>
30#include <linux/seq_file.h>
31#include <linux/root_dev.h>
32#include <linux/serial.h>
33#include <linux/tty.h>
34#include <linux/serial_core.h>
35
36#include <asm/system.h>
37#include <asm/time.h>
38#include <asm/machdep.h>
39#include <asm/prom.h>
40#include <asm/udbg.h>
41#include <asm/tsi108.h>
42#include <asm/pci-bridge.h>
43#include <asm/reg.h>
44#include <mm/mmu_decl.h>
45#include "mpc7448_hpc2.h"
46#include <asm/tsi108_irq.h>
47#include <asm/mpic.h>
48
49#undef DEBUG
50#ifdef DEBUG
51#define DBG(fmt...) do { printk(fmt); } while(0)
52#else
53#define DBG(fmt...) do { } while(0)
54#endif
55
56#ifndef CONFIG_PCI
57isa_io_base = MPC7448_HPC2_ISA_IO_BASE;
58isa_mem_base = MPC7448_HPC2_ISA_MEM_BASE;
59pci_dram_offset = MPC7448_HPC2_PCI_MEM_OFFSET;
60#endif
61
62extern int tsi108_setup_pci(struct device_node *dev);
63extern void _nmask_and_or_msr(unsigned long nmask, unsigned long or_val);
64extern void tsi108_pci_int_init(void);
65extern int tsi108_irq_cascade(struct pt_regs *regs, void *unused);
66
67/*
68 * Define all of the IRQ senses and polarities. Taken from the
69 * mpc7448hpc manual.
70 * Note: Likely, this table and the following function should be
71 * obtained and derived from the OF Device Tree.
72 */
73
74static u_char mpc7448_hpc2_pic_initsenses[] __initdata = {
75 /* External on-board sources */
76 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* INT[0] XINT0 from FPGA */
77 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* INT[1] XINT1 from FPGA */
78 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* INT[2] PHY_INT from both GIGE */
79 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* INT[3] RESERVED */
80 /* Internal Tsi108/109 interrupt sources */
81 (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE), /* Reserved IRQ */
82 (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE), /* Reserved IRQ */
83 (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE), /* Reserved IRQ */
84 (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE), /* Reserved IRQ */
85 (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE), /* DMA0 */
86 (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE), /* DMA1 */
87 (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE), /* DMA2 */
88 (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE), /* DMA3 */
89 (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE), /* UART0 */
90 (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE), /* UART1 */
91 (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE), /* I2C */
92 (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE), /* GPIO */
93 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* GIGE0 */
94 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* GIGE1 */
95 (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE), /* Reserved IRQ */
96 (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE), /* HLP */
97 (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE), /* SDC */
98 (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE), /* Processor IF */
99 (IRQ_SENSE_EDGE | IRQ_POLARITY_POSITIVE), /* Reserved IRQ */
100 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* PCI/X block */
101};
102
103int mpc7448_hpc2_exclude_device(u_char bus, u_char devfn)
104{
105 if (bus == 0 && PCI_SLOT(devfn) == 0)
106 return PCIBIOS_DEVICE_NOT_FOUND;
107 else
108 return PCIBIOS_SUCCESSFUL;
109}
110
111/*
112 * find pci slot by devfn in interrupt map of OF tree
113 */
114u8 find_slot_by_devfn(unsigned int *interrupt_map, unsigned int devfn)
115{
116 int i;
117 unsigned int tmp;
118 for (i = 0; i < 4; i++){
119 tmp = interrupt_map[i*4*7];
120 if ((tmp >> 11) == (devfn >> 3))
121 return i;
122 }
123 return i;
124}
125
126/*
127 * Scans the interrupt map for pci device
128 */
129void mpc7448_hpc2_fixup_irq(struct pci_dev *dev)
130{
131 struct pci_controller *hose;
132 struct device_node *node;
133 unsigned int *interrupt;
134 int busnr;
135 int len;
136 u8 slot;
137 u8 pin;
138
139 /* Lookup the hose */
140 busnr = dev->bus->number;
141 hose = pci_bus_to_hose(busnr);
142 if (!hose)
143 printk(KERN_ERR "No pci hose found\n");
144
145 /* Check it has an OF node associated */
146 node = (struct device_node *) hose->arch_data;
147 if (!node)
148 printk(KERN_ERR "No pci node found\n");
149
150 interrupt = (unsigned int *) get_property(node, "interrupt-map", &len);
151 slot = find_slot_by_devfn(interrupt, dev->devfn);
152 pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
153 if (pin == 0 || pin > 4)
154 pin = 1;
155 pin--;
156 dev->irq = interrupt[slot*4*7 + pin*7 + 5];
157 DBG("TSI_PCI: dev->irq = 0x%x\n", dev->irq);
158}
159/* temporary pci irq map fixup*/
160
161void __init mpc7448_hpc2_pcibios_fixup(void)
162{
163 struct pci_dev *dev = NULL;
164 for_each_pci_dev(dev) {
165 mpc7448_hpc2_fixup_irq(dev);
166 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
167 }
168}
169
170static void __init mpc7448_hpc2_setup_arch(void)
171{
172 struct device_node *cpu;
173 struct device_node *np;
174 if (ppc_md.progress)
175 ppc_md.progress("mpc7448_hpc2_setup_arch():set_bridge", 0);
176
177 cpu = of_find_node_by_type(NULL, "cpu");
178 if (cpu != 0) {
179 unsigned int *fp;
180
181 fp = (int *)get_property(cpu, "clock-frequency", NULL);
182 if (fp != 0)
183 loops_per_jiffy = *fp / HZ;
184 else
185 loops_per_jiffy = 50000000 / HZ;
186 of_node_put(cpu);
187 }
188 tsi108_csr_vir_base = get_vir_csrbase();
189
190#ifdef CONFIG_ROOT_NFS
191 ROOT_DEV = Root_NFS;
192#else
193 ROOT_DEV = Root_HDA1;
194#endif
195
196#ifdef CONFIG_BLK_DEV_INITRD
197 ROOT_DEV = Root_RAM0;
198#endif
199
200 /* setup PCI host bridge */
201#ifdef CONFIG_PCI
202 for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
203 tsi108_setup_pci(np);
204
205 ppc_md.pci_exclude_device = mpc7448_hpc2_exclude_device;
206 if (ppc_md.progress)
207 ppc_md.progress("tsi108: resources set", 0x100);
208#endif
209
210 printk(KERN_INFO "MPC7448HPC2 (TAIGA) Platform\n");
211 printk(KERN_INFO
212 "Jointly ported by Freescale and Tundra Semiconductor\n");
213 printk(KERN_INFO
214 "Enabling L2 cache then enabling the HID0 prefetch engine.\n");
215}
216
217/*
218 * Interrupt setup and service. Interrrupts on the mpc7448_hpc2 come
219 * from the four external INT pins, PCI interrupts are routed via
220 * PCI interrupt control registers, it generates internal IRQ23
221 *
222 * Interrupt routing on the Taiga Board:
223 * TSI108:PB_INT[0] -> CPU0:INT#
224 * TSI108:PB_INT[1] -> CPU0:MCP#
225 * TSI108:PB_INT[2] -> N/C
226 * TSI108:PB_INT[3] -> N/C
227 */
228static void __init mpc7448_hpc2_init_IRQ(void)
229{
230 struct mpic *mpic;
231 phys_addr_t mpic_paddr = 0;
232 struct device_node *tsi_pic;
233
234 tsi_pic = of_find_node_by_type(NULL, "open-pic");
235 if (tsi_pic) {
236 unsigned int size;
237 void *prop = get_property(tsi_pic, "reg", &size);
238 mpic_paddr = of_translate_address(tsi_pic, prop);
239 }
240
241 if (mpic_paddr == 0) {
242 printk("%s: No tsi108 PIC found !\n", __FUNCTION__);
243 return;
244 }
245
246 DBG("%s: tsi108pic phys_addr = 0x%x\n", __FUNCTION__,
247 (u32) mpic_paddr);
248
249 mpic = mpic_alloc(mpic_paddr,
250 MPIC_PRIMARY | MPIC_BIG_ENDIAN | MPIC_WANTS_RESET |
251 MPIC_SPV_EOI | MPIC_MOD_ID(MPIC_ID_TSI108),
252 0, /* num_sources used */
253 TSI108_IRQ_BASE,
254 0, /* num_sources used */
255 NR_IRQS - 4 /* XXXX */,
256 mpc7448_hpc2_pic_initsenses,
257 sizeof(mpc7448_hpc2_pic_initsenses), "Tsi108_PIC");
258
259 BUG_ON(mpic == NULL); /* XXXX */
260
261 mpic_init(mpic);
262 mpic_setup_cascade(IRQ_TSI108_PCI, tsi108_irq_cascade, mpic);
263 tsi108_pci_int_init();
264
265 /* Configure MPIC outputs to CPU0 */
266 tsi108_write_reg(TSI108_MPIC_OFFSET + 0x30c, 0);
267}
268
269void mpc7448_hpc2_show_cpuinfo(struct seq_file *m)
270{
271 seq_printf(m, "vendor\t\t: Freescale Semiconductor\n");
272 seq_printf(m, "machine\t\t: MPC7448hpc2\n");
273}
274
275void mpc7448_hpc2_restart(char *cmd)
276{
277 local_irq_disable();
278
279 /* Set exception prefix high - to the firmware */
280 _nmask_and_or_msr(0, MSR_IP);
281
282 for (;;) ; /* Spin until reset happens */
283}
284
285void mpc7448_hpc2_power_off(void)
286{
287 local_irq_disable();
288 for (;;) ; /* No way to shut power off with software */
289}
290
291void mpc7448_hpc2_halt(void)
292{
293 mpc7448_hpc2_power_off();
294}
295
296/*
297 * Called very early, device-tree isn't unflattened
298 */
299static int __init mpc7448_hpc2_probe(void)
300{
301 unsigned long root = of_get_flat_dt_root();
302
303 if (!of_flat_dt_is_compatible(root, "mpc74xx"))
304 return 0;
305 return 1;
306}
307
308static int mpc7448_machine_check_exception(struct pt_regs *regs)
309{
310 extern void tsi108_clear_pci_cfg_error(void);
311 const struct exception_table_entry *entry;
312
313 /* Are we prepared to handle this fault */
314 if ((entry = search_exception_tables(regs->nip)) != NULL) {
315 tsi108_clear_pci_cfg_error();
316 regs->msr |= MSR_RI;
317 regs->nip = entry->fixup;
318 return 1;
319 }
320 return 0;
321
322}
323define_machine(mpc7448_hpc2){
324 .name = "MPC7448 HPC2",
325 .probe = mpc7448_hpc2_probe,
326 .setup_arch = mpc7448_hpc2_setup_arch,
327 .init_IRQ = mpc7448_hpc2_init_IRQ,
328 .show_cpuinfo = mpc7448_hpc2_show_cpuinfo,
329 .get_irq = mpic_get_irq,
330 .pcibios_fixup = mpc7448_hpc2_pcibios_fixup,
331 .restart = mpc7448_hpc2_restart,
332 .calibrate_decr = generic_calibrate_decr,
333 .machine_check_exception= mpc7448_machine_check_exception,
334 .progress = udbg_progress,
335};
diff --git a/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.h b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.h
new file mode 100644
index 000000000000..a543a5242e34
--- /dev/null
+++ b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.h
@@ -0,0 +1,26 @@
1/*
2 * mpc7448_hpc2.h
3 *
4 * Definitions for Freescale MPC7448_HPC2 platform
5 *
6 * Author: Jacob Pan
7 * jacob.pan@freescale.com
8 * Maintainer: Roy Zang <roy.zang@freescale.com>
9 *
10 * 2006 (c) Freescale Semiconductor, Inc. This file is licensed under
11 * the terms of the GNU General Public License version 2. This program
12 * is licensed "as is" without any warranty of any kind, whether express
13 * or implied.
14 */
15
16#ifndef __PPC_PLATFORMS_MPC7448_HPC2_H
17#define __PPC_PLATFORMS_MPC7448_HPC2_H
18
19#include <asm/ppcboot.h>
20
21/* Base Addresses for the PCI bus
22 */
23#define MPC7448_HPC2_PCI_MEM_OFFSET (0x00000000)
24#define MPC7448_HPC2_ISA_IO_BASE (0x00000000)
25#define MPC7448_HPC2_ISA_MEM_BASE (0x00000000)
26#endif /* __PPC_PLATFORMS_MPC7448_HPC2_H */
diff --git a/arch/powerpc/platforms/iseries/dt.c b/arch/powerpc/platforms/iseries/dt.c
index d3444aabe76e..d194140c1ebf 100644
--- a/arch/powerpc/platforms/iseries/dt.c
+++ b/arch/powerpc/platforms/iseries/dt.c
@@ -252,6 +252,7 @@ static void __init dt_model(struct iseries_flat_dt *dt)
252{ 252{
253 char buf[16] = "IBM,"; 253 char buf[16] = "IBM,";
254 254
255 /* N.B. lparcfg.c knows about the "IBM," prefixes ... */
255 /* "IBM," + mfgId[2:3] + systemSerial[1:5] */ 256 /* "IBM," + mfgId[2:3] + systemSerial[1:5] */
256 strne2a(buf + 4, xItExtVpdPanel.mfgID + 2, 2); 257 strne2a(buf + 4, xItExtVpdPanel.mfgID + 2, 2);
257 strne2a(buf + 6, xItExtVpdPanel.systemSerial + 1, 5); 258 strne2a(buf + 6, xItExtVpdPanel.systemSerial + 1, 5);
@@ -264,6 +265,7 @@ static void __init dt_model(struct iseries_flat_dt *dt)
264 dt_prop_str(dt, "model", buf); 265 dt_prop_str(dt, "model", buf);
265 266
266 dt_prop_str(dt, "compatible", "IBM,iSeries"); 267 dt_prop_str(dt, "compatible", "IBM,iSeries");
268 dt_prop_u32(dt, "ibm,partition-no", HvLpConfig_getLpIndex());
267} 269}
268 270
269static void __init dt_do_vdevice(struct iseries_flat_dt *dt, 271static void __init dt_do_vdevice(struct iseries_flat_dt *dt,
diff --git a/arch/powerpc/platforms/iseries/htab.c b/arch/powerpc/platforms/iseries/htab.c
index 30bdcf3925d9..ed44dfceaa45 100644
--- a/arch/powerpc/platforms/iseries/htab.c
+++ b/arch/powerpc/platforms/iseries/htab.c
@@ -242,13 +242,11 @@ static void iSeries_hpte_invalidate(unsigned long slot, unsigned long va,
242 local_irq_restore(flags); 242 local_irq_restore(flags);
243} 243}
244 244
245void hpte_init_iSeries(void) 245void __init hpte_init_iSeries(void)
246{ 246{
247 ppc_md.hpte_invalidate = iSeries_hpte_invalidate; 247 ppc_md.hpte_invalidate = iSeries_hpte_invalidate;
248 ppc_md.hpte_updatepp = iSeries_hpte_updatepp; 248 ppc_md.hpte_updatepp = iSeries_hpte_updatepp;
249 ppc_md.hpte_updateboltedpp = iSeries_hpte_updateboltedpp; 249 ppc_md.hpte_updateboltedpp = iSeries_hpte_updateboltedpp;
250 ppc_md.hpte_insert = iSeries_hpte_insert; 250 ppc_md.hpte_insert = iSeries_hpte_insert;
251 ppc_md.hpte_remove = iSeries_hpte_remove; 251 ppc_md.hpte_remove = iSeries_hpte_remove;
252
253 htab_finish_init();
254} 252}
diff --git a/arch/powerpc/platforms/iseries/irq.c b/arch/powerpc/platforms/iseries/irq.c
index 62bbbcf5ded3..2275e64f3152 100644
--- a/arch/powerpc/platforms/iseries/irq.c
+++ b/arch/powerpc/platforms/iseries/irq.c
@@ -23,7 +23,6 @@
23 * Created, December 13, 2000 by Wayne Holm 23 * Created, December 13, 2000 by Wayne Holm
24 * End Change Activity 24 * End Change Activity
25 */ 25 */
26#include <linux/config.h>
27#include <linux/pci.h> 26#include <linux/pci.h>
28#include <linux/init.h> 27#include <linux/init.h>
29#include <linux/threads.h> 28#include <linux/threads.h>
@@ -163,27 +162,6 @@ static void pci_event_handler(struct HvLpEvent *event, struct pt_regs *regs)
163 printk(KERN_ERR "pci_event_handler: NULL event received\n"); 162 printk(KERN_ERR "pci_event_handler: NULL event received\n");
164} 163}
165 164
166/*
167 * This is called by init_IRQ. set in ppc_md.init_IRQ by iSeries_setup.c
168 * It must be called before the bus walk.
169 */
170void __init iSeries_init_IRQ(void)
171{
172 /* Register PCI event handler and open an event path */
173 int ret;
174
175 ret = HvLpEvent_registerHandler(HvLpEvent_Type_PciIo,
176 &pci_event_handler);
177 if (ret == 0) {
178 ret = HvLpEvent_openPath(HvLpEvent_Type_PciIo, 0);
179 if (ret != 0)
180 printk(KERN_ERR "iseries_init_IRQ: open event path "
181 "failed with rc 0x%x\n", ret);
182 } else
183 printk(KERN_ERR "iseries_init_IRQ: register handler "
184 "failed with rc 0x%x\n", ret);
185}
186
187#define REAL_IRQ_TO_SUBBUS(irq) (((irq) >> 14) & 0xff) 165#define REAL_IRQ_TO_SUBBUS(irq) (((irq) >> 14) & 0xff)
188#define REAL_IRQ_TO_BUS(irq) ((((irq) >> 6) & 0xff) + 1) 166#define REAL_IRQ_TO_BUS(irq) ((((irq) >> 6) & 0xff) + 1)
189#define REAL_IRQ_TO_IDSEL(irq) ((((irq) >> 3) & 7) + 1) 167#define REAL_IRQ_TO_IDSEL(irq) ((((irq) >> 3) & 7) + 1)
@@ -197,7 +175,7 @@ static void iseries_enable_IRQ(unsigned int irq)
197{ 175{
198 u32 bus, dev_id, function, mask; 176 u32 bus, dev_id, function, mask;
199 const u32 sub_bus = 0; 177 const u32 sub_bus = 0;
200 unsigned int rirq = virt_irq_to_real_map[irq]; 178 unsigned int rirq = (unsigned int)irq_map[irq].hwirq;
201 179
202 /* The IRQ has already been locked by the caller */ 180 /* The IRQ has already been locked by the caller */
203 bus = REAL_IRQ_TO_BUS(rirq); 181 bus = REAL_IRQ_TO_BUS(rirq);
@@ -214,7 +192,7 @@ static unsigned int iseries_startup_IRQ(unsigned int irq)
214{ 192{
215 u32 bus, dev_id, function, mask; 193 u32 bus, dev_id, function, mask;
216 const u32 sub_bus = 0; 194 const u32 sub_bus = 0;
217 unsigned int rirq = virt_irq_to_real_map[irq]; 195 unsigned int rirq = (unsigned int)irq_map[irq].hwirq;
218 196
219 bus = REAL_IRQ_TO_BUS(rirq); 197 bus = REAL_IRQ_TO_BUS(rirq);
220 function = REAL_IRQ_TO_FUNC(rirq); 198 function = REAL_IRQ_TO_FUNC(rirq);
@@ -242,9 +220,9 @@ void __init iSeries_activate_IRQs()
242 for_each_irq (irq) { 220 for_each_irq (irq) {
243 irq_desc_t *desc = get_irq_desc(irq); 221 irq_desc_t *desc = get_irq_desc(irq);
244 222
245 if (desc && desc->handler && desc->handler->startup) { 223 if (desc && desc->chip && desc->chip->startup) {
246 spin_lock_irqsave(&desc->lock, flags); 224 spin_lock_irqsave(&desc->lock, flags);
247 desc->handler->startup(irq); 225 desc->chip->startup(irq);
248 spin_unlock_irqrestore(&desc->lock, flags); 226 spin_unlock_irqrestore(&desc->lock, flags);
249 } 227 }
250 } 228 }
@@ -255,7 +233,7 @@ static void iseries_shutdown_IRQ(unsigned int irq)
255{ 233{
256 u32 bus, dev_id, function, mask; 234 u32 bus, dev_id, function, mask;
257 const u32 sub_bus = 0; 235 const u32 sub_bus = 0;
258 unsigned int rirq = virt_irq_to_real_map[irq]; 236 unsigned int rirq = (unsigned int)irq_map[irq].hwirq;
259 237
260 /* irq should be locked by the caller */ 238 /* irq should be locked by the caller */
261 bus = REAL_IRQ_TO_BUS(rirq); 239 bus = REAL_IRQ_TO_BUS(rirq);
@@ -278,7 +256,7 @@ static void iseries_disable_IRQ(unsigned int irq)
278{ 256{
279 u32 bus, dev_id, function, mask; 257 u32 bus, dev_id, function, mask;
280 const u32 sub_bus = 0; 258 const u32 sub_bus = 0;
281 unsigned int rirq = virt_irq_to_real_map[irq]; 259 unsigned int rirq = (unsigned int)irq_map[irq].hwirq;
282 260
283 /* The IRQ has already been locked by the caller */ 261 /* The IRQ has already been locked by the caller */
284 bus = REAL_IRQ_TO_BUS(rirq); 262 bus = REAL_IRQ_TO_BUS(rirq);
@@ -292,19 +270,19 @@ static void iseries_disable_IRQ(unsigned int irq)
292 270
293static void iseries_end_IRQ(unsigned int irq) 271static void iseries_end_IRQ(unsigned int irq)
294{ 272{
295 unsigned int rirq = virt_irq_to_real_map[irq]; 273 unsigned int rirq = (unsigned int)irq_map[irq].hwirq;
296 274
297 HvCallPci_eoi(REAL_IRQ_TO_BUS(rirq), REAL_IRQ_TO_SUBBUS(rirq), 275 HvCallPci_eoi(REAL_IRQ_TO_BUS(rirq), REAL_IRQ_TO_SUBBUS(rirq),
298 (REAL_IRQ_TO_IDSEL(rirq) << 4) + REAL_IRQ_TO_FUNC(rirq)); 276 (REAL_IRQ_TO_IDSEL(rirq) << 4) + REAL_IRQ_TO_FUNC(rirq));
299} 277}
300 278
301static hw_irq_controller iSeries_IRQ_handler = { 279static struct irq_chip iseries_pic = {
302 .typename = "iSeries irq controller", 280 .typename = "iSeries irq controller",
303 .startup = iseries_startup_IRQ, 281 .startup = iseries_startup_IRQ,
304 .shutdown = iseries_shutdown_IRQ, 282 .shutdown = iseries_shutdown_IRQ,
305 .enable = iseries_enable_IRQ, 283 .unmask = iseries_enable_IRQ,
306 .disable = iseries_disable_IRQ, 284 .mask = iseries_disable_IRQ,
307 .end = iseries_end_IRQ 285 .eoi = iseries_end_IRQ
308}; 286};
309 287
310/* 288/*
@@ -315,17 +293,14 @@ static hw_irq_controller iSeries_IRQ_handler = {
315int __init iSeries_allocate_IRQ(HvBusNumber bus, 293int __init iSeries_allocate_IRQ(HvBusNumber bus,
316 HvSubBusNumber sub_bus, u32 bsubbus) 294 HvSubBusNumber sub_bus, u32 bsubbus)
317{ 295{
318 int virtirq;
319 unsigned int realirq; 296 unsigned int realirq;
320 u8 idsel = ISERIES_GET_DEVICE_FROM_SUBBUS(bsubbus); 297 u8 idsel = ISERIES_GET_DEVICE_FROM_SUBBUS(bsubbus);
321 u8 function = ISERIES_GET_FUNCTION_FROM_SUBBUS(bsubbus); 298 u8 function = ISERIES_GET_FUNCTION_FROM_SUBBUS(bsubbus);
322 299
323 realirq = (((((sub_bus << 8) + (bus - 1)) << 3) + (idsel - 1)) << 3) 300 realirq = (((((sub_bus << 8) + (bus - 1)) << 3) + (idsel - 1)) << 3)
324 + function; 301 + function;
325 virtirq = virt_irq_create_mapping(realirq);
326 302
327 irq_desc[virtirq].handler = &iSeries_IRQ_handler; 303 return irq_create_mapping(NULL, realirq, IRQ_TYPE_NONE);
328 return virtirq;
329} 304}
330 305
331#endif /* CONFIG_PCI */ 306#endif /* CONFIG_PCI */
@@ -333,10 +308,9 @@ int __init iSeries_allocate_IRQ(HvBusNumber bus,
333/* 308/*
334 * Get the next pending IRQ. 309 * Get the next pending IRQ.
335 */ 310 */
336int iSeries_get_irq(struct pt_regs *regs) 311unsigned int iSeries_get_irq(struct pt_regs *regs)
337{ 312{
338 /* -2 means ignore this interrupt */ 313 int irq = NO_IRQ_IGNORE;
339 int irq = -2;
340 314
341#ifdef CONFIG_SMP 315#ifdef CONFIG_SMP
342 if (get_lppaca()->int_dword.fields.ipi_cnt) { 316 if (get_lppaca()->int_dword.fields.ipi_cnt) {
@@ -359,9 +333,57 @@ int iSeries_get_irq(struct pt_regs *regs)
359 } 333 }
360 spin_unlock(&pending_irqs_lock); 334 spin_unlock(&pending_irqs_lock);
361 if (irq >= NR_IRQS) 335 if (irq >= NR_IRQS)
362 irq = -2; 336 irq = NO_IRQ_IGNORE;
363 } 337 }
364#endif 338#endif
365 339
366 return irq; 340 return irq;
367} 341}
342
343static int iseries_irq_host_map(struct irq_host *h, unsigned int virq,
344 irq_hw_number_t hw, unsigned int flags)
345{
346 set_irq_chip_and_handler(virq, &iseries_pic, handle_fasteoi_irq);
347
348 return 0;
349}
350
351static struct irq_host_ops iseries_irq_host_ops = {
352 .map = iseries_irq_host_map,
353};
354
355/*
356 * This is called by init_IRQ. set in ppc_md.init_IRQ by iSeries_setup.c
357 * It must be called before the bus walk.
358 */
359void __init iSeries_init_IRQ(void)
360{
361 /* Register PCI event handler and open an event path */
362 struct irq_host *host;
363 int ret;
364
365 /*
366 * The Hypervisor only allows us up to 256 interrupt
367 * sources (the irq number is passed in a u8).
368 */
369 irq_set_virq_count(256);
370
371 /* Create irq host. No need for a revmap since HV will give us
372 * back our virtual irq number
373 */
374 host = irq_alloc_host(IRQ_HOST_MAP_NOMAP, 0, &iseries_irq_host_ops, 0);
375 BUG_ON(host == NULL);
376 irq_set_default_host(host);
377
378 ret = HvLpEvent_registerHandler(HvLpEvent_Type_PciIo,
379 &pci_event_handler);
380 if (ret == 0) {
381 ret = HvLpEvent_openPath(HvLpEvent_Type_PciIo, 0);
382 if (ret != 0)
383 printk(KERN_ERR "iseries_init_IRQ: open event path "
384 "failed with rc 0x%x\n", ret);
385 } else
386 printk(KERN_ERR "iseries_init_IRQ: register handler "
387 "failed with rc 0x%x\n", ret);
388}
389
diff --git a/arch/powerpc/platforms/iseries/irq.h b/arch/powerpc/platforms/iseries/irq.h
index 188aa808abd7..1ee8985140e5 100644
--- a/arch/powerpc/platforms/iseries/irq.h
+++ b/arch/powerpc/platforms/iseries/irq.h
@@ -4,6 +4,6 @@
4extern void iSeries_init_IRQ(void); 4extern void iSeries_init_IRQ(void);
5extern int iSeries_allocate_IRQ(HvBusNumber, HvSubBusNumber, u32); 5extern int iSeries_allocate_IRQ(HvBusNumber, HvSubBusNumber, u32);
6extern void iSeries_activate_IRQs(void); 6extern void iSeries_activate_IRQs(void);
7extern int iSeries_get_irq(struct pt_regs *); 7extern unsigned int iSeries_get_irq(struct pt_regs *);
8 8
9#endif /* _ISERIES_IRQ_H */ 9#endif /* _ISERIES_IRQ_H */
diff --git a/arch/powerpc/platforms/iseries/lpardata.c b/arch/powerpc/platforms/iseries/lpardata.c
index 438e2dba63b5..a7769445d6c7 100644
--- a/arch/powerpc/platforms/iseries/lpardata.c
+++ b/arch/powerpc/platforms/iseries/lpardata.c
@@ -6,7 +6,6 @@
6 * as published by the Free Software Foundation; either version 6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version. 7 * 2 of the License, or (at your option) any later version.
8 */ 8 */
9#include <linux/config.h>
10#include <linux/types.h> 9#include <linux/types.h>
11#include <linux/threads.h> 10#include <linux/threads.h>
12#include <linux/module.h> 11#include <linux/module.h>
diff --git a/arch/powerpc/platforms/iseries/lpevents.c b/arch/powerpc/platforms/iseries/lpevents.c
index 8ca7b9396355..2a9f81ea27d6 100644
--- a/arch/powerpc/platforms/iseries/lpevents.c
+++ b/arch/powerpc/platforms/iseries/lpevents.c
@@ -51,20 +51,21 @@ static unsigned lpEventHandlerPaths[HvLpEvent_Type_NumTypes];
51static struct HvLpEvent * get_next_hvlpevent(void) 51static struct HvLpEvent * get_next_hvlpevent(void)
52{ 52{
53 struct HvLpEvent * event; 53 struct HvLpEvent * event;
54 event = (struct HvLpEvent *)hvlpevent_queue.xSlicCurEventPtr; 54 event = (struct HvLpEvent *)hvlpevent_queue.hq_current_event;
55 55
56 if (hvlpevent_is_valid(event)) { 56 if (hvlpevent_is_valid(event)) {
57 /* rmb() needed only for weakly consistent machines (regatta) */ 57 /* rmb() needed only for weakly consistent machines (regatta) */
58 rmb(); 58 rmb();
59 /* Set pointer to next potential event */ 59 /* Set pointer to next potential event */
60 hvlpevent_queue.xSlicCurEventPtr += ((event->xSizeMinus1 + 60 hvlpevent_queue.hq_current_event += ((event->xSizeMinus1 +
61 LpEventAlign) / LpEventAlign) * LpEventAlign; 61 IT_LP_EVENT_ALIGN) / IT_LP_EVENT_ALIGN) *
62 IT_LP_EVENT_ALIGN;
62 63
63 /* Wrap to beginning if no room at end */ 64 /* Wrap to beginning if no room at end */
64 if (hvlpevent_queue.xSlicCurEventPtr > 65 if (hvlpevent_queue.hq_current_event >
65 hvlpevent_queue.xSlicLastValidEventPtr) { 66 hvlpevent_queue.hq_last_event) {
66 hvlpevent_queue.xSlicCurEventPtr = 67 hvlpevent_queue.hq_current_event =
67 hvlpevent_queue.xSlicEventStackPtr; 68 hvlpevent_queue.hq_event_stack;
68 } 69 }
69 } else { 70 } else {
70 event = NULL; 71 event = NULL;
@@ -82,10 +83,10 @@ int hvlpevent_is_pending(void)
82 if (smp_processor_id() >= spread_lpevents) 83 if (smp_processor_id() >= spread_lpevents)
83 return 0; 84 return 0;
84 85
85 next_event = (struct HvLpEvent *)hvlpevent_queue.xSlicCurEventPtr; 86 next_event = (struct HvLpEvent *)hvlpevent_queue.hq_current_event;
86 87
87 return hvlpevent_is_valid(next_event) || 88 return hvlpevent_is_valid(next_event) ||
88 hvlpevent_queue.xPlicOverflowIntPending; 89 hvlpevent_queue.hq_overflow_pending;
89} 90}
90 91
91static void hvlpevent_clear_valid(struct HvLpEvent * event) 92static void hvlpevent_clear_valid(struct HvLpEvent * event)
@@ -95,18 +96,18 @@ static void hvlpevent_clear_valid(struct HvLpEvent * event)
95 * ie. on 64-byte boundaries. 96 * ie. on 64-byte boundaries.
96 */ 97 */
97 struct HvLpEvent *tmp; 98 struct HvLpEvent *tmp;
98 unsigned extra = ((event->xSizeMinus1 + LpEventAlign) / 99 unsigned extra = ((event->xSizeMinus1 + IT_LP_EVENT_ALIGN) /
99 LpEventAlign) - 1; 100 IT_LP_EVENT_ALIGN) - 1;
100 101
101 switch (extra) { 102 switch (extra) {
102 case 3: 103 case 3:
103 tmp = (struct HvLpEvent*)((char*)event + 3 * LpEventAlign); 104 tmp = (struct HvLpEvent*)((char*)event + 3 * IT_LP_EVENT_ALIGN);
104 hvlpevent_invalidate(tmp); 105 hvlpevent_invalidate(tmp);
105 case 2: 106 case 2:
106 tmp = (struct HvLpEvent*)((char*)event + 2 * LpEventAlign); 107 tmp = (struct HvLpEvent*)((char*)event + 2 * IT_LP_EVENT_ALIGN);
107 hvlpevent_invalidate(tmp); 108 hvlpevent_invalidate(tmp);
108 case 1: 109 case 1:
109 tmp = (struct HvLpEvent*)((char*)event + 1 * LpEventAlign); 110 tmp = (struct HvLpEvent*)((char*)event + 1 * IT_LP_EVENT_ALIGN);
110 hvlpevent_invalidate(tmp); 111 hvlpevent_invalidate(tmp);
111 } 112 }
112 113
@@ -120,7 +121,7 @@ void process_hvlpevents(struct pt_regs *regs)
120 struct HvLpEvent * event; 121 struct HvLpEvent * event;
121 122
122 /* If we have recursed, just return */ 123 /* If we have recursed, just return */
123 if (!spin_trylock(&hvlpevent_queue.lock)) 124 if (!spin_trylock(&hvlpevent_queue.hq_lock))
124 return; 125 return;
125 126
126 for (;;) { 127 for (;;) {
@@ -148,17 +149,17 @@ void process_hvlpevents(struct pt_regs *regs)
148 printk(KERN_INFO "Unexpected Lp Event type=%d\n", event->xType ); 149 printk(KERN_INFO "Unexpected Lp Event type=%d\n", event->xType );
149 150
150 hvlpevent_clear_valid(event); 151 hvlpevent_clear_valid(event);
151 } else if (hvlpevent_queue.xPlicOverflowIntPending) 152 } else if (hvlpevent_queue.hq_overflow_pending)
152 /* 153 /*
153 * No more valid events. If overflow events are 154 * No more valid events. If overflow events are
154 * pending process them 155 * pending process them
155 */ 156 */
156 HvCallEvent_getOverflowLpEvents(hvlpevent_queue.xIndex); 157 HvCallEvent_getOverflowLpEvents(hvlpevent_queue.hq_index);
157 else 158 else
158 break; 159 break;
159 } 160 }
160 161
161 spin_unlock(&hvlpevent_queue.lock); 162 spin_unlock(&hvlpevent_queue.hq_lock);
162} 163}
163 164
164static int set_spread_lpevents(char *str) 165static int set_spread_lpevents(char *str)
@@ -184,20 +185,20 @@ void setup_hvlpevent_queue(void)
184{ 185{
185 void *eventStack; 186 void *eventStack;
186 187
187 spin_lock_init(&hvlpevent_queue.lock); 188 spin_lock_init(&hvlpevent_queue.hq_lock);
188 189
189 /* Allocate a page for the Event Stack. */ 190 /* Allocate a page for the Event Stack. */
190 eventStack = alloc_bootmem_pages(LpEventStackSize); 191 eventStack = alloc_bootmem_pages(IT_LP_EVENT_STACK_SIZE);
191 memset(eventStack, 0, LpEventStackSize); 192 memset(eventStack, 0, IT_LP_EVENT_STACK_SIZE);
192 193
193 /* Invoke the hypervisor to initialize the event stack */ 194 /* Invoke the hypervisor to initialize the event stack */
194 HvCallEvent_setLpEventStack(0, eventStack, LpEventStackSize); 195 HvCallEvent_setLpEventStack(0, eventStack, IT_LP_EVENT_STACK_SIZE);
195 196
196 hvlpevent_queue.xSlicEventStackPtr = (char *)eventStack; 197 hvlpevent_queue.hq_event_stack = eventStack;
197 hvlpevent_queue.xSlicCurEventPtr = (char *)eventStack; 198 hvlpevent_queue.hq_current_event = eventStack;
198 hvlpevent_queue.xSlicLastValidEventPtr = (char *)eventStack + 199 hvlpevent_queue.hq_last_event = (char *)eventStack +
199 (LpEventStackSize - LpEventMaxSize); 200 (IT_LP_EVENT_STACK_SIZE - IT_LP_EVENT_MAX_SIZE);
200 hvlpevent_queue.xIndex = 0; 201 hvlpevent_queue.hq_index = 0;
201} 202}
202 203
203/* Register a handler for an LpEvent type */ 204/* Register a handler for an LpEvent type */
diff --git a/arch/powerpc/platforms/iseries/proc.c b/arch/powerpc/platforms/iseries/proc.c
index e68b6b5fa89f..c241413629ac 100644
--- a/arch/powerpc/platforms/iseries/proc.c
+++ b/arch/powerpc/platforms/iseries/proc.c
@@ -24,7 +24,6 @@
24#include <asm/processor.h> 24#include <asm/processor.h>
25#include <asm/time.h> 25#include <asm/time.h>
26#include <asm/lppaca.h> 26#include <asm/lppaca.h>
27#include <asm/iseries/it_lp_queue.h>
28#include <asm/iseries/hv_call_xm.h> 27#include <asm/iseries/hv_call_xm.h>
29 28
30#include "processor_vpd.h" 29#include "processor_vpd.h"
diff --git a/arch/powerpc/platforms/iseries/setup.c b/arch/powerpc/platforms/iseries/setup.c
index 617c724c4590..c9605d773a77 100644
--- a/arch/powerpc/platforms/iseries/setup.c
+++ b/arch/powerpc/platforms/iseries/setup.c
@@ -16,7 +16,6 @@
16 16
17#undef DEBUG 17#undef DEBUG
18 18
19#include <linux/config.h>
20#include <linux/init.h> 19#include <linux/init.h>
21#include <linux/threads.h> 20#include <linux/threads.h>
22#include <linux/smp.h> 21#include <linux/smp.h>
@@ -81,8 +80,6 @@ static void iSeries_pci_final_fixup(void) { }
81#endif 80#endif
82 81
83extern int rd_size; /* Defined in drivers/block/rd.c */ 82extern int rd_size; /* Defined in drivers/block/rd.c */
84extern unsigned long embedded_sysmap_start;
85extern unsigned long embedded_sysmap_end;
86 83
87extern unsigned long iSeries_recal_tb; 84extern unsigned long iSeries_recal_tb;
88extern unsigned long iSeries_recal_titan; 85extern unsigned long iSeries_recal_titan;
@@ -297,8 +294,6 @@ static void __init iSeries_init_early(void)
297{ 294{
298 DBG(" -> iSeries_init_early()\n"); 295 DBG(" -> iSeries_init_early()\n");
299 296
300 ppc64_interrupt_controller = IC_ISERIES;
301
302#if defined(CONFIG_BLK_DEV_INITRD) 297#if defined(CONFIG_BLK_DEV_INITRD)
303 /* 298 /*
304 * If the init RAM disk has been configured and there is 299 * If the init RAM disk has been configured and there is
@@ -321,11 +316,6 @@ static void __init iSeries_init_early(void)
321 iSeries_recal_titan = HvCallXm_loadTod(); 316 iSeries_recal_titan = HvCallXm_loadTod();
322 317
323 /* 318 /*
324 * Initialize the hash table management pointers
325 */
326 hpte_init_iSeries();
327
328 /*
329 * Initialize the DMA/TCE management 319 * Initialize the DMA/TCE management
330 */ 320 */
331 iommu_init_early_iSeries(); 321 iommu_init_early_iSeries();
@@ -563,16 +553,6 @@ static void __init iSeries_fixup_klimit(void)
563 if (naca.xRamDisk) 553 if (naca.xRamDisk)
564 klimit = KERNELBASE + (u64)naca.xRamDisk + 554 klimit = KERNELBASE + (u64)naca.xRamDisk +
565 (naca.xRamDiskSize * HW_PAGE_SIZE); 555 (naca.xRamDiskSize * HW_PAGE_SIZE);
566 else {
567 /*
568 * No ram disk was included - check and see if there
569 * was an embedded system map. Change klimit to take
570 * into account any embedded system map
571 */
572 if (embedded_sysmap_end)
573 klimit = KERNELBASE + ((embedded_sysmap_end + 4095) &
574 0xfffffffffffff000);
575 }
576} 556}
577 557
578static int __init iSeries_src_init(void) 558static int __init iSeries_src_init(void)
@@ -677,11 +657,7 @@ static int __init iseries_probe(void)
677 powerpc_firmware_features |= FW_FEATURE_ISERIES; 657 powerpc_firmware_features |= FW_FEATURE_ISERIES;
678 powerpc_firmware_features |= FW_FEATURE_LPAR; 658 powerpc_firmware_features |= FW_FEATURE_LPAR;
679 659
680 /* 660 hpte_init_iSeries();
681 * The Hypervisor only allows us up to 256 interrupt
682 * sources (the irq number is passed in a u8).
683 */
684 virt_irq_max = 255;
685 661
686 return 1; 662 return 1;
687} 663}
diff --git a/arch/powerpc/platforms/iseries/smp.c b/arch/powerpc/platforms/iseries/smp.c
index 6f9d407a709f..2eb095edb472 100644
--- a/arch/powerpc/platforms/iseries/smp.c
+++ b/arch/powerpc/platforms/iseries/smp.c
@@ -14,7 +14,6 @@
14 14
15#undef DEBUG 15#undef DEBUG
16 16
17#include <linux/config.h>
18#include <linux/kernel.h> 17#include <linux/kernel.h>
19#include <linux/module.h> 18#include <linux/module.h>
20#include <linux/sched.h> 19#include <linux/sched.h>
diff --git a/arch/powerpc/platforms/maple/pci.c b/arch/powerpc/platforms/maple/pci.c
index 9a4efc0c3b29..63a1670d3bfd 100644
--- a/arch/powerpc/platforms/maple/pci.c
+++ b/arch/powerpc/platforms/maple/pci.c
@@ -376,9 +376,10 @@ static void __init maple_fixup_phb_resources(void)
376 unsigned long offset = (unsigned long)hose->io_base_virt - pci_io_base; 376 unsigned long offset = (unsigned long)hose->io_base_virt - pci_io_base;
377 hose->io_resource.start += offset; 377 hose->io_resource.start += offset;
378 hose->io_resource.end += offset; 378 hose->io_resource.end += offset;
379 printk(KERN_INFO "PCI Host %d, io start: %lx; io end: %lx\n", 379 printk(KERN_INFO "PCI Host %d, io start: %llx; io end: %llx\n",
380 hose->global_number, 380 hose->global_number,
381 hose->io_resource.start, hose->io_resource.end); 381 (unsigned long long)hose->io_resource.start,
382 (unsigned long long)hose->io_resource.end);
382 } 383 }
383} 384}
384 385
@@ -442,18 +443,23 @@ void __init maple_pci_init(void)
442int maple_pci_get_legacy_ide_irq(struct pci_dev *pdev, int channel) 443int maple_pci_get_legacy_ide_irq(struct pci_dev *pdev, int channel)
443{ 444{
444 struct device_node *np; 445 struct device_node *np;
445 int irq = channel ? 15 : 14; 446 unsigned int defirq = channel ? 15 : 14;
447 unsigned int irq;
446 448
447 if (pdev->vendor != PCI_VENDOR_ID_AMD || 449 if (pdev->vendor != PCI_VENDOR_ID_AMD ||
448 pdev->device != PCI_DEVICE_ID_AMD_8111_IDE) 450 pdev->device != PCI_DEVICE_ID_AMD_8111_IDE)
449 return irq; 451 return defirq;
450 452
451 np = pci_device_to_OF_node(pdev); 453 np = pci_device_to_OF_node(pdev);
452 if (np == NULL) 454 if (np == NULL)
453 return irq; 455 return defirq;
454 if (np->n_intrs < 2) 456 irq = irq_of_parse_and_map(np, channel & 0x1);
455 return irq; 457 if (irq == NO_IRQ) {
456 return np->intrs[channel & 0x1].line; 458 printk("Failed to map onboard IDE interrupt for channel %d\n",
459 channel);
460 return defirq;
461 }
462 return irq;
457} 463}
458 464
459/* XXX: To remove once all firmwares are ok */ 465/* XXX: To remove once all firmwares are ok */
diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c
index a0505ea48a86..cb528c9de4c3 100644
--- a/arch/powerpc/platforms/maple/setup.c
+++ b/arch/powerpc/platforms/maple/setup.c
@@ -11,9 +11,8 @@
11 * 11 *
12 */ 12 */
13 13
14#define DEBUG 14#undef DEBUG
15 15
16#include <linux/config.h>
17#include <linux/init.h> 16#include <linux/init.h>
18#include <linux/errno.h> 17#include <linux/errno.h>
19#include <linux/sched.h> 18#include <linux/sched.h>
@@ -199,55 +198,81 @@ static void __init maple_init_early(void)
199{ 198{
200 DBG(" -> maple_init_early\n"); 199 DBG(" -> maple_init_early\n");
201 200
202 /* Initialize hash table, from now on, we can take hash faults
203 * and call ioremap
204 */
205 hpte_init_native();
206
207 /* Setup interrupt mapping options */
208 ppc64_interrupt_controller = IC_OPEN_PIC;
209
210 iommu_init_early_dart(); 201 iommu_init_early_dart();
211 202
212 DBG(" <- maple_init_early\n"); 203 DBG(" <- maple_init_early\n");
213} 204}
214 205
215 206/*
216static __init void maple_init_IRQ(void) 207 * This is almost identical to pSeries and CHRP. We need to make that
208 * code generic at one point, with appropriate bits in the device-tree to
209 * identify the presence of an HT APIC
210 */
211static void __init maple_init_IRQ(void)
217{ 212{
218 struct device_node *root; 213 struct device_node *root, *np, *mpic_node = NULL;
219 unsigned int *opprop; 214 unsigned int *opprop;
220 unsigned long opic_addr; 215 unsigned long openpic_addr = 0;
216 int naddr, n, i, opplen, has_isus = 0;
221 struct mpic *mpic; 217 struct mpic *mpic;
222 unsigned char senses[128]; 218 unsigned int flags = MPIC_PRIMARY;
223 int n;
224 219
225 DBG(" -> maple_init_IRQ\n"); 220 /* Locate MPIC in the device-tree. Note that there is a bug
221 * in Maple device-tree where the type of the controller is
222 * open-pic and not interrupt-controller
223 */
224 for_each_node_by_type(np, "open-pic") {
225 mpic_node = np;
226 break;
227 }
228 if (mpic_node == NULL) {
229 printk(KERN_ERR
230 "Failed to locate the MPIC interrupt controller\n");
231 return;
232 }
226 233
227 /* XXX: Non standard, replace that with a proper openpic/mpic node 234 /* Find address list in /platform-open-pic */
228 * in the device-tree. Find the Open PIC if present */
229 root = of_find_node_by_path("/"); 235 root = of_find_node_by_path("/");
230 opprop = (unsigned int *) get_property(root, 236 naddr = prom_n_addr_cells(root);
231 "platform-open-pic", NULL); 237 opprop = (unsigned int *) get_property(root, "platform-open-pic",
232 if (opprop == 0) 238 &opplen);
233 panic("OpenPIC not found !\n"); 239 if (opprop != 0) {
234 240 openpic_addr = of_read_number(opprop, naddr);
235 n = prom_n_addr_cells(root); 241 has_isus = (opplen > naddr);
236 for (opic_addr = 0; n > 0; --n) 242 printk(KERN_DEBUG "OpenPIC addr: %lx, has ISUs: %d\n",
237 opic_addr = (opic_addr << 32) + *opprop++; 243 openpic_addr, has_isus);
244 }
238 of_node_put(root); 245 of_node_put(root);
239 246
240 /* Obtain sense values from device-tree */ 247 BUG_ON(openpic_addr == 0);
241 prom_get_irq_senses(senses, 0, 128);
242 248
243 mpic = mpic_alloc(opic_addr, 249 /* Check for a big endian MPIC */
244 MPIC_PRIMARY | MPIC_BIG_ENDIAN | 250 if (get_property(np, "big-endian", NULL) != NULL)
245 MPIC_BROKEN_U3 | MPIC_WANTS_RESET, 251 flags |= MPIC_BIG_ENDIAN;
246 0, 0, 128, 128, senses, 128, "U3-MPIC"); 252
253 /* XXX Maple specific bits */
254 flags |= MPIC_BROKEN_U3 | MPIC_WANTS_RESET;
255
256 /* Setup the openpic driver. More device-tree junks, we hard code no
257 * ISUs for now. I'll have to revisit some stuffs with the folks doing
258 * the firmware for those
259 */
260 mpic = mpic_alloc(mpic_node, openpic_addr, flags,
261 /*has_isus ? 16 :*/ 0, 0, " MPIC ");
247 BUG_ON(mpic == NULL); 262 BUG_ON(mpic == NULL);
248 mpic_init(mpic);
249 263
250 DBG(" <- maple_init_IRQ\n"); 264 /* Add ISUs */
265 opplen /= sizeof(u32);
266 for (n = 0, i = naddr; i < opplen; i += naddr, n++) {
267 unsigned long isuaddr = of_read_number(opprop + i, naddr);
268 mpic_assign_isu(mpic, n, isuaddr);
269 }
270
271 /* All ISUs are setup, complete initialization */
272 mpic_init(mpic);
273 ppc_md.get_irq = mpic_get_irq;
274 of_node_put(mpic_node);
275 of_node_put(root);
251} 276}
252 277
253static void __init maple_progress(char *s, unsigned short hex) 278static void __init maple_progress(char *s, unsigned short hex)
@@ -262,7 +287,9 @@ static void __init maple_progress(char *s, unsigned short hex)
262static int __init maple_probe(void) 287static int __init maple_probe(void)
263{ 288{
264 unsigned long root = of_get_flat_dt_root(); 289 unsigned long root = of_get_flat_dt_root();
265 if (!of_flat_dt_is_compatible(root, "Momentum,Maple")) 290
291 if (!of_flat_dt_is_compatible(root, "Momentum,Maple") &&
292 !of_flat_dt_is_compatible(root, "Momentum,Apache"))
266 return 0; 293 return 0;
267 /* 294 /*
268 * On U3, the DART (iommu) must be allocated now since it 295 * On U3, the DART (iommu) must be allocated now since it
@@ -272,6 +299,8 @@ static int __init maple_probe(void)
272 */ 299 */
273 alloc_dart_table(); 300 alloc_dart_table();
274 301
302 hpte_init_native();
303
275 return 1; 304 return 1;
276} 305}
277 306
@@ -281,7 +310,6 @@ define_machine(maple_md) {
281 .setup_arch = maple_setup_arch, 310 .setup_arch = maple_setup_arch,
282 .init_early = maple_init_early, 311 .init_early = maple_init_early,
283 .init_IRQ = maple_init_IRQ, 312 .init_IRQ = maple_init_IRQ,
284 .get_irq = mpic_get_irq,
285 .pcibios_fixup = maple_pcibios_fixup, 313 .pcibios_fixup = maple_pcibios_fixup,
286 .pci_get_legacy_ide_irq = maple_pci_get_legacy_ide_irq, 314 .pci_get_legacy_ide_irq = maple_pci_get_legacy_ide_irq,
287 .restart = maple_restart, 315 .restart = maple_restart,
diff --git a/arch/powerpc/platforms/maple/time.c b/arch/powerpc/platforms/maple/time.c
index b9a2b3d4bf33..9f7579b38c72 100644
--- a/arch/powerpc/platforms/maple/time.c
+++ b/arch/powerpc/platforms/maple/time.c
@@ -11,7 +11,6 @@
11 11
12#undef DEBUG 12#undef DEBUG
13 13
14#include <linux/config.h>
15#include <linux/errno.h> 14#include <linux/errno.h>
16#include <linux/sched.h> 15#include <linux/sched.h>
17#include <linux/kernel.h> 16#include <linux/kernel.h>
diff --git a/arch/powerpc/platforms/powermac/backlight.c b/arch/powerpc/platforms/powermac/backlight.c
index 498b042e1837..69f65e215a5c 100644
--- a/arch/powerpc/platforms/powermac/backlight.c
+++ b/arch/powerpc/platforms/powermac/backlight.c
@@ -7,7 +7,6 @@
7 * 7 *
8 */ 8 */
9 9
10#include <linux/config.h>
11#include <linux/kernel.h> 10#include <linux/kernel.h>
12#include <linux/fb.h> 11#include <linux/fb.h>
13#include <linux/backlight.h> 12#include <linux/backlight.h>
@@ -119,7 +118,14 @@ int pmac_backlight_set_legacy_brightness(int brightness)
119 down(&pmac_backlight->sem); 118 down(&pmac_backlight->sem);
120 props = pmac_backlight->props; 119 props = pmac_backlight->props;
121 props->brightness = brightness * 120 props->brightness = brightness *
122 props->max_brightness / OLD_BACKLIGHT_MAX; 121 (props->max_brightness + 1) /
122 (OLD_BACKLIGHT_MAX + 1);
123
124 if (props->brightness > props->max_brightness)
125 props->brightness = props->max_brightness;
126 else if (props->brightness < 0)
127 props->brightness = 0;
128
123 props->update_status(pmac_backlight); 129 props->update_status(pmac_backlight);
124 up(&pmac_backlight->sem); 130 up(&pmac_backlight->sem);
125 131
@@ -140,8 +146,11 @@ int pmac_backlight_get_legacy_brightness()
140 146
141 down(&pmac_backlight->sem); 147 down(&pmac_backlight->sem);
142 props = pmac_backlight->props; 148 props = pmac_backlight->props;
149
143 result = props->brightness * 150 result = props->brightness *
144 OLD_BACKLIGHT_MAX / props->max_brightness; 151 (OLD_BACKLIGHT_MAX + 1) /
152 (props->max_brightness + 1);
153
145 up(&pmac_backlight->sem); 154 up(&pmac_backlight->sem);
146 } 155 }
147 mutex_unlock(&pmac_backlight_mutex); 156 mutex_unlock(&pmac_backlight_mutex);
diff --git a/arch/powerpc/platforms/powermac/bootx_init.c b/arch/powerpc/platforms/powermac/bootx_init.c
index eacbfd9beabc..e63d52f227ee 100644
--- a/arch/powerpc/platforms/powermac/bootx_init.c
+++ b/arch/powerpc/platforms/powermac/bootx_init.c
@@ -9,7 +9,6 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11
12#include <linux/config.h>
13#include <linux/kernel.h> 12#include <linux/kernel.h>
14#include <linux/string.h> 13#include <linux/string.h>
15#include <linux/init.h> 14#include <linux/init.h>
@@ -163,6 +162,8 @@ static void __init bootx_add_chosen_props(unsigned long base,
163{ 162{
164 u32 val; 163 u32 val;
165 164
165 bootx_dt_add_prop("linux,bootx", NULL, 0, mem_end);
166
166 if (bootx_info->kernelParamsOffset) { 167 if (bootx_info->kernelParamsOffset) {
167 char *args = (char *)((unsigned long)bootx_info) + 168 char *args = (char *)((unsigned long)bootx_info) +
168 bootx_info->kernelParamsOffset; 169 bootx_info->kernelParamsOffset;
@@ -182,8 +183,25 @@ static void __init bootx_add_chosen_props(unsigned long base,
182static void __init bootx_add_display_props(unsigned long base, 183static void __init bootx_add_display_props(unsigned long base,
183 unsigned long *mem_end) 184 unsigned long *mem_end)
184{ 185{
186 boot_infos_t *bi = bootx_info;
187 u32 tmp;
188
185 bootx_dt_add_prop("linux,boot-display", NULL, 0, mem_end); 189 bootx_dt_add_prop("linux,boot-display", NULL, 0, mem_end);
186 bootx_dt_add_prop("linux,opened", NULL, 0, mem_end); 190 bootx_dt_add_prop("linux,opened", NULL, 0, mem_end);
191 tmp = bi->dispDeviceDepth;
192 bootx_dt_add_prop("linux,bootx-depth", &tmp, 4, mem_end);
193 tmp = bi->dispDeviceRect[2] - bi->dispDeviceRect[0];
194 bootx_dt_add_prop("linux,bootx-width", &tmp, 4, mem_end);
195 tmp = bi->dispDeviceRect[3] - bi->dispDeviceRect[1];
196 bootx_dt_add_prop("linux,bootx-height", &tmp, 4, mem_end);
197 tmp = bi->dispDeviceRowBytes;
198 bootx_dt_add_prop("linux,bootx-linebytes", &tmp, 4, mem_end);
199 tmp = (u32)bi->dispDeviceBase;
200 if (tmp == 0)
201 tmp = (u32)bi->logicalDisplayBase;
202 tmp += bi->dispDeviceRect[1] * bi->dispDeviceRowBytes;
203 tmp += bi->dispDeviceRect[0] * ((bi->dispDeviceDepth + 7) / 8);
204 bootx_dt_add_prop("linux,bootx-addr", &tmp, 4, mem_end);
187} 205}
188 206
189static void __init bootx_dt_add_string(char *s, unsigned long *mem_end) 207static void __init bootx_dt_add_string(char *s, unsigned long *mem_end)
@@ -212,7 +230,7 @@ static void __init bootx_scan_dt_build_strings(unsigned long base,
212 230
213 if (!strcmp(namep, "/chosen")) { 231 if (!strcmp(namep, "/chosen")) {
214 DBG(" detected /chosen ! adding properties names !\n"); 232 DBG(" detected /chosen ! adding properties names !\n");
215 bootx_dt_add_string("linux,platform", mem_end); 233 bootx_dt_add_string("linux,bootx", mem_end);
216 bootx_dt_add_string("linux,stdout-path", mem_end); 234 bootx_dt_add_string("linux,stdout-path", mem_end);
217 bootx_dt_add_string("linux,initrd-start", mem_end); 235 bootx_dt_add_string("linux,initrd-start", mem_end);
218 bootx_dt_add_string("linux,initrd-end", mem_end); 236 bootx_dt_add_string("linux,initrd-end", mem_end);
@@ -223,6 +241,11 @@ static void __init bootx_scan_dt_build_strings(unsigned long base,
223 DBG(" detected display ! adding properties names !\n"); 241 DBG(" detected display ! adding properties names !\n");
224 bootx_dt_add_string("linux,boot-display", mem_end); 242 bootx_dt_add_string("linux,boot-display", mem_end);
225 bootx_dt_add_string("linux,opened", mem_end); 243 bootx_dt_add_string("linux,opened", mem_end);
244 bootx_dt_add_string("linux,bootx-depth", mem_end);
245 bootx_dt_add_string("linux,bootx-width", mem_end);
246 bootx_dt_add_string("linux,bootx-height", mem_end);
247 bootx_dt_add_string("linux,bootx-linebytes", mem_end);
248 bootx_dt_add_string("linux,bootx-addr", mem_end);
226 strncpy(bootx_disp_path, namep, 255); 249 strncpy(bootx_disp_path, namep, 255);
227 } 250 }
228 251
@@ -444,7 +467,14 @@ void __init bootx_init(unsigned long r3, unsigned long r4)
444 if (!BOOT_INFO_IS_V2_COMPATIBLE(bi)) 467 if (!BOOT_INFO_IS_V2_COMPATIBLE(bi))
445 bi->logicalDisplayBase = bi->dispDeviceBase; 468 bi->logicalDisplayBase = bi->dispDeviceBase;
446 469
470 /* Fixup depth 16 -> 15 as that's what MacOS calls 16bpp */
471 if (bi->dispDeviceDepth == 16)
472 bi->dispDeviceDepth = 15;
473
447#ifdef CONFIG_BOOTX_TEXT 474#ifdef CONFIG_BOOTX_TEXT
475 ptr = (unsigned long)bi->logicalDisplayBase;
476 ptr += bi->dispDeviceRect[1] * bi->dispDeviceRowBytes;
477 ptr += bi->dispDeviceRect[0] * ((bi->dispDeviceDepth + 7) / 8);
448 btext_setup_display(bi->dispDeviceRect[2] - bi->dispDeviceRect[0], 478 btext_setup_display(bi->dispDeviceRect[2] - bi->dispDeviceRect[0],
449 bi->dispDeviceRect[3] - bi->dispDeviceRect[1], 479 bi->dispDeviceRect[3] - bi->dispDeviceRect[1],
450 bi->dispDeviceDepth, bi->dispDeviceRowBytes, 480 bi->dispDeviceDepth, bi->dispDeviceRowBytes,
diff --git a/arch/powerpc/platforms/powermac/cache.S b/arch/powerpc/platforms/powermac/cache.S
index fb977de6b704..6be1a4af3359 100644
--- a/arch/powerpc/platforms/powermac/cache.S
+++ b/arch/powerpc/platforms/powermac/cache.S
@@ -14,7 +14,6 @@
14 * 14 *
15 */ 15 */
16 16
17#include <linux/config.h>
18#include <asm/processor.h> 17#include <asm/processor.h>
19#include <asm/ppc_asm.h> 18#include <asm/ppc_asm.h>
20#include <asm/cputable.h> 19#include <asm/cputable.h>
diff --git a/arch/powerpc/platforms/powermac/cpufreq_32.c b/arch/powerpc/platforms/powermac/cpufreq_32.c
index af2a8f9f1222..62926248bdb8 100644
--- a/arch/powerpc/platforms/powermac/cpufreq_32.c
+++ b/arch/powerpc/platforms/powermac/cpufreq_32.c
@@ -13,7 +13,6 @@
13 * 13 *
14 */ 14 */
15 15
16#include <linux/config.h>
17#include <linux/module.h> 16#include <linux/module.h>
18#include <linux/types.h> 17#include <linux/types.h>
19#include <linux/errno.h> 18#include <linux/errno.h>
@@ -68,7 +67,7 @@ static unsigned int cur_freq;
68static unsigned int sleep_freq; 67static unsigned int sleep_freq;
69 68
70/* 69/*
71 * Different models uses different mecanisms to switch the frequency 70 * Different models uses different mechanisms to switch the frequency
72 */ 71 */
73static int (*set_speed_proc)(int low_speed); 72static int (*set_speed_proc)(int low_speed);
74static unsigned int (*get_speed_proc)(void); 73static unsigned int (*get_speed_proc)(void);
@@ -268,7 +267,7 @@ static int pmu_set_cpu_speed(int low_speed)
268 267
269 /* Make sure the decrementer won't interrupt us */ 268 /* Make sure the decrementer won't interrupt us */
270 asm volatile("mtdec %0" : : "r" (0x7fffffff)); 269 asm volatile("mtdec %0" : : "r" (0x7fffffff));
271 /* Make sure any pending DEC interrupt occuring while we did 270 /* Make sure any pending DEC interrupt occurring while we did
272 * the above didn't re-enable the DEC */ 271 * the above didn't re-enable the DEC */
273 mb(); 272 mb();
274 asm volatile("mtdec %0" : : "r" (0x7fffffff)); 273 asm volatile("mtdec %0" : : "r" (0x7fffffff));
diff --git a/arch/powerpc/platforms/powermac/cpufreq_64.c b/arch/powerpc/platforms/powermac/cpufreq_64.c
index b57e465a1b71..f08a14516139 100644
--- a/arch/powerpc/platforms/powermac/cpufreq_64.c
+++ b/arch/powerpc/platforms/powermac/cpufreq_64.c
@@ -10,7 +10,6 @@
10 * that is iMac G5 and latest single CPU desktop. 10 * that is iMac G5 and latest single CPU desktop.
11 */ 11 */
12 12
13#include <linux/config.h>
14#include <linux/module.h> 13#include <linux/module.h>
15#include <linux/types.h> 14#include <linux/types.h>
16#include <linux/errno.h> 15#include <linux/errno.h>
diff --git a/arch/powerpc/platforms/powermac/feature.c b/arch/powerpc/platforms/powermac/feature.c
index 85e00cb0006e..f8313bf9a9f7 100644
--- a/arch/powerpc/platforms/powermac/feature.c
+++ b/arch/powerpc/platforms/powermac/feature.c
@@ -16,7 +16,6 @@
16 * - Split split split... 16 * - Split split split...
17 * 17 *
18 */ 18 */
19#include <linux/config.h>
20#include <linux/types.h> 19#include <linux/types.h>
21#include <linux/init.h> 20#include <linux/init.h>
22#include <linux/delay.h> 21#include <linux/delay.h>
diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c
index c896ce83d412..8677f50c2586 100644
--- a/arch/powerpc/platforms/powermac/low_i2c.c
+++ b/arch/powerpc/platforms/powermac/low_i2c.c
@@ -30,7 +30,6 @@
30#undef DEBUG 30#undef DEBUG
31#undef DEBUG_LOW 31#undef DEBUG_LOW
32 32
33#include <linux/config.h>
34#include <linux/types.h> 33#include <linux/types.h>
35#include <linux/sched.h> 34#include <linux/sched.h>
36#include <linux/init.h> 35#include <linux/init.h>
@@ -523,10 +522,11 @@ static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np)
523 host->speed = KW_I2C_MODE_25KHZ; 522 host->speed = KW_I2C_MODE_25KHZ;
524 break; 523 break;
525 } 524 }
526 if (np->n_intrs > 0) 525 host->irq = irq_of_parse_and_map(np, 0);
527 host->irq = np->intrs[0].line; 526 if (host->irq == NO_IRQ)
528 else 527 printk(KERN_WARNING
529 host->irq = NO_IRQ; 528 "low_i2c: Failed to map interrupt for %s\n",
529 np->full_name);
530 530
531 host->base = ioremap((*addrp), 0x1000); 531 host->base = ioremap((*addrp), 0x1000);
532 if (host->base == NULL) { 532 if (host->base == NULL) {
diff --git a/arch/powerpc/platforms/powermac/nvram.c b/arch/powerpc/platforms/powermac/nvram.c
index 262f967b880a..6a36ea9bf673 100644
--- a/arch/powerpc/platforms/powermac/nvram.c
+++ b/arch/powerpc/platforms/powermac/nvram.c
@@ -8,7 +8,6 @@
8 * 8 *
9 * Todo: - add support for the OF persistent properties 9 * Todo: - add support for the OF persistent properties
10 */ 10 */
11#include <linux/config.h>
12#include <linux/module.h> 11#include <linux/module.h>
13#include <linux/kernel.h> 12#include <linux/kernel.h>
14#include <linux/stddef.h> 13#include <linux/stddef.h>
@@ -30,6 +29,8 @@
30#include <asm/machdep.h> 29#include <asm/machdep.h>
31#include <asm/nvram.h> 30#include <asm/nvram.h>
32 31
32#include "pmac.h"
33
33#define DEBUG 34#define DEBUG
34 35
35#ifdef DEBUG 36#ifdef DEBUG
@@ -81,9 +82,6 @@ static int nvram_partitions[3];
81// XXX Turn that into a sem 82// XXX Turn that into a sem
82static DEFINE_SPINLOCK(nv_lock); 83static DEFINE_SPINLOCK(nv_lock);
83 84
84extern int pmac_newworld;
85extern int system_running;
86
87static int (*core99_write_bank)(int bank, u8* datas); 85static int (*core99_write_bank)(int bank, u8* datas);
88static int (*core99_erase_bank)(int bank); 86static int (*core99_erase_bank)(int bank);
89 87
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index 80035853467b..556b349797e8 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -46,6 +46,9 @@ static int has_uninorth;
46static struct pci_controller *u3_agp; 46static struct pci_controller *u3_agp;
47static struct pci_controller *u4_pcie; 47static struct pci_controller *u4_pcie;
48static struct pci_controller *u3_ht; 48static struct pci_controller *u3_ht;
49#define has_second_ohare 0
50#else
51static int has_second_ohare;
49#endif /* CONFIG_PPC64 */ 52#endif /* CONFIG_PPC64 */
50 53
51extern u8 pci_cache_line_size; 54extern u8 pci_cache_line_size;
@@ -647,6 +650,33 @@ static void __init init_p2pbridge(void)
647 early_write_config_word(hose, bus, devfn, PCI_BRIDGE_CONTROL, val); 650 early_write_config_word(hose, bus, devfn, PCI_BRIDGE_CONTROL, val);
648} 651}
649 652
653static void __init init_second_ohare(void)
654{
655 struct device_node *np = of_find_node_by_name(NULL, "pci106b,7");
656 unsigned char bus, devfn;
657 unsigned short cmd;
658
659 if (np == NULL)
660 return;
661
662 /* This must run before we initialize the PICs since the second
663 * ohare hosts a PIC that will be accessed there.
664 */
665 if (pci_device_from_OF_node(np, &bus, &devfn) == 0) {
666 struct pci_controller* hose =
667 pci_find_hose_for_OF_device(np);
668 if (!hose) {
669 printk(KERN_ERR "Can't find PCI hose for OHare2 !\n");
670 return;
671 }
672 early_read_config_word(hose, bus, devfn, PCI_COMMAND, &cmd);
673 cmd |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER;
674 cmd &= ~PCI_COMMAND_IO;
675 early_write_config_word(hose, bus, devfn, PCI_COMMAND, cmd);
676 }
677 has_second_ohare = 1;
678}
679
650/* 680/*
651 * Some Apple desktop machines have a NEC PD720100A USB2 controller 681 * Some Apple desktop machines have a NEC PD720100A USB2 controller
652 * on the motherboard. Open Firmware, on these, will disable the 682 * on the motherboard. Open Firmware, on these, will disable the
@@ -688,9 +718,6 @@ static void __init fixup_nec_usb2(void)
688 " EHCI, fixing up...\n"); 718 " EHCI, fixing up...\n");
689 data &= ~1UL; 719 data &= ~1UL;
690 early_write_config_dword(hose, bus, devfn, 0xe4, data); 720 early_write_config_dword(hose, bus, devfn, 0xe4, data);
691 early_write_config_byte(hose, bus,
692 devfn | 2, PCI_INTERRUPT_LINE,
693 nec->intrs[0].line);
694 } 721 }
695 } 722 }
696} 723}
@@ -939,9 +966,10 @@ static int __init add_bridge(struct device_node *dev)
939 disp_name = "Chaos"; 966 disp_name = "Chaos";
940 primary = 0; 967 primary = 0;
941 } 968 }
942 printk(KERN_INFO "Found %s PCI host bridge at 0x%08lx. " 969 printk(KERN_INFO "Found %s PCI host bridge at 0x%016llx. "
943 "Firmware bus number: %d->%d\n", 970 "Firmware bus number: %d->%d\n",
944 disp_name, rsrc.start, hose->first_busno, hose->last_busno); 971 disp_name, (unsigned long long)rsrc.start, hose->first_busno,
972 hose->last_busno);
945#endif /* CONFIG_PPC32 */ 973#endif /* CONFIG_PPC32 */
946 974
947 DBG(" ->Hose at 0x%p, cfg_addr=0x%p,cfg_data=0x%p\n", 975 DBG(" ->Hose at 0x%p, cfg_addr=0x%p,cfg_data=0x%p\n",
@@ -957,32 +985,28 @@ static int __init add_bridge(struct device_node *dev)
957 return 0; 985 return 0;
958} 986}
959 987
960static void __init pcibios_fixup_OF_interrupts(void) 988void __init pmac_pcibios_fixup(void)
961{ 989{
962 struct pci_dev* dev = NULL; 990 struct pci_dev* dev = NULL;
963 991
964 /*
965 * Open Firmware often doesn't initialize the
966 * PCI_INTERRUPT_LINE config register properly, so we
967 * should find the device node and apply the interrupt
968 * obtained from the OF device-tree
969 */
970 for_each_pci_dev(dev) { 992 for_each_pci_dev(dev) {
971 struct device_node *node; 993 /* Read interrupt from the device-tree */
972 node = pci_device_to_OF_node(dev); 994 pci_read_irq_line(dev);
973 /* this is the node, see if it has interrupts */ 995
974 if (node && node->n_intrs > 0) 996 /* Fixup interrupt for the modem/ethernet combo controller.
975 dev->irq = node->intrs[0].line; 997 * on machines with a second ohare chip.
976 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); 998 * The number in the device tree (27) is bogus (correct for
999 * the ethernet-only board but not the combo ethernet/modem
1000 * board). The real interrupt is 28 on the second controller
1001 * -> 28+32 = 60.
1002 */
1003 if (has_second_ohare &&
1004 dev->vendor == PCI_VENDOR_ID_DEC &&
1005 dev->device == PCI_DEVICE_ID_DEC_TULIP_PLUS)
1006 dev->irq = irq_create_mapping(NULL, 60, 0);
977 } 1007 }
978} 1008}
979 1009
980void __init pmac_pcibios_fixup(void)
981{
982 /* Fixup interrupts according to OF tree */
983 pcibios_fixup_OF_interrupts();
984}
985
986#ifdef CONFIG_PPC64 1010#ifdef CONFIG_PPC64
987static void __init pmac_fixup_phb_resources(void) 1011static void __init pmac_fixup_phb_resources(void)
988{ 1012{
@@ -1070,6 +1094,7 @@ void __init pmac_pci_init(void)
1070 1094
1071#else /* CONFIG_PPC64 */ 1095#else /* CONFIG_PPC64 */
1072 init_p2pbridge(); 1096 init_p2pbridge();
1097 init_second_ohare();
1073 fixup_nec_usb2(); 1098 fixup_nec_usb2();
1074 1099
1075 /* We are still having some issues with the Xserve G4, enabling 1100 /* We are still having some issues with the Xserve G4, enabling
diff --git a/arch/powerpc/platforms/powermac/pfunc_base.c b/arch/powerpc/platforms/powermac/pfunc_base.c
index a3bd3e728fa3..6d66359ec8c8 100644
--- a/arch/powerpc/platforms/powermac/pfunc_base.c
+++ b/arch/powerpc/platforms/powermac/pfunc_base.c
@@ -1,4 +1,3 @@
1#include <linux/config.h>
2#include <linux/types.h> 1#include <linux/types.h>
3#include <linux/init.h> 2#include <linux/init.h>
4#include <linux/delay.h> 3#include <linux/delay.h>
@@ -25,19 +24,18 @@ static irqreturn_t macio_gpio_irq(int irq, void *data, struct pt_regs *regs)
25 24
26static int macio_do_gpio_irq_enable(struct pmf_function *func) 25static int macio_do_gpio_irq_enable(struct pmf_function *func)
27{ 26{
28 if (func->node->n_intrs < 1) 27 unsigned int irq = irq_of_parse_and_map(func->node, 0);
28 if (irq == NO_IRQ)
29 return -EINVAL; 29 return -EINVAL;
30 30 return request_irq(irq, macio_gpio_irq, 0, func->node->name, func);
31 return request_irq(func->node->intrs[0].line, macio_gpio_irq, 0,
32 func->node->name, func);
33} 31}
34 32
35static int macio_do_gpio_irq_disable(struct pmf_function *func) 33static int macio_do_gpio_irq_disable(struct pmf_function *func)
36{ 34{
37 if (func->node->n_intrs < 1) 35 unsigned int irq = irq_of_parse_and_map(func->node, 0);
36 if (irq == NO_IRQ)
38 return -EINVAL; 37 return -EINVAL;
39 38 free_irq(irq, func);
40 free_irq(func->node->intrs[0].line, func);
41 return 0; 39 return 0;
42} 40}
43 41
diff --git a/arch/powerpc/platforms/powermac/pfunc_core.c b/arch/powerpc/platforms/powermac/pfunc_core.c
index 047f954a89eb..b117adbf9571 100644
--- a/arch/powerpc/platforms/powermac/pfunc_core.c
+++ b/arch/powerpc/platforms/powermac/pfunc_core.c
@@ -5,7 +5,6 @@
5 * FIXME: LOCKING !!! 5 * FIXME: LOCKING !!!
6 */ 6 */
7 7
8#include <linux/config.h>
9#include <linux/init.h> 8#include <linux/init.h>
10#include <linux/delay.h> 9#include <linux/delay.h>
11#include <linux/kernel.h> 10#include <linux/kernel.h>
@@ -546,7 +545,7 @@ struct pmf_device {
546}; 545};
547 546
548static LIST_HEAD(pmf_devices); 547static LIST_HEAD(pmf_devices);
549static spinlock_t pmf_lock = SPIN_LOCK_UNLOCKED; 548static DEFINE_SPINLOCK(pmf_lock);
550static DEFINE_MUTEX(pmf_irq_mutex); 549static DEFINE_MUTEX(pmf_irq_mutex);
551 550
552static void pmf_release_device(struct kref *kref) 551static void pmf_release_device(struct kref *kref)
diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c
index 18bf3011d1e3..3d328bc1f7e0 100644
--- a/arch/powerpc/platforms/powermac/pic.c
+++ b/arch/powerpc/platforms/powermac/pic.c
@@ -15,7 +15,6 @@
15 * 15 *
16 */ 16 */
17 17
18#include <linux/config.h>
19#include <linux/stddef.h> 18#include <linux/stddef.h>
20#include <linux/init.h> 19#include <linux/init.h>
21#include <linux/sched.h> 20#include <linux/sched.h>
@@ -66,39 +65,36 @@ static u32 level_mask[4];
66 65
67static DEFINE_SPINLOCK(pmac_pic_lock); 66static DEFINE_SPINLOCK(pmac_pic_lock);
68 67
69#define GATWICK_IRQ_POOL_SIZE 10
70static struct interrupt_info gatwick_int_pool[GATWICK_IRQ_POOL_SIZE];
71
72#define NR_MASK_WORDS ((NR_IRQS + 31) / 32) 68#define NR_MASK_WORDS ((NR_IRQS + 31) / 32)
73static unsigned long ppc_lost_interrupts[NR_MASK_WORDS]; 69static unsigned long ppc_lost_interrupts[NR_MASK_WORDS];
70static unsigned long ppc_cached_irq_mask[NR_MASK_WORDS];
71static int pmac_irq_cascade = -1;
72static struct irq_host *pmac_pic_host;
74 73
75/* 74static void __pmac_retrigger(unsigned int irq_nr)
76 * Mark an irq as "lost". This is only used on the pmac
77 * since it can lose interrupts (see pmac_set_irq_mask).
78 * -- Cort
79 */
80void __set_lost(unsigned long irq_nr, int nokick)
81{ 75{
82 if (!test_and_set_bit(irq_nr, ppc_lost_interrupts)) { 76 if (irq_nr >= max_real_irqs && pmac_irq_cascade > 0) {
77 __set_bit(irq_nr, ppc_lost_interrupts);
78 irq_nr = pmac_irq_cascade;
79 mb();
80 }
81 if (!__test_and_set_bit(irq_nr, ppc_lost_interrupts)) {
83 atomic_inc(&ppc_n_lost_interrupts); 82 atomic_inc(&ppc_n_lost_interrupts);
84 if (!nokick) 83 set_dec(1);
85 set_dec(1);
86 } 84 }
87} 85}
88 86
89static void pmac_mask_and_ack_irq(unsigned int irq_nr) 87static void pmac_mask_and_ack_irq(unsigned int virq)
90{ 88{
91 unsigned long bit = 1UL << (irq_nr & 0x1f); 89 unsigned int src = irq_map[virq].hwirq;
92 int i = irq_nr >> 5; 90 unsigned long bit = 1UL << (virq & 0x1f);
91 int i = virq >> 5;
93 unsigned long flags; 92 unsigned long flags;
94 93
95 if ((unsigned)irq_nr >= max_irqs)
96 return;
97
98 clear_bit(irq_nr, ppc_cached_irq_mask);
99 if (test_and_clear_bit(irq_nr, ppc_lost_interrupts))
100 atomic_dec(&ppc_n_lost_interrupts);
101 spin_lock_irqsave(&pmac_pic_lock, flags); 94 spin_lock_irqsave(&pmac_pic_lock, flags);
95 __clear_bit(src, ppc_cached_irq_mask);
96 if (__test_and_clear_bit(src, ppc_lost_interrupts))
97 atomic_dec(&ppc_n_lost_interrupts);
102 out_le32(&pmac_irq_hw[i]->enable, ppc_cached_irq_mask[i]); 98 out_le32(&pmac_irq_hw[i]->enable, ppc_cached_irq_mask[i]);
103 out_le32(&pmac_irq_hw[i]->ack, bit); 99 out_le32(&pmac_irq_hw[i]->ack, bit);
104 do { 100 do {
@@ -110,16 +106,29 @@ static void pmac_mask_and_ack_irq(unsigned int irq_nr)
110 spin_unlock_irqrestore(&pmac_pic_lock, flags); 106 spin_unlock_irqrestore(&pmac_pic_lock, flags);
111} 107}
112 108
113static void pmac_set_irq_mask(unsigned int irq_nr, int nokicklost) 109static void pmac_ack_irq(unsigned int virq)
110{
111 unsigned int src = irq_map[virq].hwirq;
112 unsigned long bit = 1UL << (src & 0x1f);
113 int i = src >> 5;
114 unsigned long flags;
115
116 spin_lock_irqsave(&pmac_pic_lock, flags);
117 if (__test_and_clear_bit(src, ppc_lost_interrupts))
118 atomic_dec(&ppc_n_lost_interrupts);
119 out_le32(&pmac_irq_hw[i]->ack, bit);
120 (void)in_le32(&pmac_irq_hw[i]->ack);
121 spin_unlock_irqrestore(&pmac_pic_lock, flags);
122}
123
124static void __pmac_set_irq_mask(unsigned int irq_nr, int nokicklost)
114{ 125{
115 unsigned long bit = 1UL << (irq_nr & 0x1f); 126 unsigned long bit = 1UL << (irq_nr & 0x1f);
116 int i = irq_nr >> 5; 127 int i = irq_nr >> 5;
117 unsigned long flags;
118 128
119 if ((unsigned)irq_nr >= max_irqs) 129 if ((unsigned)irq_nr >= max_irqs)
120 return; 130 return;
121 131
122 spin_lock_irqsave(&pmac_pic_lock, flags);
123 /* enable unmasked interrupts */ 132 /* enable unmasked interrupts */
124 out_le32(&pmac_irq_hw[i]->enable, ppc_cached_irq_mask[i]); 133 out_le32(&pmac_irq_hw[i]->enable, ppc_cached_irq_mask[i]);
125 134
@@ -136,71 +145,78 @@ static void pmac_set_irq_mask(unsigned int irq_nr, int nokicklost)
136 * the bit in the flag register or request another interrupt. 145 * the bit in the flag register or request another interrupt.
137 */ 146 */
138 if (bit & ppc_cached_irq_mask[i] & in_le32(&pmac_irq_hw[i]->level)) 147 if (bit & ppc_cached_irq_mask[i] & in_le32(&pmac_irq_hw[i]->level))
139 __set_lost((ulong)irq_nr, nokicklost); 148 __pmac_retrigger(irq_nr);
140 spin_unlock_irqrestore(&pmac_pic_lock, flags);
141} 149}
142 150
143/* When an irq gets requested for the first client, if it's an 151/* When an irq gets requested for the first client, if it's an
144 * edge interrupt, we clear any previous one on the controller 152 * edge interrupt, we clear any previous one on the controller
145 */ 153 */
146static unsigned int pmac_startup_irq(unsigned int irq_nr) 154static unsigned int pmac_startup_irq(unsigned int virq)
147{ 155{
148 unsigned long bit = 1UL << (irq_nr & 0x1f); 156 unsigned long flags;
149 int i = irq_nr >> 5; 157 unsigned int src = irq_map[virq].hwirq;
158 unsigned long bit = 1UL << (src & 0x1f);
159 int i = src >> 5;
150 160
151 if ((irq_desc[irq_nr].status & IRQ_LEVEL) == 0) 161 spin_lock_irqsave(&pmac_pic_lock, flags);
162 if ((irq_desc[virq].status & IRQ_LEVEL) == 0)
152 out_le32(&pmac_irq_hw[i]->ack, bit); 163 out_le32(&pmac_irq_hw[i]->ack, bit);
153 set_bit(irq_nr, ppc_cached_irq_mask); 164 __set_bit(src, ppc_cached_irq_mask);
154 pmac_set_irq_mask(irq_nr, 0); 165 __pmac_set_irq_mask(src, 0);
166 spin_unlock_irqrestore(&pmac_pic_lock, flags);
155 167
156 return 0; 168 return 0;
157} 169}
158 170
159static void pmac_mask_irq(unsigned int irq_nr) 171static void pmac_mask_irq(unsigned int virq)
160{ 172{
161 clear_bit(irq_nr, ppc_cached_irq_mask); 173 unsigned long flags;
162 pmac_set_irq_mask(irq_nr, 0); 174 unsigned int src = irq_map[virq].hwirq;
163 mb(); 175
176 spin_lock_irqsave(&pmac_pic_lock, flags);
177 __clear_bit(src, ppc_cached_irq_mask);
178 __pmac_set_irq_mask(src, 0);
179 spin_unlock_irqrestore(&pmac_pic_lock, flags);
164} 180}
165 181
166static void pmac_unmask_irq(unsigned int irq_nr) 182static void pmac_unmask_irq(unsigned int virq)
167{ 183{
168 set_bit(irq_nr, ppc_cached_irq_mask); 184 unsigned long flags;
169 pmac_set_irq_mask(irq_nr, 0); 185 unsigned int src = irq_map[virq].hwirq;
186
187 spin_lock_irqsave(&pmac_pic_lock, flags);
188 __set_bit(src, ppc_cached_irq_mask);
189 __pmac_set_irq_mask(src, 0);
190 spin_unlock_irqrestore(&pmac_pic_lock, flags);
170} 191}
171 192
172static void pmac_end_irq(unsigned int irq_nr) 193static int pmac_retrigger(unsigned int virq)
173{ 194{
174 if (!(irq_desc[irq_nr].status & (IRQ_DISABLED|IRQ_INPROGRESS)) 195 unsigned long flags;
175 && irq_desc[irq_nr].action) {
176 set_bit(irq_nr, ppc_cached_irq_mask);
177 pmac_set_irq_mask(irq_nr, 1);
178 }
179}
180 196
197 spin_lock_irqsave(&pmac_pic_lock, flags);
198 __pmac_retrigger(irq_map[virq].hwirq);
199 spin_unlock_irqrestore(&pmac_pic_lock, flags);
200 return 1;
201}
181 202
182struct hw_interrupt_type pmac_pic = { 203static struct irq_chip pmac_pic = {
183 .typename = " PMAC-PIC ", 204 .typename = " PMAC-PIC ",
184 .startup = pmac_startup_irq, 205 .startup = pmac_startup_irq,
185 .enable = pmac_unmask_irq, 206 .mask = pmac_mask_irq,
186 .disable = pmac_mask_irq, 207 .ack = pmac_ack_irq,
187 .ack = pmac_mask_and_ack_irq, 208 .mask_ack = pmac_mask_and_ack_irq,
188 .end = pmac_end_irq, 209 .unmask = pmac_unmask_irq,
189}; 210 .retrigger = pmac_retrigger,
190
191struct hw_interrupt_type gatwick_pic = {
192 .typename = " GATWICK ",
193 .startup = pmac_startup_irq,
194 .enable = pmac_unmask_irq,
195 .disable = pmac_mask_irq,
196 .ack = pmac_mask_and_ack_irq,
197 .end = pmac_end_irq,
198}; 211};
199 212
200static irqreturn_t gatwick_action(int cpl, void *dev_id, struct pt_regs *regs) 213static irqreturn_t gatwick_action(int cpl, void *dev_id, struct pt_regs *regs)
201{ 214{
215 unsigned long flags;
202 int irq, bits; 216 int irq, bits;
217 int rc = IRQ_NONE;
203 218
219 spin_lock_irqsave(&pmac_pic_lock, flags);
204 for (irq = max_irqs; (irq -= 32) >= max_real_irqs; ) { 220 for (irq = max_irqs; (irq -= 32) >= max_real_irqs; ) {
205 int i = irq >> 5; 221 int i = irq >> 5;
206 bits = in_le32(&pmac_irq_hw[i]->event) | ppc_lost_interrupts[i]; 222 bits = in_le32(&pmac_irq_hw[i]->event) | ppc_lost_interrupts[i];
@@ -210,17 +226,20 @@ static irqreturn_t gatwick_action(int cpl, void *dev_id, struct pt_regs *regs)
210 if (bits == 0) 226 if (bits == 0)
211 continue; 227 continue;
212 irq += __ilog2(bits); 228 irq += __ilog2(bits);
229 spin_unlock_irqrestore(&pmac_pic_lock, flags);
213 __do_IRQ(irq, regs); 230 __do_IRQ(irq, regs);
214 return IRQ_HANDLED; 231 spin_lock_irqsave(&pmac_pic_lock, flags);
232 rc = IRQ_HANDLED;
215 } 233 }
216 printk("gatwick irq not from gatwick pic\n"); 234 spin_unlock_irqrestore(&pmac_pic_lock, flags);
217 return IRQ_NONE; 235 return rc;
218} 236}
219 237
220static int pmac_get_irq(struct pt_regs *regs) 238static unsigned int pmac_pic_get_irq(struct pt_regs *regs)
221{ 239{
222 int irq; 240 int irq;
223 unsigned long bits = 0; 241 unsigned long bits = 0;
242 unsigned long flags;
224 243
225#ifdef CONFIG_SMP 244#ifdef CONFIG_SMP
226 void psurge_smp_message_recv(struct pt_regs *); 245 void psurge_smp_message_recv(struct pt_regs *);
@@ -228,9 +247,10 @@ static int pmac_get_irq(struct pt_regs *regs)
228 /* IPI's are a hack on the powersurge -- Cort */ 247 /* IPI's are a hack on the powersurge -- Cort */
229 if ( smp_processor_id() != 0 ) { 248 if ( smp_processor_id() != 0 ) {
230 psurge_smp_message_recv(regs); 249 psurge_smp_message_recv(regs);
231 return -2; /* ignore, already handled */ 250 return NO_IRQ_IGNORE; /* ignore, already handled */
232 } 251 }
233#endif /* CONFIG_SMP */ 252#endif /* CONFIG_SMP */
253 spin_lock_irqsave(&pmac_pic_lock, flags);
234 for (irq = max_real_irqs; (irq -= 32) >= 0; ) { 254 for (irq = max_real_irqs; (irq -= 32) >= 0; ) {
235 int i = irq >> 5; 255 int i = irq >> 5;
236 bits = in_le32(&pmac_irq_hw[i]->event) | ppc_lost_interrupts[i]; 256 bits = in_le32(&pmac_irq_hw[i]->event) | ppc_lost_interrupts[i];
@@ -242,133 +262,10 @@ static int pmac_get_irq(struct pt_regs *regs)
242 irq += __ilog2(bits); 262 irq += __ilog2(bits);
243 break; 263 break;
244 } 264 }
245 265 spin_unlock_irqrestore(&pmac_pic_lock, flags);
246 return irq; 266 if (unlikely(irq < 0))
247} 267 return NO_IRQ;
248 268 return irq_linear_revmap(pmac_pic_host, irq);
249/* This routine will fix some missing interrupt values in the device tree
250 * on the gatwick mac-io controller used by some PowerBooks
251 *
252 * Walking of OF nodes could use a bit more fixing up here, but it's not
253 * very important as this is all boot time code on static portions of the
254 * device-tree.
255 *
256 * However, the modifications done to "intrs" will have to be removed and
257 * replaced with proper updates of the "interrupts" properties or
258 * AAPL,interrupts, yet to be decided, once the dynamic parsing is there.
259 */
260static void __init pmac_fix_gatwick_interrupts(struct device_node *gw,
261 int irq_base)
262{
263 struct device_node *node;
264 int count;
265
266 memset(gatwick_int_pool, 0, sizeof(gatwick_int_pool));
267 count = 0;
268 for (node = NULL; (node = of_get_next_child(gw, node)) != NULL;) {
269 /* Fix SCC */
270 if ((strcasecmp(node->name, "escc") == 0) && node->child) {
271 if (node->child->n_intrs < 3) {
272 node->child->intrs = &gatwick_int_pool[count];
273 count += 3;
274 }
275 node->child->n_intrs = 3;
276 node->child->intrs[0].line = 15+irq_base;
277 node->child->intrs[1].line = 4+irq_base;
278 node->child->intrs[2].line = 5+irq_base;
279 printk(KERN_INFO "irq: fixed SCC on gatwick"
280 " (%d,%d,%d)\n",
281 node->child->intrs[0].line,
282 node->child->intrs[1].line,
283 node->child->intrs[2].line);
284 }
285 /* Fix media-bay & left SWIM */
286 if (strcasecmp(node->name, "media-bay") == 0) {
287 struct device_node* ya_node;
288
289 if (node->n_intrs == 0)
290 node->intrs = &gatwick_int_pool[count++];
291 node->n_intrs = 1;
292 node->intrs[0].line = 29+irq_base;
293 printk(KERN_INFO "irq: fixed media-bay on gatwick"
294 " (%d)\n", node->intrs[0].line);
295
296 ya_node = node->child;
297 while(ya_node) {
298 if (strcasecmp(ya_node->name, "floppy") == 0) {
299 if (ya_node->n_intrs < 2) {
300 ya_node->intrs = &gatwick_int_pool[count];
301 count += 2;
302 }
303 ya_node->n_intrs = 2;
304 ya_node->intrs[0].line = 19+irq_base;
305 ya_node->intrs[1].line = 1+irq_base;
306 printk(KERN_INFO "irq: fixed floppy on second controller (%d,%d)\n",
307 ya_node->intrs[0].line, ya_node->intrs[1].line);
308 }
309 if (strcasecmp(ya_node->name, "ata4") == 0) {
310 if (ya_node->n_intrs < 2) {
311 ya_node->intrs = &gatwick_int_pool[count];
312 count += 2;
313 }
314 ya_node->n_intrs = 2;
315 ya_node->intrs[0].line = 14+irq_base;
316 ya_node->intrs[1].line = 3+irq_base;
317 printk(KERN_INFO "irq: fixed ide on second controller (%d,%d)\n",
318 ya_node->intrs[0].line, ya_node->intrs[1].line);
319 }
320 ya_node = ya_node->sibling;
321 }
322 }
323 }
324 if (count > 10) {
325 printk("WARNING !! Gatwick interrupt pool overflow\n");
326 printk(" GATWICK_IRQ_POOL_SIZE = %d\n", GATWICK_IRQ_POOL_SIZE);
327 printk(" requested = %d\n", count);
328 }
329}
330
331/*
332 * The PowerBook 3400/2400/3500 can have a combo ethernet/modem
333 * card which includes an ohare chip that acts as a second interrupt
334 * controller. If we find this second ohare, set it up and fix the
335 * interrupt value in the device tree for the ethernet chip.
336 */
337static void __init enable_second_ohare(struct device_node *np)
338{
339 unsigned char bus, devfn;
340 unsigned short cmd;
341 struct device_node *ether;
342
343 /* This code doesn't strictly belong here, it could be part of
344 * either the PCI initialisation or the feature code. It's kept
345 * here for historical reasons.
346 */
347 if (pci_device_from_OF_node(np, &bus, &devfn) == 0) {
348 struct pci_controller* hose =
349 pci_find_hose_for_OF_device(np);
350 if (!hose) {
351 printk(KERN_ERR "Can't find PCI hose for OHare2 !\n");
352 return;
353 }
354 early_read_config_word(hose, bus, devfn, PCI_COMMAND, &cmd);
355 cmd |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER;
356 cmd &= ~PCI_COMMAND_IO;
357 early_write_config_word(hose, bus, devfn, PCI_COMMAND, cmd);
358 }
359
360 /* Fix interrupt for the modem/ethernet combo controller. The number
361 * in the device tree (27) is bogus (correct for the ethernet-only
362 * board but not the combo ethernet/modem board).
363 * The real interrupt is 28 on the second controller -> 28+32 = 60.
364 */
365 ether = of_find_node_by_name(NULL, "pci1011,14");
366 if (ether && ether->n_intrs > 0) {
367 ether->intrs[0].line = 60;
368 printk(KERN_INFO "irq: Fixed ethernet IRQ to %d\n",
369 ether->intrs[0].line);
370 }
371 of_node_put(ether);
372} 269}
373 270
374#ifdef CONFIG_XMON 271#ifdef CONFIG_XMON
@@ -382,22 +279,65 @@ static struct irqaction xmon_action = {
382 279
383static struct irqaction gatwick_cascade_action = { 280static struct irqaction gatwick_cascade_action = {
384 .handler = gatwick_action, 281 .handler = gatwick_action,
385 .flags = SA_INTERRUPT, 282 .flags = IRQF_DISABLED,
386 .mask = CPU_MASK_NONE, 283 .mask = CPU_MASK_NONE,
387 .name = "cascade", 284 .name = "cascade",
388}; 285};
389 286
287static int pmac_pic_host_match(struct irq_host *h, struct device_node *node)
288{
289 /* We match all, we don't always have a node anyway */
290 return 1;
291}
292
293static int pmac_pic_host_map(struct irq_host *h, unsigned int virq,
294 irq_hw_number_t hw, unsigned int flags)
295{
296 struct irq_desc *desc = get_irq_desc(virq);
297 int level;
298
299 if (hw >= max_irqs)
300 return -EINVAL;
301
302 /* Mark level interrupts, set delayed disable for edge ones and set
303 * handlers
304 */
305 level = !!(level_mask[hw >> 5] & (1UL << (hw & 0x1f)));
306 if (level)
307 desc->status |= IRQ_LEVEL;
308 else
309 desc->status |= IRQ_DELAYED_DISABLE;
310 set_irq_chip_and_handler(virq, &pmac_pic, level ?
311 handle_level_irq : handle_edge_irq);
312 return 0;
313}
314
315static int pmac_pic_host_xlate(struct irq_host *h, struct device_node *ct,
316 u32 *intspec, unsigned int intsize,
317 irq_hw_number_t *out_hwirq,
318 unsigned int *out_flags)
319
320{
321 *out_hwirq = *intspec;
322 return 0;
323}
324
325static struct irq_host_ops pmac_pic_host_ops = {
326 .match = pmac_pic_host_match,
327 .map = pmac_pic_host_map,
328 .xlate = pmac_pic_host_xlate,
329};
330
390static void __init pmac_pic_probe_oldstyle(void) 331static void __init pmac_pic_probe_oldstyle(void)
391{ 332{
392 int i; 333 int i;
393 int irq_cascade = -1;
394 struct device_node *master = NULL; 334 struct device_node *master = NULL;
395 struct device_node *slave = NULL; 335 struct device_node *slave = NULL;
396 u8 __iomem *addr; 336 u8 __iomem *addr;
397 struct resource r; 337 struct resource r;
398 338
399 /* Set our get_irq function */ 339 /* Set our get_irq function */
400 ppc_md.get_irq = pmac_get_irq; 340 ppc_md.get_irq = pmac_pic_get_irq;
401 341
402 /* 342 /*
403 * Find the interrupt controller type & node 343 * Find the interrupt controller type & node
@@ -415,7 +355,6 @@ static void __init pmac_pic_probe_oldstyle(void)
415 if (slave) { 355 if (slave) {
416 max_irqs = 64; 356 max_irqs = 64;
417 level_mask[1] = OHARE_LEVEL_MASK; 357 level_mask[1] = OHARE_LEVEL_MASK;
418 enable_second_ohare(slave);
419 } 358 }
420 } else if ((master = of_find_node_by_name(NULL, "mac-io")) != NULL) { 359 } else if ((master = of_find_node_by_name(NULL, "mac-io")) != NULL) {
421 max_irqs = max_real_irqs = 64; 360 max_irqs = max_real_irqs = 64;
@@ -439,14 +378,18 @@ static void __init pmac_pic_probe_oldstyle(void)
439 max_irqs = 128; 378 max_irqs = 128;
440 level_mask[2] = HEATHROW_LEVEL_MASK; 379 level_mask[2] = HEATHROW_LEVEL_MASK;
441 level_mask[3] = 0; 380 level_mask[3] = 0;
442 pmac_fix_gatwick_interrupts(slave, max_real_irqs);
443 } 381 }
444 } 382 }
445 BUG_ON(master == NULL); 383 BUG_ON(master == NULL);
446 384
447 /* Set the handler for the main PIC */ 385 /*
448 for ( i = 0; i < max_real_irqs ; i++ ) 386 * Allocate an irq host
449 irq_desc[i].handler = &pmac_pic; 387 */
388 pmac_pic_host = irq_alloc_host(IRQ_HOST_MAP_LINEAR, max_irqs,
389 &pmac_pic_host_ops,
390 max_irqs);
391 BUG_ON(pmac_pic_host == NULL);
392 irq_set_default_host(pmac_pic_host);
450 393
451 /* Get addresses of first controller if we have a node for it */ 394 /* Get addresses of first controller if we have a node for it */
452 BUG_ON(of_address_to_resource(master, 0, &r)); 395 BUG_ON(of_address_to_resource(master, 0, &r));
@@ -473,39 +416,38 @@ static void __init pmac_pic_probe_oldstyle(void)
473 pmac_irq_hw[i++] = 416 pmac_irq_hw[i++] =
474 (volatile struct pmac_irq_hw __iomem *) 417 (volatile struct pmac_irq_hw __iomem *)
475 (addr + 0x10); 418 (addr + 0x10);
476 irq_cascade = slave->intrs[0].line; 419 pmac_irq_cascade = irq_of_parse_and_map(slave, 0);
477 420
478 printk(KERN_INFO "irq: Found slave Apple PIC %s for %d irqs" 421 printk(KERN_INFO "irq: Found slave Apple PIC %s for %d irqs"
479 " cascade: %d\n", slave->full_name, 422 " cascade: %d\n", slave->full_name,
480 max_irqs - max_real_irqs, irq_cascade); 423 max_irqs - max_real_irqs, pmac_irq_cascade);
481 } 424 }
482 of_node_put(slave); 425 of_node_put(slave);
483 426
484 /* disable all interrupts in all controllers */ 427 /* Disable all interrupts in all controllers */
485 for (i = 0; i * 32 < max_irqs; ++i) 428 for (i = 0; i * 32 < max_irqs; ++i)
486 out_le32(&pmac_irq_hw[i]->enable, 0); 429 out_le32(&pmac_irq_hw[i]->enable, 0);
487 430
488 /* mark level interrupts */ 431 /* Hookup cascade irq */
489 for (i = 0; i < max_irqs; i++) 432 if (slave && pmac_irq_cascade != NO_IRQ)
490 if (level_mask[i >> 5] & (1UL << (i & 0x1f))) 433 setup_irq(pmac_irq_cascade, &gatwick_cascade_action);
491 irq_desc[i].status = IRQ_LEVEL;
492 434
493 /* Setup handlers for secondary controller and hook cascade irq*/
494 if (slave) {
495 for ( i = max_real_irqs ; i < max_irqs ; i++ )
496 irq_desc[i].handler = &gatwick_pic;
497 setup_irq(irq_cascade, &gatwick_cascade_action);
498 }
499 printk(KERN_INFO "irq: System has %d possible interrupts\n", max_irqs); 435 printk(KERN_INFO "irq: System has %d possible interrupts\n", max_irqs);
500#ifdef CONFIG_XMON 436#ifdef CONFIG_XMON
501 setup_irq(20, &xmon_action); 437 setup_irq(irq_create_mapping(NULL, 20, 0), &xmon_action);
502#endif 438#endif
503} 439}
504#endif /* CONFIG_PPC32 */ 440#endif /* CONFIG_PPC32 */
505 441
506static int pmac_u3_cascade(struct pt_regs *regs, void *data) 442static void pmac_u3_cascade(unsigned int irq, struct irq_desc *desc,
443 struct pt_regs *regs)
507{ 444{
508 return mpic_get_one_irq((struct mpic *)data, regs); 445 struct mpic *mpic = desc->handler_data;
446
447 unsigned int cascade_irq = mpic_get_one_irq(mpic, regs);
448 if (cascade_irq != NO_IRQ)
449 generic_handle_irq(cascade_irq, regs);
450 desc->chip->eoi(irq);
509} 451}
510 452
511static void __init pmac_pic_setup_mpic_nmi(struct mpic *mpic) 453static void __init pmac_pic_setup_mpic_nmi(struct mpic *mpic)
@@ -515,21 +457,20 @@ static void __init pmac_pic_setup_mpic_nmi(struct mpic *mpic)
515 int nmi_irq; 457 int nmi_irq;
516 458
517 pswitch = of_find_node_by_name(NULL, "programmer-switch"); 459 pswitch = of_find_node_by_name(NULL, "programmer-switch");
518 if (pswitch && pswitch->n_intrs) { 460 if (pswitch) {
519 nmi_irq = pswitch->intrs[0].line; 461 nmi_irq = irq_of_parse_and_map(pswitch, 0);
520 mpic_irq_set_priority(nmi_irq, 9); 462 if (nmi_irq != NO_IRQ) {
521 setup_irq(nmi_irq, &xmon_action); 463 mpic_irq_set_priority(nmi_irq, 9);
464 setup_irq(nmi_irq, &xmon_action);
465 }
466 of_node_put(pswitch);
522 } 467 }
523 of_node_put(pswitch);
524#endif /* defined(CONFIG_XMON) && defined(CONFIG_PPC32) */ 468#endif /* defined(CONFIG_XMON) && defined(CONFIG_PPC32) */
525} 469}
526 470
527static struct mpic * __init pmac_setup_one_mpic(struct device_node *np, 471static struct mpic * __init pmac_setup_one_mpic(struct device_node *np,
528 int master) 472 int master)
529{ 473{
530 unsigned char senses[128];
531 int offset = master ? 0 : 128;
532 int count = master ? 128 : 124;
533 const char *name = master ? " MPIC 1 " : " MPIC 2 "; 474 const char *name = master ? " MPIC 1 " : " MPIC 2 ";
534 struct resource r; 475 struct resource r;
535 struct mpic *mpic; 476 struct mpic *mpic;
@@ -542,8 +483,6 @@ static struct mpic * __init pmac_setup_one_mpic(struct device_node *np,
542 483
543 pmac_call_feature(PMAC_FTR_ENABLE_MPIC, np, 0, 0); 484 pmac_call_feature(PMAC_FTR_ENABLE_MPIC, np, 0, 0);
544 485
545 prom_get_irq_senses(senses, offset, offset + count);
546
547 flags |= MPIC_WANTS_RESET; 486 flags |= MPIC_WANTS_RESET;
548 if (get_property(np, "big-endian", NULL)) 487 if (get_property(np, "big-endian", NULL))
549 flags |= MPIC_BIG_ENDIAN; 488 flags |= MPIC_BIG_ENDIAN;
@@ -554,8 +493,7 @@ static struct mpic * __init pmac_setup_one_mpic(struct device_node *np,
554 if (master && (flags & MPIC_BIG_ENDIAN)) 493 if (master && (flags & MPIC_BIG_ENDIAN))
555 flags |= MPIC_BROKEN_U3; 494 flags |= MPIC_BROKEN_U3;
556 495
557 mpic = mpic_alloc(r.start, flags, 0, offset, count, master ? 252 : 0, 496 mpic = mpic_alloc(np, r.start, flags, 0, 0, name);
558 senses, count, name);
559 if (mpic == NULL) 497 if (mpic == NULL)
560 return NULL; 498 return NULL;
561 499
@@ -568,6 +506,7 @@ static int __init pmac_pic_probe_mpic(void)
568{ 506{
569 struct mpic *mpic1, *mpic2; 507 struct mpic *mpic1, *mpic2;
570 struct device_node *np, *master = NULL, *slave = NULL; 508 struct device_node *np, *master = NULL, *slave = NULL;
509 unsigned int cascade;
571 510
572 /* We can have up to 2 MPICs cascaded */ 511 /* We can have up to 2 MPICs cascaded */
573 for (np = NULL; (np = of_find_node_by_type(np, "open-pic")) 512 for (np = NULL; (np = of_find_node_by_type(np, "open-pic"))
@@ -604,8 +543,15 @@ static int __init pmac_pic_probe_mpic(void)
604 of_node_put(master); 543 of_node_put(master);
605 544
606 /* No slave, let's go out */ 545 /* No slave, let's go out */
607 if (slave == NULL || slave->n_intrs < 1) 546 if (slave == NULL)
547 return 0;
548
549 /* Get/Map slave interrupt */
550 cascade = irq_of_parse_and_map(slave, 0);
551 if (cascade == NO_IRQ) {
552 printk(KERN_ERR "Failed to map cascade IRQ\n");
608 return 0; 553 return 0;
554 }
609 555
610 mpic2 = pmac_setup_one_mpic(slave, 0); 556 mpic2 = pmac_setup_one_mpic(slave, 0);
611 if (mpic2 == NULL) { 557 if (mpic2 == NULL) {
@@ -613,7 +559,8 @@ static int __init pmac_pic_probe_mpic(void)
613 of_node_put(slave); 559 of_node_put(slave);
614 return 0; 560 return 0;
615 } 561 }
616 mpic_setup_cascade(slave->intrs[0].line, pmac_u3_cascade, mpic2); 562 set_irq_data(cascade, mpic2);
563 set_irq_chained_handler(cascade, pmac_u3_cascade);
617 564
618 of_node_put(slave); 565 of_node_put(slave);
619 return 0; 566 return 0;
@@ -622,6 +569,19 @@ static int __init pmac_pic_probe_mpic(void)
622 569
623void __init pmac_pic_init(void) 570void __init pmac_pic_init(void)
624{ 571{
572 unsigned int flags = 0;
573
574 /* We configure the OF parsing based on our oldworld vs. newworld
575 * platform type and wether we were booted by BootX.
576 */
577#ifdef CONFIG_PPC32
578 if (!pmac_newworld)
579 flags |= OF_IMAP_OLDWORLD_MAC;
580 if (get_property(of_chosen, "linux,bootx", NULL) != NULL)
581 flags |= OF_IMAP_NO_PHANDLE;
582 of_irq_map_init(flags);
583#endif /* CONFIG_PPC_32 */
584
625 /* We first try to detect Apple's new Core99 chipset, since mac-io 585 /* We first try to detect Apple's new Core99 chipset, since mac-io
626 * is quite different on those machines and contains an IBM MPIC2. 586 * is quite different on those machines and contains an IBM MPIC2.
627 */ 587 */
@@ -644,6 +604,7 @@ unsigned long sleep_save_mask[2];
644 604
645/* This used to be passed by the PMU driver but that link got 605/* This used to be passed by the PMU driver but that link got
646 * broken with the new driver model. We use this tweak for now... 606 * broken with the new driver model. We use this tweak for now...
607 * We really want to do things differently though...
647 */ 608 */
648static int pmacpic_find_viaint(void) 609static int pmacpic_find_viaint(void)
649{ 610{
@@ -657,7 +618,7 @@ static int pmacpic_find_viaint(void)
657 np = of_find_node_by_name(NULL, "via-pmu"); 618 np = of_find_node_by_name(NULL, "via-pmu");
658 if (np == NULL) 619 if (np == NULL)
659 goto not_found; 620 goto not_found;
660 viaint = np->intrs[0].line; 621 viaint = irq_of_parse_and_map(np, 0);;
661#endif /* CONFIG_ADB_PMU */ 622#endif /* CONFIG_ADB_PMU */
662 623
663not_found: 624not_found:
diff --git a/arch/powerpc/platforms/powermac/pmac.h b/arch/powerpc/platforms/powermac/pmac.h
index 21c7b0f8f329..94e7b24b840b 100644
--- a/arch/powerpc/platforms/powermac/pmac.h
+++ b/arch/powerpc/platforms/powermac/pmac.h
@@ -12,6 +12,8 @@
12 12
13struct rtc_time; 13struct rtc_time;
14 14
15extern int pmac_newworld;
16
15extern long pmac_time_init(void); 17extern long pmac_time_init(void);
16extern unsigned long pmac_get_boot_time(void); 18extern unsigned long pmac_get_boot_time(void);
17extern void pmac_get_rtc_time(struct rtc_time *); 19extern void pmac_get_rtc_time(struct rtc_time *);
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index 9cc7db7a8bdc..31a9da769fa2 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -23,7 +23,6 @@
23 * bootup setup stuff.. 23 * bootup setup stuff..
24 */ 24 */
25 25
26#include <linux/config.h>
27#include <linux/init.h> 26#include <linux/init.h>
28#include <linux/errno.h> 27#include <linux/errno.h>
29#include <linux/sched.h> 28#include <linux/sched.h>
@@ -600,13 +599,6 @@ pmac_halt(void)
600 */ 599 */
601static void __init pmac_init_early(void) 600static void __init pmac_init_early(void)
602{ 601{
603#ifdef CONFIG_PPC64
604 /* Initialize hash table, from now on, we can take hash faults
605 * and call ioremap
606 */
607 hpte_init_native();
608#endif
609
610 /* Enable early btext debug if requested */ 602 /* Enable early btext debug if requested */
611 if (strstr(cmd_line, "btextdbg")) { 603 if (strstr(cmd_line, "btextdbg")) {
612 udbg_adb_init_early(); 604 udbg_adb_init_early();
@@ -621,9 +613,6 @@ static void __init pmac_init_early(void)
621 udbg_adb_init(!!strstr(cmd_line, "btextdbg")); 613 udbg_adb_init(!!strstr(cmd_line, "btextdbg"));
622 614
623#ifdef CONFIG_PPC64 615#ifdef CONFIG_PPC64
624 /* Setup interrupt mapping options */
625 ppc64_interrupt_controller = IC_OPEN_PIC;
626
627 iommu_init_early_dart(); 616 iommu_init_early_dart();
628#endif 617#endif
629} 618}
@@ -683,6 +672,8 @@ static int __init pmac_probe(void)
683 * part of the cacheable linar mapping 672 * part of the cacheable linar mapping
684 */ 673 */
685 alloc_dart_table(); 674 alloc_dart_table();
675
676 hpte_init_native();
686#endif 677#endif
687 678
688#ifdef CONFIG_PPC32 679#ifdef CONFIG_PPC32
diff --git a/arch/powerpc/platforms/powermac/sleep.S b/arch/powerpc/platforms/powermac/sleep.S
index 22b113d19b24..1174ca128efa 100644
--- a/arch/powerpc/platforms/powermac/sleep.S
+++ b/arch/powerpc/platforms/powermac/sleep.S
@@ -10,7 +10,6 @@
10 * 10 *
11 */ 11 */
12 12
13#include <linux/config.h>
14#include <asm/processor.h> 13#include <asm/processor.h>
15#include <asm/page.h> 14#include <asm/page.h>
16#include <asm/ppc_asm.h> 15#include <asm/ppc_asm.h>
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c
index 1065d87fc279..827b7121ffb8 100644
--- a/arch/powerpc/platforms/powermac/smp.c
+++ b/arch/powerpc/platforms/powermac/smp.c
@@ -21,7 +21,6 @@
21 * as published by the Free Software Foundation; either version 21 * as published by the Free Software Foundation; either version
22 * 2 of the License, or (at your option) any later version. 22 * 2 of the License, or (at your option) any later version.
23 */ 23 */
24#include <linux/config.h>
25#include <linux/kernel.h> 24#include <linux/kernel.h>
26#include <linux/sched.h> 25#include <linux/sched.h>
27#include <linux/smp.h> 26#include <linux/smp.h>
@@ -378,7 +377,7 @@ static void __init psurge_dual_sync_tb(int cpu_nr)
378 377
379static struct irqaction psurge_irqaction = { 378static struct irqaction psurge_irqaction = {
380 .handler = psurge_primary_intr, 379 .handler = psurge_primary_intr,
381 .flags = SA_INTERRUPT, 380 .flags = IRQF_DISABLED,
382 .mask = CPU_MASK_NONE, 381 .mask = CPU_MASK_NONE,
383 .name = "primary IPI", 382 .name = "primary IPI",
384}; 383};
diff --git a/arch/powerpc/platforms/powermac/time.c b/arch/powerpc/platforms/powermac/time.c
index 890758aa9667..a4173906e945 100644
--- a/arch/powerpc/platforms/powermac/time.c
+++ b/arch/powerpc/platforms/powermac/time.c
@@ -9,7 +9,6 @@
9 * Copyright (C) 2003-2005 Benjamin Herrenschmidt. 9 * Copyright (C) 2003-2005 Benjamin Herrenschmidt.
10 * 10 *
11 */ 11 */
12#include <linux/config.h>
13#include <linux/errno.h> 12#include <linux/errno.h>
14#include <linux/sched.h> 13#include <linux/sched.h>
15#include <linux/kernel.h> 14#include <linux/kernel.h>
diff --git a/arch/powerpc/platforms/powermac/udbg_adb.c b/arch/powerpc/platforms/powermac/udbg_adb.c
index 06c8265c2baf..6124e59e1038 100644
--- a/arch/powerpc/platforms/powermac/udbg_adb.c
+++ b/arch/powerpc/platforms/powermac/udbg_adb.c
@@ -1,4 +1,3 @@
1#include <linux/config.h>
2#include <linux/string.h> 1#include <linux/string.h>
3#include <linux/kernel.h> 2#include <linux/kernel.h>
4#include <linux/errno.h> 3#include <linux/errno.h>
diff --git a/arch/powerpc/platforms/powermac/udbg_scc.c b/arch/powerpc/platforms/powermac/udbg_scc.c
index b4fa9f03b461..37e5b1eff911 100644
--- a/arch/powerpc/platforms/powermac/udbg_scc.c
+++ b/arch/powerpc/platforms/powermac/udbg_scc.c
@@ -8,7 +8,6 @@
8 * as published by the Free Software Foundation; either version 8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11#include <linux/config.h>
12#include <linux/types.h> 11#include <linux/types.h>
13#include <asm/udbg.h> 12#include <asm/udbg.h>
14#include <asm/processor.h> 13#include <asm/processor.h>
diff --git a/arch/powerpc/platforms/pseries/eeh_cache.c b/arch/powerpc/platforms/pseries/eeh_cache.c
index 98c23aec85be..c37a8497c60f 100644
--- a/arch/powerpc/platforms/pseries/eeh_cache.c
+++ b/arch/powerpc/platforms/pseries/eeh_cache.c
@@ -287,7 +287,7 @@ void pci_addr_cache_remove_device(struct pci_dev *dev)
287 * find the pci device that corresponds to a given address. 287 * find the pci device that corresponds to a given address.
288 * This routine scans all pci busses to build the cache. 288 * This routine scans all pci busses to build the cache.
289 * Must be run late in boot process, after the pci controllers 289 * Must be run late in boot process, after the pci controllers
290 * have been scaned for devices (after all device resources are known). 290 * have been scanned for devices (after all device resources are known).
291 */ 291 */
292void __init pci_addr_cache_build(void) 292void __init pci_addr_cache_build(void)
293{ 293{
diff --git a/arch/powerpc/platforms/pseries/eeh_driver.c b/arch/powerpc/platforms/pseries/eeh_driver.c
index 0ec9a5445b95..aaad2c0afcbf 100644
--- a/arch/powerpc/platforms/pseries/eeh_driver.c
+++ b/arch/powerpc/platforms/pseries/eeh_driver.c
@@ -175,7 +175,7 @@ static void eeh_report_failure(struct pci_dev *dev, void *userdata)
175 * 175 *
176 * pSeries systems will isolate a PCI slot if the PCI-Host 176 * pSeries systems will isolate a PCI slot if the PCI-Host
177 * bridge detects address or data parity errors, DMA's 177 * bridge detects address or data parity errors, DMA's
178 * occuring to wild addresses (which usually happen due to 178 * occurring to wild addresses (which usually happen due to
179 * bugs in device drivers or in PCI adapter firmware). 179 * bugs in device drivers or in PCI adapter firmware).
180 * Slot isolations also occur if #SERR, #PERR or other misc 180 * Slot isolations also occur if #SERR, #PERR or other misc
181 * PCI-related errors are detected. 181 * PCI-related errors are detected.
diff --git a/arch/powerpc/platforms/pseries/eeh_event.c b/arch/powerpc/platforms/pseries/eeh_event.c
index 8f2d12935b99..45ccc687e57c 100644
--- a/arch/powerpc/platforms/pseries/eeh_event.c
+++ b/arch/powerpc/platforms/pseries/eeh_event.c
@@ -35,7 +35,7 @@
35 */ 35 */
36 36
37/* EEH event workqueue setup. */ 37/* EEH event workqueue setup. */
38static spinlock_t eeh_eventlist_lock = SPIN_LOCK_UNLOCKED; 38static DEFINE_SPINLOCK(eeh_eventlist_lock);
39LIST_HEAD(eeh_eventlist); 39LIST_HEAD(eeh_eventlist);
40static void eeh_thread_launcher(void *); 40static void eeh_thread_launcher(void *);
41DECLARE_WORK(eeh_event_wq, eeh_thread_launcher, NULL); 41DECLARE_WORK(eeh_event_wq, eeh_thread_launcher, NULL);
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index d03a8b078f9d..d67af2c65754 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -24,7 +24,6 @@
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 */ 25 */
26 26
27#include <linux/config.h>
28#include <linux/init.h> 27#include <linux/init.h>
29#include <linux/types.h> 28#include <linux/types.h>
30#include <linux/slab.h> 29#include <linux/slab.h>
@@ -92,6 +91,15 @@ static void tce_free_pSeries(struct iommu_table *tbl, long index, long npages)
92 *(tcep++) = 0; 91 *(tcep++) = 0;
93} 92}
94 93
94static unsigned long tce_get_pseries(struct iommu_table *tbl, long index)
95{
96 u64 *tcep;
97
98 index <<= TCE_PAGE_FACTOR;
99 tcep = ((u64 *)tbl->it_base) + index;
100
101 return *tcep;
102}
95 103
96static void tce_build_pSeriesLP(struct iommu_table *tbl, long tcenum, 104static void tce_build_pSeriesLP(struct iommu_table *tbl, long tcenum,
97 long npages, unsigned long uaddr, 105 long npages, unsigned long uaddr,
@@ -235,6 +243,25 @@ static void tce_freemulti_pSeriesLP(struct iommu_table *tbl, long tcenum, long n
235 } 243 }
236} 244}
237 245
246static unsigned long tce_get_pSeriesLP(struct iommu_table *tbl, long tcenum)
247{
248 u64 rc;
249 unsigned long tce_ret;
250
251 tcenum <<= TCE_PAGE_FACTOR;
252 rc = plpar_tce_get((u64)tbl->it_index, (u64)tcenum << 12, &tce_ret);
253
254 if (rc && printk_ratelimit()) {
255 printk("tce_get_pSeriesLP: plpar_tce_get failed. rc=%ld\n",
256 rc);
257 printk("\tindex = 0x%lx\n", (u64)tbl->it_index);
258 printk("\ttcenum = 0x%lx\n", (u64)tcenum);
259 show_stack(current, (unsigned long *)__get_SP());
260 }
261
262 return tce_ret;
263}
264
238static void iommu_table_setparms(struct pci_controller *phb, 265static void iommu_table_setparms(struct pci_controller *phb,
239 struct device_node *dn, 266 struct device_node *dn,
240 struct iommu_table *tbl) 267 struct iommu_table *tbl)
@@ -254,7 +281,10 @@ static void iommu_table_setparms(struct pci_controller *phb,
254 } 281 }
255 282
256 tbl->it_base = (unsigned long)__va(*basep); 283 tbl->it_base = (unsigned long)__va(*basep);
284
285#ifndef CONFIG_CRASH_DUMP
257 memset((void *)tbl->it_base, 0, *sizep); 286 memset((void *)tbl->it_base, 0, *sizep);
287#endif
258 288
259 tbl->it_busno = phb->bus->number; 289 tbl->it_busno = phb->bus->number;
260 290
@@ -560,11 +590,13 @@ void iommu_init_early_pSeries(void)
560 ppc_md.tce_build = tce_build_pSeriesLP; 590 ppc_md.tce_build = tce_build_pSeriesLP;
561 ppc_md.tce_free = tce_free_pSeriesLP; 591 ppc_md.tce_free = tce_free_pSeriesLP;
562 } 592 }
593 ppc_md.tce_get = tce_get_pSeriesLP;
563 ppc_md.iommu_bus_setup = iommu_bus_setup_pSeriesLP; 594 ppc_md.iommu_bus_setup = iommu_bus_setup_pSeriesLP;
564 ppc_md.iommu_dev_setup = iommu_dev_setup_pSeriesLP; 595 ppc_md.iommu_dev_setup = iommu_dev_setup_pSeriesLP;
565 } else { 596 } else {
566 ppc_md.tce_build = tce_build_pSeries; 597 ppc_md.tce_build = tce_build_pSeries;
567 ppc_md.tce_free = tce_free_pSeries; 598 ppc_md.tce_free = tce_free_pSeries;
599 ppc_md.tce_get = tce_get_pseries;
568 ppc_md.iommu_bus_setup = iommu_bus_setup_pSeries; 600 ppc_md.iommu_bus_setup = iommu_bus_setup_pSeries;
569 ppc_md.iommu_dev_setup = iommu_dev_setup_pSeries; 601 ppc_md.iommu_dev_setup = iommu_dev_setup_pSeries;
570 } 602 }
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 634b7d06d3cc..3aeb40699042 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -21,7 +21,6 @@
21 21
22#undef DEBUG_LOW 22#undef DEBUG_LOW
23 23
24#include <linux/config.h>
25#include <linux/kernel.h> 24#include <linux/kernel.h>
26#include <linux/dma-mapping.h> 25#include <linux/dma-mapping.h>
27#include <linux/console.h> 26#include <linux/console.h>
@@ -513,7 +512,7 @@ void pSeries_lpar_flush_hash_range(unsigned long number, int local)
513 spin_unlock_irqrestore(&pSeries_lpar_tlbie_lock, flags); 512 spin_unlock_irqrestore(&pSeries_lpar_tlbie_lock, flags);
514} 513}
515 514
516void hpte_init_lpar(void) 515void __init hpte_init_lpar(void)
517{ 516{
518 ppc_md.hpte_invalidate = pSeries_lpar_hpte_invalidate; 517 ppc_md.hpte_invalidate = pSeries_lpar_hpte_invalidate;
519 ppc_md.hpte_updatepp = pSeries_lpar_hpte_updatepp; 518 ppc_md.hpte_updatepp = pSeries_lpar_hpte_updatepp;
@@ -522,6 +521,4 @@ void hpte_init_lpar(void)
522 ppc_md.hpte_remove = pSeries_lpar_hpte_remove; 521 ppc_md.hpte_remove = pSeries_lpar_hpte_remove;
523 ppc_md.flush_hash_range = pSeries_lpar_flush_hash_range; 522 ppc_md.flush_hash_range = pSeries_lpar_flush_hash_range;
524 ppc_md.hpte_clear_all = pSeries_lpar_hptab_clear; 523 ppc_md.hpte_clear_all = pSeries_lpar_hptab_clear;
525
526 htab_finish_init();
527} 524}
diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c
index 9639c66b453d..9df783088b61 100644
--- a/arch/powerpc/platforms/pseries/ras.c
+++ b/arch/powerpc/platforms/pseries/ras.c
@@ -72,32 +72,62 @@ static irqreturn_t ras_error_interrupt(int irq, void *dev_id,
72 72
73/* #define DEBUG */ 73/* #define DEBUG */
74 74
75static void request_ras_irqs(struct device_node *np, char *propname, 75
76static void request_ras_irqs(struct device_node *np,
76 irqreturn_t (*handler)(int, void *, struct pt_regs *), 77 irqreturn_t (*handler)(int, void *, struct pt_regs *),
77 const char *name) 78 const char *name)
78{ 79{
79 unsigned int *ireg, len, i; 80 int i, index, count = 0;
80 int virq, n_intr; 81 struct of_irq oirq;
81 82 u32 *opicprop;
82 ireg = (unsigned int *)get_property(np, propname, &len); 83 unsigned int opicplen;
83 if (ireg == NULL) 84 unsigned int virqs[16];
84 return; 85
85 n_intr = prom_n_intr_cells(np); 86 /* Check for obsolete "open-pic-interrupt" property. If present, then
86 len /= n_intr * sizeof(*ireg); 87 * map those interrupts using the default interrupt host and default
87 88 * trigger
88 for (i = 0; i < len; i++) { 89 */
89 virq = virt_irq_create_mapping(*ireg); 90 opicprop = (u32 *)get_property(np, "open-pic-interrupt", &opicplen);
90 if (virq == NO_IRQ) { 91 if (opicprop) {
91 printk(KERN_ERR "Unable to allocate interrupt " 92 opicplen /= sizeof(u32);
92 "number for %s\n", np->full_name); 93 for (i = 0; i < opicplen; i++) {
93 return; 94 if (count > 15)
95 break;
96 virqs[count] = irq_create_mapping(NULL, *(opicprop++),
97 IRQ_TYPE_NONE);
98 if (virqs[count] == NO_IRQ)
99 printk(KERN_ERR "Unable to allocate interrupt "
100 "number for %s\n", np->full_name);
101 else
102 count++;
103
94 } 104 }
95 if (request_irq(irq_offset_up(virq), handler, 0, name, NULL)) { 105 }
106 /* Else use normal interrupt tree parsing */
107 else {
108 /* First try to do a proper OF tree parsing */
109 for (index = 0; of_irq_map_one(np, index, &oirq) == 0;
110 index++) {
111 if (count > 15)
112 break;
113 virqs[count] = irq_create_of_mapping(oirq.controller,
114 oirq.specifier,
115 oirq.size);
116 if (virqs[count] == NO_IRQ)
117 printk(KERN_ERR "Unable to allocate interrupt "
118 "number for %s\n", np->full_name);
119 else
120 count++;
121 }
122 }
123
124 /* Now request them */
125 for (i = 0; i < count; i++) {
126 if (request_irq(virqs[i], handler, 0, name, NULL)) {
96 printk(KERN_ERR "Unable to request interrupt %d for " 127 printk(KERN_ERR "Unable to request interrupt %d for "
97 "%s\n", irq_offset_up(virq), np->full_name); 128 "%s\n", virqs[i], np->full_name);
98 return; 129 return;
99 } 130 }
100 ireg += n_intr;
101 } 131 }
102} 132}
103 133
@@ -115,20 +145,14 @@ static int __init init_ras_IRQ(void)
115 /* Internal Errors */ 145 /* Internal Errors */
116 np = of_find_node_by_path("/event-sources/internal-errors"); 146 np = of_find_node_by_path("/event-sources/internal-errors");
117 if (np != NULL) { 147 if (np != NULL) {
118 request_ras_irqs(np, "open-pic-interrupt", ras_error_interrupt, 148 request_ras_irqs(np, ras_error_interrupt, "RAS_ERROR");
119 "RAS_ERROR");
120 request_ras_irqs(np, "interrupts", ras_error_interrupt,
121 "RAS_ERROR");
122 of_node_put(np); 149 of_node_put(np);
123 } 150 }
124 151
125 /* EPOW Events */ 152 /* EPOW Events */
126 np = of_find_node_by_path("/event-sources/epow-events"); 153 np = of_find_node_by_path("/event-sources/epow-events");
127 if (np != NULL) { 154 if (np != NULL) {
128 request_ras_irqs(np, "open-pic-interrupt", ras_epow_interrupt, 155 request_ras_irqs(np, ras_epow_interrupt, "RAS_EPOW");
129 "RAS_EPOW");
130 request_ras_irqs(np, "interrupts", ras_epow_interrupt,
131 "RAS_EPOW");
132 of_node_put(np); 156 of_node_put(np);
133 } 157 }
134 158
@@ -162,7 +186,7 @@ ras_epow_interrupt(int irq, void *dev_id, struct pt_regs * regs)
162 186
163 status = rtas_call(ras_check_exception_token, 6, 1, NULL, 187 status = rtas_call(ras_check_exception_token, 6, 1, NULL,
164 RAS_VECTOR_OFFSET, 188 RAS_VECTOR_OFFSET,
165 virt_irq_to_real(irq_offset_down(irq)), 189 irq_map[irq].hwirq,
166 RTAS_EPOW_WARNING | RTAS_POWERMGM_EVENTS, 190 RTAS_EPOW_WARNING | RTAS_POWERMGM_EVENTS,
167 critical, __pa(&ras_log_buf), 191 critical, __pa(&ras_log_buf),
168 rtas_get_error_log_max()); 192 rtas_get_error_log_max());
@@ -198,7 +222,7 @@ ras_error_interrupt(int irq, void *dev_id, struct pt_regs * regs)
198 222
199 status = rtas_call(ras_check_exception_token, 6, 1, NULL, 223 status = rtas_call(ras_check_exception_token, 6, 1, NULL,
200 RAS_VECTOR_OFFSET, 224 RAS_VECTOR_OFFSET,
201 virt_irq_to_real(irq_offset_down(irq)), 225 irq_map[irq].hwirq,
202 RTAS_INTERNAL_ERROR, 1 /*Time Critical */, 226 RTAS_INTERNAL_ERROR, 1 /*Time Critical */,
203 __pa(&ras_log_buf), 227 __pa(&ras_log_buf),
204 rtas_get_error_log_max()); 228 rtas_get_error_log_max());
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 1e28518c6121..54a52437265c 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -18,7 +18,6 @@
18 18
19#undef DEBUG 19#undef DEBUG
20 20
21#include <linux/config.h>
22#include <linux/cpu.h> 21#include <linux/cpu.h>
23#include <linux/errno.h> 22#include <linux/errno.h>
24#include <linux/sched.h> 23#include <linux/sched.h>
@@ -77,6 +76,9 @@
77#define DBG(fmt...) 76#define DBG(fmt...)
78#endif 77#endif
79 78
79/* move those away to a .h */
80extern void smp_init_pseries_mpic(void);
81extern void smp_init_pseries_xics(void);
80extern void find_udbg_vterm(void); 82extern void find_udbg_vterm(void);
81 83
82int fwnmi_active; /* TRUE if an FWNMI handler is present */ 84int fwnmi_active; /* TRUE if an FWNMI handler is present */
@@ -84,7 +86,7 @@ int fwnmi_active; /* TRUE if an FWNMI handler is present */
84static void pseries_shared_idle_sleep(void); 86static void pseries_shared_idle_sleep(void);
85static void pseries_dedicated_idle_sleep(void); 87static void pseries_dedicated_idle_sleep(void);
86 88
87struct mpic *pSeries_mpic; 89static struct device_node *pSeries_mpic_node;
88 90
89static void pSeries_show_cpuinfo(struct seq_file *m) 91static void pSeries_show_cpuinfo(struct seq_file *m)
90{ 92{
@@ -119,63 +121,92 @@ static void __init fwnmi_init(void)
119 fwnmi_active = 1; 121 fwnmi_active = 1;
120} 122}
121 123
122static void __init pSeries_init_mpic(void) 124void pseries_8259_cascade(unsigned int irq, struct irq_desc *desc,
125 struct pt_regs *regs)
123{ 126{
124 unsigned int *addrp; 127 unsigned int cascade_irq = i8259_irq(regs);
125 struct device_node *np; 128 if (cascade_irq != NO_IRQ)
126 unsigned long intack = 0; 129 generic_handle_irq(cascade_irq, regs);
127 130 desc->chip->eoi(irq);
128 /* All ISUs are setup, complete initialization */
129 mpic_init(pSeries_mpic);
130
131 /* Check what kind of cascade ACK we have */
132 if (!(np = of_find_node_by_name(NULL, "pci"))
133 || !(addrp = (unsigned int *)
134 get_property(np, "8259-interrupt-acknowledge", NULL)))
135 printk(KERN_ERR "Cannot find pci to get ack address\n");
136 else
137 intack = addrp[prom_n_addr_cells(np)-1];
138 of_node_put(np);
139
140 /* Setup the legacy interrupts & controller */
141 i8259_init(intack, 0);
142
143 /* Hook cascade to mpic */
144 mpic_setup_cascade(NUM_ISA_INTERRUPTS, i8259_irq_cascade, NULL);
145} 131}
146 132
147static void __init pSeries_setup_mpic(void) 133static void __init pseries_mpic_init_IRQ(void)
148{ 134{
135 struct device_node *np, *old, *cascade = NULL;
136 unsigned int *addrp;
137 unsigned long intack = 0;
149 unsigned int *opprop; 138 unsigned int *opprop;
150 unsigned long openpic_addr = 0; 139 unsigned long openpic_addr = 0;
151 unsigned char senses[NR_IRQS - NUM_ISA_INTERRUPTS]; 140 unsigned int cascade_irq;
152 struct device_node *root; 141 int naddr, n, i, opplen;
153 int irq_count; 142 struct mpic *mpic;
154 143
155 /* Find the Open PIC if present */ 144 np = of_find_node_by_path("/");
156 root = of_find_node_by_path("/"); 145 naddr = prom_n_addr_cells(np);
157 opprop = (unsigned int *) get_property(root, "platform-open-pic", NULL); 146 opprop = (unsigned int *) get_property(np, "platform-open-pic", &opplen);
158 if (opprop != 0) { 147 if (opprop != 0) {
159 int n = prom_n_addr_cells(root); 148 openpic_addr = of_read_number(opprop, naddr);
160
161 for (openpic_addr = 0; n > 0; --n)
162 openpic_addr = (openpic_addr << 32) + *opprop++;
163 printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr); 149 printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr);
164 } 150 }
165 of_node_put(root); 151 of_node_put(np);
166 152
167 BUG_ON(openpic_addr == 0); 153 BUG_ON(openpic_addr == 0);
168 154
169 /* Get the sense values from OF */
170 prom_get_irq_senses(senses, NUM_ISA_INTERRUPTS, NR_IRQS);
171
172 /* Setup the openpic driver */ 155 /* Setup the openpic driver */
173 irq_count = NR_IRQS - NUM_ISA_INTERRUPTS - 4; /* leave room for IPIs */ 156 mpic = mpic_alloc(pSeries_mpic_node, openpic_addr,
174 pSeries_mpic = mpic_alloc(openpic_addr, MPIC_PRIMARY, 157 MPIC_PRIMARY,
175 16, 16, irq_count, /* isu size, irq offset, irq count */ 158 16, 250, /* isu size, irq count */
176 NR_IRQS - 4, /* ipi offset */ 159 " MPIC ");
177 senses, irq_count, /* sense & sense size */ 160 BUG_ON(mpic == NULL);
178 " MPIC "); 161
162 /* Add ISUs */
163 opplen /= sizeof(u32);
164 for (n = 0, i = naddr; i < opplen; i += naddr, n++) {
165 unsigned long isuaddr = of_read_number(opprop + i, naddr);
166 mpic_assign_isu(mpic, n, isuaddr);
167 }
168
169 /* All ISUs are setup, complete initialization */
170 mpic_init(mpic);
171
172 /* Look for cascade */
173 for_each_node_by_type(np, "interrupt-controller")
174 if (device_is_compatible(np, "chrp,iic")) {
175 cascade = np;
176 break;
177 }
178 if (cascade == NULL)
179 return;
180
181 cascade_irq = irq_of_parse_and_map(cascade, 0);
182 if (cascade == NO_IRQ) {
183 printk(KERN_ERR "xics: failed to map cascade interrupt");
184 return;
185 }
186
187 /* Check ACK type */
188 for (old = of_node_get(cascade); old != NULL ; old = np) {
189 np = of_get_parent(old);
190 of_node_put(old);
191 if (np == NULL)
192 break;
193 if (strcmp(np->name, "pci") != 0)
194 continue;
195 addrp = (u32 *)get_property(np, "8259-interrupt-acknowledge",
196 NULL);
197 if (addrp == NULL)
198 continue;
199 naddr = prom_n_addr_cells(np);
200 intack = addrp[naddr-1];
201 if (naddr > 1)
202 intack |= ((unsigned long)addrp[naddr-2]) << 32;
203 }
204 if (intack)
205 printk(KERN_DEBUG "mpic: PCI 8259 intack at 0x%016lx\n",
206 intack);
207 i8259_init(cascade, intack);
208 of_node_put(cascade);
209 set_irq_chained_handler(cascade_irq, pseries_8259_cascade);
179} 210}
180 211
181static void pseries_lpar_enable_pmcs(void) 212static void pseries_lpar_enable_pmcs(void)
@@ -193,23 +224,67 @@ static void pseries_lpar_enable_pmcs(void)
193 get_lppaca()->pmcregs_in_use = 1; 224 get_lppaca()->pmcregs_in_use = 1;
194} 225}
195 226
196static void __init pSeries_setup_arch(void) 227#ifdef CONFIG_KEXEC
228static void pseries_kexec_cpu_down_mpic(int crash_shutdown, int secondary)
197{ 229{
198 /* Fixup ppc_md depending on the type of interrupt controller */ 230 mpic_teardown_this_cpu(secondary);
199 if (ppc64_interrupt_controller == IC_OPEN_PIC) { 231}
200 ppc_md.init_IRQ = pSeries_init_mpic; 232
201 ppc_md.get_irq = mpic_get_irq; 233static void pseries_kexec_cpu_down_xics(int crash_shutdown, int secondary)
202 /* Allocate the mpic now, so that find_and_init_phbs() can 234{
203 * fill the ISUs */ 235 /* Don't risk a hypervisor call if we're crashing */
204 pSeries_setup_mpic(); 236 if (firmware_has_feature(FW_FEATURE_SPLPAR) && !crash_shutdown) {
205 } else { 237 unsigned long vpa = __pa(get_lppaca());
206 ppc_md.init_IRQ = xics_init_IRQ; 238
207 ppc_md.get_irq = xics_get_irq; 239 if (unregister_vpa(hard_smp_processor_id(), vpa)) {
240 printk("VPA deregistration of cpu %u (hw_cpu_id %d) "
241 "failed\n", smp_processor_id(),
242 hard_smp_processor_id());
243 }
208 } 244 }
245 xics_teardown_cpu(secondary);
246}
247#endif /* CONFIG_KEXEC */
248
249static void __init pseries_discover_pic(void)
250{
251 struct device_node *np;
252 char *typep;
209 253
254 for (np = NULL; (np = of_find_node_by_name(np,
255 "interrupt-controller"));) {
256 typep = (char *)get_property(np, "compatible", NULL);
257 if (strstr(typep, "open-pic")) {
258 pSeries_mpic_node = of_node_get(np);
259 ppc_md.init_IRQ = pseries_mpic_init_IRQ;
260 ppc_md.get_irq = mpic_get_irq;
261#ifdef CONFIG_KEXEC
262 ppc_md.kexec_cpu_down = pseries_kexec_cpu_down_mpic;
263#endif
264#ifdef CONFIG_SMP
265 smp_init_pseries_mpic();
266#endif
267 return;
268 } else if (strstr(typep, "ppc-xicp")) {
269 ppc_md.init_IRQ = xics_init_IRQ;
270#ifdef CONFIG_KEXEC
271 ppc_md.kexec_cpu_down = pseries_kexec_cpu_down_xics;
272#endif
210#ifdef CONFIG_SMP 273#ifdef CONFIG_SMP
211 smp_init_pSeries(); 274 smp_init_pseries_xics();
212#endif 275#endif
276 return;
277 }
278 }
279 printk(KERN_ERR "pSeries_discover_pic: failed to recognize"
280 " interrupt-controller\n");
281}
282
283static void __init pSeries_setup_arch(void)
284{
285 /* Discover PIC type and setup ppc_md accordingly */
286 pseries_discover_pic();
287
213 /* openpic global configuration register (64-bit format). */ 288 /* openpic global configuration register (64-bit format). */
214 /* openpic Interrupt Source Unit pointer (64-bit format). */ 289 /* openpic Interrupt Source Unit pointer (64-bit format). */
215 /* python0 facility area (mmio) (64-bit format) REAL address. */ 290 /* python0 facility area (mmio) (64-bit format) REAL address. */
@@ -261,41 +336,11 @@ static int __init pSeries_init_panel(void)
261} 336}
262arch_initcall(pSeries_init_panel); 337arch_initcall(pSeries_init_panel);
263 338
264static void __init pSeries_discover_pic(void)
265{
266 struct device_node *np;
267 char *typep;
268
269 /*
270 * Setup interrupt mapping options that are needed for finish_device_tree
271 * to properly parse the OF interrupt tree & do the virtual irq mapping
272 */
273 __irq_offset_value = NUM_ISA_INTERRUPTS;
274 ppc64_interrupt_controller = IC_INVALID;
275 for (np = NULL; (np = of_find_node_by_name(np, "interrupt-controller"));) {
276 typep = (char *)get_property(np, "compatible", NULL);
277 if (strstr(typep, "open-pic")) {
278 ppc64_interrupt_controller = IC_OPEN_PIC;
279 break;
280 } else if (strstr(typep, "ppc-xicp")) {
281 ppc64_interrupt_controller = IC_PPC_XIC;
282 break;
283 }
284 }
285 if (ppc64_interrupt_controller == IC_INVALID)
286 printk("pSeries_discover_pic: failed to recognize"
287 " interrupt-controller\n");
288
289}
290
291static void pSeries_mach_cpu_die(void) 339static void pSeries_mach_cpu_die(void)
292{ 340{
293 local_irq_disable(); 341 local_irq_disable();
294 idle_task_exit(); 342 idle_task_exit();
295 /* Some hardware requires clearing the CPPR, while other hardware does not 343 xics_teardown_cpu(0);
296 * it is safe either way
297 */
298 pSeriesLP_cppr_info(0, 0);
299 rtas_stop_self(); 344 rtas_stop_self();
300 /* Should never get here... */ 345 /* Should never get here... */
301 BUG(); 346 BUG();
@@ -322,11 +367,6 @@ static void __init pSeries_init_early(void)
322 DBG(" -> pSeries_init_early()\n"); 367 DBG(" -> pSeries_init_early()\n");
323 368
324 fw_feature_init(); 369 fw_feature_init();
325
326 if (firmware_has_feature(FW_FEATURE_LPAR))
327 hpte_init_lpar();
328 else
329 hpte_init_native();
330 370
331 if (firmware_has_feature(FW_FEATURE_LPAR)) 371 if (firmware_has_feature(FW_FEATURE_LPAR))
332 find_udbg_vterm(); 372 find_udbg_vterm();
@@ -338,8 +378,6 @@ static void __init pSeries_init_early(void)
338 378
339 iommu_init_early_pSeries(); 379 iommu_init_early_pSeries();
340 380
341 pSeries_discover_pic();
342
343 DBG(" <- pSeries_init_early()\n"); 381 DBG(" <- pSeries_init_early()\n");
344} 382}
345 383
@@ -384,6 +422,11 @@ static int __init pSeries_probe_hypertas(unsigned long node,
384 if (of_get_flat_dt_prop(node, "ibm,hypertas-functions", NULL) != NULL) 422 if (of_get_flat_dt_prop(node, "ibm,hypertas-functions", NULL) != NULL)
385 powerpc_firmware_features |= FW_FEATURE_LPAR; 423 powerpc_firmware_features |= FW_FEATURE_LPAR;
386 424
425 if (firmware_has_feature(FW_FEATURE_LPAR))
426 hpte_init_lpar();
427 else
428 hpte_init_native();
429
387 return 1; 430 return 1;
388} 431}
389 432
@@ -506,27 +549,6 @@ static int pSeries_pci_probe_mode(struct pci_bus *bus)
506 return PCI_PROBE_NORMAL; 549 return PCI_PROBE_NORMAL;
507} 550}
508 551
509#ifdef CONFIG_KEXEC
510static void pseries_kexec_cpu_down(int crash_shutdown, int secondary)
511{
512 /* Don't risk a hypervisor call if we're crashing */
513 if (firmware_has_feature(FW_FEATURE_SPLPAR) && !crash_shutdown) {
514 unsigned long vpa = __pa(get_lppaca());
515
516 if (unregister_vpa(hard_smp_processor_id(), vpa)) {
517 printk("VPA deregistration of cpu %u (hw_cpu_id %d) "
518 "failed\n", smp_processor_id(),
519 hard_smp_processor_id());
520 }
521 }
522
523 if (ppc64_interrupt_controller == IC_OPEN_PIC)
524 mpic_teardown_this_cpu(secondary);
525 else
526 xics_teardown_cpu(secondary);
527}
528#endif
529
530define_machine(pseries) { 552define_machine(pseries) {
531 .name = "pSeries", 553 .name = "pSeries",
532 .probe = pSeries_probe, 554 .probe = pSeries_probe,
@@ -551,7 +573,6 @@ define_machine(pseries) {
551 .system_reset_exception = pSeries_system_reset_exception, 573 .system_reset_exception = pSeries_system_reset_exception,
552 .machine_check_exception = pSeries_machine_check_exception, 574 .machine_check_exception = pSeries_machine_check_exception,
553#ifdef CONFIG_KEXEC 575#ifdef CONFIG_KEXEC
554 .kexec_cpu_down = pseries_kexec_cpu_down,
555 .machine_kexec = default_machine_kexec, 576 .machine_kexec = default_machine_kexec,
556 .machine_kexec_prepare = default_machine_kexec_prepare, 577 .machine_kexec_prepare = default_machine_kexec_prepare,
557 .machine_crash_shutdown = default_machine_crash_shutdown, 578 .machine_crash_shutdown = default_machine_crash_shutdown,
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c
index 3cf78a6cd27c..ac61098ff401 100644
--- a/arch/powerpc/platforms/pseries/smp.c
+++ b/arch/powerpc/platforms/pseries/smp.c
@@ -14,7 +14,6 @@
14 14
15#undef DEBUG 15#undef DEBUG
16 16
17#include <linux/config.h>
18#include <linux/kernel.h> 17#include <linux/kernel.h>
19#include <linux/module.h> 18#include <linux/module.h>
20#include <linux/sched.h> 19#include <linux/sched.h>
@@ -417,27 +416,12 @@ static struct smp_ops_t pSeries_xics_smp_ops = {
417#endif 416#endif
418 417
419/* This is called very early */ 418/* This is called very early */
420void __init smp_init_pSeries(void) 419static void __init smp_init_pseries(void)
421{ 420{
422 int i; 421 int i;
423 422
424 DBG(" -> smp_init_pSeries()\n"); 423 DBG(" -> smp_init_pSeries()\n");
425 424
426 switch (ppc64_interrupt_controller) {
427#ifdef CONFIG_MPIC
428 case IC_OPEN_PIC:
429 smp_ops = &pSeries_mpic_smp_ops;
430 break;
431#endif
432#ifdef CONFIG_XICS
433 case IC_PPC_XIC:
434 smp_ops = &pSeries_xics_smp_ops;
435 break;
436#endif
437 default:
438 panic("Invalid interrupt controller");
439 }
440
441#ifdef CONFIG_HOTPLUG_CPU 425#ifdef CONFIG_HOTPLUG_CPU
442 smp_ops->cpu_disable = pSeries_cpu_disable; 426 smp_ops->cpu_disable = pSeries_cpu_disable;
443 smp_ops->cpu_die = pSeries_cpu_die; 427 smp_ops->cpu_die = pSeries_cpu_die;
@@ -472,3 +456,18 @@ void __init smp_init_pSeries(void)
472 DBG(" <- smp_init_pSeries()\n"); 456 DBG(" <- smp_init_pSeries()\n");
473} 457}
474 458
459#ifdef CONFIG_MPIC
460void __init smp_init_pseries_mpic(void)
461{
462 smp_ops = &pSeries_mpic_smp_ops;
463
464 smp_init_pseries();
465}
466#endif
467
468void __init smp_init_pseries_xics(void)
469{
470 smp_ops = &pSeries_xics_smp_ops;
471
472 smp_init_pseries();
473}
diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c
index b14f9b5c114e..716972aa9777 100644
--- a/arch/powerpc/platforms/pseries/xics.c
+++ b/arch/powerpc/platforms/pseries/xics.c
@@ -8,7 +8,9 @@
8 * as published by the Free Software Foundation; either version 8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11#include <linux/config.h> 11
12#undef DEBUG
13
12#include <linux/types.h> 14#include <linux/types.h>
13#include <linux/threads.h> 15#include <linux/threads.h>
14#include <linux/kernel.h> 16#include <linux/kernel.h>
@@ -20,6 +22,7 @@
20#include <linux/gfp.h> 22#include <linux/gfp.h>
21#include <linux/radix-tree.h> 23#include <linux/radix-tree.h>
22#include <linux/cpu.h> 24#include <linux/cpu.h>
25
23#include <asm/firmware.h> 26#include <asm/firmware.h>
24#include <asm/prom.h> 27#include <asm/prom.h>
25#include <asm/io.h> 28#include <asm/io.h>
@@ -32,26 +35,6 @@
32 35
33#include "xics.h" 36#include "xics.h"
34 37
35static unsigned int xics_startup(unsigned int irq);
36static void xics_enable_irq(unsigned int irq);
37static void xics_disable_irq(unsigned int irq);
38static void xics_mask_and_ack_irq(unsigned int irq);
39static void xics_end_irq(unsigned int irq);
40static void xics_set_affinity(unsigned int irq_nr, cpumask_t cpumask);
41
42static struct hw_interrupt_type xics_pic = {
43 .typename = " XICS ",
44 .startup = xics_startup,
45 .enable = xics_enable_irq,
46 .disable = xics_disable_irq,
47 .ack = xics_mask_and_ack_irq,
48 .end = xics_end_irq,
49 .set_affinity = xics_set_affinity
50};
51
52/* This is used to map real irq numbers to virtual */
53static struct radix_tree_root irq_map = RADIX_TREE_INIT(GFP_ATOMIC);
54
55#define XICS_IPI 2 38#define XICS_IPI 2
56#define XICS_IRQ_SPURIOUS 0 39#define XICS_IRQ_SPURIOUS 0
57 40
@@ -60,7 +43,7 @@ static struct radix_tree_root irq_map = RADIX_TREE_INIT(GFP_ATOMIC);
60 43
61/* 44/*
62 * Mark IPIs as higher priority so we can take them inside interrupts that 45 * Mark IPIs as higher priority so we can take them inside interrupts that
63 * arent marked SA_INTERRUPT 46 * arent marked IRQF_DISABLED
64 */ 47 */
65#define IPI_PRIORITY 4 48#define IPI_PRIORITY 4
66 49
@@ -82,12 +65,12 @@ struct xics_ipl {
82 65
83static struct xics_ipl __iomem *xics_per_cpu[NR_CPUS]; 66static struct xics_ipl __iomem *xics_per_cpu[NR_CPUS];
84 67
85static int xics_irq_8259_cascade = 0;
86static int xics_irq_8259_cascade_real = 0;
87static unsigned int default_server = 0xFF; 68static unsigned int default_server = 0xFF;
88static unsigned int default_distrib_server = 0; 69static unsigned int default_distrib_server = 0;
89static unsigned int interrupt_server_size = 8; 70static unsigned int interrupt_server_size = 8;
90 71
72static struct irq_host *xics_host;
73
91/* 74/*
92 * XICS only has a single IPI, so encode the messages per CPU 75 * XICS only has a single IPI, so encode the messages per CPU
93 */ 76 */
@@ -99,48 +82,34 @@ static int ibm_set_xive;
99static int ibm_int_on; 82static int ibm_int_on;
100static int ibm_int_off; 83static int ibm_int_off;
101 84
102typedef struct {
103 int (*xirr_info_get)(int cpu);
104 void (*xirr_info_set)(int cpu, int val);
105 void (*cppr_info)(int cpu, u8 val);
106 void (*qirr_info)(int cpu, u8 val);
107} xics_ops;
108 85
86/* Direct HW low level accessors */
109 87
110/* SMP */
111 88
112static int pSeries_xirr_info_get(int n_cpu) 89static inline unsigned int direct_xirr_info_get(int n_cpu)
113{ 90{
114 return in_be32(&xics_per_cpu[n_cpu]->xirr.word); 91 return in_be32(&xics_per_cpu[n_cpu]->xirr.word);
115} 92}
116 93
117static void pSeries_xirr_info_set(int n_cpu, int value) 94static inline void direct_xirr_info_set(int n_cpu, int value)
118{ 95{
119 out_be32(&xics_per_cpu[n_cpu]->xirr.word, value); 96 out_be32(&xics_per_cpu[n_cpu]->xirr.word, value);
120} 97}
121 98
122static void pSeries_cppr_info(int n_cpu, u8 value) 99static inline void direct_cppr_info(int n_cpu, u8 value)
123{ 100{
124 out_8(&xics_per_cpu[n_cpu]->xirr.bytes[0], value); 101 out_8(&xics_per_cpu[n_cpu]->xirr.bytes[0], value);
125} 102}
126 103
127static void pSeries_qirr_info(int n_cpu, u8 value) 104static inline void direct_qirr_info(int n_cpu, u8 value)
128{ 105{
129 out_8(&xics_per_cpu[n_cpu]->qirr.bytes[0], value); 106 out_8(&xics_per_cpu[n_cpu]->qirr.bytes[0], value);
130} 107}
131 108
132static xics_ops pSeries_ops = {
133 pSeries_xirr_info_get,
134 pSeries_xirr_info_set,
135 pSeries_cppr_info,
136 pSeries_qirr_info
137};
138 109
139static xics_ops *ops = &pSeries_ops; 110/* LPAR low level accessors */
140 111
141 112
142/* LPAR */
143
144static inline long plpar_eoi(unsigned long xirr) 113static inline long plpar_eoi(unsigned long xirr)
145{ 114{
146 return plpar_hcall_norets(H_EOI, xirr); 115 return plpar_hcall_norets(H_EOI, xirr);
@@ -162,7 +131,7 @@ static inline long plpar_xirr(unsigned long *xirr_ret)
162 return plpar_hcall(H_XIRR, 0, 0, 0, 0, xirr_ret, &dummy, &dummy); 131 return plpar_hcall(H_XIRR, 0, 0, 0, 0, xirr_ret, &dummy, &dummy);
163} 132}
164 133
165static int pSeriesLP_xirr_info_get(int n_cpu) 134static inline unsigned int lpar_xirr_info_get(int n_cpu)
166{ 135{
167 unsigned long lpar_rc; 136 unsigned long lpar_rc;
168 unsigned long return_value; 137 unsigned long return_value;
@@ -170,10 +139,10 @@ static int pSeriesLP_xirr_info_get(int n_cpu)
170 lpar_rc = plpar_xirr(&return_value); 139 lpar_rc = plpar_xirr(&return_value);
171 if (lpar_rc != H_SUCCESS) 140 if (lpar_rc != H_SUCCESS)
172 panic(" bad return code xirr - rc = %lx \n", lpar_rc); 141 panic(" bad return code xirr - rc = %lx \n", lpar_rc);
173 return (int)return_value; 142 return (unsigned int)return_value;
174} 143}
175 144
176static void pSeriesLP_xirr_info_set(int n_cpu, int value) 145static inline void lpar_xirr_info_set(int n_cpu, int value)
177{ 146{
178 unsigned long lpar_rc; 147 unsigned long lpar_rc;
179 unsigned long val64 = value & 0xffffffff; 148 unsigned long val64 = value & 0xffffffff;
@@ -184,7 +153,7 @@ static void pSeriesLP_xirr_info_set(int n_cpu, int value)
184 val64); 153 val64);
185} 154}
186 155
187void pSeriesLP_cppr_info(int n_cpu, u8 value) 156static inline void lpar_cppr_info(int n_cpu, u8 value)
188{ 157{
189 unsigned long lpar_rc; 158 unsigned long lpar_rc;
190 159
@@ -193,7 +162,7 @@ void pSeriesLP_cppr_info(int n_cpu, u8 value)
193 panic("bad return code cppr - rc = %lx\n", lpar_rc); 162 panic("bad return code cppr - rc = %lx\n", lpar_rc);
194} 163}
195 164
196static void pSeriesLP_qirr_info(int n_cpu , u8 value) 165static inline void lpar_qirr_info(int n_cpu , u8 value)
197{ 166{
198 unsigned long lpar_rc; 167 unsigned long lpar_rc;
199 168
@@ -202,43 +171,16 @@ static void pSeriesLP_qirr_info(int n_cpu , u8 value)
202 panic("bad return code qirr - rc = %lx\n", lpar_rc); 171 panic("bad return code qirr - rc = %lx\n", lpar_rc);
203} 172}
204 173
205xics_ops pSeriesLP_ops = {
206 pSeriesLP_xirr_info_get,
207 pSeriesLP_xirr_info_set,
208 pSeriesLP_cppr_info,
209 pSeriesLP_qirr_info
210};
211
212static unsigned int xics_startup(unsigned int virq)
213{
214 unsigned int irq;
215
216 irq = irq_offset_down(virq);
217 if (radix_tree_insert(&irq_map, virt_irq_to_real(irq),
218 &virt_irq_to_real_map[irq]) == -ENOMEM)
219 printk(KERN_CRIT "Out of memory creating real -> virtual"
220 " IRQ mapping for irq %u (real 0x%x)\n",
221 virq, virt_irq_to_real(irq));
222 xics_enable_irq(virq);
223 return 0; /* return value is ignored */
224}
225 174
226static unsigned int real_irq_to_virt(unsigned int real_irq) 175/* High level handlers and init code */
227{
228 unsigned int *ptr;
229 176
230 ptr = radix_tree_lookup(&irq_map, real_irq);
231 if (ptr == NULL)
232 return NO_IRQ;
233 return ptr - virt_irq_to_real_map;
234}
235 177
236#ifdef CONFIG_SMP 178#ifdef CONFIG_SMP
237static int get_irq_server(unsigned int irq) 179static int get_irq_server(unsigned int virq)
238{ 180{
239 unsigned int server; 181 unsigned int server;
240 /* For the moment only implement delivery to all cpus or one cpu */ 182 /* For the moment only implement delivery to all cpus or one cpu */
241 cpumask_t cpumask = irq_affinity[irq]; 183 cpumask_t cpumask = irq_desc[virq].affinity;
242 cpumask_t tmp = CPU_MASK_NONE; 184 cpumask_t tmp = CPU_MASK_NONE;
243 185
244 if (!distribute_irqs) 186 if (!distribute_irqs)
@@ -259,23 +201,28 @@ static int get_irq_server(unsigned int irq)
259 201
260} 202}
261#else 203#else
262static int get_irq_server(unsigned int irq) 204static int get_irq_server(unsigned int virq)
263{ 205{
264 return default_server; 206 return default_server;
265} 207}
266#endif 208#endif
267 209
268static void xics_enable_irq(unsigned int virq) 210
211static void xics_unmask_irq(unsigned int virq)
269{ 212{
270 unsigned int irq; 213 unsigned int irq;
271 int call_status; 214 int call_status;
272 unsigned int server; 215 unsigned int server;
273 216
274 irq = virt_irq_to_real(irq_offset_down(virq)); 217 pr_debug("xics: unmask virq %d\n", virq);
275 if (irq == XICS_IPI) 218
219 irq = (unsigned int)irq_map[virq].hwirq;
220 pr_debug(" -> map to hwirq 0x%x\n", irq);
221 if (irq == XICS_IPI || irq == XICS_IRQ_SPURIOUS)
276 return; 222 return;
277 223
278 server = get_irq_server(virq); 224 server = get_irq_server(virq);
225
279 call_status = rtas_call(ibm_set_xive, 3, 1, NULL, irq, server, 226 call_status = rtas_call(ibm_set_xive, 3, 1, NULL, irq, server,
280 DEFAULT_PRIORITY); 227 DEFAULT_PRIORITY);
281 if (call_status != 0) { 228 if (call_status != 0) {
@@ -294,7 +241,7 @@ static void xics_enable_irq(unsigned int virq)
294 } 241 }
295} 242}
296 243
297static void xics_disable_real_irq(unsigned int irq) 244static void xics_mask_real_irq(unsigned int irq)
298{ 245{
299 int call_status; 246 int call_status;
300 unsigned int server; 247 unsigned int server;
@@ -319,75 +266,86 @@ static void xics_disable_real_irq(unsigned int irq)
319 } 266 }
320} 267}
321 268
322static void xics_disable_irq(unsigned int virq) 269static void xics_mask_irq(unsigned int virq)
323{ 270{
324 unsigned int irq; 271 unsigned int irq;
325 272
326 irq = virt_irq_to_real(irq_offset_down(virq)); 273 pr_debug("xics: mask virq %d\n", virq);
327 xics_disable_real_irq(irq); 274
275 irq = (unsigned int)irq_map[virq].hwirq;
276 if (irq == XICS_IPI || irq == XICS_IRQ_SPURIOUS)
277 return;
278 xics_mask_real_irq(irq);
279}
280
281static unsigned int xics_startup(unsigned int virq)
282{
283 unsigned int irq;
284
285 /* force a reverse mapping of the interrupt so it gets in the cache */
286 irq = (unsigned int)irq_map[virq].hwirq;
287 irq_radix_revmap(xics_host, irq);
288
289 /* unmask it */
290 xics_unmask_irq(virq);
291 return 0;
328} 292}
329 293
330static void xics_end_irq(unsigned int irq) 294static void xics_eoi_direct(unsigned int virq)
331{ 295{
332 int cpu = smp_processor_id(); 296 int cpu = smp_processor_id();
297 unsigned int irq = (unsigned int)irq_map[virq].hwirq;
333 298
334 iosync(); 299 iosync();
335 ops->xirr_info_set(cpu, ((0xff << 24) | 300 direct_xirr_info_set(cpu, (0xff << 24) | irq);
336 (virt_irq_to_real(irq_offset_down(irq)))));
337
338} 301}
339 302
340static void xics_mask_and_ack_irq(unsigned int irq) 303
304static void xics_eoi_lpar(unsigned int virq)
341{ 305{
342 int cpu = smp_processor_id(); 306 int cpu = smp_processor_id();
307 unsigned int irq = (unsigned int)irq_map[virq].hwirq;
343 308
344 if (irq < irq_offset_value()) { 309 iosync();
345 i8259_pic.ack(irq); 310 lpar_xirr_info_set(cpu, (0xff << 24) | irq);
346 iosync();
347 ops->xirr_info_set(cpu, ((0xff<<24) |
348 xics_irq_8259_cascade_real));
349 iosync();
350 }
351} 311}
352 312
353int xics_get_irq(struct pt_regs *regs) 313static inline unsigned int xics_remap_irq(unsigned int vec)
354{ 314{
355 unsigned int cpu = smp_processor_id(); 315 unsigned int irq;
356 unsigned int vec;
357 int irq;
358 316
359 vec = ops->xirr_info_get(cpu);
360 /* (vec >> 24) == old priority */
361 vec &= 0x00ffffff; 317 vec &= 0x00ffffff;
362 318
363 /* for sanity, this had better be < NR_IRQS - 16 */ 319 if (vec == XICS_IRQ_SPURIOUS)
364 if (vec == xics_irq_8259_cascade_real) { 320 return NO_IRQ;
365 irq = i8259_irq(regs); 321 irq = irq_radix_revmap(xics_host, vec);
366 xics_end_irq(irq_offset_up(xics_irq_8259_cascade)); 322 if (likely(irq != NO_IRQ))
367 } else if (vec == XICS_IRQ_SPURIOUS) { 323 return irq;
368 irq = -1; 324
369 } else { 325 printk(KERN_ERR "Interrupt %u (real) is invalid,"
370 irq = real_irq_to_virt(vec); 326 " disabling it.\n", vec);
371 if (irq == NO_IRQ) 327 xics_mask_real_irq(vec);
372 irq = real_irq_to_virt_slowpath(vec); 328 return NO_IRQ;
373 if (irq == NO_IRQ) {
374 printk(KERN_ERR "Interrupt %u (real) is invalid,"
375 " disabling it.\n", vec);
376 xics_disable_real_irq(vec);
377 } else
378 irq = irq_offset_up(irq);
379 }
380 return irq;
381} 329}
382 330
383#ifdef CONFIG_SMP 331static unsigned int xics_get_irq_direct(struct pt_regs *regs)
332{
333 unsigned int cpu = smp_processor_id();
384 334
385static irqreturn_t xics_ipi_action(int irq, void *dev_id, struct pt_regs *regs) 335 return xics_remap_irq(direct_xirr_info_get(cpu));
336}
337
338static unsigned int xics_get_irq_lpar(struct pt_regs *regs)
386{ 339{
387 int cpu = smp_processor_id(); 340 unsigned int cpu = smp_processor_id();
341
342 return xics_remap_irq(lpar_xirr_info_get(cpu));
343}
388 344
389 ops->qirr_info(cpu, 0xff); 345#ifdef CONFIG_SMP
390 346
347static irqreturn_t xics_ipi_dispatch(int cpu, struct pt_regs *regs)
348{
391 WARN_ON(cpu_is_offline(cpu)); 349 WARN_ON(cpu_is_offline(cpu));
392 350
393 while (xics_ipi_message[cpu].value) { 351 while (xics_ipi_message[cpu].value) {
@@ -419,18 +377,88 @@ static irqreturn_t xics_ipi_action(int irq, void *dev_id, struct pt_regs *regs)
419 return IRQ_HANDLED; 377 return IRQ_HANDLED;
420} 378}
421 379
380static irqreturn_t xics_ipi_action_direct(int irq, void *dev_id, struct pt_regs *regs)
381{
382 int cpu = smp_processor_id();
383
384 direct_qirr_info(cpu, 0xff);
385
386 return xics_ipi_dispatch(cpu, regs);
387}
388
389static irqreturn_t xics_ipi_action_lpar(int irq, void *dev_id, struct pt_regs *regs)
390{
391 int cpu = smp_processor_id();
392
393 lpar_qirr_info(cpu, 0xff);
394
395 return xics_ipi_dispatch(cpu, regs);
396}
397
422void xics_cause_IPI(int cpu) 398void xics_cause_IPI(int cpu)
423{ 399{
424 ops->qirr_info(cpu, IPI_PRIORITY); 400 if (firmware_has_feature(FW_FEATURE_LPAR))
401 lpar_qirr_info(cpu, IPI_PRIORITY);
402 else
403 direct_qirr_info(cpu, IPI_PRIORITY);
425} 404}
405
426#endif /* CONFIG_SMP */ 406#endif /* CONFIG_SMP */
427 407
408static void xics_set_cpu_priority(int cpu, unsigned char cppr)
409{
410 if (firmware_has_feature(FW_FEATURE_LPAR))
411 lpar_cppr_info(cpu, cppr);
412 else
413 direct_cppr_info(cpu, cppr);
414 iosync();
415}
416
417static void xics_set_affinity(unsigned int virq, cpumask_t cpumask)
418{
419 unsigned int irq;
420 int status;
421 int xics_status[2];
422 unsigned long newmask;
423 cpumask_t tmp = CPU_MASK_NONE;
424
425 irq = (unsigned int)irq_map[virq].hwirq;
426 if (irq == XICS_IPI || irq == XICS_IRQ_SPURIOUS)
427 return;
428
429 status = rtas_call(ibm_get_xive, 1, 3, xics_status, irq);
430
431 if (status) {
432 printk(KERN_ERR "xics_set_affinity: irq=%u ibm,get-xive "
433 "returns %d\n", irq, status);
434 return;
435 }
436
437 /* For the moment only implement delivery to all cpus or one cpu */
438 if (cpus_equal(cpumask, CPU_MASK_ALL)) {
439 newmask = default_distrib_server;
440 } else {
441 cpus_and(tmp, cpu_online_map, cpumask);
442 if (cpus_empty(tmp))
443 return;
444 newmask = get_hard_smp_processor_id(first_cpu(tmp));
445 }
446
447 status = rtas_call(ibm_set_xive, 3, 1, NULL,
448 irq, newmask, xics_status[1]);
449
450 if (status) {
451 printk(KERN_ERR "xics_set_affinity: irq=%u ibm,set-xive "
452 "returns %d\n", irq, status);
453 return;
454 }
455}
456
428void xics_setup_cpu(void) 457void xics_setup_cpu(void)
429{ 458{
430 int cpu = smp_processor_id(); 459 int cpu = smp_processor_id();
431 460
432 ops->cppr_info(cpu, 0xff); 461 xics_set_cpu_priority(cpu, 0xff);
433 iosync();
434 462
435 /* 463 /*
436 * Put the calling processor into the GIQ. This is really only 464 * Put the calling processor into the GIQ. This is really only
@@ -443,72 +471,266 @@ void xics_setup_cpu(void)
443 (1UL << interrupt_server_size) - 1 - default_distrib_server, 1); 471 (1UL << interrupt_server_size) - 1 - default_distrib_server, 1);
444} 472}
445 473
446void xics_init_IRQ(void) 474
475static struct irq_chip xics_pic_direct = {
476 .typename = " XICS ",
477 .startup = xics_startup,
478 .mask = xics_mask_irq,
479 .unmask = xics_unmask_irq,
480 .eoi = xics_eoi_direct,
481 .set_affinity = xics_set_affinity
482};
483
484
485static struct irq_chip xics_pic_lpar = {
486 .typename = " XICS ",
487 .startup = xics_startup,
488 .mask = xics_mask_irq,
489 .unmask = xics_unmask_irq,
490 .eoi = xics_eoi_lpar,
491 .set_affinity = xics_set_affinity
492};
493
494
495static int xics_host_match(struct irq_host *h, struct device_node *node)
496{
497 /* IBM machines have interrupt parents of various funky types for things
498 * like vdevices, events, etc... The trick we use here is to match
499 * everything here except the legacy 8259 which is compatible "chrp,iic"
500 */
501 return !device_is_compatible(node, "chrp,iic");
502}
503
504static int xics_host_map_direct(struct irq_host *h, unsigned int virq,
505 irq_hw_number_t hw, unsigned int flags)
506{
507 unsigned int sense = flags & IRQ_TYPE_SENSE_MASK;
508
509 pr_debug("xics: map_direct virq %d, hwirq 0x%lx, flags: 0x%x\n",
510 virq, hw, flags);
511
512 if (sense && sense != IRQ_TYPE_LEVEL_LOW)
513 printk(KERN_WARNING "xics: using unsupported sense 0x%x"
514 " for irq %d (h: 0x%lx)\n", flags, virq, hw);
515
516 get_irq_desc(virq)->status |= IRQ_LEVEL;
517 set_irq_chip_and_handler(virq, &xics_pic_direct, handle_fasteoi_irq);
518 return 0;
519}
520
521static int xics_host_map_lpar(struct irq_host *h, unsigned int virq,
522 irq_hw_number_t hw, unsigned int flags)
523{
524 unsigned int sense = flags & IRQ_TYPE_SENSE_MASK;
525
526 pr_debug("xics: map_lpar virq %d, hwirq 0x%lx, flags: 0x%x\n",
527 virq, hw, flags);
528
529 if (sense && sense != IRQ_TYPE_LEVEL_LOW)
530 printk(KERN_WARNING "xics: using unsupported sense 0x%x"
531 " for irq %d (h: 0x%lx)\n", flags, virq, hw);
532
533 get_irq_desc(virq)->status |= IRQ_LEVEL;
534 set_irq_chip_and_handler(virq, &xics_pic_lpar, handle_fasteoi_irq);
535 return 0;
536}
537
538static int xics_host_xlate(struct irq_host *h, struct device_node *ct,
539 u32 *intspec, unsigned int intsize,
540 irq_hw_number_t *out_hwirq, unsigned int *out_flags)
541
542{
543 /* Current xics implementation translates everything
544 * to level. It is not technically right for MSIs but this
545 * is irrelevant at this point. We might get smarter in the future
546 */
547 *out_hwirq = intspec[0];
548 *out_flags = IRQ_TYPE_LEVEL_LOW;
549
550 return 0;
551}
552
553static struct irq_host_ops xics_host_direct_ops = {
554 .match = xics_host_match,
555 .map = xics_host_map_direct,
556 .xlate = xics_host_xlate,
557};
558
559static struct irq_host_ops xics_host_lpar_ops = {
560 .match = xics_host_match,
561 .map = xics_host_map_lpar,
562 .xlate = xics_host_xlate,
563};
564
565static void __init xics_init_host(void)
566{
567 struct irq_host_ops *ops;
568
569 if (firmware_has_feature(FW_FEATURE_LPAR))
570 ops = &xics_host_lpar_ops;
571 else
572 ops = &xics_host_direct_ops;
573 xics_host = irq_alloc_host(IRQ_HOST_MAP_TREE, 0, ops,
574 XICS_IRQ_SPURIOUS);
575 BUG_ON(xics_host == NULL);
576 irq_set_default_host(xics_host);
577}
578
579static void __init xics_map_one_cpu(int hw_id, unsigned long addr,
580 unsigned long size)
447{ 581{
582#ifdef CONFIG_SMP
448 int i; 583 int i;
449 unsigned long intr_size = 0;
450 struct device_node *np;
451 uint *ireg, ilen, indx = 0;
452 unsigned long intr_base = 0;
453 struct xics_interrupt_node {
454 unsigned long addr;
455 unsigned long size;
456 } intnodes[NR_CPUS];
457 584
458 ppc64_boot_msg(0x20, "XICS Init"); 585 /* This may look gross but it's good enough for now, we don't quite
586 * have a hard -> linux processor id matching.
587 */
588 for_each_possible_cpu(i) {
589 if (!cpu_present(i))
590 continue;
591 if (hw_id == get_hard_smp_processor_id(i)) {
592 xics_per_cpu[i] = ioremap(addr, size);
593 return;
594 }
595 }
596#else
597 if (hw_id != 0)
598 return;
599 xics_per_cpu[0] = ioremap(addr, size);
600#endif /* CONFIG_SMP */
601}
459 602
460 ibm_get_xive = rtas_token("ibm,get-xive"); 603static void __init xics_init_one_node(struct device_node *np,
461 ibm_set_xive = rtas_token("ibm,set-xive"); 604 unsigned int *indx)
462 ibm_int_on = rtas_token("ibm,int-on"); 605{
463 ibm_int_off = rtas_token("ibm,int-off"); 606 unsigned int ilen;
607 u32 *ireg;
464 608
465 np = of_find_node_by_type(NULL, "PowerPC-External-Interrupt-Presentation"); 609 /* This code does the theorically broken assumption that the interrupt
466 if (!np) 610 * server numbers are the same as the hard CPU numbers.
467 panic("xics_init_IRQ: can't find interrupt presentation"); 611 * This happens to be the case so far but we are playing with fire...
612 * should be fixed one of these days. -BenH.
613 */
614 ireg = (u32 *)get_property(np, "ibm,interrupt-server-ranges", NULL);
468 615
469nextnode: 616 /* Do that ever happen ? we'll know soon enough... but even good'old
470 ireg = (uint *)get_property(np, "ibm,interrupt-server-ranges", NULL); 617 * f80 does have that property ..
618 */
619 WARN_ON(ireg == NULL);
471 if (ireg) { 620 if (ireg) {
472 /* 621 /*
473 * set node starting index for this node 622 * set node starting index for this node
474 */ 623 */
475 indx = *ireg; 624 *indx = *ireg;
476 } 625 }
477 626 ireg = (u32 *)get_property(np, "reg", &ilen);
478 ireg = (uint *)get_property(np, "reg", &ilen);
479 if (!ireg) 627 if (!ireg)
480 panic("xics_init_IRQ: can't find interrupt reg property"); 628 panic("xics_init_IRQ: can't find interrupt reg property");
481 629
482 while (ilen) { 630 while (ilen >= (4 * sizeof(u32))) {
483 intnodes[indx].addr = (unsigned long)*ireg++ << 32; 631 unsigned long addr, size;
484 ilen -= sizeof(uint); 632
485 intnodes[indx].addr |= *ireg++; 633 /* XXX Use proper OF parsing code here !!! */
486 ilen -= sizeof(uint); 634 addr = (unsigned long)*ireg++ << 32;
487 intnodes[indx].size = (unsigned long)*ireg++ << 32; 635 ilen -= sizeof(u32);
488 ilen -= sizeof(uint); 636 addr |= *ireg++;
489 intnodes[indx].size |= *ireg++; 637 ilen -= sizeof(u32);
490 ilen -= sizeof(uint); 638 size = (unsigned long)*ireg++ << 32;
491 indx++; 639 ilen -= sizeof(u32);
492 if (indx >= NR_CPUS) break; 640 size |= *ireg++;
641 ilen -= sizeof(u32);
642 xics_map_one_cpu(*indx, addr, size);
643 (*indx)++;
644 }
645}
646
647
648static void __init xics_setup_8259_cascade(void)
649{
650 struct device_node *np, *old, *found = NULL;
651 int cascade, naddr;
652 u32 *addrp;
653 unsigned long intack = 0;
654
655 for_each_node_by_type(np, "interrupt-controller")
656 if (device_is_compatible(np, "chrp,iic")) {
657 found = np;
658 break;
659 }
660 if (found == NULL) {
661 printk(KERN_DEBUG "xics: no ISA interrupt controller\n");
662 return;
663 }
664 cascade = irq_of_parse_and_map(found, 0);
665 if (cascade == NO_IRQ) {
666 printk(KERN_ERR "xics: failed to map cascade interrupt");
667 return;
668 }
669 pr_debug("xics: cascade mapped to irq %d\n", cascade);
670
671 for (old = of_node_get(found); old != NULL ; old = np) {
672 np = of_get_parent(old);
673 of_node_put(old);
674 if (np == NULL)
675 break;
676 if (strcmp(np->name, "pci") != 0)
677 continue;
678 addrp = (u32 *)get_property(np, "8259-interrupt-acknowledge", NULL);
679 if (addrp == NULL)
680 continue;
681 naddr = prom_n_addr_cells(np);
682 intack = addrp[naddr-1];
683 if (naddr > 1)
684 intack |= ((unsigned long)addrp[naddr-2]) << 32;
685 }
686 if (intack)
687 printk(KERN_DEBUG "xics: PCI 8259 intack at 0x%016lx\n", intack);
688 i8259_init(found, intack);
689 of_node_put(found);
690 set_irq_chained_handler(cascade, pseries_8259_cascade);
691}
692
693void __init xics_init_IRQ(void)
694{
695 int i;
696 struct device_node *np;
697 u32 *ireg, ilen, indx = 0;
698 int found = 0;
699
700 ppc64_boot_msg(0x20, "XICS Init");
701
702 ibm_get_xive = rtas_token("ibm,get-xive");
703 ibm_set_xive = rtas_token("ibm,set-xive");
704 ibm_int_on = rtas_token("ibm,int-on");
705 ibm_int_off = rtas_token("ibm,int-off");
706
707 for_each_node_by_type(np, "PowerPC-External-Interrupt-Presentation") {
708 found = 1;
709 if (firmware_has_feature(FW_FEATURE_LPAR))
710 break;
711 xics_init_one_node(np, &indx);
493 } 712 }
713 if (found == 0)
714 return;
494 715
495 np = of_find_node_by_type(np, "PowerPC-External-Interrupt-Presentation"); 716 xics_init_host();
496 if ((indx < NR_CPUS) && np) goto nextnode;
497 717
498 /* Find the server numbers for the boot cpu. */ 718 /* Find the server numbers for the boot cpu. */
499 for (np = of_find_node_by_type(NULL, "cpu"); 719 for (np = of_find_node_by_type(NULL, "cpu");
500 np; 720 np;
501 np = of_find_node_by_type(np, "cpu")) { 721 np = of_find_node_by_type(np, "cpu")) {
502 ireg = (uint *)get_property(np, "reg", &ilen); 722 ireg = (u32 *)get_property(np, "reg", &ilen);
503 if (ireg && ireg[0] == get_hard_smp_processor_id(boot_cpuid)) { 723 if (ireg && ireg[0] == get_hard_smp_processor_id(boot_cpuid)) {
504 ireg = (uint *)get_property(np, "ibm,ppc-interrupt-gserver#s", 724 ireg = (u32 *)get_property(np,
505 &ilen); 725 "ibm,ppc-interrupt-gserver#s",
726 &ilen);
506 i = ilen / sizeof(int); 727 i = ilen / sizeof(int);
507 if (ireg && i > 0) { 728 if (ireg && i > 0) {
508 default_server = ireg[0]; 729 default_server = ireg[0];
509 default_distrib_server = ireg[i-1]; /* take last element */ 730 /* take last element */
731 default_distrib_server = ireg[i-1];
510 } 732 }
511 ireg = (uint *)get_property(np, 733 ireg = (u32 *)get_property(np,
512 "ibm,interrupt-server#-size", NULL); 734 "ibm,interrupt-server#-size", NULL);
513 if (ireg) 735 if (ireg)
514 interrupt_server_size = *ireg; 736 interrupt_server_size = *ireg;
@@ -517,132 +739,48 @@ nextnode:
517 } 739 }
518 of_node_put(np); 740 of_node_put(np);
519 741
520 intr_base = intnodes[0].addr;
521 intr_size = intnodes[0].size;
522
523 np = of_find_node_by_type(NULL, "interrupt-controller");
524 if (!np) {
525 printk(KERN_DEBUG "xics: no ISA interrupt controller\n");
526 xics_irq_8259_cascade_real = -1;
527 xics_irq_8259_cascade = -1;
528 } else {
529 ireg = (uint *) get_property(np, "interrupts", NULL);
530 if (!ireg)
531 panic("xics_init_IRQ: can't find ISA interrupts property");
532
533 xics_irq_8259_cascade_real = *ireg;
534 xics_irq_8259_cascade
535 = virt_irq_create_mapping(xics_irq_8259_cascade_real);
536 i8259_init(0, 0);
537 of_node_put(np);
538 }
539
540 if (firmware_has_feature(FW_FEATURE_LPAR)) 742 if (firmware_has_feature(FW_FEATURE_LPAR))
541 ops = &pSeriesLP_ops; 743 ppc_md.get_irq = xics_get_irq_lpar;
542 else { 744 else
543#ifdef CONFIG_SMP 745 ppc_md.get_irq = xics_get_irq_direct;
544 for_each_possible_cpu(i) {
545 int hard_id;
546
547 /* FIXME: Do this dynamically! --RR */
548 if (!cpu_present(i))
549 continue;
550
551 hard_id = get_hard_smp_processor_id(i);
552 xics_per_cpu[i] = ioremap(intnodes[hard_id].addr,
553 intnodes[hard_id].size);
554 }
555#else
556 xics_per_cpu[0] = ioremap(intr_base, intr_size);
557#endif /* CONFIG_SMP */
558 }
559
560 for (i = irq_offset_value(); i < NR_IRQS; ++i)
561 get_irq_desc(i)->handler = &xics_pic;
562 746
563 xics_setup_cpu(); 747 xics_setup_cpu();
564 748
749 xics_setup_8259_cascade();
750
565 ppc64_boot_msg(0x21, "XICS Done"); 751 ppc64_boot_msg(0x21, "XICS Done");
566} 752}
567 753
568/*
569 * We cant do this in init_IRQ because we need the memory subsystem up for
570 * request_irq()
571 */
572static int __init xics_setup_i8259(void)
573{
574 if (ppc64_interrupt_controller == IC_PPC_XIC &&
575 xics_irq_8259_cascade != -1) {
576 if (request_irq(irq_offset_up(xics_irq_8259_cascade),
577 no_action, 0, "8259 cascade", NULL))
578 printk(KERN_ERR "xics_setup_i8259: couldn't get 8259 "
579 "cascade\n");
580 }
581 return 0;
582}
583arch_initcall(xics_setup_i8259);
584 754
585#ifdef CONFIG_SMP 755#ifdef CONFIG_SMP
586void xics_request_IPIs(void) 756void xics_request_IPIs(void)
587{ 757{
588 virt_irq_to_real_map[XICS_IPI] = XICS_IPI; 758 unsigned int ipi;
589 759
590 /* IPIs are marked SA_INTERRUPT as they must run with irqs disabled */ 760 ipi = irq_create_mapping(xics_host, XICS_IPI, 0);
591 request_irq(irq_offset_up(XICS_IPI), xics_ipi_action, SA_INTERRUPT, 761 BUG_ON(ipi == NO_IRQ);
592 "IPI", NULL);
593 get_irq_desc(irq_offset_up(XICS_IPI))->status |= IRQ_PER_CPU;
594}
595#endif
596
597static void xics_set_affinity(unsigned int virq, cpumask_t cpumask)
598{
599 unsigned int irq;
600 int status;
601 int xics_status[2];
602 unsigned long newmask;
603 cpumask_t tmp = CPU_MASK_NONE;
604
605 irq = virt_irq_to_real(irq_offset_down(virq));
606 if (irq == XICS_IPI || irq == NO_IRQ)
607 return;
608
609 status = rtas_call(ibm_get_xive, 1, 3, xics_status, irq);
610 762
611 if (status) { 763 /*
612 printk(KERN_ERR "xics_set_affinity: irq=%u ibm,get-xive " 764 * IPIs are marked IRQF_DISABLED as they must run with irqs
613 "returns %d\n", irq, status); 765 * disabled
614 return; 766 */
615 } 767 set_irq_handler(ipi, handle_percpu_irq);
616 768 if (firmware_has_feature(FW_FEATURE_LPAR))
617 /* For the moment only implement delivery to all cpus or one cpu */ 769 request_irq(ipi, xics_ipi_action_lpar, IRQF_DISABLED,
618 if (cpus_equal(cpumask, CPU_MASK_ALL)) { 770 "IPI", NULL);
619 newmask = default_distrib_server; 771 else
620 } else { 772 request_irq(ipi, xics_ipi_action_direct, IRQF_DISABLED,
621 cpus_and(tmp, cpu_online_map, cpumask); 773 "IPI", NULL);
622 if (cpus_empty(tmp))
623 return;
624 newmask = get_hard_smp_processor_id(first_cpu(tmp));
625 }
626
627 status = rtas_call(ibm_set_xive, 3, 1, NULL,
628 irq, newmask, xics_status[1]);
629
630 if (status) {
631 printk(KERN_ERR "xics_set_affinity: irq=%u ibm,set-xive "
632 "returns %d\n", irq, status);
633 return;
634 }
635} 774}
775#endif /* CONFIG_SMP */
636 776
637void xics_teardown_cpu(int secondary) 777void xics_teardown_cpu(int secondary)
638{ 778{
639 int cpu = smp_processor_id(); 779 int cpu = smp_processor_id();
780 unsigned int ipi;
781 struct irq_desc *desc;
640 782
641 ops->cppr_info(cpu, 0x00); 783 xics_set_cpu_priority(cpu, 0);
642 iosync();
643
644 /* Clear IPI */
645 ops->qirr_info(cpu, 0xff);
646 784
647 /* 785 /*
648 * we need to EOI the IPI if we got here from kexec down IPI 786 * we need to EOI the IPI if we got here from kexec down IPI
@@ -651,7 +789,13 @@ void xics_teardown_cpu(int secondary)
651 * should we be flagging idle loop instead? 789 * should we be flagging idle loop instead?
652 * or creating some task to be scheduled? 790 * or creating some task to be scheduled?
653 */ 791 */
654 ops->xirr_info_set(cpu, XICS_IPI); 792
793 ipi = irq_find_mapping(xics_host, XICS_IPI);
794 if (ipi == XICS_IRQ_SPURIOUS)
795 return;
796 desc = get_irq_desc(ipi);
797 if (desc->chip && desc->chip->eoi)
798 desc->chip->eoi(XICS_IPI);
655 799
656 /* 800 /*
657 * Some machines need to have at least one cpu in the GIQ, 801 * Some machines need to have at least one cpu in the GIQ,
@@ -659,8 +803,8 @@ void xics_teardown_cpu(int secondary)
659 */ 803 */
660 if (secondary) 804 if (secondary)
661 rtas_set_indicator(GLOBAL_INTERRUPT_QUEUE, 805 rtas_set_indicator(GLOBAL_INTERRUPT_QUEUE,
662 (1UL << interrupt_server_size) - 1 - 806 (1UL << interrupt_server_size) - 1 -
663 default_distrib_server, 0); 807 default_distrib_server, 0);
664} 808}
665 809
666#ifdef CONFIG_HOTPLUG_CPU 810#ifdef CONFIG_HOTPLUG_CPU
@@ -672,8 +816,7 @@ void xics_migrate_irqs_away(void)
672 unsigned int irq, virq, cpu = smp_processor_id(); 816 unsigned int irq, virq, cpu = smp_processor_id();
673 817
674 /* Reject any interrupt that was queued to us... */ 818 /* Reject any interrupt that was queued to us... */
675 ops->cppr_info(cpu, 0); 819 xics_set_cpu_priority(cpu, 0);
676 iosync();
677 820
678 /* remove ourselves from the global interrupt queue */ 821 /* remove ourselves from the global interrupt queue */
679 status = rtas_set_indicator(GLOBAL_INTERRUPT_QUEUE, 822 status = rtas_set_indicator(GLOBAL_INTERRUPT_QUEUE,
@@ -681,29 +824,28 @@ void xics_migrate_irqs_away(void)
681 WARN_ON(status < 0); 824 WARN_ON(status < 0);
682 825
683 /* Allow IPIs again... */ 826 /* Allow IPIs again... */
684 ops->cppr_info(cpu, DEFAULT_PRIORITY); 827 xics_set_cpu_priority(cpu, DEFAULT_PRIORITY);
685 iosync();
686 828
687 for_each_irq(virq) { 829 for_each_irq(virq) {
688 irq_desc_t *desc; 830 struct irq_desc *desc;
689 int xics_status[2]; 831 int xics_status[2];
690 unsigned long flags; 832 unsigned long flags;
691 833
692 /* We cant set affinity on ISA interrupts */ 834 /* We cant set affinity on ISA interrupts */
693 if (virq < irq_offset_value()) 835 if (virq < NUM_ISA_INTERRUPTS)
694 continue; 836 continue;
695 837 if (irq_map[virq].host != xics_host)
696 desc = get_irq_desc(virq); 838 continue;
697 irq = virt_irq_to_real(irq_offset_down(virq)); 839 irq = (unsigned int)irq_map[virq].hwirq;
698
699 /* We need to get IPIs still. */ 840 /* We need to get IPIs still. */
700 if (irq == XICS_IPI || irq == NO_IRQ) 841 if (irq == XICS_IPI || irq == XICS_IRQ_SPURIOUS)
701 continue; 842 continue;
843 desc = get_irq_desc(virq);
702 844
703 /* We only need to migrate enabled IRQS */ 845 /* We only need to migrate enabled IRQS */
704 if (desc == NULL || desc->handler == NULL 846 if (desc == NULL || desc->chip == NULL
705 || desc->action == NULL 847 || desc->action == NULL
706 || desc->handler->set_affinity == NULL) 848 || desc->chip->set_affinity == NULL)
707 continue; 849 continue;
708 850
709 spin_lock_irqsave(&desc->lock, flags); 851 spin_lock_irqsave(&desc->lock, flags);
@@ -728,8 +870,8 @@ void xics_migrate_irqs_away(void)
728 virq, cpu); 870 virq, cpu);
729 871
730 /* Reset affinity to all cpus */ 872 /* Reset affinity to all cpus */
731 desc->handler->set_affinity(virq, CPU_MASK_ALL); 873 desc->chip->set_affinity(virq, CPU_MASK_ALL);
732 irq_affinity[virq] = CPU_MASK_ALL; 874 irq_desc[irq].affinity = CPU_MASK_ALL;
733unlock: 875unlock:
734 spin_unlock_irqrestore(&desc->lock, flags); 876 spin_unlock_irqrestore(&desc->lock, flags);
735 } 877 }
diff --git a/arch/powerpc/platforms/pseries/xics.h b/arch/powerpc/platforms/pseries/xics.h
index e14c70868f1d..6ee1055b0ffb 100644
--- a/arch/powerpc/platforms/pseries/xics.h
+++ b/arch/powerpc/platforms/pseries/xics.h
@@ -14,13 +14,12 @@
14 14
15#include <linux/cache.h> 15#include <linux/cache.h>
16 16
17void xics_init_IRQ(void); 17extern void xics_init_IRQ(void);
18int xics_get_irq(struct pt_regs *); 18extern void xics_setup_cpu(void);
19void xics_setup_cpu(void); 19extern void xics_teardown_cpu(int secondary);
20void xics_teardown_cpu(int secondary); 20extern void xics_cause_IPI(int cpu);
21void xics_cause_IPI(int cpu); 21extern void xics_request_IPIs(void);
22void xics_request_IPIs(void); 22extern void xics_migrate_irqs_away(void);
23void xics_migrate_irqs_away(void);
24 23
25/* first argument is ignored for now*/ 24/* first argument is ignored for now*/
26void pSeriesLP_cppr_info(int n_cpu, u8 value); 25void pSeriesLP_cppr_info(int n_cpu, u8 value);
@@ -31,4 +30,8 @@ struct xics_ipi_struct {
31 30
32extern struct xics_ipi_struct xics_ipi_message[NR_CPUS] __cacheline_aligned; 31extern struct xics_ipi_struct xics_ipi_message[NR_CPUS] __cacheline_aligned;
33 32
33struct irq_desc;
34extern void pseries_8259_cascade(unsigned int irq, struct irq_desc *desc,
35 struct pt_regs *regs);
36
34#endif /* _POWERPC_KERNEL_XICS_H */ 37#endif /* _POWERPC_KERNEL_XICS_H */
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
index cef95b023730..cebfae242602 100644
--- a/arch/powerpc/sysdev/Makefile
+++ b/arch/powerpc/sysdev/Makefile
@@ -4,7 +4,6 @@ endif
4 4
5obj-$(CONFIG_MPIC) += mpic.o 5obj-$(CONFIG_MPIC) += mpic.o
6obj-$(CONFIG_PPC_INDIRECT_PCI) += indirect_pci.o 6obj-$(CONFIG_PPC_INDIRECT_PCI) += indirect_pci.o
7obj-$(CONFIG_PPC_I8259) += i8259.o
8obj-$(CONFIG_PPC_MPC106) += grackle.o 7obj-$(CONFIG_PPC_MPC106) += grackle.o
9obj-$(CONFIG_BOOKE) += dcr.o 8obj-$(CONFIG_BOOKE) += dcr.o
10obj-$(CONFIG_40x) += dcr.o 9obj-$(CONFIG_40x) += dcr.o
@@ -12,3 +11,9 @@ obj-$(CONFIG_U3_DART) += dart_iommu.o
12obj-$(CONFIG_MMIO_NVRAM) += mmio_nvram.o 11obj-$(CONFIG_MMIO_NVRAM) += mmio_nvram.o
13obj-$(CONFIG_PPC_83xx) += ipic.o 12obj-$(CONFIG_PPC_83xx) += ipic.o
14obj-$(CONFIG_FSL_SOC) += fsl_soc.o 13obj-$(CONFIG_FSL_SOC) += fsl_soc.o
14obj-$(CONFIG_PPC_TODC) += todc.o
15obj-$(CONFIG_TSI108_BRIDGE) += tsi108_pci.o tsi108_dev.o
16
17ifeq ($(CONFIG_PPC_MERGE),y)
18obj-$(CONFIG_PPC_I8259) += i8259.o
19 endif
diff --git a/arch/powerpc/sysdev/dart.h b/arch/powerpc/sysdev/dart.h
index c2d05763ccbe..1c8817c4835e 100644
--- a/arch/powerpc/sysdev/dart.h
+++ b/arch/powerpc/sysdev/dart.h
@@ -47,8 +47,12 @@
47/* U4 registers */ 47/* U4 registers */
48#define DART_BASE_U4_BASE_MASK 0xffffff 48#define DART_BASE_U4_BASE_MASK 0xffffff
49#define DART_BASE_U4_BASE_SHIFT 0 49#define DART_BASE_U4_BASE_SHIFT 0
50#define DART_CNTL_U4_FLUSHTLB 0x20000000
51#define DART_CNTL_U4_ENABLE 0x80000000 50#define DART_CNTL_U4_ENABLE 0x80000000
51#define DART_CNTL_U4_IONE 0x40000000
52#define DART_CNTL_U4_FLUSHTLB 0x20000000
53#define DART_CNTL_U4_IDLE 0x10000000
54#define DART_CNTL_U4_PAR_EN 0x08000000
55#define DART_CNTL_U4_IONE_MASK 0x07ffffff
52#define DART_SIZE_U4_SIZE_MASK 0x1fff 56#define DART_SIZE_U4_SIZE_MASK 0x1fff
53#define DART_SIZE_U4_SIZE_SHIFT 0 57#define DART_SIZE_U4_SIZE_SHIFT 0
54 58
diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c
index 6232091cc72b..e32fadde1f77 100644
--- a/arch/powerpc/sysdev/dart_iommu.c
+++ b/arch/powerpc/sysdev/dart_iommu.c
@@ -27,7 +27,6 @@
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 */ 28 */
29 29
30#include <linux/config.h>
31#include <linux/init.h> 30#include <linux/init.h>
32#include <linux/types.h> 31#include <linux/types.h>
33#include <linux/slab.h> 32#include <linux/slab.h>
@@ -101,8 +100,8 @@ retry:
101 if (l == (1L << limit)) { 100 if (l == (1L << limit)) {
102 if (limit < 4) { 101 if (limit < 4) {
103 limit++; 102 limit++;
104 reg = DART_IN(DART_CNTL); 103 reg = DART_IN(DART_CNTL);
105 reg &= ~inv_bit; 104 reg &= ~inv_bit;
106 DART_OUT(DART_CNTL, reg); 105 DART_OUT(DART_CNTL, reg);
107 goto retry; 106 goto retry;
108 } else 107 } else
@@ -111,11 +110,39 @@ retry:
111 } 110 }
112} 111}
113 112
113static inline void dart_tlb_invalidate_one(unsigned long bus_rpn)
114{
115 unsigned int reg;
116 unsigned int l, limit;
117
118 reg = DART_CNTL_U4_ENABLE | DART_CNTL_U4_IONE |
119 (bus_rpn & DART_CNTL_U4_IONE_MASK);
120 DART_OUT(DART_CNTL, reg);
121
122 limit = 0;
123wait_more:
124 l = 0;
125 while ((DART_IN(DART_CNTL) & DART_CNTL_U4_IONE) && l < (1L << limit)) {
126 rmb();
127 l++;
128 }
129
130 if (l == (1L << limit)) {
131 if (limit < 4) {
132 limit++;
133 goto wait_more;
134 } else
135 panic("DART: TLB did not flush after waiting a long "
136 "time. Buggy U4 ?");
137 }
138}
139
114static void dart_flush(struct iommu_table *tbl) 140static void dart_flush(struct iommu_table *tbl)
115{ 141{
116 if (dart_dirty) 142 if (dart_dirty) {
117 dart_tlb_invalidate_all(); 143 dart_tlb_invalidate_all();
118 dart_dirty = 0; 144 dart_dirty = 0;
145 }
119} 146}
120 147
121static void dart_build(struct iommu_table *tbl, long index, 148static void dart_build(struct iommu_table *tbl, long index,
@@ -124,6 +151,7 @@ static void dart_build(struct iommu_table *tbl, long index,
124{ 151{
125 unsigned int *dp; 152 unsigned int *dp;
126 unsigned int rpn; 153 unsigned int rpn;
154 long l;
127 155
128 DBG("dart: build at: %lx, %lx, addr: %x\n", index, npages, uaddr); 156 DBG("dart: build at: %lx, %lx, addr: %x\n", index, npages, uaddr);
129 157
@@ -135,7 +163,8 @@ static void dart_build(struct iommu_table *tbl, long index,
135 /* On U3, all memory is contigous, so we can move this 163 /* On U3, all memory is contigous, so we can move this
136 * out of the loop. 164 * out of the loop.
137 */ 165 */
138 while (npages--) { 166 l = npages;
167 while (l--) {
139 rpn = virt_to_abs(uaddr) >> DART_PAGE_SHIFT; 168 rpn = virt_to_abs(uaddr) >> DART_PAGE_SHIFT;
140 169
141 *(dp++) = DARTMAP_VALID | (rpn & DARTMAP_RPNMASK); 170 *(dp++) = DARTMAP_VALID | (rpn & DARTMAP_RPNMASK);
@@ -143,7 +172,14 @@ static void dart_build(struct iommu_table *tbl, long index,
143 uaddr += DART_PAGE_SIZE; 172 uaddr += DART_PAGE_SIZE;
144 } 173 }
145 174
146 dart_dirty = 1; 175 if (dart_is_u4) {
176 rpn = index;
177 mb(); /* make sure all updates have reached memory */
178 while (npages--)
179 dart_tlb_invalidate_one(rpn++);
180 } else {
181 dart_dirty = 1;
182 }
147} 183}
148 184
149 185
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 71a3275935ec..e983972132d8 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -9,7 +9,6 @@
9 * option) any later version. 9 * option) any later version.
10 */ 10 */
11 11
12#include <linux/config.h>
13#include <linux/stddef.h> 12#include <linux/stddef.h>
14#include <linux/kernel.h> 13#include <linux/kernel.h>
15#include <linux/init.h> 14#include <linux/init.h>
diff --git a/arch/powerpc/sysdev/i8259.c b/arch/powerpc/sysdev/i8259.c
index b7ac32fdd776..72c73a6105cd 100644
--- a/arch/powerpc/sysdev/i8259.c
+++ b/arch/powerpc/sysdev/i8259.c
@@ -6,11 +6,16 @@
6 * as published by the Free Software Foundation; either version 6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version. 7 * 2 of the License, or (at your option) any later version.
8 */ 8 */
9#undef DEBUG
10
9#include <linux/init.h> 11#include <linux/init.h>
10#include <linux/ioport.h> 12#include <linux/ioport.h>
11#include <linux/interrupt.h> 13#include <linux/interrupt.h>
14#include <linux/kernel.h>
15#include <linux/delay.h>
12#include <asm/io.h> 16#include <asm/io.h>
13#include <asm/i8259.h> 17#include <asm/i8259.h>
18#include <asm/prom.h>
14 19
15static volatile void __iomem *pci_intack; /* RO, gives us the irq vector */ 20static volatile void __iomem *pci_intack; /* RO, gives us the irq vector */
16 21
@@ -20,7 +25,8 @@ static unsigned char cached_8259[2] = { 0xff, 0xff };
20 25
21static DEFINE_SPINLOCK(i8259_lock); 26static DEFINE_SPINLOCK(i8259_lock);
22 27
23static int i8259_pic_irq_offset; 28static struct device_node *i8259_node;
29static struct irq_host *i8259_host;
24 30
25/* 31/*
26 * Acknowledge the IRQ using either the PCI host bridge's interrupt 32 * Acknowledge the IRQ using either the PCI host bridge's interrupt
@@ -28,16 +34,18 @@ static int i8259_pic_irq_offset;
28 * which is called. It should be noted that polling is broken on some 34 * which is called. It should be noted that polling is broken on some
29 * IBM and Motorola PReP boxes so we must use the int-ack feature on them. 35 * IBM and Motorola PReP boxes so we must use the int-ack feature on them.
30 */ 36 */
31int i8259_irq(struct pt_regs *regs) 37unsigned int i8259_irq(struct pt_regs *regs)
32{ 38{
33 int irq; 39 int irq;
34 40 int lock = 0;
35 spin_lock(&i8259_lock);
36 41
37 /* Either int-ack or poll for the IRQ */ 42 /* Either int-ack or poll for the IRQ */
38 if (pci_intack) 43 if (pci_intack)
39 irq = readb(pci_intack); 44 irq = readb(pci_intack);
40 else { 45 else {
46 spin_lock(&i8259_lock);
47 lock = 1;
48
41 /* Perform an interrupt acknowledge cycle on controller 1. */ 49 /* Perform an interrupt acknowledge cycle on controller 1. */
42 outb(0x0C, 0x20); /* prepare for poll */ 50 outb(0x0C, 0x20); /* prepare for poll */
43 irq = inb(0x20) & 7; 51 irq = inb(0x20) & 7;
@@ -62,16 +70,13 @@ int i8259_irq(struct pt_regs *regs)
62 if (!pci_intack) 70 if (!pci_intack)
63 outb(0x0B, 0x20); /* ISR register */ 71 outb(0x0B, 0x20); /* ISR register */
64 if(~inb(0x20) & 0x80) 72 if(~inb(0x20) & 0x80)
65 irq = -1; 73 irq = NO_IRQ;
66 } 74 } else if (irq == 0xff)
75 irq = NO_IRQ;
67 76
68 spin_unlock(&i8259_lock); 77 if (lock)
69 return irq + i8259_pic_irq_offset; 78 spin_unlock(&i8259_lock);
70} 79 return irq;
71
72int i8259_irq_cascade(struct pt_regs *regs, void *unused)
73{
74 return i8259_irq(regs);
75} 80}
76 81
77static void i8259_mask_and_ack_irq(unsigned int irq_nr) 82static void i8259_mask_and_ack_irq(unsigned int irq_nr)
@@ -79,7 +84,6 @@ static void i8259_mask_and_ack_irq(unsigned int irq_nr)
79 unsigned long flags; 84 unsigned long flags;
80 85
81 spin_lock_irqsave(&i8259_lock, flags); 86 spin_lock_irqsave(&i8259_lock, flags);
82 irq_nr -= i8259_pic_irq_offset;
83 if (irq_nr > 7) { 87 if (irq_nr > 7) {
84 cached_A1 |= 1 << (irq_nr-8); 88 cached_A1 |= 1 << (irq_nr-8);
85 inb(0xA1); /* DUMMY */ 89 inb(0xA1); /* DUMMY */
@@ -105,8 +109,9 @@ static void i8259_mask_irq(unsigned int irq_nr)
105{ 109{
106 unsigned long flags; 110 unsigned long flags;
107 111
112 pr_debug("i8259_mask_irq(%d)\n", irq_nr);
113
108 spin_lock_irqsave(&i8259_lock, flags); 114 spin_lock_irqsave(&i8259_lock, flags);
109 irq_nr -= i8259_pic_irq_offset;
110 if (irq_nr < 8) 115 if (irq_nr < 8)
111 cached_21 |= 1 << irq_nr; 116 cached_21 |= 1 << irq_nr;
112 else 117 else
@@ -119,8 +124,9 @@ static void i8259_unmask_irq(unsigned int irq_nr)
119{ 124{
120 unsigned long flags; 125 unsigned long flags;
121 126
127 pr_debug("i8259_unmask_irq(%d)\n", irq_nr);
128
122 spin_lock_irqsave(&i8259_lock, flags); 129 spin_lock_irqsave(&i8259_lock, flags);
123 irq_nr -= i8259_pic_irq_offset;
124 if (irq_nr < 8) 130 if (irq_nr < 8)
125 cached_21 &= ~(1 << irq_nr); 131 cached_21 &= ~(1 << irq_nr);
126 else 132 else
@@ -129,19 +135,11 @@ static void i8259_unmask_irq(unsigned int irq_nr)
129 spin_unlock_irqrestore(&i8259_lock, flags); 135 spin_unlock_irqrestore(&i8259_lock, flags);
130} 136}
131 137
132static void i8259_end_irq(unsigned int irq) 138static struct irq_chip i8259_pic = {
133{ 139 .typename = " i8259 ",
134 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)) 140 .mask = i8259_mask_irq,
135 && irq_desc[irq].action) 141 .unmask = i8259_unmask_irq,
136 i8259_unmask_irq(irq); 142 .mask_ack = i8259_mask_and_ack_irq,
137}
138
139struct hw_interrupt_type i8259_pic = {
140 .typename = " i8259 ",
141 .enable = i8259_unmask_irq,
142 .disable = i8259_mask_irq,
143 .ack = i8259_mask_and_ack_irq,
144 .end = i8259_end_irq,
145}; 143};
146 144
147static struct resource pic1_iores = { 145static struct resource pic1_iores = {
@@ -165,25 +163,84 @@ static struct resource pic_edgectrl_iores = {
165 .flags = IORESOURCE_BUSY, 163 .flags = IORESOURCE_BUSY,
166}; 164};
167 165
168static struct irqaction i8259_irqaction = { 166static int i8259_host_match(struct irq_host *h, struct device_node *node)
169 .handler = no_action, 167{
170 .flags = SA_INTERRUPT, 168 return i8259_node == NULL || i8259_node == node;
171 .mask = CPU_MASK_NONE, 169}
172 .name = "82c59 secondary cascade", 170
171static int i8259_host_map(struct irq_host *h, unsigned int virq,
172 irq_hw_number_t hw, unsigned int flags)
173{
174 pr_debug("i8259_host_map(%d, 0x%lx)\n", virq, hw);
175
176 /* We block the internal cascade */
177 if (hw == 2)
178 get_irq_desc(virq)->status |= IRQ_NOREQUEST;
179
180 /* We use the level stuff only for now, we might want to
181 * be more cautious here but that works for now
182 */
183 get_irq_desc(virq)->status |= IRQ_LEVEL;
184 set_irq_chip_and_handler(virq, &i8259_pic, handle_level_irq);
185 return 0;
186}
187
188static void i8259_host_unmap(struct irq_host *h, unsigned int virq)
189{
190 /* Make sure irq is masked in hardware */
191 i8259_mask_irq(virq);
192
193 /* remove chip and handler */
194 set_irq_chip_and_handler(virq, NULL, NULL);
195
196 /* Make sure it's completed */
197 synchronize_irq(virq);
198}
199
200static int i8259_host_xlate(struct irq_host *h, struct device_node *ct,
201 u32 *intspec, unsigned int intsize,
202 irq_hw_number_t *out_hwirq, unsigned int *out_flags)
203{
204 static unsigned char map_isa_senses[4] = {
205 IRQ_TYPE_LEVEL_LOW,
206 IRQ_TYPE_LEVEL_HIGH,
207 IRQ_TYPE_EDGE_FALLING,
208 IRQ_TYPE_EDGE_RISING,
209 };
210
211 *out_hwirq = intspec[0];
212 if (intsize > 1 && intspec[1] < 4)
213 *out_flags = map_isa_senses[intspec[1]];
214 else
215 *out_flags = IRQ_TYPE_NONE;
216
217 return 0;
218}
219
220static struct irq_host_ops i8259_host_ops = {
221 .match = i8259_host_match,
222 .map = i8259_host_map,
223 .unmap = i8259_host_unmap,
224 .xlate = i8259_host_xlate,
173}; 225};
174 226
175/* 227/****
176 * i8259_init() 228 * i8259_init - Initialize the legacy controller
177 * intack_addr - PCI interrupt acknowledge (real) address which will return 229 * @node: device node of the legacy PIC (can be NULL, but then, it will match
178 * the active irq from the 8259 230 * all interrupts, so beware)
231 * @intack_addr: PCI interrupt acknowledge (real) address which will return
232 * the active irq from the 8259
179 */ 233 */
180void __init i8259_init(unsigned long intack_addr, int offset) 234void i8259_init(struct device_node *node, unsigned long intack_addr)
181{ 235{
182 unsigned long flags; 236 unsigned long flags;
183 int i;
184 237
238 /* initialize the controller */
185 spin_lock_irqsave(&i8259_lock, flags); 239 spin_lock_irqsave(&i8259_lock, flags);
186 i8259_pic_irq_offset = offset; 240
241 /* Mask all first */
242 outb(0xff, 0xA1);
243 outb(0xff, 0x21);
187 244
188 /* init master interrupt controller */ 245 /* init master interrupt controller */
189 outb(0x11, 0x20); /* Start init sequence */ 246 outb(0x11, 0x20); /* Start init sequence */
@@ -197,21 +254,36 @@ void __init i8259_init(unsigned long intack_addr, int offset)
197 outb(0x02, 0xA1); /* edge triggered, Cascade (slave) on IRQ2 */ 254 outb(0x02, 0xA1); /* edge triggered, Cascade (slave) on IRQ2 */
198 outb(0x01, 0xA1); /* Select 8086 mode */ 255 outb(0x01, 0xA1); /* Select 8086 mode */
199 256
257 /* That thing is slow */
258 udelay(100);
259
200 /* always read ISR */ 260 /* always read ISR */
201 outb(0x0B, 0x20); 261 outb(0x0B, 0x20);
202 outb(0x0B, 0xA0); 262 outb(0x0B, 0xA0);
203 263
204 /* Mask all interrupts */ 264 /* Unmask the internal cascade */
265 cached_21 &= ~(1 << 2);
266
267 /* Set interrupt masks */
205 outb(cached_A1, 0xA1); 268 outb(cached_A1, 0xA1);
206 outb(cached_21, 0x21); 269 outb(cached_21, 0x21);
207 270
208 spin_unlock_irqrestore(&i8259_lock, flags); 271 spin_unlock_irqrestore(&i8259_lock, flags);
209 272
210 for (i = 0; i < NUM_ISA_INTERRUPTS; ++i) 273 /* create a legacy host */
211 irq_desc[offset + i].handler = &i8259_pic; 274 if (node)
275 i8259_node = of_node_get(node);
276 i8259_host = irq_alloc_host(IRQ_HOST_MAP_LEGACY, 0, &i8259_host_ops, 0);
277 if (i8259_host == NULL) {
278 printk(KERN_ERR "i8259: failed to allocate irq host !\n");
279 return;
280 }
212 281
213 /* reserve our resources */ 282 /* reserve our resources */
214 setup_irq(offset + 2, &i8259_irqaction); 283 /* XXX should we continue doing that ? it seems to cause problems
284 * with further requesting of PCI IO resources for that range...
285 * need to look into it.
286 */
215 request_resource(&ioport_resource, &pic1_iores); 287 request_resource(&ioport_resource, &pic1_iores);
216 request_resource(&ioport_resource, &pic2_iores); 288 request_resource(&ioport_resource, &pic2_iores);
217 request_resource(&ioport_resource, &pic_edgectrl_iores); 289 request_resource(&ioport_resource, &pic_edgectrl_iores);
@@ -219,4 +291,5 @@ void __init i8259_init(unsigned long intack_addr, int offset)
219 if (intack_addr != 0) 291 if (intack_addr != 0)
220 pci_intack = ioremap(intack_addr, 1); 292 pci_intack = ioremap(intack_addr, 1);
221 293
294 printk(KERN_INFO "i8259 legacy interrupt controller initialized\n");
222} 295}
diff --git a/arch/powerpc/sysdev/ipic.c b/arch/powerpc/sysdev/ipic.c
index 8f01e0f1d847..46801f5ec03f 100644
--- a/arch/powerpc/sysdev/ipic.c
+++ b/arch/powerpc/sysdev/ipic.c
@@ -472,7 +472,7 @@ void __init ipic_init(phys_addr_t phys_addr,
472 ipic_write(primary_ipic->regs, IPIC_SEMSR, temp); 472 ipic_write(primary_ipic->regs, IPIC_SEMSR, temp);
473 473
474 for (i = 0 ; i < NR_IPIC_INTS ; i++) { 474 for (i = 0 ; i < NR_IPIC_INTS ; i++) {
475 irq_desc[i+irq_offset].handler = &ipic; 475 irq_desc[i+irq_offset].chip = &ipic;
476 irq_desc[i+irq_offset].status = IRQ_LEVEL; 476 irq_desc[i+irq_offset].status = IRQ_LEVEL;
477 } 477 }
478 478
diff --git a/arch/powerpc/sysdev/mmio_nvram.c b/arch/powerpc/sysdev/mmio_nvram.c
index 74e0d31a3559..615350d46b52 100644
--- a/arch/powerpc/sysdev/mmio_nvram.c
+++ b/arch/powerpc/sysdev/mmio_nvram.c
@@ -32,7 +32,7 @@
32 32
33static void __iomem *mmio_nvram_start; 33static void __iomem *mmio_nvram_start;
34static long mmio_nvram_len; 34static long mmio_nvram_len;
35static spinlock_t mmio_nvram_lock = SPIN_LOCK_UNLOCKED; 35static DEFINE_SPINLOCK(mmio_nvram_lock);
36 36
37static ssize_t mmio_nvram_read(char *buf, size_t count, loff_t *index) 37static ssize_t mmio_nvram_read(char *buf, size_t count, loff_t *index)
38{ 38{
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index bffe50d02c99..7d31d7cc392d 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -17,7 +17,6 @@
17#undef DEBUG_IRQ 17#undef DEBUG_IRQ
18#undef DEBUG_LOW 18#undef DEBUG_LOW
19 19
20#include <linux/config.h>
21#include <linux/types.h> 20#include <linux/types.h>
22#include <linux/kernel.h> 21#include <linux/kernel.h>
23#include <linux/init.h> 22#include <linux/init.h>
@@ -101,8 +100,8 @@ static inline u32 _mpic_cpu_read(struct mpic *mpic, unsigned int reg)
101 100
102 if (mpic->flags & MPIC_PRIMARY) 101 if (mpic->flags & MPIC_PRIMARY)
103 cpu = hard_smp_processor_id(); 102 cpu = hard_smp_processor_id();
104 103 return _mpic_read(mpic->flags & MPIC_BIG_ENDIAN,
105 return _mpic_read(mpic->flags & MPIC_BIG_ENDIAN, mpic->cpuregs[cpu], reg); 104 mpic->cpuregs[cpu], reg);
106} 105}
107 106
108static inline void _mpic_cpu_write(struct mpic *mpic, unsigned int reg, u32 value) 107static inline void _mpic_cpu_write(struct mpic *mpic, unsigned int reg, u32 value)
@@ -341,27 +340,19 @@ static void __init mpic_scan_ht_pics(struct mpic *mpic)
341#endif /* CONFIG_MPIC_BROKEN_U3 */ 340#endif /* CONFIG_MPIC_BROKEN_U3 */
342 341
343 342
343#define mpic_irq_to_hw(virq) ((unsigned int)irq_map[virq].hwirq)
344
344/* Find an mpic associated with a given linux interrupt */ 345/* Find an mpic associated with a given linux interrupt */
345static struct mpic *mpic_find(unsigned int irq, unsigned int *is_ipi) 346static struct mpic *mpic_find(unsigned int irq, unsigned int *is_ipi)
346{ 347{
347 struct mpic *mpic = mpics; 348 unsigned int src = mpic_irq_to_hw(irq);
348 349
349 while(mpic) { 350 if (irq < NUM_ISA_INTERRUPTS)
350 /* search IPIs first since they may override the main interrupts */ 351 return NULL;
351 if (irq >= mpic->ipi_offset && irq < (mpic->ipi_offset + 4)) { 352 if (is_ipi)
352 if (is_ipi) 353 *is_ipi = (src >= MPIC_VEC_IPI_0 && src <= MPIC_VEC_IPI_3);
353 *is_ipi = 1; 354
354 return mpic; 355 return irq_desc[irq].chip_data;
355 }
356 if (irq >= mpic->irq_offset &&
357 irq < (mpic->irq_offset + mpic->irq_count)) {
358 if (is_ipi)
359 *is_ipi = 0;
360 return mpic;
361 }
362 mpic = mpic -> next;
363 }
364 return NULL;
365} 356}
366 357
367/* Convert a cpu mask from logical to physical cpu numbers. */ 358/* Convert a cpu mask from logical to physical cpu numbers. */
@@ -379,14 +370,14 @@ static inline u32 mpic_physmask(u32 cpumask)
379/* Get the mpic structure from the IPI number */ 370/* Get the mpic structure from the IPI number */
380static inline struct mpic * mpic_from_ipi(unsigned int ipi) 371static inline struct mpic * mpic_from_ipi(unsigned int ipi)
381{ 372{
382 return container_of(irq_desc[ipi].handler, struct mpic, hc_ipi); 373 return irq_desc[ipi].chip_data;
383} 374}
384#endif 375#endif
385 376
386/* Get the mpic structure from the irq number */ 377/* Get the mpic structure from the irq number */
387static inline struct mpic * mpic_from_irq(unsigned int irq) 378static inline struct mpic * mpic_from_irq(unsigned int irq)
388{ 379{
389 return container_of(irq_desc[irq].handler, struct mpic, hc_irq); 380 return irq_desc[irq].chip_data;
390} 381}
391 382
392/* Send an EOI */ 383/* Send an EOI */
@@ -399,9 +390,7 @@ static inline void mpic_eoi(struct mpic *mpic)
399#ifdef CONFIG_SMP 390#ifdef CONFIG_SMP
400static irqreturn_t mpic_ipi_action(int irq, void *dev_id, struct pt_regs *regs) 391static irqreturn_t mpic_ipi_action(int irq, void *dev_id, struct pt_regs *regs)
401{ 392{
402 struct mpic *mpic = dev_id; 393 smp_message_recv(mpic_irq_to_hw(irq) - MPIC_VEC_IPI_0, regs);
403
404 smp_message_recv(irq - mpic->ipi_offset, regs);
405 return IRQ_HANDLED; 394 return IRQ_HANDLED;
406} 395}
407#endif /* CONFIG_SMP */ 396#endif /* CONFIG_SMP */
@@ -411,11 +400,11 @@ static irqreturn_t mpic_ipi_action(int irq, void *dev_id, struct pt_regs *regs)
411 */ 400 */
412 401
413 402
414static void mpic_enable_irq(unsigned int irq) 403static void mpic_unmask_irq(unsigned int irq)
415{ 404{
416 unsigned int loops = 100000; 405 unsigned int loops = 100000;
417 struct mpic *mpic = mpic_from_irq(irq); 406 struct mpic *mpic = mpic_from_irq(irq);
418 unsigned int src = irq - mpic->irq_offset; 407 unsigned int src = mpic_irq_to_hw(irq);
419 408
420 DBG("%p: %s: enable_irq: %d (src %d)\n", mpic, mpic->name, irq, src); 409 DBG("%p: %s: enable_irq: %d (src %d)\n", mpic, mpic->name, irq, src);
421 410
@@ -430,39 +419,13 @@ static void mpic_enable_irq(unsigned int irq)
430 break; 419 break;
431 } 420 }
432 } while(mpic_irq_read(src, MPIC_IRQ_VECTOR_PRI) & MPIC_VECPRI_MASK); 421 } while(mpic_irq_read(src, MPIC_IRQ_VECTOR_PRI) & MPIC_VECPRI_MASK);
433
434#ifdef CONFIG_MPIC_BROKEN_U3
435 if (mpic->flags & MPIC_BROKEN_U3) {
436 unsigned int src = irq - mpic->irq_offset;
437 if (mpic_is_ht_interrupt(mpic, src) &&
438 (irq_desc[irq].status & IRQ_LEVEL))
439 mpic_ht_end_irq(mpic, src);
440 }
441#endif /* CONFIG_MPIC_BROKEN_U3 */
442}
443
444static unsigned int mpic_startup_irq(unsigned int irq)
445{
446#ifdef CONFIG_MPIC_BROKEN_U3
447 struct mpic *mpic = mpic_from_irq(irq);
448 unsigned int src = irq - mpic->irq_offset;
449#endif /* CONFIG_MPIC_BROKEN_U3 */
450
451 mpic_enable_irq(irq);
452
453#ifdef CONFIG_MPIC_BROKEN_U3
454 if (mpic_is_ht_interrupt(mpic, src))
455 mpic_startup_ht_interrupt(mpic, src, irq_desc[irq].status);
456#endif /* CONFIG_MPIC_BROKEN_U3 */
457
458 return 0;
459} 422}
460 423
461static void mpic_disable_irq(unsigned int irq) 424static void mpic_mask_irq(unsigned int irq)
462{ 425{
463 unsigned int loops = 100000; 426 unsigned int loops = 100000;
464 struct mpic *mpic = mpic_from_irq(irq); 427 struct mpic *mpic = mpic_from_irq(irq);
465 unsigned int src = irq - mpic->irq_offset; 428 unsigned int src = mpic_irq_to_hw(irq);
466 429
467 DBG("%s: disable_irq: %d (src %d)\n", mpic->name, irq, src); 430 DBG("%s: disable_irq: %d (src %d)\n", mpic->name, irq, src);
468 431
@@ -479,23 +442,58 @@ static void mpic_disable_irq(unsigned int irq)
479 } while(!(mpic_irq_read(src, MPIC_IRQ_VECTOR_PRI) & MPIC_VECPRI_MASK)); 442 } while(!(mpic_irq_read(src, MPIC_IRQ_VECTOR_PRI) & MPIC_VECPRI_MASK));
480} 443}
481 444
482static void mpic_shutdown_irq(unsigned int irq) 445static void mpic_end_irq(unsigned int irq)
483{ 446{
447 struct mpic *mpic = mpic_from_irq(irq);
448
449#ifdef DEBUG_IRQ
450 DBG("%s: end_irq: %d\n", mpic->name, irq);
451#endif
452 /* We always EOI on end_irq() even for edge interrupts since that
453 * should only lower the priority, the MPIC should have properly
454 * latched another edge interrupt coming in anyway
455 */
456
457 mpic_eoi(mpic);
458}
459
484#ifdef CONFIG_MPIC_BROKEN_U3 460#ifdef CONFIG_MPIC_BROKEN_U3
461
462static void mpic_unmask_ht_irq(unsigned int irq)
463{
485 struct mpic *mpic = mpic_from_irq(irq); 464 struct mpic *mpic = mpic_from_irq(irq);
486 unsigned int src = irq - mpic->irq_offset; 465 unsigned int src = mpic_irq_to_hw(irq);
487 466
488 if (mpic_is_ht_interrupt(mpic, src)) 467 mpic_unmask_irq(irq);
489 mpic_shutdown_ht_interrupt(mpic, src, irq_desc[irq].status);
490 468
491#endif /* CONFIG_MPIC_BROKEN_U3 */ 469 if (irq_desc[irq].status & IRQ_LEVEL)
470 mpic_ht_end_irq(mpic, src);
471}
472
473static unsigned int mpic_startup_ht_irq(unsigned int irq)
474{
475 struct mpic *mpic = mpic_from_irq(irq);
476 unsigned int src = mpic_irq_to_hw(irq);
477
478 mpic_unmask_irq(irq);
479 mpic_startup_ht_interrupt(mpic, src, irq_desc[irq].status);
492 480
493 mpic_disable_irq(irq); 481 return 0;
494} 482}
495 483
496static void mpic_end_irq(unsigned int irq) 484static void mpic_shutdown_ht_irq(unsigned int irq)
497{ 485{
498 struct mpic *mpic = mpic_from_irq(irq); 486 struct mpic *mpic = mpic_from_irq(irq);
487 unsigned int src = mpic_irq_to_hw(irq);
488
489 mpic_shutdown_ht_interrupt(mpic, src, irq_desc[irq].status);
490 mpic_mask_irq(irq);
491}
492
493static void mpic_end_ht_irq(unsigned int irq)
494{
495 struct mpic *mpic = mpic_from_irq(irq);
496 unsigned int src = mpic_irq_to_hw(irq);
499 497
500#ifdef DEBUG_IRQ 498#ifdef DEBUG_IRQ
501 DBG("%s: end_irq: %d\n", mpic->name, irq); 499 DBG("%s: end_irq: %d\n", mpic->name, irq);
@@ -505,30 +503,25 @@ static void mpic_end_irq(unsigned int irq)
505 * latched another edge interrupt coming in anyway 503 * latched another edge interrupt coming in anyway
506 */ 504 */
507 505
508#ifdef CONFIG_MPIC_BROKEN_U3 506 if (irq_desc[irq].status & IRQ_LEVEL)
509 if (mpic->flags & MPIC_BROKEN_U3) { 507 mpic_ht_end_irq(mpic, src);
510 unsigned int src = irq - mpic->irq_offset;
511 if (mpic_is_ht_interrupt(mpic, src) &&
512 (irq_desc[irq].status & IRQ_LEVEL))
513 mpic_ht_end_irq(mpic, src);
514 }
515#endif /* CONFIG_MPIC_BROKEN_U3 */
516
517 mpic_eoi(mpic); 508 mpic_eoi(mpic);
518} 509}
519 510
511#endif /* CONFIG_MPIC_BROKEN_U3 */
512
520#ifdef CONFIG_SMP 513#ifdef CONFIG_SMP
521 514
522static void mpic_enable_ipi(unsigned int irq) 515static void mpic_unmask_ipi(unsigned int irq)
523{ 516{
524 struct mpic *mpic = mpic_from_ipi(irq); 517 struct mpic *mpic = mpic_from_ipi(irq);
525 unsigned int src = irq - mpic->ipi_offset; 518 unsigned int src = mpic_irq_to_hw(irq) - MPIC_VEC_IPI_0;
526 519
527 DBG("%s: enable_ipi: %d (ipi %d)\n", mpic->name, irq, src); 520 DBG("%s: enable_ipi: %d (ipi %d)\n", mpic->name, irq, src);
528 mpic_ipi_write(src, mpic_ipi_read(src) & ~MPIC_VECPRI_MASK); 521 mpic_ipi_write(src, mpic_ipi_read(src) & ~MPIC_VECPRI_MASK);
529} 522}
530 523
531static void mpic_disable_ipi(unsigned int irq) 524static void mpic_mask_ipi(unsigned int irq)
532{ 525{
533 /* NEVER disable an IPI... that's just plain wrong! */ 526 /* NEVER disable an IPI... that's just plain wrong! */
534} 527}
@@ -541,7 +534,7 @@ static void mpic_end_ipi(unsigned int irq)
541 * IPIs are marked IRQ_PER_CPU. This has the side effect of 534 * IPIs are marked IRQ_PER_CPU. This has the side effect of
542 * preventing the IRQ_PENDING/IRQ_INPROGRESS logic from 535 * preventing the IRQ_PENDING/IRQ_INPROGRESS logic from
543 * applying to them. We EOI them late to avoid re-entering. 536 * applying to them. We EOI them late to avoid re-entering.
544 * We mark IPI's with SA_INTERRUPT as they must run with 537 * We mark IPI's with IRQF_DISABLED as they must run with
545 * irqs disabled. 538 * irqs disabled.
546 */ 539 */
547 mpic_eoi(mpic); 540 mpic_eoi(mpic);
@@ -552,29 +545,176 @@ static void mpic_end_ipi(unsigned int irq)
552static void mpic_set_affinity(unsigned int irq, cpumask_t cpumask) 545static void mpic_set_affinity(unsigned int irq, cpumask_t cpumask)
553{ 546{
554 struct mpic *mpic = mpic_from_irq(irq); 547 struct mpic *mpic = mpic_from_irq(irq);
548 unsigned int src = mpic_irq_to_hw(irq);
555 549
556 cpumask_t tmp; 550 cpumask_t tmp;
557 551
558 cpus_and(tmp, cpumask, cpu_online_map); 552 cpus_and(tmp, cpumask, cpu_online_map);
559 553
560 mpic_irq_write(irq - mpic->irq_offset, MPIC_IRQ_DESTINATION, 554 mpic_irq_write(src, MPIC_IRQ_DESTINATION,
561 mpic_physmask(cpus_addr(tmp)[0])); 555 mpic_physmask(cpus_addr(tmp)[0]));
562} 556}
563 557
558static unsigned int mpic_flags_to_vecpri(unsigned int flags, int *level)
559{
560 unsigned int vecpri;
561
562 /* Now convert sense value */
563 switch(flags & IRQ_TYPE_SENSE_MASK) {
564 case IRQ_TYPE_EDGE_RISING:
565 vecpri = MPIC_VECPRI_SENSE_EDGE |
566 MPIC_VECPRI_POLARITY_POSITIVE;
567 *level = 0;
568 break;
569 case IRQ_TYPE_EDGE_FALLING:
570 vecpri = MPIC_VECPRI_SENSE_EDGE |
571 MPIC_VECPRI_POLARITY_NEGATIVE;
572 *level = 0;
573 break;
574 case IRQ_TYPE_LEVEL_HIGH:
575 vecpri = MPIC_VECPRI_SENSE_LEVEL |
576 MPIC_VECPRI_POLARITY_POSITIVE;
577 *level = 1;
578 break;
579 case IRQ_TYPE_LEVEL_LOW:
580 default:
581 vecpri = MPIC_VECPRI_SENSE_LEVEL |
582 MPIC_VECPRI_POLARITY_NEGATIVE;
583 *level = 1;
584 }
585 return vecpri;
586}
587
588static struct irq_chip mpic_irq_chip = {
589 .mask = mpic_mask_irq,
590 .unmask = mpic_unmask_irq,
591 .eoi = mpic_end_irq,
592};
593
594#ifdef CONFIG_SMP
595static struct irq_chip mpic_ipi_chip = {
596 .mask = mpic_mask_ipi,
597 .unmask = mpic_unmask_ipi,
598 .eoi = mpic_end_ipi,
599};
600#endif /* CONFIG_SMP */
601
602#ifdef CONFIG_MPIC_BROKEN_U3
603static struct irq_chip mpic_irq_ht_chip = {
604 .startup = mpic_startup_ht_irq,
605 .shutdown = mpic_shutdown_ht_irq,
606 .mask = mpic_mask_irq,
607 .unmask = mpic_unmask_ht_irq,
608 .eoi = mpic_end_ht_irq,
609};
610#endif /* CONFIG_MPIC_BROKEN_U3 */
611
612
613static int mpic_host_match(struct irq_host *h, struct device_node *node)
614{
615 struct mpic *mpic = h->host_data;
616
617 /* Exact match, unless mpic node is NULL */
618 return mpic->of_node == NULL || mpic->of_node == node;
619}
620
621static int mpic_host_map(struct irq_host *h, unsigned int virq,
622 irq_hw_number_t hw, unsigned int flags)
623{
624 struct irq_desc *desc = get_irq_desc(virq);
625 struct irq_chip *chip;
626 struct mpic *mpic = h->host_data;
627 unsigned int vecpri = MPIC_VECPRI_SENSE_LEVEL |
628 MPIC_VECPRI_POLARITY_NEGATIVE;
629 int level;
630
631 pr_debug("mpic: map virq %d, hwirq 0x%lx, flags: 0x%x\n",
632 virq, hw, flags);
633
634 if (hw == MPIC_VEC_SPURRIOUS)
635 return -EINVAL;
636#ifdef CONFIG_SMP
637 else if (hw >= MPIC_VEC_IPI_0) {
638 WARN_ON(!(mpic->flags & MPIC_PRIMARY));
639
640 pr_debug("mpic: mapping as IPI\n");
641 set_irq_chip_data(virq, mpic);
642 set_irq_chip_and_handler(virq, &mpic->hc_ipi,
643 handle_percpu_irq);
644 return 0;
645 }
646#endif /* CONFIG_SMP */
647
648 if (hw >= mpic->irq_count)
649 return -EINVAL;
650
651 /* If no sense provided, check default sense array */
652 if (((flags & IRQ_TYPE_SENSE_MASK) == IRQ_TYPE_NONE) &&
653 mpic->senses && hw < mpic->senses_count)
654 flags |= mpic->senses[hw];
655
656 vecpri = mpic_flags_to_vecpri(flags, &level);
657 if (level)
658 desc->status |= IRQ_LEVEL;
659 chip = &mpic->hc_irq;
660
661#ifdef CONFIG_MPIC_BROKEN_U3
662 /* Check for HT interrupts, override vecpri */
663 if (mpic_is_ht_interrupt(mpic, hw)) {
664 vecpri &= ~(MPIC_VECPRI_SENSE_MASK |
665 MPIC_VECPRI_POLARITY_MASK);
666 vecpri |= MPIC_VECPRI_POLARITY_POSITIVE;
667 chip = &mpic->hc_ht_irq;
668 }
669#endif
670
671 /* Reconfigure irq */
672 vecpri |= MPIC_VECPRI_MASK | hw | (8 << MPIC_VECPRI_PRIORITY_SHIFT);
673 mpic_irq_write(hw, MPIC_IRQ_VECTOR_PRI, vecpri);
674
675 pr_debug("mpic: mapping as IRQ\n");
676
677 set_irq_chip_data(virq, mpic);
678 set_irq_chip_and_handler(virq, chip, handle_fasteoi_irq);
679 return 0;
680}
681
682static int mpic_host_xlate(struct irq_host *h, struct device_node *ct,
683 u32 *intspec, unsigned int intsize,
684 irq_hw_number_t *out_hwirq, unsigned int *out_flags)
685
686{
687 static unsigned char map_mpic_senses[4] = {
688 IRQ_TYPE_EDGE_RISING,
689 IRQ_TYPE_LEVEL_LOW,
690 IRQ_TYPE_LEVEL_HIGH,
691 IRQ_TYPE_EDGE_FALLING,
692 };
693
694 *out_hwirq = intspec[0];
695 if (intsize > 1 && intspec[1] < 4)
696 *out_flags = map_mpic_senses[intspec[1]];
697 else
698 *out_flags = IRQ_TYPE_NONE;
699
700 return 0;
701}
702
703static struct irq_host_ops mpic_host_ops = {
704 .match = mpic_host_match,
705 .map = mpic_host_map,
706 .xlate = mpic_host_xlate,
707};
564 708
565/* 709/*
566 * Exported functions 710 * Exported functions
567 */ 711 */
568 712
569 713struct mpic * __init mpic_alloc(struct device_node *node,
570struct mpic * __init mpic_alloc(unsigned long phys_addr, 714 unsigned long phys_addr,
571 unsigned int flags, 715 unsigned int flags,
572 unsigned int isu_size, 716 unsigned int isu_size,
573 unsigned int irq_offset,
574 unsigned int irq_count, 717 unsigned int irq_count,
575 unsigned int ipi_offset,
576 unsigned char *senses,
577 unsigned int senses_count,
578 const char *name) 718 const char *name)
579{ 719{
580 struct mpic *mpic; 720 struct mpic *mpic;
@@ -586,33 +726,38 @@ struct mpic * __init mpic_alloc(unsigned long phys_addr,
586 if (mpic == NULL) 726 if (mpic == NULL)
587 return NULL; 727 return NULL;
588 728
589
590 memset(mpic, 0, sizeof(struct mpic)); 729 memset(mpic, 0, sizeof(struct mpic));
591 mpic->name = name; 730 mpic->name = name;
731 mpic->of_node = node ? of_node_get(node) : NULL;
592 732
733 mpic->irqhost = irq_alloc_host(IRQ_HOST_MAP_LINEAR, 256,
734 &mpic_host_ops,
735 MPIC_VEC_SPURRIOUS);
736 if (mpic->irqhost == NULL) {
737 of_node_put(node);
738 return NULL;
739 }
740
741 mpic->irqhost->host_data = mpic;
742 mpic->hc_irq = mpic_irq_chip;
593 mpic->hc_irq.typename = name; 743 mpic->hc_irq.typename = name;
594 mpic->hc_irq.startup = mpic_startup_irq;
595 mpic->hc_irq.shutdown = mpic_shutdown_irq;
596 mpic->hc_irq.enable = mpic_enable_irq;
597 mpic->hc_irq.disable = mpic_disable_irq;
598 mpic->hc_irq.end = mpic_end_irq;
599 if (flags & MPIC_PRIMARY) 744 if (flags & MPIC_PRIMARY)
600 mpic->hc_irq.set_affinity = mpic_set_affinity; 745 mpic->hc_irq.set_affinity = mpic_set_affinity;
746#ifdef CONFIG_MPIC_BROKEN_U3
747 mpic->hc_ht_irq = mpic_irq_ht_chip;
748 mpic->hc_ht_irq.typename = name;
749 if (flags & MPIC_PRIMARY)
750 mpic->hc_ht_irq.set_affinity = mpic_set_affinity;
751#endif /* CONFIG_MPIC_BROKEN_U3 */
601#ifdef CONFIG_SMP 752#ifdef CONFIG_SMP
753 mpic->hc_ipi = mpic_ipi_chip;
602 mpic->hc_ipi.typename = name; 754 mpic->hc_ipi.typename = name;
603 mpic->hc_ipi.enable = mpic_enable_ipi;
604 mpic->hc_ipi.disable = mpic_disable_ipi;
605 mpic->hc_ipi.end = mpic_end_ipi;
606#endif /* CONFIG_SMP */ 755#endif /* CONFIG_SMP */
607 756
608 mpic->flags = flags; 757 mpic->flags = flags;
609 mpic->isu_size = isu_size; 758 mpic->isu_size = isu_size;
610 mpic->irq_offset = irq_offset;
611 mpic->irq_count = irq_count; 759 mpic->irq_count = irq_count;
612 mpic->ipi_offset = ipi_offset;
613 mpic->num_sources = 0; /* so far */ 760 mpic->num_sources = 0; /* so far */
614 mpic->senses = senses;
615 mpic->senses_count = senses_count;
616 761
617 /* Map the global registers */ 762 /* Map the global registers */
618 mpic->gregs = ioremap(phys_addr + MPIC_GREG_BASE, 0x1000); 763 mpic->gregs = ioremap(phys_addr + MPIC_GREG_BASE, 0x1000);
@@ -680,8 +825,10 @@ struct mpic * __init mpic_alloc(unsigned long phys_addr,
680 mpic->next = mpics; 825 mpic->next = mpics;
681 mpics = mpic; 826 mpics = mpic;
682 827
683 if (flags & MPIC_PRIMARY) 828 if (flags & MPIC_PRIMARY) {
684 mpic_primary = mpic; 829 mpic_primary = mpic;
830 irq_set_default_host(mpic->irqhost);
831 }
685 832
686 return mpic; 833 return mpic;
687} 834}
@@ -698,26 +845,10 @@ void __init mpic_assign_isu(struct mpic *mpic, unsigned int isu_num,
698 mpic->num_sources = isu_first + mpic->isu_size; 845 mpic->num_sources = isu_first + mpic->isu_size;
699} 846}
700 847
701void __init mpic_setup_cascade(unsigned int irq, mpic_cascade_t handler, 848void __init mpic_set_default_senses(struct mpic *mpic, u8 *senses, int count)
702 void *data)
703{ 849{
704 struct mpic *mpic = mpic_find(irq, NULL); 850 mpic->senses = senses;
705 unsigned long flags; 851 mpic->senses_count = count;
706
707 /* Synchronization here is a bit dodgy, so don't try to replace cascade
708 * interrupts on the fly too often ... but normally it's set up at boot.
709 */
710 spin_lock_irqsave(&mpic_lock, flags);
711 if (mpic->cascade)
712 mpic_disable_irq(mpic->cascade_vec + mpic->irq_offset);
713 mpic->cascade = NULL;
714 wmb();
715 mpic->cascade_vec = irq - mpic->irq_offset;
716 mpic->cascade_data = data;
717 wmb();
718 mpic->cascade = handler;
719 mpic_enable_irq(irq);
720 spin_unlock_irqrestore(&mpic_lock, flags);
721} 852}
722 853
723void __init mpic_init(struct mpic *mpic) 854void __init mpic_init(struct mpic *mpic)
@@ -725,6 +856,11 @@ void __init mpic_init(struct mpic *mpic)
725 int i; 856 int i;
726 857
727 BUG_ON(mpic->num_sources == 0); 858 BUG_ON(mpic->num_sources == 0);
859 WARN_ON(mpic->num_sources > MPIC_VEC_IPI_0);
860
861 /* Sanitize source count */
862 if (mpic->num_sources > MPIC_VEC_IPI_0)
863 mpic->num_sources = MPIC_VEC_IPI_0;
728 864
729 printk(KERN_INFO "mpic: Initializing for %d sources\n", mpic->num_sources); 865 printk(KERN_INFO "mpic: Initializing for %d sources\n", mpic->num_sources);
730 866
@@ -748,12 +884,6 @@ void __init mpic_init(struct mpic *mpic)
748 MPIC_VECPRI_MASK | 884 MPIC_VECPRI_MASK |
749 (10 << MPIC_VECPRI_PRIORITY_SHIFT) | 885 (10 << MPIC_VECPRI_PRIORITY_SHIFT) |
750 (MPIC_VEC_IPI_0 + i)); 886 (MPIC_VEC_IPI_0 + i));
751#ifdef CONFIG_SMP
752 if (!(mpic->flags & MPIC_PRIMARY))
753 continue;
754 irq_desc[mpic->ipi_offset+i].status |= IRQ_PER_CPU;
755 irq_desc[mpic->ipi_offset+i].handler = &mpic->hc_ipi;
756#endif /* CONFIG_SMP */
757 } 887 }
758 888
759 /* Initialize interrupt sources */ 889 /* Initialize interrupt sources */
@@ -764,31 +894,21 @@ void __init mpic_init(struct mpic *mpic)
764 /* Do the HT PIC fixups on U3 broken mpic */ 894 /* Do the HT PIC fixups on U3 broken mpic */
765 DBG("MPIC flags: %x\n", mpic->flags); 895 DBG("MPIC flags: %x\n", mpic->flags);
766 if ((mpic->flags & MPIC_BROKEN_U3) && (mpic->flags & MPIC_PRIMARY)) 896 if ((mpic->flags & MPIC_BROKEN_U3) && (mpic->flags & MPIC_PRIMARY))
767 mpic_scan_ht_pics(mpic); 897 mpic_scan_ht_pics(mpic);
768#endif /* CONFIG_MPIC_BROKEN_U3 */ 898#endif /* CONFIG_MPIC_BROKEN_U3 */
769 899
770 for (i = 0; i < mpic->num_sources; i++) { 900 for (i = 0; i < mpic->num_sources; i++) {
771 /* start with vector = source number, and masked */ 901 /* start with vector = source number, and masked */
772 u32 vecpri = MPIC_VECPRI_MASK | i | (8 << MPIC_VECPRI_PRIORITY_SHIFT); 902 u32 vecpri = MPIC_VECPRI_MASK | i | (8 << MPIC_VECPRI_PRIORITY_SHIFT);
773 int level = 0; 903 int level = 1;
774 904
775 /* if it's an IPI, we skip it */
776 if ((mpic->irq_offset + i) >= (mpic->ipi_offset + i) &&
777 (mpic->irq_offset + i) < (mpic->ipi_offset + i + 4))
778 continue;
779
780 /* do senses munging */ 905 /* do senses munging */
781 if (mpic->senses && i < mpic->senses_count) { 906 if (mpic->senses && i < mpic->senses_count)
782 if (mpic->senses[i] & IRQ_SENSE_LEVEL) 907 vecpri = mpic_flags_to_vecpri(mpic->senses[i],
783 vecpri |= MPIC_VECPRI_SENSE_LEVEL; 908 &level);
784 if (mpic->senses[i] & IRQ_POLARITY_POSITIVE) 909 else
785 vecpri |= MPIC_VECPRI_POLARITY_POSITIVE;
786 } else
787 vecpri |= MPIC_VECPRI_SENSE_LEVEL; 910 vecpri |= MPIC_VECPRI_SENSE_LEVEL;
788 911
789 /* remember if it was a level interrupts */
790 level = (vecpri & MPIC_VECPRI_SENSE_LEVEL);
791
792 /* deal with broken U3 */ 912 /* deal with broken U3 */
793 if (mpic->flags & MPIC_BROKEN_U3) { 913 if (mpic->flags & MPIC_BROKEN_U3) {
794#ifdef CONFIG_MPIC_BROKEN_U3 914#ifdef CONFIG_MPIC_BROKEN_U3
@@ -809,12 +929,6 @@ void __init mpic_init(struct mpic *mpic)
809 mpic_irq_write(i, MPIC_IRQ_VECTOR_PRI, vecpri); 929 mpic_irq_write(i, MPIC_IRQ_VECTOR_PRI, vecpri);
810 mpic_irq_write(i, MPIC_IRQ_DESTINATION, 930 mpic_irq_write(i, MPIC_IRQ_DESTINATION,
811 1 << hard_smp_processor_id()); 931 1 << hard_smp_processor_id());
812
813 /* init linux descriptors */
814 if (i < mpic->irq_count) {
815 irq_desc[mpic->irq_offset+i].status = level ? IRQ_LEVEL : 0;
816 irq_desc[mpic->irq_offset+i].handler = &mpic->hc_irq;
817 }
818 } 932 }
819 933
820 /* Init spurrious vector */ 934 /* Init spurrious vector */
@@ -855,19 +969,20 @@ void mpic_irq_set_priority(unsigned int irq, unsigned int pri)
855{ 969{
856 int is_ipi; 970 int is_ipi;
857 struct mpic *mpic = mpic_find(irq, &is_ipi); 971 struct mpic *mpic = mpic_find(irq, &is_ipi);
972 unsigned int src = mpic_irq_to_hw(irq);
858 unsigned long flags; 973 unsigned long flags;
859 u32 reg; 974 u32 reg;
860 975
861 spin_lock_irqsave(&mpic_lock, flags); 976 spin_lock_irqsave(&mpic_lock, flags);
862 if (is_ipi) { 977 if (is_ipi) {
863 reg = mpic_ipi_read(irq - mpic->ipi_offset) & 978 reg = mpic_ipi_read(src - MPIC_VEC_IPI_0) &
864 ~MPIC_VECPRI_PRIORITY_MASK; 979 ~MPIC_VECPRI_PRIORITY_MASK;
865 mpic_ipi_write(irq - mpic->ipi_offset, 980 mpic_ipi_write(src - MPIC_VEC_IPI_0,
866 reg | (pri << MPIC_VECPRI_PRIORITY_SHIFT)); 981 reg | (pri << MPIC_VECPRI_PRIORITY_SHIFT));
867 } else { 982 } else {
868 reg = mpic_irq_read(irq - mpic->irq_offset,MPIC_IRQ_VECTOR_PRI) 983 reg = mpic_irq_read(src, MPIC_IRQ_VECTOR_PRI)
869 & ~MPIC_VECPRI_PRIORITY_MASK; 984 & ~MPIC_VECPRI_PRIORITY_MASK;
870 mpic_irq_write(irq - mpic->irq_offset, MPIC_IRQ_VECTOR_PRI, 985 mpic_irq_write(src, MPIC_IRQ_VECTOR_PRI,
871 reg | (pri << MPIC_VECPRI_PRIORITY_SHIFT)); 986 reg | (pri << MPIC_VECPRI_PRIORITY_SHIFT));
872 } 987 }
873 spin_unlock_irqrestore(&mpic_lock, flags); 988 spin_unlock_irqrestore(&mpic_lock, flags);
@@ -877,14 +992,15 @@ unsigned int mpic_irq_get_priority(unsigned int irq)
877{ 992{
878 int is_ipi; 993 int is_ipi;
879 struct mpic *mpic = mpic_find(irq, &is_ipi); 994 struct mpic *mpic = mpic_find(irq, &is_ipi);
995 unsigned int src = mpic_irq_to_hw(irq);
880 unsigned long flags; 996 unsigned long flags;
881 u32 reg; 997 u32 reg;
882 998
883 spin_lock_irqsave(&mpic_lock, flags); 999 spin_lock_irqsave(&mpic_lock, flags);
884 if (is_ipi) 1000 if (is_ipi)
885 reg = mpic_ipi_read(irq - mpic->ipi_offset); 1001 reg = mpic_ipi_read(src = MPIC_VEC_IPI_0);
886 else 1002 else
887 reg = mpic_irq_read(irq - mpic->irq_offset, MPIC_IRQ_VECTOR_PRI); 1003 reg = mpic_irq_read(src, MPIC_IRQ_VECTOR_PRI);
888 spin_unlock_irqrestore(&mpic_lock, flags); 1004 spin_unlock_irqrestore(&mpic_lock, flags);
889 return (reg & MPIC_VECPRI_PRIORITY_MASK) >> MPIC_VECPRI_PRIORITY_SHIFT; 1005 return (reg & MPIC_VECPRI_PRIORITY_MASK) >> MPIC_VECPRI_PRIORITY_SHIFT;
890} 1006}
@@ -906,7 +1022,7 @@ void mpic_setup_this_cpu(void)
906 /* let the mpic know we want intrs. default affinity is 0xffffffff 1022 /* let the mpic know we want intrs. default affinity is 0xffffffff
907 * until changed via /proc. That's how it's done on x86. If we want 1023 * until changed via /proc. That's how it's done on x86. If we want
908 * it differently, then we should make sure we also change the default 1024 * it differently, then we should make sure we also change the default
909 * values of irq_affinity in irq.c. 1025 * values of irq_desc[].affinity in irq.c.
910 */ 1026 */
911 if (distribute_irqs) { 1027 if (distribute_irqs) {
912 for (i = 0; i < mpic->num_sources ; i++) 1028 for (i = 0; i < mpic->num_sources ; i++)
@@ -979,37 +1095,20 @@ void mpic_send_ipi(unsigned int ipi_no, unsigned int cpu_mask)
979 mpic_physmask(cpu_mask & cpus_addr(cpu_online_map)[0])); 1095 mpic_physmask(cpu_mask & cpus_addr(cpu_online_map)[0]));
980} 1096}
981 1097
982int mpic_get_one_irq(struct mpic *mpic, struct pt_regs *regs) 1098unsigned int mpic_get_one_irq(struct mpic *mpic, struct pt_regs *regs)
983{ 1099{
984 u32 irq; 1100 u32 src;
985 1101
986 irq = mpic_cpu_read(MPIC_CPU_INTACK) & MPIC_VECPRI_VECTOR_MASK; 1102 src = mpic_cpu_read(MPIC_CPU_INTACK) & MPIC_VECPRI_VECTOR_MASK;
987#ifdef DEBUG_LOW
988 DBG("%s: get_one_irq(): %d\n", mpic->name, irq);
989#endif
990 if (mpic->cascade && irq == mpic->cascade_vec) {
991#ifdef DEBUG_LOW 1103#ifdef DEBUG_LOW
992 DBG("%s: cascading ...\n", mpic->name); 1104 DBG("%s: get_one_irq(): %d\n", mpic->name, src);
993#endif
994 irq = mpic->cascade(regs, mpic->cascade_data);
995 mpic_eoi(mpic);
996 return irq;
997 }
998 if (unlikely(irq == MPIC_VEC_SPURRIOUS))
999 return -1;
1000 if (irq < MPIC_VEC_IPI_0) {
1001#ifdef DEBUG_IRQ
1002 DBG("%s: irq %d\n", mpic->name, irq + mpic->irq_offset);
1003#endif
1004 return irq + mpic->irq_offset;
1005 }
1006#ifdef DEBUG_IPI
1007 DBG("%s: ipi %d !\n", mpic->name, irq - MPIC_VEC_IPI_0);
1008#endif 1105#endif
1009 return irq - MPIC_VEC_IPI_0 + mpic->ipi_offset; 1106 if (unlikely(src == MPIC_VEC_SPURRIOUS))
1107 return NO_IRQ;
1108 return irq_linear_revmap(mpic->irqhost, src);
1010} 1109}
1011 1110
1012int mpic_get_irq(struct pt_regs *regs) 1111unsigned int mpic_get_irq(struct pt_regs *regs)
1013{ 1112{
1014 struct mpic *mpic = mpic_primary; 1113 struct mpic *mpic = mpic_primary;
1015 1114
@@ -1023,22 +1122,27 @@ int mpic_get_irq(struct pt_regs *regs)
1023void mpic_request_ipis(void) 1122void mpic_request_ipis(void)
1024{ 1123{
1025 struct mpic *mpic = mpic_primary; 1124 struct mpic *mpic = mpic_primary;
1026 1125 int i;
1126 static char *ipi_names[] = {
1127 "IPI0 (call function)",
1128 "IPI1 (reschedule)",
1129 "IPI2 (unused)",
1130 "IPI3 (debugger break)",
1131 };
1027 BUG_ON(mpic == NULL); 1132 BUG_ON(mpic == NULL);
1028 1133
1029 printk("requesting IPIs ... \n"); 1134 printk(KERN_INFO "mpic: requesting IPIs ... \n");
1030 1135
1031 /* IPIs are marked SA_INTERRUPT as they must run with irqs disabled */ 1136 for (i = 0; i < 4; i++) {
1032 request_irq(mpic->ipi_offset+0, mpic_ipi_action, SA_INTERRUPT, 1137 unsigned int vipi = irq_create_mapping(mpic->irqhost,
1033 "IPI0 (call function)", mpic); 1138 MPIC_VEC_IPI_0 + i, 0);
1034 request_irq(mpic->ipi_offset+1, mpic_ipi_action, SA_INTERRUPT, 1139 if (vipi == NO_IRQ) {
1035 "IPI1 (reschedule)", mpic); 1140 printk(KERN_ERR "Failed to map IPI %d\n", i);
1036 request_irq(mpic->ipi_offset+2, mpic_ipi_action, SA_INTERRUPT, 1141 break;
1037 "IPI2 (unused)", mpic); 1142 }
1038 request_irq(mpic->ipi_offset+3, mpic_ipi_action, SA_INTERRUPT, 1143 request_irq(vipi, mpic_ipi_action, IRQF_DISABLED,
1039 "IPI3 (debugger break)", mpic); 1144 ipi_names[i], mpic);
1040 1145 }
1041 printk("IPIs requested... \n");
1042} 1146}
1043 1147
1044void smp_mpic_message_pass(int target, int msg) 1148void smp_mpic_message_pass(int target, int msg)
diff --git a/arch/powerpc/sysdev/todc.c b/arch/powerpc/sysdev/todc.c
new file mode 100644
index 000000000000..0a65980efb50
--- /dev/null
+++ b/arch/powerpc/sysdev/todc.c
@@ -0,0 +1,392 @@
1/*
2 * Time of Day Clock support for the M48T35, M48T37, M48T59, and MC146818
3 * Real Time Clocks/Timekeepers.
4 *
5 * Author: Mark A. Greer <mgreer@mvista.com>
6 *
7 * 2001-2004 (c) MontaVista, Software, Inc. This file is licensed under
8 * the terms of the GNU General Public License version 2. This program
9 * is licensed "as is" without any warranty of any kind, whether express
10 * or implied.
11 */
12#include <linux/errno.h>
13#include <linux/init.h>
14#include <linux/kernel.h>
15#include <linux/time.h>
16#include <linux/timex.h>
17#include <linux/bcd.h>
18#include <linux/mc146818rtc.h>
19
20#include <asm/machdep.h>
21#include <asm/io.h>
22#include <asm/time.h>
23#include <asm/todc.h>
24
25/*
26 * Depending on the hardware on your board and your board design, the
27 * RTC/NVRAM may be accessed either directly (like normal memory) or via
28 * address/data registers. If your board uses the direct method, set
29 * 'nvram_data' to the base address of your nvram and leave 'nvram_as0' and
30 * 'nvram_as1' NULL. If your board uses address/data regs to access nvram,
31 * set 'nvram_as0' to the address of the lower byte, set 'nvram_as1' to the
32 * address of the upper byte (leave NULL if using mc146818), and set
33 * 'nvram_data' to the address of the 8-bit data register.
34 *
35 * Note: Even though the documentation for the various RTC chips say that it
36 * take up to a second before it starts updating once the 'R' bit is
37 * cleared, they always seem to update even though we bang on it many
38 * times a second. This is true, except for the Dallas Semi 1746/1747
39 * (possibly others). Those chips seem to have a real problem whenever
40 * we set the 'R' bit before reading them, they basically stop counting.
41 * --MAG
42 */
43
44/*
45 * 'todc_info' should be initialized in your *_setup.c file to
46 * point to a fully initialized 'todc_info_t' structure.
47 * This structure holds all the register offsets for your particular
48 * TODC/RTC chip.
49 * TODC_ALLOC()/TODC_INIT() will allocate and initialize this table for you.
50 */
51
52#ifdef RTC_FREQ_SELECT
53#undef RTC_FREQ_SELECT
54#define RTC_FREQ_SELECT control_b /* Register A */
55#endif
56
57#ifdef RTC_CONTROL
58#undef RTC_CONTROL
59#define RTC_CONTROL control_a /* Register B */
60#endif
61
62#ifdef RTC_INTR_FLAGS
63#undef RTC_INTR_FLAGS
64#define RTC_INTR_FLAGS watchdog /* Register C */
65#endif
66
67#ifdef RTC_VALID
68#undef RTC_VALID
69#define RTC_VALID interrupts /* Register D */
70#endif
71
72/* Access routines when RTC accessed directly (like normal memory) */
73u_char
74todc_direct_read_val(int addr)
75{
76 return readb((void __iomem *)(todc_info->nvram_data + addr));
77}
78
79void
80todc_direct_write_val(int addr, unsigned char val)
81{
82 writeb(val, (void __iomem *)(todc_info->nvram_data + addr));
83 return;
84}
85
86/* Access routines for accessing m48txx type chips via addr/data regs */
87u_char
88todc_m48txx_read_val(int addr)
89{
90 outb(addr, todc_info->nvram_as0);
91 outb(addr>>todc_info->as0_bits, todc_info->nvram_as1);
92 return inb(todc_info->nvram_data);
93}
94
95void
96todc_m48txx_write_val(int addr, unsigned char val)
97{
98 outb(addr, todc_info->nvram_as0);
99 outb(addr>>todc_info->as0_bits, todc_info->nvram_as1);
100 outb(val, todc_info->nvram_data);
101 return;
102}
103
104/* Access routines for accessing mc146818 type chips via addr/data regs */
105u_char
106todc_mc146818_read_val(int addr)
107{
108 outb_p(addr, todc_info->nvram_as0);
109 return inb_p(todc_info->nvram_data);
110}
111
112void
113todc_mc146818_write_val(int addr, unsigned char val)
114{
115 outb_p(addr, todc_info->nvram_as0);
116 outb_p(val, todc_info->nvram_data);
117}
118
119
120/*
121 * Routines to make RTC chips with NVRAM buried behind an addr/data pair
122 * have the NVRAM and clock regs appear at the same level.
123 * The NVRAM will appear to start at addr 0 and the clock regs will appear
124 * to start immediately after the NVRAM (actually, start at offset
125 * todc_info->nvram_size).
126 */
127static inline u_char
128todc_read_val(int addr)
129{
130 u_char val;
131
132 if (todc_info->sw_flags & TODC_FLAG_2_LEVEL_NVRAM) {
133 if (addr < todc_info->nvram_size) { /* NVRAM */
134 ppc_md.rtc_write_val(todc_info->nvram_addr_reg, addr);
135 val = ppc_md.rtc_read_val(todc_info->nvram_data_reg);
136 } else { /* Clock Reg */
137 addr -= todc_info->nvram_size;
138 val = ppc_md.rtc_read_val(addr);
139 }
140 } else
141 val = ppc_md.rtc_read_val(addr);
142
143 return val;
144}
145
146static inline void
147todc_write_val(int addr, u_char val)
148{
149 if (todc_info->sw_flags & TODC_FLAG_2_LEVEL_NVRAM) {
150 if (addr < todc_info->nvram_size) { /* NVRAM */
151 ppc_md.rtc_write_val(todc_info->nvram_addr_reg, addr);
152 ppc_md.rtc_write_val(todc_info->nvram_data_reg, val);
153 } else { /* Clock Reg */
154 addr -= todc_info->nvram_size;
155 ppc_md.rtc_write_val(addr, val);
156 }
157 } else
158 ppc_md.rtc_write_val(addr, val);
159}
160
161/*
162 * TODC routines
163 *
164 * There is some ugly stuff in that there are assumptions for the mc146818.
165 *
166 * Assumptions:
167 * - todc_info->control_a has the offset as mc146818 Register B reg
168 * - todc_info->control_b has the offset as mc146818 Register A reg
169 * - m48txx control reg's write enable or 'W' bit is same as
170 * mc146818 Register B 'SET' bit (i.e., 0x80)
171 *
172 * These assumptions were made to make the code simpler.
173 */
174long __init
175todc_time_init(void)
176{
177 u_char cntl_b;
178
179 if (!ppc_md.rtc_read_val)
180 ppc_md.rtc_read_val = ppc_md.nvram_read_val;
181 if (!ppc_md.rtc_write_val)
182 ppc_md.rtc_write_val = ppc_md.nvram_write_val;
183
184 cntl_b = todc_read_val(todc_info->control_b);
185
186 if (todc_info->rtc_type == TODC_TYPE_MC146818) {
187 if ((cntl_b & 0x70) != 0x20) {
188 printk(KERN_INFO "TODC real-time-clock was stopped."
189 " Now starting...");
190 cntl_b &= ~0x70;
191 cntl_b |= 0x20;
192 }
193
194 todc_write_val(todc_info->control_b, cntl_b);
195 } else if (todc_info->rtc_type == TODC_TYPE_DS17285) {
196 u_char mode;
197
198 mode = todc_read_val(TODC_TYPE_DS17285_CNTL_A);
199 /* Make sure countdown clear is not set */
200 mode &= ~0x40;
201 /* Enable oscillator, extended register set */
202 mode |= 0x30;
203 todc_write_val(TODC_TYPE_DS17285_CNTL_A, mode);
204
205 } else if (todc_info->rtc_type == TODC_TYPE_DS1501) {
206 u_char month;
207
208 todc_info->enable_read = TODC_DS1501_CNTL_B_TE;
209 todc_info->enable_write = TODC_DS1501_CNTL_B_TE;
210
211 month = todc_read_val(todc_info->month);
212
213 if ((month & 0x80) == 0x80) {
214 printk(KERN_INFO "TODC %s %s\n",
215 "real-time-clock was stopped.",
216 "Now starting...");
217 month &= ~0x80;
218 todc_write_val(todc_info->month, month);
219 }
220
221 cntl_b &= ~TODC_DS1501_CNTL_B_TE;
222 todc_write_val(todc_info->control_b, cntl_b);
223 } else { /* must be a m48txx type */
224 u_char cntl_a;
225
226 todc_info->enable_read = TODC_MK48TXX_CNTL_A_R;
227 todc_info->enable_write = TODC_MK48TXX_CNTL_A_W;
228
229 cntl_a = todc_read_val(todc_info->control_a);
230
231 /* Check & clear STOP bit in control B register */
232 if (cntl_b & TODC_MK48TXX_DAY_CB) {
233 printk(KERN_INFO "TODC %s %s\n",
234 "real-time-clock was stopped.",
235 "Now starting...");
236
237 cntl_a |= todc_info->enable_write;
238 cntl_b &= ~TODC_MK48TXX_DAY_CB;/* Start Oscil */
239
240 todc_write_val(todc_info->control_a, cntl_a);
241 todc_write_val(todc_info->control_b, cntl_b);
242 }
243
244 /* Make sure READ & WRITE bits are cleared. */
245 cntl_a &= ~(todc_info->enable_write | todc_info->enable_read);
246 todc_write_val(todc_info->control_a, cntl_a);
247 }
248
249 return 0;
250}
251
252/*
253 * There is some ugly stuff in that there are assumptions that for a mc146818,
254 * the todc_info->control_a has the offset of the mc146818 Register B reg and
255 * that the register'ss 'SET' bit is the same as the m48txx's write enable
256 * bit in the control register of the m48txx (i.e., 0x80).
257 *
258 * It was done to make the code look simpler.
259 */
260void
261todc_get_rtc_time(struct rtc_time *tm)
262{
263 uint year = 0, mon = 0, mday = 0, hour = 0, min = 0, sec = 0;
264 uint limit, i;
265 u_char save_control, uip = 0;
266 extern void GregorianDay(struct rtc_time *);
267
268 spin_lock(&rtc_lock);
269 save_control = todc_read_val(todc_info->control_a);
270
271 if (todc_info->rtc_type != TODC_TYPE_MC146818) {
272 limit = 1;
273
274 switch (todc_info->rtc_type) {
275 case TODC_TYPE_DS1553:
276 case TODC_TYPE_DS1557:
277 case TODC_TYPE_DS1743:
278 case TODC_TYPE_DS1746: /* XXXX BAD HACK -> FIX */
279 case TODC_TYPE_DS1747:
280 case TODC_TYPE_DS17285:
281 break;
282 default:
283 todc_write_val(todc_info->control_a,
284 (save_control | todc_info->enable_read));
285 }
286 } else
287 limit = 100000000;
288
289 for (i=0; i<limit; i++) {
290 if (todc_info->rtc_type == TODC_TYPE_MC146818)
291 uip = todc_read_val(todc_info->RTC_FREQ_SELECT);
292
293 sec = todc_read_val(todc_info->seconds) & 0x7f;
294 min = todc_read_val(todc_info->minutes) & 0x7f;
295 hour = todc_read_val(todc_info->hours) & 0x3f;
296 mday = todc_read_val(todc_info->day_of_month) & 0x3f;
297 mon = todc_read_val(todc_info->month) & 0x1f;
298 year = todc_read_val(todc_info->year) & 0xff;
299
300 if (todc_info->rtc_type == TODC_TYPE_MC146818) {
301 uip |= todc_read_val(todc_info->RTC_FREQ_SELECT);
302 if ((uip & RTC_UIP) == 0)
303 break;
304 }
305 }
306
307 if (todc_info->rtc_type != TODC_TYPE_MC146818) {
308 switch (todc_info->rtc_type) {
309 case TODC_TYPE_DS1553:
310 case TODC_TYPE_DS1557:
311 case TODC_TYPE_DS1743:
312 case TODC_TYPE_DS1746: /* XXXX BAD HACK -> FIX */
313 case TODC_TYPE_DS1747:
314 case TODC_TYPE_DS17285:
315 break;
316 default:
317 save_control &= ~(todc_info->enable_read);
318 todc_write_val(todc_info->control_a, save_control);
319 }
320 }
321 spin_unlock(&rtc_lock);
322
323 if ((todc_info->rtc_type != TODC_TYPE_MC146818)
324 || ((save_control & RTC_DM_BINARY) == 0)
325 || RTC_ALWAYS_BCD) {
326 BCD_TO_BIN(sec);
327 BCD_TO_BIN(min);
328 BCD_TO_BIN(hour);
329 BCD_TO_BIN(mday);
330 BCD_TO_BIN(mon);
331 BCD_TO_BIN(year);
332 }
333
334 if ((year + 1900) < 1970) {
335 year += 100;
336 }
337
338 tm->tm_sec = sec;
339 tm->tm_min = min;
340 tm->tm_hour = hour;
341 tm->tm_mday = mday;
342 tm->tm_mon = mon;
343 tm->tm_year = year;
344
345 GregorianDay(tm);
346}
347
348int
349todc_set_rtc_time(struct rtc_time *tm)
350{
351 u_char save_control, save_freq_select = 0;
352
353 spin_lock(&rtc_lock);
354 save_control = todc_read_val(todc_info->control_a);
355
356 /* Assuming MK48T59_RTC_CA_WRITE & RTC_SET are equal */
357 todc_write_val(todc_info->control_a,
358 (save_control | todc_info->enable_write));
359 save_control &= ~(todc_info->enable_write); /* in case it was set */
360
361 if (todc_info->rtc_type == TODC_TYPE_MC146818) {
362 save_freq_select = todc_read_val(todc_info->RTC_FREQ_SELECT);
363 todc_write_val(todc_info->RTC_FREQ_SELECT,
364 save_freq_select | RTC_DIV_RESET2);
365 }
366
367 if ((todc_info->rtc_type != TODC_TYPE_MC146818)
368 || ((save_control & RTC_DM_BINARY) == 0)
369 || RTC_ALWAYS_BCD) {
370 BIN_TO_BCD(tm->tm_sec);
371 BIN_TO_BCD(tm->tm_min);
372 BIN_TO_BCD(tm->tm_hour);
373 BIN_TO_BCD(tm->tm_mon);
374 BIN_TO_BCD(tm->tm_mday);
375 BIN_TO_BCD(tm->tm_year);
376 }
377
378 todc_write_val(todc_info->seconds, tm->tm_sec);
379 todc_write_val(todc_info->minutes, tm->tm_min);
380 todc_write_val(todc_info->hours, tm->tm_hour);
381 todc_write_val(todc_info->month, tm->tm_mon);
382 todc_write_val(todc_info->day_of_month, tm->tm_mday);
383 todc_write_val(todc_info->year, tm->tm_year);
384
385 todc_write_val(todc_info->control_a, save_control);
386
387 if (todc_info->rtc_type == TODC_TYPE_MC146818)
388 todc_write_val(todc_info->RTC_FREQ_SELECT, save_freq_select);
389
390 spin_unlock(&rtc_lock);
391 return 0;
392}
diff --git a/arch/powerpc/sysdev/tsi108_dev.c b/arch/powerpc/sysdev/tsi108_dev.c
new file mode 100644
index 000000000000..26a0cc820cde
--- /dev/null
+++ b/arch/powerpc/sysdev/tsi108_dev.c
@@ -0,0 +1,145 @@
1/*
2 * tsi108/109 device setup code
3 *
4 * Maintained by Roy Zang < tie-fei.zang@freescale.com >
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#include <linux/config.h>
13#include <linux/stddef.h>
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/errno.h>
17#include <linux/major.h>
18#include <linux/delay.h>
19#include <linux/irq.h>
20#include <linux/module.h>
21#include <linux/device.h>
22#include <linux/platform_device.h>
23#include <asm/tsi108.h>
24
25#include <asm/system.h>
26#include <asm/atomic.h>
27#include <asm/io.h>
28#include <asm/irq.h>
29#include <asm/prom.h>
30#include <mm/mmu_decl.h>
31
32#undef DEBUG
33
34#ifdef DEBUG
35#define DBG(fmt...) do { printk(fmt); } while(0)
36#else
37#define DBG(fmt...) do { } while(0)
38#endif
39
40static phys_addr_t tsi108_csr_base = -1;
41
42phys_addr_t get_csrbase(void)
43{
44 struct device_node *tsi;
45
46 if (tsi108_csr_base != -1)
47 return tsi108_csr_base;
48
49 tsi = of_find_node_by_type(NULL, "tsi-bridge");
50 if (tsi) {
51 unsigned int size;
52 void *prop = get_property(tsi, "reg", &size);
53 tsi108_csr_base = of_translate_address(tsi, prop);
54 of_node_put(tsi);
55 };
56 return tsi108_csr_base;
57}
58
59u32 get_vir_csrbase(void)
60{
61 return (u32) (ioremap(get_csrbase(), 0x10000));
62}
63
64EXPORT_SYMBOL(get_csrbase);
65EXPORT_SYMBOL(get_vir_csrbase);
66
67static int __init tsi108_eth_of_init(void)
68{
69 struct device_node *np;
70 unsigned int i;
71 struct platform_device *tsi_eth_dev;
72 struct resource res;
73 int ret;
74
75 for (np = NULL, i = 0;
76 (np = of_find_compatible_node(np, "network", "tsi-ethernet")) != NULL;
77 i++) {
78 struct resource r[2];
79 struct device_node *phy;
80 hw_info tsi_eth_data;
81 unsigned int *id;
82 unsigned int *phy_id;
83 void *mac_addr;
84 phandle *ph;
85
86 memset(r, 0, sizeof(r));
87 memset(&tsi_eth_data, 0, sizeof(tsi_eth_data));
88
89 ret = of_address_to_resource(np, 0, &r[0]);
90 DBG("%s: name:start->end = %s:0x%lx-> 0x%lx\n",
91 __FUNCTION__,r[0].name, r[0].start, r[0].end);
92 if (ret)
93 goto err;
94
95 r[1].name = "tx";
96 r[1].start = np->intrs[0].line;
97 r[1].end = np->intrs[0].line;
98 r[1].flags = IORESOURCE_IRQ;
99
100 tsi_eth_dev =
101 platform_device_register_simple("tsi-ethernet", i, &r[0],
102 np->n_intrs + 1);
103
104 if (IS_ERR(tsi_eth_dev)) {
105 ret = PTR_ERR(tsi_eth_dev);
106 goto err;
107 }
108
109 mac_addr = get_property(np, "address", NULL);
110 memcpy(tsi_eth_data.mac_addr, mac_addr, 6);
111
112 ph = (phandle *) get_property(np, "phy-handle", NULL);
113 phy = of_find_node_by_phandle(*ph);
114
115 if (phy == NULL) {
116 ret = -ENODEV;
117 goto unreg;
118 }
119
120 id = (u32 *) get_property(phy, "reg", NULL);
121 phy_id = (u32 *) get_property(phy, "phy-id", NULL);
122 ret = of_address_to_resource(phy, 0, &res);
123 if (ret) {
124 of_node_put(phy);
125 goto unreg;
126 }
127 tsi_eth_data.regs = r[0].start;
128 tsi_eth_data.phyregs = res.start;
129 tsi_eth_data.phy = *phy_id;
130 tsi_eth_data.irq_num = np->intrs[0].line;
131 of_node_put(phy);
132 ret =
133 platform_device_add_data(tsi_eth_dev, &tsi_eth_data,
134 sizeof(hw_info));
135 if (ret)
136 goto unreg;
137 }
138 return 0;
139unreg:
140 platform_device_unregister(tsi_eth_dev);
141err:
142 return ret;
143}
144
145arch_initcall(tsi108_eth_of_init);
diff --git a/arch/powerpc/sysdev/tsi108_pci.c b/arch/powerpc/sysdev/tsi108_pci.c
new file mode 100644
index 000000000000..3265d54c82ed
--- /dev/null
+++ b/arch/powerpc/sysdev/tsi108_pci.c
@@ -0,0 +1,412 @@
1/*
2 * Common routines for Tundra Semiconductor TSI108 host bridge.
3 *
4 * 2004-2005 (c) Tundra Semiconductor Corp.
5 * Author: Alex Bounine (alexandreb@tundra.com)
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the Free
9 * Software Foundation; either version 2 of the License, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc., 59
19 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 */
21
22#include <linux/kernel.h>
23#include <linux/init.h>
24#include <linux/pci.h>
25#include <linux/slab.h>
26#include <linux/irq.h>
27#include <linux/interrupt.h>
28
29
30#include <asm/byteorder.h>
31#include <asm/io.h>
32#include <asm/irq.h>
33#include <asm/uaccess.h>
34#include <asm/machdep.h>
35#include <asm/pci-bridge.h>
36#include <asm/tsi108.h>
37#include <asm/tsi108_irq.h>
38#include <asm/prom.h>
39
40#undef DEBUG
41#ifdef DEBUG
42#define DBG(x...) printk(x)
43#else
44#define DBG(x...)
45#endif
46
47#define tsi_mk_config_addr(bus, devfunc, offset) \
48 ((((bus)<<16) | ((devfunc)<<8) | (offset & 0xfc)) + tsi108_pci_cfg_base)
49
50u32 tsi108_pci_cfg_base;
51u32 tsi108_csr_vir_base;
52
53extern u32 get_vir_csrbase(void);
54extern u32 tsi108_read_reg(u32 reg_offset);
55extern void tsi108_write_reg(u32 reg_offset, u32 val);
56
57int
58tsi108_direct_write_config(struct pci_bus *bus, unsigned int devfunc,
59 int offset, int len, u32 val)
60{
61 volatile unsigned char *cfg_addr;
62
63 if (ppc_md.pci_exclude_device)
64 if (ppc_md.pci_exclude_device(bus->number, devfunc))
65 return PCIBIOS_DEVICE_NOT_FOUND;
66
67 cfg_addr = (unsigned char *)(tsi_mk_config_addr(bus->number,
68 devfunc, offset) |
69 (offset & 0x03));
70
71#ifdef DEBUG
72 printk("PCI CFG write : ");
73 printk("%d:0x%x:0x%x ", bus->number, devfunc, offset);
74 printk("%d ADDR=0x%08x ", len, (uint) cfg_addr);
75 printk("data = 0x%08x\n", val);
76#endif
77
78 switch (len) {
79 case 1:
80 out_8((u8 *) cfg_addr, val);
81 break;
82 case 2:
83 out_le16((u16 *) cfg_addr, val);
84 break;
85 default:
86 out_le32((u32 *) cfg_addr, val);
87 break;
88 }
89
90 return PCIBIOS_SUCCESSFUL;
91}
92
93void tsi108_clear_pci_error(u32 pci_cfg_base)
94{
95 u32 err_stat, err_addr, pci_stat;
96
97 /*
98 * Quietly clear PB and PCI error flags set as result
99 * of PCI/X configuration read requests.
100 */
101
102 /* Read PB Error Log Registers */
103
104 err_stat = tsi108_read_reg(TSI108_PB_OFFSET + TSI108_PB_ERRCS);
105 err_addr = tsi108_read_reg(TSI108_PB_OFFSET + TSI108_PB_AERR);
106
107 if (err_stat & TSI108_PB_ERRCS_ES) {
108 /* Clear error flag */
109 tsi108_write_reg(TSI108_PB_OFFSET + TSI108_PB_ERRCS,
110 TSI108_PB_ERRCS_ES);
111
112 /* Clear read error reported in PB_ISR */
113 tsi108_write_reg(TSI108_PB_OFFSET + TSI108_PB_ISR,
114 TSI108_PB_ISR_PBS_RD_ERR);
115
116 /* Clear PCI/X bus cfg errors if applicable */
117 if ((err_addr & 0xFF000000) == pci_cfg_base) {
118 pci_stat =
119 tsi108_read_reg(TSI108_PCI_OFFSET + TSI108_PCI_CSR);
120 tsi108_write_reg(TSI108_PCI_OFFSET + TSI108_PCI_CSR,
121 pci_stat);
122 }
123 }
124
125 return;
126}
127
128#define __tsi108_read_pci_config(x, addr, op) \
129 __asm__ __volatile__( \
130 " "op" %0,0,%1\n" \
131 "1: eieio\n" \
132 "2:\n" \
133 ".section .fixup,\"ax\"\n" \
134 "3: li %0,-1\n" \
135 " b 2b\n" \
136 ".section __ex_table,\"a\"\n" \
137 " .align 2\n" \
138 " .long 1b,3b\n" \
139 ".text" \
140 : "=r"(x) : "r"(addr))
141
142int
143tsi108_direct_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
144 int len, u32 * val)
145{
146 volatile unsigned char *cfg_addr;
147 u32 temp;
148
149 if (ppc_md.pci_exclude_device)
150 if (ppc_md.pci_exclude_device(bus->number, devfn))
151 return PCIBIOS_DEVICE_NOT_FOUND;
152
153 cfg_addr = (unsigned char *)(tsi_mk_config_addr(bus->number,
154 devfn,
155 offset) | (offset &
156 0x03));
157
158 switch (len) {
159 case 1:
160 __tsi108_read_pci_config(temp, cfg_addr, "lbzx");
161 break;
162 case 2:
163 __tsi108_read_pci_config(temp, cfg_addr, "lhbrx");
164 break;
165 default:
166 __tsi108_read_pci_config(temp, cfg_addr, "lwbrx");
167 break;
168 }
169
170 *val = temp;
171
172#ifdef DEBUG
173 if ((0xFFFFFFFF != temp) && (0xFFFF != temp) && (0xFF != temp)) {
174 printk("PCI CFG read : ");
175 printk("%d:0x%x:0x%x ", bus->number, devfn, offset);
176 printk("%d ADDR=0x%08x ", len, (uint) cfg_addr);
177 printk("data = 0x%x\n", *val);
178 }
179#endif
180 return PCIBIOS_SUCCESSFUL;
181}
182
183void tsi108_clear_pci_cfg_error(void)
184{
185 tsi108_clear_pci_error(TSI108_PCI_CFG_BASE_PHYS);
186}
187
188static struct pci_ops tsi108_direct_pci_ops = {
189 tsi108_direct_read_config,
190 tsi108_direct_write_config
191};
192
193int __init tsi108_setup_pci(struct device_node *dev)
194{
195 int len;
196 struct pci_controller *hose;
197 struct resource rsrc;
198 int *bus_range;
199 int primary = 0, has_address = 0;
200
201 /* PCI Config mapping */
202 tsi108_pci_cfg_base = (u32)ioremap(TSI108_PCI_CFG_BASE_PHYS,
203 TSI108_PCI_CFG_SIZE);
204 DBG("TSI_PCI: %s tsi108_pci_cfg_base=0x%x\n", __FUNCTION__,
205 tsi108_pci_cfg_base);
206
207 /* Fetch host bridge registers address */
208 has_address = (of_address_to_resource(dev, 0, &rsrc) == 0);
209
210 /* Get bus range if any */
211 bus_range = (int *)get_property(dev, "bus-range", &len);
212 if (bus_range == NULL || len < 2 * sizeof(int)) {
213 printk(KERN_WARNING "Can't get bus-range for %s, assume"
214 " bus 0\n", dev->full_name);
215 }
216
217 hose = pcibios_alloc_controller();
218
219 if (!hose) {
220 printk("PCI Host bridge init failed\n");
221 return -ENOMEM;
222 }
223 hose->arch_data = dev;
224 hose->set_cfg_type = 1;
225
226 hose->first_busno = bus_range ? bus_range[0] : 0;
227 hose->last_busno = bus_range ? bus_range[1] : 0xff;
228
229 (hose)->ops = &tsi108_direct_pci_ops;
230
231 printk(KERN_INFO "Found tsi108 PCI host bridge at 0x%08lx. "
232 "Firmware bus number: %d->%d\n",
233 rsrc.start, hose->first_busno, hose->last_busno);
234
235 /* Interpret the "ranges" property */
236 /* This also maps the I/O region and sets isa_io/mem_base */
237 pci_process_bridge_OF_ranges(hose, dev, primary);
238 return 0;
239}
240
241/*
242 * Low level utility functions
243 */
244
245static void tsi108_pci_int_mask(u_int irq)
246{
247 u_int irp_cfg;
248 int int_line = (irq - IRQ_PCI_INTAD_BASE);
249
250 irp_cfg = tsi108_read_reg(TSI108_PCI_OFFSET + TSI108_PCI_IRP_CFG_CTL);
251 mb();
252 irp_cfg |= (1 << int_line); /* INTx_DIR = output */
253 irp_cfg &= ~(3 << (8 + (int_line * 2))); /* INTx_TYPE = unused */
254 tsi108_write_reg(TSI108_PCI_OFFSET + TSI108_PCI_IRP_CFG_CTL, irp_cfg);
255 mb();
256 irp_cfg = tsi108_read_reg(TSI108_PCI_OFFSET + TSI108_PCI_IRP_CFG_CTL);
257}
258
259static void tsi108_pci_int_unmask(u_int irq)
260{
261 u_int irp_cfg;
262 int int_line = (irq - IRQ_PCI_INTAD_BASE);
263
264 irp_cfg = tsi108_read_reg(TSI108_PCI_OFFSET + TSI108_PCI_IRP_CFG_CTL);
265 mb();
266 irp_cfg &= ~(1 << int_line);
267 irp_cfg |= (3 << (8 + (int_line * 2)));
268 tsi108_write_reg(TSI108_PCI_OFFSET + TSI108_PCI_IRP_CFG_CTL, irp_cfg);
269 mb();
270}
271
272static void init_pci_source(void)
273{
274 tsi108_write_reg(TSI108_PCI_OFFSET + TSI108_PCI_IRP_CFG_CTL,
275 0x0000ff00);
276 tsi108_write_reg(TSI108_PCI_OFFSET + TSI108_PCI_IRP_ENABLE,
277 TSI108_PCI_IRP_ENABLE_P_INT);
278 mb();
279}
280
281static inline int get_pci_source(void)
282{
283 u_int temp = 0;
284 int irq = -1;
285 int i;
286 u_int pci_irp_stat;
287 static int mask = 0;
288
289 /* Read PCI/X block interrupt status register */
290 pci_irp_stat = tsi108_read_reg(TSI108_PCI_OFFSET + TSI108_PCI_IRP_STAT);
291 mb();
292
293 if (pci_irp_stat & TSI108_PCI_IRP_STAT_P_INT) {
294 /* Process Interrupt from PCI bus INTA# - INTD# lines */
295 temp =
296 tsi108_read_reg(TSI108_PCI_OFFSET +
297 TSI108_PCI_IRP_INTAD) & 0xf;
298 mb();
299 for (i = 0; i < 4; i++, mask++) {
300 if (temp & (1 << mask % 4)) {
301 irq = IRQ_PCI_INTA + mask % 4;
302 mask++;
303 break;
304 }
305 }
306
307 /* Disable interrupts from PCI block */
308 temp = tsi108_read_reg(TSI108_PCI_OFFSET + TSI108_PCI_IRP_ENABLE);
309 tsi108_write_reg(TSI108_PCI_OFFSET + TSI108_PCI_IRP_ENABLE,
310 temp & ~TSI108_PCI_IRP_ENABLE_P_INT);
311 mb();
312 (void)tsi108_read_reg(TSI108_PCI_OFFSET + TSI108_PCI_IRP_ENABLE);
313 mb();
314 }
315#ifdef DEBUG
316 else {
317 printk("TSI108_PIC: error in TSI108_PCI_IRP_STAT\n");
318 pci_irp_stat =
319 tsi108_read_reg(TSI108_PCI_OFFSET + TSI108_PCI_IRP_STAT);
320 temp =
321 tsi108_read_reg(TSI108_PCI_OFFSET + TSI108_PCI_IRP_INTAD);
322 mb();
323 printk(">> stat=0x%08x intad=0x%08x ", pci_irp_stat, temp);
324 temp =
325 tsi108_read_reg(TSI108_PCI_OFFSET + TSI108_PCI_IRP_CFG_CTL);
326 mb();
327 printk("cfg_ctl=0x%08x ", temp);
328 temp =
329 tsi108_read_reg(TSI108_PCI_OFFSET + TSI108_PCI_IRP_ENABLE);
330 mb();
331 printk("irp_enable=0x%08x\n", temp);
332 }
333#endif /* end of DEBUG */
334
335 return irq;
336}
337
338
339/*
340 * Linux descriptor level callbacks
341 */
342
343static void tsi108_pci_irq_enable(u_int irq)
344{
345 tsi108_pci_int_unmask(irq);
346}
347
348static void tsi108_pci_irq_disable(u_int irq)
349{
350 tsi108_pci_int_mask(irq);
351}
352
353static void tsi108_pci_irq_ack(u_int irq)
354{
355 tsi108_pci_int_mask(irq);
356}
357
358static void tsi108_pci_irq_end(u_int irq)
359{
360 tsi108_pci_int_unmask(irq);
361
362 /* Enable interrupts from PCI block */
363 tsi108_write_reg(TSI108_PCI_OFFSET + TSI108_PCI_IRP_ENABLE,
364 tsi108_read_reg(TSI108_PCI_OFFSET +
365 TSI108_PCI_IRP_ENABLE) |
366 TSI108_PCI_IRP_ENABLE_P_INT);
367 mb();
368}
369
370/*
371 * Interrupt controller descriptor for cascaded PCI interrupt controller.
372 */
373
374struct hw_interrupt_type tsi108_pci_irq = {
375 .typename = "tsi108_PCI_int",
376 .enable = tsi108_pci_irq_enable,
377 .disable = tsi108_pci_irq_disable,
378 .ack = tsi108_pci_irq_ack,
379 .end = tsi108_pci_irq_end,
380};
381
382/*
383 * Exported functions
384 */
385
386/*
387 * The Tsi108 PCI interrupts initialization routine.
388 *
389 * The INTA# - INTD# interrupts on the PCI bus are reported by the PCI block
390 * to the MPIC using single interrupt source (IRQ_TSI108_PCI). Therefore the
391 * PCI block has to be treated as a cascaded interrupt controller connected
392 * to the MPIC.
393 */
394
395void __init tsi108_pci_int_init(void)
396{
397 u_int i;
398
399 DBG("Tsi108_pci_int_init: initializing PCI interrupts\n");
400
401 for (i = 0; i < NUM_PCI_IRQS; i++) {
402 irq_desc[i + IRQ_PCI_INTAD_BASE].handler = &tsi108_pci_irq;
403 irq_desc[i + IRQ_PCI_INTAD_BASE].status |= IRQ_LEVEL;
404 }
405
406 init_pci_source();
407}
408
409int tsi108_irq_cascade(struct pt_regs *regs, void *unused)
410{
411 return get_pci_source();
412}
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 0741df8c41b7..179b10ced8c7 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -8,7 +8,6 @@
8 * as published by the Free Software Foundation; either version 8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11#include <linux/config.h>
12#include <linux/errno.h> 11#include <linux/errno.h>
13#include <linux/sched.h> 12#include <linux/sched.h>
14#include <linux/smp.h> 13#include <linux/smp.h>