aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-03-23 01:20:46 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-23 01:20:46 -0500
commit2e6e33bab6e1996a5dec9108fb467b52b841e7a8 (patch)
tree6b98b15c2fe7899cdeb2453589cdee00f7853492 /arch/powerpc
parentb7ad6d75028d021362221d9b2db19fcff995c3f8 (diff)
parentb88a0b1d5560cf1959c1565617e460a45c688a08 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
* git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc: (78 commits) [PATCH] powerpc: Add FSL SEC node to documentation [PATCH] macintosh: tidy-up driver_register() return values [PATCH] powerpc: tidy-up of_register_driver()/driver_register() return values [PATCH] powerpc: via-pmu warning fix [PATCH] macintosh: cleanup the use of i2c headers [PATCH] powerpc: dont allow old RTC to be selected [PATCH] powerpc: make powerbook_sleep_grackle static [PATCH] powerpc: Fix warning in add_memory [PATCH] powerpc: update mailing list addresses [PATCH] powerpc: Remove calculation of io hole [PATCH] powerpc: iseries: Add bootargs to /chosen [PATCH] powerpc: iseries: Add /system-id, /model and /compatible [PATCH] powerpc: Add strne2a() to convert a string from EBCDIC to ASCII [PATCH] powerpc: iseries: Make more stuff static in platforms/iseries/mf.c [PATCH] powerpc: iseries: Remove pointless iSeries_(restart|power_off|halt) [PATCH] powerpc: iseries: mf related cleanups [PATCH] powerpc: Replace platform_is_lpar() with a firmware feature [PATCH] powerpc: trivial: Cleanup whitespace in cputable.h [PATCH] powerpc: Remove unused iommu_off logic from pSeries_init_early() [PATCH] powerpc: Unconfuse htab_bolt_mapping() callers ...
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/Kconfig38
-rw-r--r--arch/powerpc/Makefile2
-rw-r--r--arch/powerpc/boot/install.sh2
-rw-r--r--arch/powerpc/boot/main.c4
-rw-r--r--arch/powerpc/configs/mpc8540_ads_defconfig721
-rw-r--r--arch/powerpc/kernel/asm-offsets.c3
-rw-r--r--arch/powerpc/kernel/cputable.c12
-rw-r--r--arch/powerpc/kernel/entry_64.S11
-rw-r--r--arch/powerpc/kernel/firmware.c25
-rw-r--r--arch/powerpc/kernel/head_44x.S2
-rw-r--r--arch/powerpc/kernel/head_64.S11
-rw-r--r--arch/powerpc/kernel/head_8xx.S2
-rw-r--r--arch/powerpc/kernel/head_booke.h363
-rw-r--r--arch/powerpc/kernel/head_fsl_booke.S6
-rw-r--r--arch/powerpc/kernel/iomap.c2
-rw-r--r--arch/powerpc/kernel/iommu.c1
-rw-r--r--arch/powerpc/kernel/irq.c32
-rw-r--r--arch/powerpc/kernel/kprobes.c1
-rw-r--r--arch/powerpc/kernel/of_device.c5
-rw-r--r--arch/powerpc/kernel/pci_iommu.c1
-rw-r--r--arch/powerpc/kernel/ppc_ksyms.c1
-rw-r--r--arch/powerpc/kernel/process.c9
-rw-r--r--arch/powerpc/kernel/prom.c4
-rw-r--r--arch/powerpc/kernel/ptrace-common.h2
-rw-r--r--arch/powerpc/kernel/rtas-proc.c1
-rw-r--r--arch/powerpc/kernel/rtas_pci.c2
-rw-r--r--arch/powerpc/kernel/setup_64.c2
-rw-r--r--arch/powerpc/kernel/signal_64.c2
-rw-r--r--arch/powerpc/kernel/smp.c4
-rw-r--r--arch/powerpc/kernel/time.c241
-rw-r--r--arch/powerpc/kernel/vdso.c2
-rw-r--r--arch/powerpc/lib/copypage_64.S2
-rw-r--r--arch/powerpc/lib/copyuser_64.S2
-rw-r--r--arch/powerpc/lib/e2a.c14
-rw-r--r--arch/powerpc/lib/memcpy_64.S2
-rw-r--r--arch/powerpc/lib/rheap.c2
-rw-r--r--arch/powerpc/mm/fault.c2
-rw-r--r--arch/powerpc/mm/hash_low_32.S2
-rw-r--r--arch/powerpc/mm/hash_utils_64.c32
-rw-r--r--arch/powerpc/mm/init_64.c48
-rw-r--r--arch/powerpc/mm/lmb.c16
-rw-r--r--arch/powerpc/mm/mem.c3
-rw-r--r--arch/powerpc/mm/mmap.c2
-rw-r--r--arch/powerpc/mm/numa.c160
-rw-r--r--arch/powerpc/mm/slb_low.S2
-rw-r--r--arch/powerpc/mm/stab.c4
-rw-r--r--arch/powerpc/mm/tlb_64.c2
-rw-r--r--arch/powerpc/oprofile/op_model_power4.c3
-rw-r--r--arch/powerpc/platforms/83xx/Makefile4
-rw-r--r--arch/powerpc/platforms/83xx/misc.c55
-rw-r--r--arch/powerpc/platforms/83xx/mpc834x_sys.c89
-rw-r--r--arch/powerpc/platforms/83xx/mpc834x_sys.h2
-rw-r--r--arch/powerpc/platforms/83xx/mpc83xx.h5
-rw-r--r--arch/powerpc/platforms/83xx/pci.c21
-rw-r--r--arch/powerpc/platforms/85xx/Kconfig74
-rw-r--r--arch/powerpc/platforms/85xx/Makefile6
-rw-r--r--arch/powerpc/platforms/85xx/misc.c31
-rw-r--r--arch/powerpc/platforms/85xx/mpc8540_ads.h36
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx.h18
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_ads.c244
-rw-r--r--arch/powerpc/platforms/85xx/pci.c96
-rw-r--r--arch/powerpc/platforms/Makefile2
-rw-r--r--arch/powerpc/platforms/chrp/pegasos_eth.c2
-rw-r--r--arch/powerpc/platforms/chrp/setup.c2
-rw-r--r--arch/powerpc/platforms/chrp/time.c2
-rw-r--r--arch/powerpc/platforms/iseries/mf.c112
-rw-r--r--arch/powerpc/platforms/iseries/setup.c72
-rw-r--r--arch/powerpc/platforms/maple/time.c2
-rw-r--r--arch/powerpc/platforms/powermac/cpufreq_32.c2
-rw-r--r--arch/powerpc/platforms/powermac/feature.c2
-rw-r--r--arch/powerpc/platforms/powermac/nvram.c2
-rw-r--r--arch/powerpc/platforms/powermac/setup.c8
-rw-r--r--arch/powerpc/platforms/pseries/Makefile3
-rw-r--r--arch/powerpc/platforms/pseries/firmware.c103
-rw-r--r--arch/powerpc/platforms/pseries/firmware.h17
-rw-r--r--arch/powerpc/platforms/pseries/hvCall.S2
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c4
-rw-r--r--arch/powerpc/platforms/pseries/pci.c2
-rw-r--r--arch/powerpc/platforms/pseries/setup.c67
-rw-r--r--arch/powerpc/platforms/pseries/smp.c2
-rw-r--r--arch/powerpc/platforms/pseries/xics.c3
-rw-r--r--arch/powerpc/sysdev/dart_iommu.c2
-rw-r--r--arch/powerpc/sysdev/dcr.S2
-rw-r--r--arch/powerpc/sysdev/fsl_soc.c292
-rw-r--r--arch/powerpc/sysdev/ipic.h2
-rw-r--r--arch/powerpc/xmon/xmon.c30
86 files changed, 2573 insertions, 659 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index dfba81719dec..fae42da7468d 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -127,6 +127,12 @@ config PPC_83xx
127 select 83xx 127 select 83xx
128 select PPC_FPU 128 select PPC_FPU
129 129
130config PPC_85xx
131 bool "Freescale 85xx"
132 select E500
133 select FSL_SOC
134 select 85xx
135
130config 40x 136config 40x
131 bool "AMCC 40x" 137 bool "AMCC 40x"
132 138
@@ -139,8 +145,6 @@ config 8xx
139config E200 145config E200
140 bool "Freescale e200" 146 bool "Freescale e200"
141 147
142config E500
143 bool "Freescale e500"
144endchoice 148endchoice
145 149
146config POWER4_ONLY 150config POWER4_ONLY
@@ -168,6 +172,13 @@ config 6xx
168config 83xx 172config 83xx
169 bool 173 bool
170 174
175# this is temp to handle compat with arch=ppc
176config 85xx
177 bool
178
179config E500
180 bool
181
171config PPC_FPU 182config PPC_FPU
172 bool 183 bool
173 default y if PPC64 184 default y if PPC64
@@ -217,6 +228,7 @@ config ALTIVEC
217config SPE 228config SPE
218 bool "SPE Support" 229 bool "SPE Support"
219 depends on E200 || E500 230 depends on E200 || E500
231 default y
220 ---help--- 232 ---help---
221 This option enables kernel support for the Signal Processing 233 This option enables kernel support for the Signal Processing
222 Extensions (SPE) to the PowerPC processor. The kernel currently 234 Extensions (SPE) to the PowerPC processor. The kernel currently
@@ -238,6 +250,21 @@ config PPC_STD_MMU_32
238 def_bool y 250 def_bool y
239 depends on PPC_STD_MMU && PPC32 251 depends on PPC_STD_MMU && PPC32
240 252
253config VIRT_CPU_ACCOUNTING
254 bool "Deterministic task and CPU time accounting"
255 depends on PPC64
256 default y
257 help
258 Select this option to enable more accurate task and CPU time
259 accounting. This is done by reading a CPU counter on each
260 kernel entry and exit and on transitions within the kernel
261 between system, softirq and hardirq state, so there is a
262 small performance impact. This also enables accounting of
263 stolen time on logically-partitioned systems running on
264 IBM POWER5-based machines.
265
266 If in doubt, say Y here.
267
241config SMP 268config SMP
242 depends on PPC_STD_MMU 269 depends on PPC_STD_MMU
243 bool "Symmetric multi-processing support" 270 bool "Symmetric multi-processing support"
@@ -734,13 +761,12 @@ config GENERIC_ISA_DMA
734 761
735config PPC_I8259 762config PPC_I8259
736 bool 763 bool
737 default y if 85xx
738 default n 764 default n
739 765
740config PPC_INDIRECT_PCI 766config PPC_INDIRECT_PCI
741 bool 767 bool
742 depends on PCI 768 depends on PCI
743 default y if 40x || 44x || 85xx 769 default y if 40x || 44x
744 default n 770 default n
745 771
746config EISA 772config EISA
@@ -757,8 +783,8 @@ config MCA
757 bool 783 bool
758 784
759config PCI 785config PCI
760 bool "PCI support" if 40x || CPM2 || PPC_83xx || 85xx || PPC_MPC52xx || (EMBEDDED && PPC_ISERIES) 786 bool "PCI support" if 40x || CPM2 || PPC_83xx || PPC_85xx || PPC_MPC52xx || (EMBEDDED && PPC_ISERIES)
761 default y if !40x && !CPM2 && !8xx && !APUS && !PPC_83xx && !85xx 787 default y if !40x && !CPM2 && !8xx && !APUS && !PPC_83xx && !PPC_85xx
762 default PCI_PERMEDIA if !4xx && !CPM2 && !8xx && APUS 788 default PCI_PERMEDIA if !4xx && !CPM2 && !8xx && APUS
763 default PCI_QSPAN if !4xx && !CPM2 && 8xx 789 default PCI_QSPAN if !4xx && !CPM2 && 8xx
764 help 790 help
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 5500ab55d042..a3fc7a23158f 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -148,7 +148,7 @@ all: $(KBUILD_IMAGE)
148 148
149CPPFLAGS_vmlinux.lds := -Upowerpc 149CPPFLAGS_vmlinux.lds := -Upowerpc
150 150
151BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd vmlinux.sm uImage 151BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd vmlinux.sm uImage vmlinux.bin
152 152
153.PHONY: $(BOOT_TARGETS) 153.PHONY: $(BOOT_TARGETS)
154 154
diff --git a/arch/powerpc/boot/install.sh b/arch/powerpc/boot/install.sh
index eacce9590816..b002bfd56786 100644
--- a/arch/powerpc/boot/install.sh
+++ b/arch/powerpc/boot/install.sh
@@ -1,7 +1,5 @@
1#!/bin/sh 1#!/bin/sh
2# 2#
3# arch/ppc64/boot/install.sh
4#
5# This file is subject to the terms and conditions of the GNU General Public 3# This file is subject to the terms and conditions of the GNU General Public
6# License. See the file "COPYING" in the main directory of this archive 4# License. See the file "COPYING" in the main directory of this archive
7# for more details. 5# for more details.
diff --git a/arch/powerpc/boot/main.c b/arch/powerpc/boot/main.c
index 55ec59867250..816446f0e497 100644
--- a/arch/powerpc/boot/main.c
+++ b/arch/powerpc/boot/main.c
@@ -152,7 +152,7 @@ static int is_elf64(void *hdr)
152 elf64ph = (Elf64_Phdr *)((unsigned long)elf64 + 152 elf64ph = (Elf64_Phdr *)((unsigned long)elf64 +
153 (unsigned long)elf64->e_phoff); 153 (unsigned long)elf64->e_phoff);
154 for (i = 0; i < (unsigned int)elf64->e_phnum; i++, elf64ph++) 154 for (i = 0; i < (unsigned int)elf64->e_phnum; i++, elf64ph++)
155 if (elf64ph->p_type == PT_LOAD && elf64ph->p_offset != 0) 155 if (elf64ph->p_type == PT_LOAD)
156 break; 156 break;
157 if (i >= (unsigned int)elf64->e_phnum) 157 if (i >= (unsigned int)elf64->e_phnum)
158 return 0; 158 return 0;
@@ -193,7 +193,7 @@ static int is_elf32(void *hdr)
193 elf32 = (Elf32_Ehdr *)elfheader; 193 elf32 = (Elf32_Ehdr *)elfheader;
194 elf32ph = (Elf32_Phdr *) ((unsigned long)elf32 + elf32->e_phoff); 194 elf32ph = (Elf32_Phdr *) ((unsigned long)elf32 + elf32->e_phoff);
195 for (i = 0; i < elf32->e_phnum; i++, elf32ph++) 195 for (i = 0; i < elf32->e_phnum; i++, elf32ph++)
196 if (elf32ph->p_type == PT_LOAD && elf32ph->p_offset != 0) 196 if (elf32ph->p_type == PT_LOAD)
197 break; 197 break;
198 if (i >= elf32->e_phnum) 198 if (i >= elf32->e_phnum)
199 return 0; 199 return 0;
diff --git a/arch/powerpc/configs/mpc8540_ads_defconfig b/arch/powerpc/configs/mpc8540_ads_defconfig
new file mode 100644
index 000000000000..2a8290ee15c6
--- /dev/null
+++ b/arch/powerpc/configs/mpc8540_ads_defconfig
@@ -0,0 +1,721 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version:
4# Sat Jan 14 15:57:54 2006
5#
6# CONFIG_PPC64 is not set
7CONFIG_PPC32=y
8CONFIG_PPC_MERGE=y
9CONFIG_MMU=y
10CONFIG_GENERIC_HARDIRQS=y
11CONFIG_RWSEM_XCHGADD_ALGORITHM=y
12CONFIG_GENERIC_CALIBRATE_DELAY=y
13CONFIG_PPC=y
14CONFIG_EARLY_PRINTK=y
15CONFIG_GENERIC_NVRAM=y
16CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
17CONFIG_ARCH_MAY_HAVE_PC_FDC=y
18CONFIG_PPC_OF=y
19CONFIG_PPC_UDBG_16550=y
20# CONFIG_GENERIC_TBSYNC is not set
21
22#
23# Processor support
24#
25# CONFIG_CLASSIC32 is not set
26# CONFIG_PPC_52xx is not set
27# CONFIG_PPC_82xx is not set
28# CONFIG_PPC_83xx is not set
29CONFIG_PPC_85xx=y
30# CONFIG_40x is not set
31# CONFIG_44x is not set
32# CONFIG_8xx is not set
33# CONFIG_E200 is not set
34CONFIG_85xx=y
35CONFIG_E500=y
36CONFIG_BOOKE=y
37CONFIG_FSL_BOOKE=y
38# CONFIG_PHYS_64BIT is not set
39CONFIG_SPE=y
40
41#
42# Code maturity level options
43#
44CONFIG_EXPERIMENTAL=y
45CONFIG_CLEAN_COMPILE=y
46CONFIG_BROKEN_ON_SMP=y
47CONFIG_INIT_ENV_ARG_LIMIT=32
48
49#
50# General setup
51#
52CONFIG_LOCALVERSION=""
53CONFIG_LOCALVERSION_AUTO=y
54CONFIG_SWAP=y
55CONFIG_SYSVIPC=y
56# CONFIG_POSIX_MQUEUE is not set
57# CONFIG_BSD_PROCESS_ACCT is not set
58CONFIG_SYSCTL=y
59# CONFIG_AUDIT is not set
60# CONFIG_IKCONFIG is not set
61CONFIG_INITRAMFS_SOURCE=""
62# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
63CONFIG_EMBEDDED=y
64CONFIG_KALLSYMS=y
65# CONFIG_KALLSYMS_ALL is not set
66# CONFIG_KALLSYMS_EXTRA_PASS is not set
67CONFIG_HOTPLUG=y
68CONFIG_PRINTK=y
69CONFIG_BUG=y
70CONFIG_ELF_CORE=y
71CONFIG_BASE_FULL=y
72CONFIG_FUTEX=y
73CONFIG_EPOLL=y
74CONFIG_SHMEM=y
75CONFIG_CC_ALIGN_FUNCTIONS=0
76CONFIG_CC_ALIGN_LABELS=0
77CONFIG_CC_ALIGN_LOOPS=0
78CONFIG_CC_ALIGN_JUMPS=0
79CONFIG_SLAB=y
80# CONFIG_TINY_SHMEM is not set
81CONFIG_BASE_SMALL=0
82# CONFIG_SLOB is not set
83
84#
85# Loadable module support
86#
87# CONFIG_MODULES is not set
88
89#
90# Block layer
91#
92# CONFIG_LBD is not set
93
94#
95# IO Schedulers
96#
97CONFIG_IOSCHED_NOOP=y
98CONFIG_IOSCHED_AS=y
99CONFIG_IOSCHED_DEADLINE=y
100CONFIG_IOSCHED_CFQ=y
101CONFIG_DEFAULT_AS=y
102# CONFIG_DEFAULT_DEADLINE is not set
103# CONFIG_DEFAULT_CFQ is not set
104# CONFIG_DEFAULT_NOOP is not set
105CONFIG_DEFAULT_IOSCHED="anticipatory"
106CONFIG_MPIC=y
107# CONFIG_WANT_EARLY_SERIAL is not set
108
109#
110# Platform support
111#
112CONFIG_MPC8540_ADS=y
113CONFIG_MPC8540=y
114CONFIG_PPC_INDIRECT_PCI_BE=y
115
116#
117# Kernel options
118#
119# CONFIG_HIGHMEM is not set
120# CONFIG_HZ_100 is not set
121CONFIG_HZ_250=y
122# CONFIG_HZ_1000 is not set
123CONFIG_HZ=250
124CONFIG_PREEMPT_NONE=y
125# CONFIG_PREEMPT_VOLUNTARY is not set
126# CONFIG_PREEMPT is not set
127CONFIG_BINFMT_ELF=y
128CONFIG_BINFMT_MISC=y
129CONFIG_MATH_EMULATION=y
130CONFIG_ARCH_FLATMEM_ENABLE=y
131CONFIG_SELECT_MEMORY_MODEL=y
132CONFIG_FLATMEM_MANUAL=y
133# CONFIG_DISCONTIGMEM_MANUAL is not set
134# CONFIG_SPARSEMEM_MANUAL is not set
135CONFIG_FLATMEM=y
136CONFIG_FLAT_NODE_MEM_MAP=y
137# CONFIG_SPARSEMEM_STATIC is not set
138CONFIG_SPLIT_PTLOCK_CPUS=4
139CONFIG_PROC_DEVICETREE=y
140# CONFIG_CMDLINE_BOOL is not set
141# CONFIG_PM is not set
142# CONFIG_SOFTWARE_SUSPEND is not set
143# CONFIG_SECCOMP is not set
144CONFIG_ISA_DMA_API=y
145
146#
147# Bus options
148#
149# CONFIG_PPC_I8259 is not set
150CONFIG_PPC_INDIRECT_PCI=y
151CONFIG_FSL_SOC=y
152# CONFIG_PCI is not set
153# CONFIG_PCI_DOMAINS is not set
154
155#
156# PCCARD (PCMCIA/CardBus) support
157#
158# CONFIG_PCCARD is not set
159
160#
161# PCI Hotplug Support
162#
163
164#
165# Advanced setup
166#
167# CONFIG_ADVANCED_OPTIONS is not set
168
169#
170# Default settings for advanced configuration options are used
171#
172CONFIG_HIGHMEM_START=0xfe000000
173CONFIG_LOWMEM_SIZE=0x30000000
174CONFIG_KERNEL_START=0xc0000000
175CONFIG_TASK_SIZE=0x80000000
176CONFIG_BOOT_LOAD=0x00800000
177
178#
179# Networking
180#
181CONFIG_NET=y
182
183#
184# Networking options
185#
186CONFIG_PACKET=y
187# CONFIG_PACKET_MMAP is not set
188CONFIG_UNIX=y
189# CONFIG_NET_KEY is not set
190CONFIG_INET=y
191CONFIG_IP_MULTICAST=y
192# CONFIG_IP_ADVANCED_ROUTER is not set
193CONFIG_IP_FIB_HASH=y
194CONFIG_IP_PNP=y
195CONFIG_IP_PNP_DHCP=y
196CONFIG_IP_PNP_BOOTP=y
197# CONFIG_IP_PNP_RARP is not set
198# CONFIG_NET_IPIP is not set
199# CONFIG_NET_IPGRE is not set
200# CONFIG_IP_MROUTE is not set
201# CONFIG_ARPD is not set
202CONFIG_SYN_COOKIES=y
203# CONFIG_INET_AH is not set
204# CONFIG_INET_ESP is not set
205# CONFIG_INET_IPCOMP is not set
206# CONFIG_INET_TUNNEL is not set
207CONFIG_INET_DIAG=y
208CONFIG_INET_TCP_DIAG=y
209# CONFIG_TCP_CONG_ADVANCED is not set
210CONFIG_TCP_CONG_BIC=y
211# CONFIG_IPV6 is not set
212# CONFIG_NETFILTER is not set
213
214#
215# DCCP Configuration (EXPERIMENTAL)
216#
217# CONFIG_IP_DCCP is not set
218
219#
220# SCTP Configuration (EXPERIMENTAL)
221#
222# CONFIG_IP_SCTP is not set
223# CONFIG_ATM is not set
224# CONFIG_BRIDGE is not set
225# CONFIG_VLAN_8021Q is not set
226# CONFIG_DECNET is not set
227# CONFIG_LLC2 is not set
228# CONFIG_IPX is not set
229# CONFIG_ATALK is not set
230# CONFIG_X25 is not set
231# CONFIG_LAPB is not set
232
233#
234# TIPC Configuration (EXPERIMENTAL)
235#
236# CONFIG_TIPC is not set
237# CONFIG_NET_DIVERT is not set
238# CONFIG_ECONET is not set
239# CONFIG_WAN_ROUTER is not set
240
241#
242# QoS and/or fair queueing
243#
244# CONFIG_NET_SCHED is not set
245
246#
247# Network testing
248#
249# CONFIG_NET_PKTGEN is not set
250# CONFIG_HAMRADIO is not set
251# CONFIG_IRDA is not set
252# CONFIG_BT is not set
253# CONFIG_IEEE80211 is not set
254
255#
256# Device Drivers
257#
258
259#
260# Generic Driver Options
261#
262CONFIG_STANDALONE=y
263CONFIG_PREVENT_FIRMWARE_BUILD=y
264# CONFIG_FW_LOADER is not set
265# CONFIG_DEBUG_DRIVER is not set
266
267#
268# Connector - unified userspace <-> kernelspace linker
269#
270# CONFIG_CONNECTOR is not set
271
272#
273# Memory Technology Devices (MTD)
274#
275# CONFIG_MTD is not set
276
277#
278# Parallel port support
279#
280# CONFIG_PARPORT is not set
281
282#
283# Plug and Play support
284#
285
286#
287# Block devices
288#
289# CONFIG_BLK_DEV_FD is not set
290# CONFIG_BLK_DEV_COW_COMMON is not set
291CONFIG_BLK_DEV_LOOP=y
292# CONFIG_BLK_DEV_CRYPTOLOOP is not set
293# CONFIG_BLK_DEV_NBD is not set
294CONFIG_BLK_DEV_RAM=y
295CONFIG_BLK_DEV_RAM_COUNT=16
296CONFIG_BLK_DEV_RAM_SIZE=32768
297CONFIG_BLK_DEV_INITRD=y
298# CONFIG_CDROM_PKTCDVD is not set
299# CONFIG_ATA_OVER_ETH is not set
300
301#
302# ATA/ATAPI/MFM/RLL support
303#
304# CONFIG_IDE is not set
305
306#
307# SCSI device support
308#
309# CONFIG_RAID_ATTRS is not set
310# CONFIG_SCSI is not set
311
312#
313# Multi-device support (RAID and LVM)
314#
315# CONFIG_MD is not set
316
317#
318# Fusion MPT device support
319#
320# CONFIG_FUSION is not set
321
322#
323# IEEE 1394 (FireWire) support
324#
325
326#
327# I2O device support
328#
329
330#
331# Macintosh device drivers
332#
333# CONFIG_WINDFARM is not set
334
335#
336# Network device support
337#
338CONFIG_NETDEVICES=y
339# CONFIG_DUMMY is not set
340# CONFIG_BONDING is not set
341# CONFIG_EQUALIZER is not set
342# CONFIG_TUN is not set
343
344#
345# PHY device support
346#
347CONFIG_PHYLIB=y
348
349#
350# MII PHY device drivers
351#
352# CONFIG_MARVELL_PHY is not set
353# CONFIG_DAVICOM_PHY is not set
354# CONFIG_QSEMI_PHY is not set
355# CONFIG_LXT_PHY is not set
356# CONFIG_CICADA_PHY is not set
357
358#
359# Ethernet (10 or 100Mbit)
360#
361CONFIG_NET_ETHERNET=y
362CONFIG_MII=y
363
364#
365# Ethernet (1000 Mbit)
366#
367CONFIG_GIANFAR=y
368CONFIG_GFAR_NAPI=y
369
370#
371# Ethernet (10000 Mbit)
372#
373
374#
375# Token Ring devices
376#
377
378#
379# Wireless LAN (non-hamradio)
380#
381# CONFIG_NET_RADIO is not set
382
383#
384# Wan interfaces
385#
386# CONFIG_WAN is not set
387# CONFIG_PPP is not set
388# CONFIG_SLIP is not set
389# CONFIG_SHAPER is not set
390# CONFIG_NETCONSOLE is not set
391# CONFIG_NETPOLL is not set
392# CONFIG_NET_POLL_CONTROLLER is not set
393
394#
395# ISDN subsystem
396#
397# CONFIG_ISDN is not set
398
399#
400# Telephony Support
401#
402# CONFIG_PHONE is not set
403
404#
405# Input device support
406#
407CONFIG_INPUT=y
408
409#
410# Userland interfaces
411#
412# CONFIG_INPUT_MOUSEDEV is not set
413# CONFIG_INPUT_JOYDEV is not set
414# CONFIG_INPUT_TSDEV is not set
415# CONFIG_INPUT_EVDEV is not set
416# CONFIG_INPUT_EVBUG is not set
417
418#
419# Input Device Drivers
420#
421# CONFIG_INPUT_KEYBOARD is not set
422# CONFIG_INPUT_MOUSE is not set
423# CONFIG_INPUT_JOYSTICK is not set
424# CONFIG_INPUT_TOUCHSCREEN is not set
425# CONFIG_INPUT_MISC is not set
426
427#
428# Hardware I/O ports
429#
430# CONFIG_SERIO is not set
431# CONFIG_GAMEPORT is not set
432
433#
434# Character devices
435#
436# CONFIG_VT is not set
437# CONFIG_SERIAL_NONSTANDARD is not set
438
439#
440# Serial drivers
441#
442CONFIG_SERIAL_8250=y
443CONFIG_SERIAL_8250_CONSOLE=y
444CONFIG_SERIAL_8250_NR_UARTS=4
445CONFIG_SERIAL_8250_RUNTIME_UARTS=4
446# CONFIG_SERIAL_8250_EXTENDED is not set
447
448#
449# Non-8250 serial port support
450#
451CONFIG_SERIAL_CORE=y
452CONFIG_SERIAL_CORE_CONSOLE=y
453CONFIG_UNIX98_PTYS=y
454CONFIG_LEGACY_PTYS=y
455CONFIG_LEGACY_PTY_COUNT=256
456
457#
458# IPMI
459#
460# CONFIG_IPMI_HANDLER is not set
461
462#
463# Watchdog Cards
464#
465# CONFIG_WATCHDOG is not set
466# CONFIG_NVRAM is not set
467CONFIG_GEN_RTC=y
468# CONFIG_GEN_RTC_X is not set
469# CONFIG_DTLK is not set
470# CONFIG_R3964 is not set
471
472#
473# Ftape, the floppy tape device driver
474#
475# CONFIG_AGP is not set
476# CONFIG_RAW_DRIVER is not set
477
478#
479# TPM devices
480#
481# CONFIG_TCG_TPM is not set
482# CONFIG_TELCLOCK is not set
483
484#
485# I2C support
486#
487# CONFIG_I2C is not set
488
489#
490# Dallas's 1-wire bus
491#
492# CONFIG_W1 is not set
493
494#
495# Hardware Monitoring support
496#
497CONFIG_HWMON=y
498# CONFIG_HWMON_VID is not set
499# CONFIG_HWMON_DEBUG_CHIP is not set
500
501#
502# Misc devices
503#
504
505#
506# Multimedia Capabilities Port drivers
507#
508
509#
510# Multimedia devices
511#
512# CONFIG_VIDEO_DEV is not set
513
514#
515# Digital Video Broadcasting Devices
516#
517# CONFIG_DVB is not set
518
519#
520# Graphics support
521#
522# CONFIG_FB is not set
523
524#
525# Sound
526#
527# CONFIG_SOUND is not set
528
529#
530# USB support
531#
532# CONFIG_USB_ARCH_HAS_HCD is not set
533# CONFIG_USB_ARCH_HAS_OHCI is not set
534
535#
536# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
537#
538
539#
540# USB Gadget Support
541#
542# CONFIG_USB_GADGET is not set
543
544#
545# MMC/SD Card support
546#
547# CONFIG_MMC is not set
548
549#
550# InfiniBand support
551#
552
553#
554# SN Devices
555#
556
557#
558# File systems
559#
560CONFIG_EXT2_FS=y
561# CONFIG_EXT2_FS_XATTR is not set
562# CONFIG_EXT2_FS_XIP is not set
563CONFIG_EXT3_FS=y
564CONFIG_EXT3_FS_XATTR=y
565# CONFIG_EXT3_FS_POSIX_ACL is not set
566# CONFIG_EXT3_FS_SECURITY is not set
567CONFIG_JBD=y
568# CONFIG_JBD_DEBUG is not set
569CONFIG_FS_MBCACHE=y
570# CONFIG_REISERFS_FS is not set
571# CONFIG_JFS_FS is not set
572# CONFIG_FS_POSIX_ACL is not set
573# CONFIG_XFS_FS is not set
574# CONFIG_OCFS2_FS is not set
575# CONFIG_MINIX_FS is not set
576# CONFIG_ROMFS_FS is not set
577CONFIG_INOTIFY=y
578# CONFIG_QUOTA is not set
579CONFIG_DNOTIFY=y
580# CONFIG_AUTOFS_FS is not set
581# CONFIG_AUTOFS4_FS is not set
582# CONFIG_FUSE_FS is not set
583
584#
585# CD-ROM/DVD Filesystems
586#
587# CONFIG_ISO9660_FS is not set
588# CONFIG_UDF_FS is not set
589
590#
591# DOS/FAT/NT Filesystems
592#
593# CONFIG_MSDOS_FS is not set
594# CONFIG_VFAT_FS is not set
595# CONFIG_NTFS_FS is not set
596
597#
598# Pseudo filesystems
599#
600CONFIG_PROC_FS=y
601CONFIG_PROC_KCORE=y
602CONFIG_SYSFS=y
603CONFIG_TMPFS=y
604# CONFIG_HUGETLB_PAGE is not set
605CONFIG_RAMFS=y
606# CONFIG_RELAYFS_FS is not set
607# CONFIG_CONFIGFS_FS is not set
608
609#
610# Miscellaneous filesystems
611#
612# CONFIG_ADFS_FS is not set
613# CONFIG_AFFS_FS is not set
614# CONFIG_HFS_FS is not set
615# CONFIG_HFSPLUS_FS is not set
616# CONFIG_BEFS_FS is not set
617# CONFIG_BFS_FS is not set
618# CONFIG_EFS_FS is not set
619# CONFIG_CRAMFS is not set
620# CONFIG_VXFS_FS is not set
621# CONFIG_HPFS_FS is not set
622# CONFIG_QNX4FS_FS is not set
623# CONFIG_SYSV_FS is not set
624# CONFIG_UFS_FS is not set
625
626#
627# Network File Systems
628#
629CONFIG_NFS_FS=y
630# CONFIG_NFS_V3 is not set
631# CONFIG_NFS_V4 is not set
632# CONFIG_NFS_DIRECTIO is not set
633# CONFIG_NFSD is not set
634CONFIG_ROOT_NFS=y
635CONFIG_LOCKD=y
636CONFIG_NFS_COMMON=y
637CONFIG_SUNRPC=y
638# CONFIG_RPCSEC_GSS_KRB5 is not set
639# CONFIG_RPCSEC_GSS_SPKM3 is not set
640# CONFIG_SMB_FS is not set
641# CONFIG_CIFS is not set
642# CONFIG_NCP_FS is not set
643# CONFIG_CODA_FS is not set
644# CONFIG_AFS_FS is not set
645# CONFIG_9P_FS is not set
646
647#
648# Partition Types
649#
650CONFIG_PARTITION_ADVANCED=y
651# CONFIG_ACORN_PARTITION is not set
652# CONFIG_OSF_PARTITION is not set
653# CONFIG_AMIGA_PARTITION is not set
654# CONFIG_ATARI_PARTITION is not set
655# CONFIG_MAC_PARTITION is not set
656# CONFIG_MSDOS_PARTITION is not set
657# CONFIG_LDM_PARTITION is not set
658# CONFIG_SGI_PARTITION is not set
659# CONFIG_ULTRIX_PARTITION is not set
660# CONFIG_SUN_PARTITION is not set
661# CONFIG_EFI_PARTITION is not set
662
663#
664# Native Language Support
665#
666# CONFIG_NLS is not set
667
668#
669# Library routines
670#
671# CONFIG_CRC_CCITT is not set
672# CONFIG_CRC16 is not set
673CONFIG_CRC32=y
674# CONFIG_LIBCRC32C is not set
675
676#
677# Instrumentation Support
678#
679# CONFIG_PROFILING is not set
680
681#
682# Kernel hacking
683#
684# CONFIG_PRINTK_TIME is not set
685# CONFIG_MAGIC_SYSRQ is not set
686CONFIG_DEBUG_KERNEL=y
687CONFIG_LOG_BUF_SHIFT=14
688CONFIG_DETECT_SOFTLOCKUP=y
689# CONFIG_SCHEDSTATS is not set
690# CONFIG_DEBUG_SLAB is not set
691CONFIG_DEBUG_MUTEXES=y
692# CONFIG_DEBUG_SPINLOCK is not set
693# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
694# CONFIG_DEBUG_KOBJECT is not set
695# CONFIG_DEBUG_INFO is not set
696# CONFIG_DEBUG_FS is not set
697# CONFIG_DEBUG_VM is not set
698# CONFIG_RCU_TORTURE_TEST is not set
699# CONFIG_DEBUGGER is not set
700# CONFIG_BDI_SWITCH is not set
701# CONFIG_BOOTX_TEXT is not set
702# CONFIG_PPC_EARLY_DEBUG_LPAR is not set
703# CONFIG_PPC_EARLY_DEBUG_G5 is not set
704# CONFIG_PPC_EARLY_DEBUG_RTAS is not set
705# CONFIG_PPC_EARLY_DEBUG_MAPLE is not set
706# CONFIG_PPC_EARLY_DEBUG_ISERIES is not set
707
708#
709# Security options
710#
711# CONFIG_KEYS is not set
712# CONFIG_SECURITY is not set
713
714#
715# Cryptographic options
716#
717# CONFIG_CRYPTO is not set
718
719#
720# Hardware crypto devices
721#
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index c9a660e4c2db..882889b15926 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -136,6 +136,9 @@ int main(void)
136 DEFINE(PACAEMERGSP, offsetof(struct paca_struct, emergency_sp)); 136 DEFINE(PACAEMERGSP, offsetof(struct paca_struct, emergency_sp));
137 DEFINE(PACALPPACAPTR, offsetof(struct paca_struct, lppaca_ptr)); 137 DEFINE(PACALPPACAPTR, offsetof(struct paca_struct, lppaca_ptr));
138 DEFINE(PACAHWCPUID, offsetof(struct paca_struct, hw_cpu_id)); 138 DEFINE(PACAHWCPUID, offsetof(struct paca_struct, hw_cpu_id));
139 DEFINE(PACA_STARTPURR, offsetof(struct paca_struct, startpurr));
140 DEFINE(PACA_USER_TIME, offsetof(struct paca_struct, user_time));
141 DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time));
139 142
140 DEFINE(LPPACASRR0, offsetof(struct lppaca, saved_srr0)); 143 DEFINE(LPPACASRR0, offsetof(struct lppaca, saved_srr0));
141 DEFINE(LPPACASRR1, offsetof(struct lppaca, saved_srr1)); 144 DEFINE(LPPACASRR1, offsetof(struct lppaca, saved_srr1));
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index e4e81374cb9a..39e348a3ade2 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -894,7 +894,7 @@ struct cpu_spec cpu_specs[] = {
894 .platform = "ppc405", 894 .platform = "ppc405",
895 }, 895 },
896 { /* Xilinx Virtex-II Pro */ 896 { /* Xilinx Virtex-II Pro */
897 .pvr_mask = 0xffff0000, 897 .pvr_mask = 0xfffff000,
898 .pvr_value = 0x20010000, 898 .pvr_value = 0x20010000,
899 .cpu_name = "Virtex-II Pro", 899 .cpu_name = "Virtex-II Pro",
900 .cpu_features = CPU_FTRS_40X, 900 .cpu_features = CPU_FTRS_40X,
@@ -904,6 +904,16 @@ struct cpu_spec cpu_specs[] = {
904 .dcache_bsize = 32, 904 .dcache_bsize = 32,
905 .platform = "ppc405", 905 .platform = "ppc405",
906 }, 906 },
907 { /* Xilinx Virtex-4 FX */
908 .pvr_mask = 0xfffff000,
909 .pvr_value = 0x20011000,
910 .cpu_name = "Virtex-4 FX",
911 .cpu_features = CPU_FTRS_40X,
912 .cpu_user_features = PPC_FEATURE_32 |
913 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
914 .icache_bsize = 32,
915 .dcache_bsize = 32,
916 },
907 { /* 405EP */ 917 { /* 405EP */
908 .pvr_mask = 0xffff0000, 918 .pvr_mask = 0xffff0000,
909 .pvr_value = 0x51210000, 919 .pvr_value = 0x51210000,
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 24be0cf86d7f..1060155d84c3 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/ppc64/kernel/entry.S
3 *
4 * PowerPC version 2 * PowerPC version
5 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) 3 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
6 * Rewritten by Cort Dougan (cort@cs.nmt.edu) for PReP 4 * Rewritten by Cort Dougan (cort@cs.nmt.edu) for PReP
@@ -63,6 +61,7 @@ system_call_common:
63 std r12,_MSR(r1) 61 std r12,_MSR(r1)
64 std r0,GPR0(r1) 62 std r0,GPR0(r1)
65 std r10,GPR1(r1) 63 std r10,GPR1(r1)
64 ACCOUNT_CPU_USER_ENTRY(r10, r11)
66 std r2,GPR2(r1) 65 std r2,GPR2(r1)
67 std r3,GPR3(r1) 66 std r3,GPR3(r1)
68 std r4,GPR4(r1) 67 std r4,GPR4(r1)
@@ -170,8 +169,9 @@ syscall_error_cont:
170 stdcx. r0,0,r1 /* to clear the reservation */ 169 stdcx. r0,0,r1 /* to clear the reservation */
171 andi. r6,r8,MSR_PR 170 andi. r6,r8,MSR_PR
172 ld r4,_LINK(r1) 171 ld r4,_LINK(r1)
173 beq- 1f /* only restore r13 if */ 172 beq- 1f
174 ld r13,GPR13(r1) /* returning to usermode */ 173 ACCOUNT_CPU_USER_EXIT(r11, r12)
174 ld r13,GPR13(r1) /* only restore r13 if returning to usermode */
1751: ld r2,GPR2(r1) 1751: ld r2,GPR2(r1)
176 li r12,MSR_RI 176 li r12,MSR_RI
177 andc r11,r10,r12 177 andc r11,r10,r12
@@ -322,7 +322,7 @@ _GLOBAL(ret_from_fork)
322 * the fork code also. 322 * the fork code also.
323 * 323 *
324 * The code which creates the new task context is in 'copy_thread' 324 * The code which creates the new task context is in 'copy_thread'
325 * in arch/ppc64/kernel/process.c 325 * in arch/powerpc/kernel/process.c
326 */ 326 */
327 .align 7 327 .align 7
328_GLOBAL(_switch) 328_GLOBAL(_switch)
@@ -486,6 +486,7 @@ restore:
486 * userspace 486 * userspace
487 */ 487 */
488 beq 1f 488 beq 1f
489 ACCOUNT_CPU_USER_EXIT(r3, r4)
489 REST_GPR(13, r1) 490 REST_GPR(13, r1)
4901: 4911:
491 ld r3,_CTR(r1) 492 ld r3,_CTR(r1)
diff --git a/arch/powerpc/kernel/firmware.c b/arch/powerpc/kernel/firmware.c
index 65eae752a527..4d37a3cb80f6 100644
--- a/arch/powerpc/kernel/firmware.c
+++ b/arch/powerpc/kernel/firmware.c
@@ -18,28 +18,3 @@
18#include <asm/firmware.h> 18#include <asm/firmware.h>
19 19
20unsigned long ppc64_firmware_features; 20unsigned long ppc64_firmware_features;
21
22#ifdef CONFIG_PPC_PSERIES
23firmware_feature_t firmware_features_table[FIRMWARE_MAX_FEATURES] = {
24 {FW_FEATURE_PFT, "hcall-pft"},
25 {FW_FEATURE_TCE, "hcall-tce"},
26 {FW_FEATURE_SPRG0, "hcall-sprg0"},
27 {FW_FEATURE_DABR, "hcall-dabr"},
28 {FW_FEATURE_COPY, "hcall-copy"},
29 {FW_FEATURE_ASR, "hcall-asr"},
30 {FW_FEATURE_DEBUG, "hcall-debug"},
31 {FW_FEATURE_PERF, "hcall-perf"},
32 {FW_FEATURE_DUMP, "hcall-dump"},
33 {FW_FEATURE_INTERRUPT, "hcall-interrupt"},
34 {FW_FEATURE_MIGRATE, "hcall-migrate"},
35 {FW_FEATURE_PERFMON, "hcall-perfmon"},
36 {FW_FEATURE_CRQ, "hcall-crq"},
37 {FW_FEATURE_VIO, "hcall-vio"},
38 {FW_FEATURE_RDMA, "hcall-rdma"},
39 {FW_FEATURE_LLAN, "hcall-lLAN"},
40 {FW_FEATURE_BULK, "hcall-bulk"},
41 {FW_FEATURE_XDABR, "hcall-xdabr"},
42 {FW_FEATURE_MULTITCE, "hcall-multi-tce"},
43 {FW_FEATURE_SPLPAR, "hcall-splpar"},
44};
45#endif
diff --git a/arch/powerpc/kernel/head_44x.S b/arch/powerpc/kernel/head_44x.S
index 8b49679fad54..47c7fa148c9a 100644
--- a/arch/powerpc/kernel/head_44x.S
+++ b/arch/powerpc/kernel/head_44x.S
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/ppc/kernel/head_44x.S
3 *
4 * Kernel execution entry point code. 2 * Kernel execution entry point code.
5 * 3 *
6 * Copyright (c) 1995-1996 Gary Thomas <gdt@linuxppc.org> 4 * Copyright (c) 1995-1996 Gary Thomas <gdt@linuxppc.org>
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 9b65029dd2a3..35084f3a841b 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/ppc64/kernel/head.S
3 *
4 * PowerPC version 2 * PowerPC version
5 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) 3 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
6 * 4 *
@@ -279,6 +277,7 @@ exception_marker:
279 std r10,0(r1); /* make stack chain pointer */ \ 277 std r10,0(r1); /* make stack chain pointer */ \
280 std r0,GPR0(r1); /* save r0 in stackframe */ \ 278 std r0,GPR0(r1); /* save r0 in stackframe */ \
281 std r10,GPR1(r1); /* save r1 in stackframe */ \ 279 std r10,GPR1(r1); /* save r1 in stackframe */ \
280 ACCOUNT_CPU_USER_ENTRY(r9, r10); \
282 std r2,GPR2(r1); /* save r2 in stackframe */ \ 281 std r2,GPR2(r1); /* save r2 in stackframe */ \
283 SAVE_4GPRS(3, r1); /* save r3 - r6 in stackframe */ \ 282 SAVE_4GPRS(3, r1); /* save r3 - r6 in stackframe */ \
284 SAVE_2GPRS(7, r1); /* save r7, r8 in stackframe */ \ 283 SAVE_2GPRS(7, r1); /* save r7, r8 in stackframe */ \
@@ -846,6 +845,14 @@ fast_exception_return:
846 ld r11,_NIP(r1) 845 ld r11,_NIP(r1)
847 andi. r3,r12,MSR_RI /* check if RI is set */ 846 andi. r3,r12,MSR_RI /* check if RI is set */
848 beq- unrecov_fer 847 beq- unrecov_fer
848
849#ifdef CONFIG_VIRT_CPU_ACCOUNTING
850 andi. r3,r12,MSR_PR
851 beq 2f
852 ACCOUNT_CPU_USER_EXIT(r3, r4)
8532:
854#endif
855
849 ld r3,_CCR(r1) 856 ld r3,_CCR(r1)
850 ld r4,_LINK(r1) 857 ld r4,_LINK(r1)
851 ld r5,_CTR(r1) 858 ld r5,_CTR(r1)
diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S
index bc6d1ac55235..28941f5ce673 100644
--- a/arch/powerpc/kernel/head_8xx.S
+++ b/arch/powerpc/kernel/head_8xx.S
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/ppc/kernel/except_8xx.S
3 *
4 * PowerPC version 2 * PowerPC version
5 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) 3 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
6 * Rewritten by Cort Dougan (cort@cs.nmt.edu) for PReP 4 * Rewritten by Cort Dougan (cort@cs.nmt.edu) for PReP
diff --git a/arch/powerpc/kernel/head_booke.h b/arch/powerpc/kernel/head_booke.h
new file mode 100644
index 000000000000..8536e7676160
--- /dev/null
+++ b/arch/powerpc/kernel/head_booke.h
@@ -0,0 +1,363 @@
1#ifndef __HEAD_BOOKE_H__
2#define __HEAD_BOOKE_H__
3
4/*
5 * Macros used for common Book-e exception handling
6 */
7
8#define SET_IVOR(vector_number, vector_label) \
9 li r26,vector_label@l; \
10 mtspr SPRN_IVOR##vector_number,r26; \
11 sync
12
13#define NORMAL_EXCEPTION_PROLOG \
14 mtspr SPRN_SPRG0,r10; /* save two registers to work with */\
15 mtspr SPRN_SPRG1,r11; \
16 mtspr SPRN_SPRG4W,r1; \
17 mfcr r10; /* save CR in r10 for now */\
18 mfspr r11,SPRN_SRR1; /* check whether user or kernel */\
19 andi. r11,r11,MSR_PR; \
20 beq 1f; \
21 mfspr r1,SPRN_SPRG3; /* if from user, start at top of */\
22 lwz r1,THREAD_INFO-THREAD(r1); /* this thread's kernel stack */\
23 addi r1,r1,THREAD_SIZE; \
241: subi r1,r1,INT_FRAME_SIZE; /* Allocate an exception frame */\
25 mr r11,r1; \
26 stw r10,_CCR(r11); /* save various registers */\
27 stw r12,GPR12(r11); \
28 stw r9,GPR9(r11); \
29 mfspr r10,SPRN_SPRG0; \
30 stw r10,GPR10(r11); \
31 mfspr r12,SPRN_SPRG1; \
32 stw r12,GPR11(r11); \
33 mflr r10; \
34 stw r10,_LINK(r11); \
35 mfspr r10,SPRN_SPRG4R; \
36 mfspr r12,SPRN_SRR0; \
37 stw r10,GPR1(r11); \
38 mfspr r9,SPRN_SRR1; \
39 stw r10,0(r11); \
40 rlwinm r9,r9,0,14,12; /* clear MSR_WE (necessary?) */\
41 stw r0,GPR0(r11); \
42 SAVE_4GPRS(3, r11); \
43 SAVE_2GPRS(7, r11)
44
45/* To handle the additional exception priority levels on 40x and Book-E
46 * processors we allocate a 4k stack per additional priority level. The various
47 * head_xxx.S files allocate space (exception_stack_top) for each priority's
48 * stack times the number of CPUs
49 *
50 * On 40x critical is the only additional level
51 * On 44x/e500 we have critical and machine check
52 * On e200 we have critical and debug (machine check occurs via critical)
53 *
54 * Additionally we reserve a SPRG for each priority level so we can free up a
55 * GPR to use as the base for indirect access to the exception stacks. This
56 * is necessary since the MMU is always on, for Book-E parts, and the stacks
57 * are offset from KERNELBASE.
58 *
59 */
60#define BOOKE_EXCEPTION_STACK_SIZE (8192)
61
62/* CRIT_SPRG only used in critical exception handling */
63#define CRIT_SPRG SPRN_SPRG2
64/* MCHECK_SPRG only used in machine check exception handling */
65#define MCHECK_SPRG SPRN_SPRG6W
66
67#define MCHECK_STACK_TOP (exception_stack_top - 4096)
68#define CRIT_STACK_TOP (exception_stack_top)
69
70/* only on e200 for now */
71#define DEBUG_STACK_TOP (exception_stack_top - 4096)
72#define DEBUG_SPRG SPRN_SPRG6W
73
74#ifdef CONFIG_SMP
75#define BOOKE_LOAD_EXC_LEVEL_STACK(level) \
76 mfspr r8,SPRN_PIR; \
77 mulli r8,r8,BOOKE_EXCEPTION_STACK_SIZE; \
78 neg r8,r8; \
79 addis r8,r8,level##_STACK_TOP@ha; \
80 addi r8,r8,level##_STACK_TOP@l
81#else
82#define BOOKE_LOAD_EXC_LEVEL_STACK(level) \
83 lis r8,level##_STACK_TOP@h; \
84 ori r8,r8,level##_STACK_TOP@l
85#endif
86
87/*
88 * Exception prolog for critical/machine check exceptions. This is a
89 * little different from the normal exception prolog above since a
90 * critical/machine check exception can potentially occur at any point
91 * during normal exception processing. Thus we cannot use the same SPRG
92 * registers as the normal prolog above. Instead we use a portion of the
93 * critical/machine check exception stack at low physical addresses.
94 */
95#define EXC_LEVEL_EXCEPTION_PROLOG(exc_level, exc_level_srr0, exc_level_srr1) \
96 mtspr exc_level##_SPRG,r8; \
97 BOOKE_LOAD_EXC_LEVEL_STACK(exc_level);/* r8 points to the exc_level stack*/ \
98 stw r10,GPR10-INT_FRAME_SIZE(r8); \
99 stw r11,GPR11-INT_FRAME_SIZE(r8); \
100 mfcr r10; /* save CR in r10 for now */\
101 mfspr r11,exc_level_srr1; /* check whether user or kernel */\
102 andi. r11,r11,MSR_PR; \
103 mr r11,r8; \
104 mfspr r8,exc_level##_SPRG; \
105 beq 1f; \
106 /* COMING FROM USER MODE */ \
107 mfspr r11,SPRN_SPRG3; /* if from user, start at top of */\
108 lwz r11,THREAD_INFO-THREAD(r11); /* this thread's kernel stack */\
109 addi r11,r11,THREAD_SIZE; \
1101: subi r11,r11,INT_FRAME_SIZE; /* Allocate an exception frame */\
111 stw r10,_CCR(r11); /* save various registers */\
112 stw r12,GPR12(r11); \
113 stw r9,GPR9(r11); \
114 mflr r10; \
115 stw r10,_LINK(r11); \
116 mfspr r12,SPRN_DEAR; /* save DEAR and ESR in the frame */\
117 stw r12,_DEAR(r11); /* since they may have had stuff */\
118 mfspr r9,SPRN_ESR; /* in them at the point where the */\
119 stw r9,_ESR(r11); /* exception was taken */\
120 mfspr r12,exc_level_srr0; \
121 stw r1,GPR1(r11); \
122 mfspr r9,exc_level_srr1; \
123 stw r1,0(r11); \
124 mr r1,r11; \
125 rlwinm r9,r9,0,14,12; /* clear MSR_WE (necessary?) */\
126 stw r0,GPR0(r11); \
127 SAVE_4GPRS(3, r11); \
128 SAVE_2GPRS(7, r11)
129
130#define CRITICAL_EXCEPTION_PROLOG \
131 EXC_LEVEL_EXCEPTION_PROLOG(CRIT, SPRN_CSRR0, SPRN_CSRR1)
132#define DEBUG_EXCEPTION_PROLOG \
133 EXC_LEVEL_EXCEPTION_PROLOG(DEBUG, SPRN_DSRR0, SPRN_DSRR1)
134#define MCHECK_EXCEPTION_PROLOG \
135 EXC_LEVEL_EXCEPTION_PROLOG(MCHECK, SPRN_MCSRR0, SPRN_MCSRR1)
136
137/*
138 * Exception vectors.
139 */
140#define START_EXCEPTION(label) \
141 .align 5; \
142label:
143
144#define FINISH_EXCEPTION(func) \
145 bl transfer_to_handler_full; \
146 .long func; \
147 .long ret_from_except_full
148
149#define EXCEPTION(n, label, hdlr, xfer) \
150 START_EXCEPTION(label); \
151 NORMAL_EXCEPTION_PROLOG; \
152 addi r3,r1,STACK_FRAME_OVERHEAD; \
153 xfer(n, hdlr)
154
155#define CRITICAL_EXCEPTION(n, label, hdlr) \
156 START_EXCEPTION(label); \
157 CRITICAL_EXCEPTION_PROLOG; \
158 addi r3,r1,STACK_FRAME_OVERHEAD; \
159 EXC_XFER_TEMPLATE(hdlr, n+2, (MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)), \
160 NOCOPY, crit_transfer_to_handler, \
161 ret_from_crit_exc)
162
163#define MCHECK_EXCEPTION(n, label, hdlr) \
164 START_EXCEPTION(label); \
165 MCHECK_EXCEPTION_PROLOG; \
166 mfspr r5,SPRN_ESR; \
167 stw r5,_ESR(r11); \
168 addi r3,r1,STACK_FRAME_OVERHEAD; \
169 EXC_XFER_TEMPLATE(hdlr, n+2, (MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)), \
170 NOCOPY, mcheck_transfer_to_handler, \
171 ret_from_mcheck_exc)
172
173#define EXC_XFER_TEMPLATE(hdlr, trap, msr, copyee, tfer, ret) \
174 li r10,trap; \
175 stw r10,_TRAP(r11); \
176 lis r10,msr@h; \
177 ori r10,r10,msr@l; \
178 copyee(r10, r9); \
179 bl tfer; \
180 .long hdlr; \
181 .long ret
182
183#define COPY_EE(d, s) rlwimi d,s,0,16,16
184#define NOCOPY(d, s)
185
186#define EXC_XFER_STD(n, hdlr) \
187 EXC_XFER_TEMPLATE(hdlr, n, MSR_KERNEL, NOCOPY, transfer_to_handler_full, \
188 ret_from_except_full)
189
190#define EXC_XFER_LITE(n, hdlr) \
191 EXC_XFER_TEMPLATE(hdlr, n+1, MSR_KERNEL, NOCOPY, transfer_to_handler, \
192 ret_from_except)
193
194#define EXC_XFER_EE(n, hdlr) \
195 EXC_XFER_TEMPLATE(hdlr, n, MSR_KERNEL, COPY_EE, transfer_to_handler_full, \
196 ret_from_except_full)
197
198#define EXC_XFER_EE_LITE(n, hdlr) \
199 EXC_XFER_TEMPLATE(hdlr, n+1, MSR_KERNEL, COPY_EE, transfer_to_handler, \
200 ret_from_except)
201
202/* Check for a single step debug exception while in an exception
203 * handler before state has been saved. This is to catch the case
204 * where an instruction that we are trying to single step causes
205 * an exception (eg ITLB/DTLB miss) and thus the first instruction of
206 * the exception handler generates a single step debug exception.
207 *
208 * If we get a debug trap on the first instruction of an exception handler,
209 * we reset the MSR_DE in the _exception handler's_ MSR (the debug trap is
210 * a critical exception, so we are using SPRN_CSRR1 to manipulate the MSR).
211 * The exception handler was handling a non-critical interrupt, so it will
212 * save (and later restore) the MSR via SPRN_CSRR1, which will still have
213 * the MSR_DE bit set.
214 */
215#ifdef CONFIG_E200
216#define DEBUG_EXCEPTION \
217 START_EXCEPTION(Debug); \
218 DEBUG_EXCEPTION_PROLOG; \
219 \
220 /* \
221 * If there is a single step or branch-taken exception in an \
222 * exception entry sequence, it was probably meant to apply to \
223 * the code where the exception occurred (since exception entry \
224 * doesn't turn off DE automatically). We simulate the effect \
225 * of turning off DE on entry to an exception handler by turning \
226 * off DE in the CSRR1 value and clearing the debug status. \
227 */ \
228 mfspr r10,SPRN_DBSR; /* check single-step/branch taken */ \
229 andis. r10,r10,DBSR_IC@h; \
230 beq+ 2f; \
231 \
232 lis r10,KERNELBASE@h; /* check if exception in vectors */ \
233 ori r10,r10,KERNELBASE@l; \
234 cmplw r12,r10; \
235 blt+ 2f; /* addr below exception vectors */ \
236 \
237 lis r10,Debug@h; \
238 ori r10,r10,Debug@l; \
239 cmplw r12,r10; \
240 bgt+ 2f; /* addr above exception vectors */ \
241 \
242 /* here it looks like we got an inappropriate debug exception. */ \
2431: rlwinm r9,r9,0,~MSR_DE; /* clear DE in the CDRR1 value */ \
244 lis r10,DBSR_IC@h; /* clear the IC event */ \
245 mtspr SPRN_DBSR,r10; \
246 /* restore state and get out */ \
247 lwz r10,_CCR(r11); \
248 lwz r0,GPR0(r11); \
249 lwz r1,GPR1(r11); \
250 mtcrf 0x80,r10; \
251 mtspr SPRN_DSRR0,r12; \
252 mtspr SPRN_DSRR1,r9; \
253 lwz r9,GPR9(r11); \
254 lwz r12,GPR12(r11); \
255 mtspr DEBUG_SPRG,r8; \
256 BOOKE_LOAD_EXC_LEVEL_STACK(DEBUG); /* r8 points to the debug stack */ \
257 lwz r10,GPR10-INT_FRAME_SIZE(r8); \
258 lwz r11,GPR11-INT_FRAME_SIZE(r8); \
259 mfspr r8,DEBUG_SPRG; \
260 \
261 RFDI; \
262 b .; \
263 \
264 /* continue normal handling for a critical exception... */ \
2652: mfspr r4,SPRN_DBSR; \
266 addi r3,r1,STACK_FRAME_OVERHEAD; \
267 EXC_XFER_TEMPLATE(DebugException, 0x2002, (MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)), NOCOPY, debug_transfer_to_handler, ret_from_debug_exc)
268#else
269#define DEBUG_EXCEPTION \
270 START_EXCEPTION(Debug); \
271 CRITICAL_EXCEPTION_PROLOG; \
272 \
273 /* \
274 * If there is a single step or branch-taken exception in an \
275 * exception entry sequence, it was probably meant to apply to \
276 * the code where the exception occurred (since exception entry \
277 * doesn't turn off DE automatically). We simulate the effect \
278 * of turning off DE on entry to an exception handler by turning \
279 * off DE in the CSRR1 value and clearing the debug status. \
280 */ \
281 mfspr r10,SPRN_DBSR; /* check single-step/branch taken */ \
282 andis. r10,r10,DBSR_IC@h; \
283 beq+ 2f; \
284 \
285 lis r10,KERNELBASE@h; /* check if exception in vectors */ \
286 ori r10,r10,KERNELBASE@l; \
287 cmplw r12,r10; \
288 blt+ 2f; /* addr below exception vectors */ \
289 \
290 lis r10,Debug@h; \
291 ori r10,r10,Debug@l; \
292 cmplw r12,r10; \
293 bgt+ 2f; /* addr above exception vectors */ \
294 \
295 /* here it looks like we got an inappropriate debug exception. */ \
2961: rlwinm r9,r9,0,~MSR_DE; /* clear DE in the CSRR1 value */ \
297 lis r10,DBSR_IC@h; /* clear the IC event */ \
298 mtspr SPRN_DBSR,r10; \
299 /* restore state and get out */ \
300 lwz r10,_CCR(r11); \
301 lwz r0,GPR0(r11); \
302 lwz r1,GPR1(r11); \
303 mtcrf 0x80,r10; \
304 mtspr SPRN_CSRR0,r12; \
305 mtspr SPRN_CSRR1,r9; \
306 lwz r9,GPR9(r11); \
307 lwz r12,GPR12(r11); \
308 mtspr CRIT_SPRG,r8; \
309 BOOKE_LOAD_EXC_LEVEL_STACK(CRIT); /* r8 points to the debug stack */ \
310 lwz r10,GPR10-INT_FRAME_SIZE(r8); \
311 lwz r11,GPR11-INT_FRAME_SIZE(r8); \
312 mfspr r8,CRIT_SPRG; \
313 \
314 rfci; \
315 b .; \
316 \
317 /* continue normal handling for a critical exception... */ \
3182: mfspr r4,SPRN_DBSR; \
319 addi r3,r1,STACK_FRAME_OVERHEAD; \
320 EXC_XFER_TEMPLATE(DebugException, 0x2002, (MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)), NOCOPY, crit_transfer_to_handler, ret_from_crit_exc)
321#endif
322
323#define INSTRUCTION_STORAGE_EXCEPTION \
324 START_EXCEPTION(InstructionStorage) \
325 NORMAL_EXCEPTION_PROLOG; \
326 mfspr r5,SPRN_ESR; /* Grab the ESR and save it */ \
327 stw r5,_ESR(r11); \
328 mr r4,r12; /* Pass SRR0 as arg2 */ \
329 li r5,0; /* Pass zero as arg3 */ \
330 EXC_XFER_EE_LITE(0x0400, handle_page_fault)
331
332#define ALIGNMENT_EXCEPTION \
333 START_EXCEPTION(Alignment) \
334 NORMAL_EXCEPTION_PROLOG; \
335 mfspr r4,SPRN_DEAR; /* Grab the DEAR and save it */ \
336 stw r4,_DEAR(r11); \
337 addi r3,r1,STACK_FRAME_OVERHEAD; \
338 EXC_XFER_EE(0x0600, alignment_exception)
339
340#define PROGRAM_EXCEPTION \
341 START_EXCEPTION(Program) \
342 NORMAL_EXCEPTION_PROLOG; \
343 mfspr r4,SPRN_ESR; /* Grab the ESR and save it */ \
344 stw r4,_ESR(r11); \
345 addi r3,r1,STACK_FRAME_OVERHEAD; \
346 EXC_XFER_STD(0x0700, program_check_exception)
347
348#define DECREMENTER_EXCEPTION \
349 START_EXCEPTION(Decrementer) \
350 NORMAL_EXCEPTION_PROLOG; \
351 lis r0,TSR_DIS@h; /* Setup the DEC interrupt mask */ \
352 mtspr SPRN_TSR,r0; /* Clear the DEC interrupt */ \
353 addi r3,r1,STACK_FRAME_OVERHEAD; \
354 EXC_XFER_LITE(0x0900, timer_interrupt)
355
356#define FP_UNAVAILABLE_EXCEPTION \
357 START_EXCEPTION(FloatingPointUnavailable) \
358 NORMAL_EXCEPTION_PROLOG; \
359 bne load_up_fpu; /* if from user, just load it up */ \
360 addi r3,r1,STACK_FRAME_OVERHEAD; \
361 EXC_XFER_EE_LITE(0x800, kernel_fp_unavailable_exception)
362
363#endif /* __HEAD_BOOKE_H__ */
diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
index 8d60fa99fc4b..dd86bbed7627 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/ppc/kernel/head_fsl_booke.S
3 *
4 * Kernel execution entry point code. 2 * Kernel execution entry point code.
5 * 3 *
6 * Copyright (c) 1995-1996 Gary Thomas <gdt@linuxppc.org> 4 * Copyright (c) 1995-1996 Gary Thomas <gdt@linuxppc.org>
@@ -316,6 +314,7 @@ skpinv: addi r6,r6,1 /* Increment */
316 */ 314 */
317 lis r2,DBCR0_IDM@h 315 lis r2,DBCR0_IDM@h
318 mtspr SPRN_DBCR0,r2 316 mtspr SPRN_DBCR0,r2
317 isync
319 /* clear any residual debug events */ 318 /* clear any residual debug events */
320 li r2,-1 319 li r2,-1
321 mtspr SPRN_DBSR,r2 320 mtspr SPRN_DBSR,r2
@@ -1002,12 +1001,15 @@ _GLOBAL(giveup_fpu)
1002_GLOBAL(abort) 1001_GLOBAL(abort)
1003 li r13,0 1002 li r13,0
1004 mtspr SPRN_DBCR0,r13 /* disable all debug events */ 1003 mtspr SPRN_DBCR0,r13 /* disable all debug events */
1004 isync
1005 mfmsr r13 1005 mfmsr r13
1006 ori r13,r13,MSR_DE@l /* Enable Debug Events */ 1006 ori r13,r13,MSR_DE@l /* Enable Debug Events */
1007 mtmsr r13 1007 mtmsr r13
1008 isync
1008 mfspr r13,SPRN_DBCR0 1009 mfspr r13,SPRN_DBCR0
1009 lis r13,(DBCR0_IDM|DBCR0_RST_CHIP)@h 1010 lis r13,(DBCR0_IDM|DBCR0_RST_CHIP)@h
1010 mtspr SPRN_DBCR0,r13 1011 mtspr SPRN_DBCR0,r13
1012 isync
1011 1013
1012_GLOBAL(set_context) 1014_GLOBAL(set_context)
1013 1015
diff --git a/arch/powerpc/kernel/iomap.c b/arch/powerpc/kernel/iomap.c
index 6160c8dbb7c5..fd8214caedee 100644
--- a/arch/powerpc/kernel/iomap.c
+++ b/arch/powerpc/kernel/iomap.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/ppc64/kernel/iomap.c
3 *
4 * ppc64 "iomap" interface implementation. 2 * ppc64 "iomap" interface implementation.
5 * 3 *
6 * (C) Copyright 2004 Linus Torvalds 4 * (C) Copyright 2004 Linus Torvalds
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index 946f3219fd29..d9a7fdef59b9 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -1,5 +1,4 @@
1/* 1/*
2 * arch/ppc64/kernel/iommu.c
3 * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen, IBM Corporation 2 * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen, IBM Corporation
4 * 3 *
5 * Rewrite, cleanup, new allocation schemes, virtual merging: 4 * Rewrite, cleanup, new allocation schemes, virtual merging:
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index d1fffce86df9..24dc8117b822 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/ppc/kernel/irq.c
3 *
4 * Derived from arch/i386/kernel/irq.c 2 * Derived from arch/i386/kernel/irq.c
5 * Copyright (C) 1992 Linus Torvalds 3 * Copyright (C) 1992 Linus Torvalds
6 * Adapted from arch/i386 by Gary Thomas 4 * Adapted from arch/i386 by Gary Thomas
@@ -371,6 +369,7 @@ unsigned int real_irq_to_virt_slowpath(unsigned int real_irq)
371 return NO_IRQ; 369 return NO_IRQ;
372 370
373} 371}
372#endif /* CONFIG_PPC64 */
374 373
375#ifdef CONFIG_IRQSTACKS 374#ifdef CONFIG_IRQSTACKS
376struct thread_info *softirq_ctx[NR_CPUS]; 375struct thread_info *softirq_ctx[NR_CPUS];
@@ -394,10 +393,24 @@ void irq_ctx_init(void)
394 } 393 }
395} 394}
396 395
396static inline void do_softirq_onstack(void)
397{
398 struct thread_info *curtp, *irqtp;
399
400 curtp = current_thread_info();
401 irqtp = softirq_ctx[smp_processor_id()];
402 irqtp->task = curtp->task;
403 call_do_softirq(irqtp);
404 irqtp->task = NULL;
405}
406
407#else
408#define do_softirq_onstack() __do_softirq()
409#endif /* CONFIG_IRQSTACKS */
410
397void do_softirq(void) 411void do_softirq(void)
398{ 412{
399 unsigned long flags; 413 unsigned long flags;
400 struct thread_info *curtp, *irqtp;
401 414
402 if (in_interrupt()) 415 if (in_interrupt())
403 return; 416 return;
@@ -405,19 +418,18 @@ void do_softirq(void)
405 local_irq_save(flags); 418 local_irq_save(flags);
406 419
407 if (local_softirq_pending()) { 420 if (local_softirq_pending()) {
408 curtp = current_thread_info(); 421 account_system_vtime(current);
409 irqtp = softirq_ctx[smp_processor_id()]; 422 local_bh_disable();
410 irqtp->task = curtp->task; 423 do_softirq_onstack();
411 call_do_softirq(irqtp); 424 account_system_vtime(current);
412 irqtp->task = NULL; 425 __local_bh_enable();
413 } 426 }
414 427
415 local_irq_restore(flags); 428 local_irq_restore(flags);
416} 429}
417EXPORT_SYMBOL(do_softirq); 430EXPORT_SYMBOL(do_softirq);
418 431
419#endif /* CONFIG_IRQSTACKS */ 432#ifdef CONFIG_PPC64
420
421static int __init setup_noirqdistrib(char *str) 433static int __init setup_noirqdistrib(char *str)
422{ 434{
423 distribute_irqs = 0; 435 distribute_irqs = 0;
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
index cfab48566db1..258039fb3016 100644
--- a/arch/powerpc/kernel/kprobes.c
+++ b/arch/powerpc/kernel/kprobes.c
@@ -1,6 +1,5 @@
1/* 1/*
2 * Kernel Probes (KProbes) 2 * Kernel Probes (KProbes)
3 * arch/ppc64/kernel/kprobes.c
4 * 3 *
5 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
diff --git a/arch/powerpc/kernel/of_device.c b/arch/powerpc/kernel/of_device.c
index 22d83d4d1af5..9feeeef5a875 100644
--- a/arch/powerpc/kernel/of_device.c
+++ b/arch/powerpc/kernel/of_device.c
@@ -147,15 +147,12 @@ postcore_initcall(of_bus_driver_init);
147 147
148int of_register_driver(struct of_platform_driver *drv) 148int of_register_driver(struct of_platform_driver *drv)
149{ 149{
150 int count = 0;
151
152 /* initialize common driver fields */ 150 /* initialize common driver fields */
153 drv->driver.name = drv->name; 151 drv->driver.name = drv->name;
154 drv->driver.bus = &of_platform_bus_type; 152 drv->driver.bus = &of_platform_bus_type;
155 153
156 /* register with core */ 154 /* register with core */
157 count = driver_register(&drv->driver); 155 return driver_register(&drv->driver);
158 return count ? count : 1;
159} 156}
160 157
161void of_unregister_driver(struct of_platform_driver *drv) 158void of_unregister_driver(struct of_platform_driver *drv)
diff --git a/arch/powerpc/kernel/pci_iommu.c b/arch/powerpc/kernel/pci_iommu.c
index bdf15dbbf4f0..c336f3e31cff 100644
--- a/arch/powerpc/kernel/pci_iommu.c
+++ b/arch/powerpc/kernel/pci_iommu.c
@@ -1,5 +1,4 @@
1/* 1/*
2 * arch/ppc64/kernel/pci_iommu.c
3 * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen, IBM Corporation 2 * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen, IBM Corporation
4 * 3 *
5 * Rewrite, cleanup, new allocation schemes: 4 * Rewrite, cleanup, new allocation schemes:
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
index 63ecbec05202..dfa5398ab3c8 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -57,7 +57,6 @@ extern void machine_check_exception(struct pt_regs *regs);
57extern void alignment_exception(struct pt_regs *regs); 57extern void alignment_exception(struct pt_regs *regs);
58extern void program_check_exception(struct pt_regs *regs); 58extern void program_check_exception(struct pt_regs *regs);
59extern void single_step_exception(struct pt_regs *regs); 59extern void single_step_exception(struct pt_regs *regs);
60extern int pmac_newworld;
61extern int sys_sigreturn(struct pt_regs *regs); 60extern int sys_sigreturn(struct pt_regs *regs);
62 61
63EXPORT_SYMBOL(clear_pages); 62EXPORT_SYMBOL(clear_pages);
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index c225cf154bfe..1770a066c217 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/ppc/kernel/process.c
3 *
4 * Derived from "arch/i386/kernel/process.c" 2 * Derived from "arch/i386/kernel/process.c"
5 * Copyright (C) 1995 Linus Torvalds 3 * Copyright (C) 1995 Linus Torvalds
6 * 4 *
@@ -47,9 +45,9 @@
47#include <asm/mmu.h> 45#include <asm/mmu.h>
48#include <asm/prom.h> 46#include <asm/prom.h>
49#include <asm/machdep.h> 47#include <asm/machdep.h>
48#include <asm/time.h>
50#ifdef CONFIG_PPC64 49#ifdef CONFIG_PPC64
51#include <asm/firmware.h> 50#include <asm/firmware.h>
52#include <asm/time.h>
53#endif 51#endif
54 52
55extern unsigned long _get_SP(void); 53extern unsigned long _get_SP(void);
@@ -330,6 +328,11 @@ struct task_struct *__switch_to(struct task_struct *prev,
330#endif 328#endif
331 329
332 local_irq_save(flags); 330 local_irq_save(flags);
331
332 account_system_vtime(current);
333 account_process_vtime(current);
334 calculate_steal_time();
335
333 last = _switch(old_thread, new_thread); 336 last = _switch(old_thread, new_thread);
334 337
335 local_irq_restore(flags); 338 local_irq_restore(flags);
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 6dbd21726770..d63cd562d9d5 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -829,10 +829,6 @@ void __init unflatten_device_tree(void)
829 829
830 /* Allocate memory for the expanded device tree */ 830 /* Allocate memory for the expanded device tree */
831 mem = lmb_alloc(size + 4, __alignof__(struct device_node)); 831 mem = lmb_alloc(size + 4, __alignof__(struct device_node));
832 if (!mem) {
833 DBG("Couldn't allocate memory with lmb_alloc()!\n");
834 panic("Couldn't allocate memory with lmb_alloc()!\n");
835 }
836 mem = (unsigned long) __va(mem); 832 mem = (unsigned long) __va(mem);
837 833
838 ((u32 *)mem)[size / 4] = 0xdeadbeef; 834 ((u32 *)mem)[size / 4] = 0xdeadbeef;
diff --git a/arch/powerpc/kernel/ptrace-common.h b/arch/powerpc/kernel/ptrace-common.h
index 5ccbdbe0d5c9..c42a860c8d25 100644
--- a/arch/powerpc/kernel/ptrace-common.h
+++ b/arch/powerpc/kernel/ptrace-common.h
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/ppc64/kernel/ptrace-common.h
3 *
4 * Copyright (c) 2002 Stephen Rothwell, IBM Coproration 2 * Copyright (c) 2002 Stephen Rothwell, IBM Coproration
5 * Extracted from ptrace.c and ptrace32.c 3 * Extracted from ptrace.c and ptrace32.c
6 * 4 *
diff --git a/arch/powerpc/kernel/rtas-proc.c b/arch/powerpc/kernel/rtas-proc.c
index 7a95b8a28354..1f03fb28cc0a 100644
--- a/arch/powerpc/kernel/rtas-proc.c
+++ b/arch/powerpc/kernel/rtas-proc.c
@@ -1,5 +1,4 @@
1/* 1/*
2 * arch/ppc64/kernel/rtas-proc.c
3 * Copyright (C) 2000 Tilmann Bitterberg 2 * Copyright (C) 2000 Tilmann Bitterberg
4 * (tilmann@bitterberg.de) 3 * (tilmann@bitterberg.de)
5 * 4 *
diff --git a/arch/powerpc/kernel/rtas_pci.c b/arch/powerpc/kernel/rtas_pci.c
index 7442775ef2a1..57b539a03fa9 100644
--- a/arch/powerpc/kernel/rtas_pci.c
+++ b/arch/powerpc/kernel/rtas_pci.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/ppc64/kernel/rtas_pci.c
3 *
4 * Copyright (C) 2001 Dave Engebretsen, IBM Corporation 2 * Copyright (C) 2001 Dave Engebretsen, IBM Corporation
5 * Copyright (C) 2003 Anton Blanchard <anton@au.ibm.com>, IBM 3 * Copyright (C) 2003 Anton Blanchard <anton@au.ibm.com>, IBM
6 * 4 *
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index f96c49b03ba0..2f3fdad35594 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -497,8 +497,6 @@ void __init setup_system(void)
497#endif 497#endif
498 printk("-----------------------------------------------------\n"); 498 printk("-----------------------------------------------------\n");
499 499
500 mm_init_ppc64();
501
502 DBG(" <- setup_system()\n"); 500 DBG(" <- setup_system()\n");
503} 501}
504 502
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index 4324f8a8ba24..47f910380a6a 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/ppc64/kernel/signal.c
3 *
4 * PowerPC version 2 * PowerPC version
5 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) 3 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
6 * 4 *
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 13595a64f013..805eaedbc308 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -541,7 +541,7 @@ int __devinit start_secondary(void *unused)
541 smp_ops->take_timebase(); 541 smp_ops->take_timebase();
542 542
543 if (system_state > SYSTEM_BOOTING) 543 if (system_state > SYSTEM_BOOTING)
544 per_cpu(last_jiffy, cpu) = get_tb(); 544 snapshot_timebase();
545 545
546 spin_lock(&call_lock); 546 spin_lock(&call_lock);
547 cpu_set(cpu, cpu_online_map); 547 cpu_set(cpu, cpu_online_map);
@@ -573,6 +573,8 @@ void __init smp_cpus_done(unsigned int max_cpus)
573 573
574 set_cpus_allowed(current, old_mask); 574 set_cpus_allowed(current, old_mask);
575 575
576 snapshot_timebases();
577
576 dump_numa_cpu_topology(); 578 dump_numa_cpu_topology();
577} 579}
578 580
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 86f7e3d154d8..4a27218a086c 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -51,6 +51,7 @@
51#include <linux/percpu.h> 51#include <linux/percpu.h>
52#include <linux/rtc.h> 52#include <linux/rtc.h>
53#include <linux/jiffies.h> 53#include <linux/jiffies.h>
54#include <linux/posix-timers.h>
54 55
55#include <asm/io.h> 56#include <asm/io.h>
56#include <asm/processor.h> 57#include <asm/processor.h>
@@ -98,6 +99,7 @@ unsigned long tb_ticks_per_jiffy;
98unsigned long tb_ticks_per_usec = 100; /* sane default */ 99unsigned long tb_ticks_per_usec = 100; /* sane default */
99EXPORT_SYMBOL(tb_ticks_per_usec); 100EXPORT_SYMBOL(tb_ticks_per_usec);
100unsigned long tb_ticks_per_sec; 101unsigned long tb_ticks_per_sec;
102EXPORT_SYMBOL(tb_ticks_per_sec); /* for cputime_t conversions */
101u64 tb_to_xs; 103u64 tb_to_xs;
102unsigned tb_to_us; 104unsigned tb_to_us;
103 105
@@ -135,6 +137,224 @@ unsigned long tb_last_stamp;
135 */ 137 */
136DEFINE_PER_CPU(unsigned long, last_jiffy); 138DEFINE_PER_CPU(unsigned long, last_jiffy);
137 139
140#ifdef CONFIG_VIRT_CPU_ACCOUNTING
141/*
142 * Factors for converting from cputime_t (timebase ticks) to
143 * jiffies, milliseconds, seconds, and clock_t (1/USER_HZ seconds).
144 * These are all stored as 0.64 fixed-point binary fractions.
145 */
146u64 __cputime_jiffies_factor;
147EXPORT_SYMBOL(__cputime_jiffies_factor);
148u64 __cputime_msec_factor;
149EXPORT_SYMBOL(__cputime_msec_factor);
150u64 __cputime_sec_factor;
151EXPORT_SYMBOL(__cputime_sec_factor);
152u64 __cputime_clockt_factor;
153EXPORT_SYMBOL(__cputime_clockt_factor);
154
155static void calc_cputime_factors(void)
156{
157 struct div_result res;
158
159 div128_by_32(HZ, 0, tb_ticks_per_sec, &res);
160 __cputime_jiffies_factor = res.result_low;
161 div128_by_32(1000, 0, tb_ticks_per_sec, &res);
162 __cputime_msec_factor = res.result_low;
163 div128_by_32(1, 0, tb_ticks_per_sec, &res);
164 __cputime_sec_factor = res.result_low;
165 div128_by_32(USER_HZ, 0, tb_ticks_per_sec, &res);
166 __cputime_clockt_factor = res.result_low;
167}
168
169/*
170 * Read the PURR on systems that have it, otherwise the timebase.
171 */
172static u64 read_purr(void)
173{
174 if (cpu_has_feature(CPU_FTR_PURR))
175 return mfspr(SPRN_PURR);
176 return mftb();
177}
178
179/*
180 * Account time for a transition between system, hard irq
181 * or soft irq state.
182 */
183void account_system_vtime(struct task_struct *tsk)
184{
185 u64 now, delta;
186 unsigned long flags;
187
188 local_irq_save(flags);
189 now = read_purr();
190 delta = now - get_paca()->startpurr;
191 get_paca()->startpurr = now;
192 if (!in_interrupt()) {
193 delta += get_paca()->system_time;
194 get_paca()->system_time = 0;
195 }
196 account_system_time(tsk, 0, delta);
197 local_irq_restore(flags);
198}
199
200/*
201 * Transfer the user and system times accumulated in the paca
202 * by the exception entry and exit code to the generic process
203 * user and system time records.
204 * Must be called with interrupts disabled.
205 */
206void account_process_vtime(struct task_struct *tsk)
207{
208 cputime_t utime;
209
210 utime = get_paca()->user_time;
211 get_paca()->user_time = 0;
212 account_user_time(tsk, utime);
213}
214
215static void account_process_time(struct pt_regs *regs)
216{
217 int cpu = smp_processor_id();
218
219 account_process_vtime(current);
220 run_local_timers();
221 if (rcu_pending(cpu))
222 rcu_check_callbacks(cpu, user_mode(regs));
223 scheduler_tick();
224 run_posix_cpu_timers(current);
225}
226
227#ifdef CONFIG_PPC_SPLPAR
228/*
229 * Stuff for accounting stolen time.
230 */
231struct cpu_purr_data {
232 int initialized; /* thread is running */
233 u64 tb0; /* timebase at origin time */
234 u64 purr0; /* PURR at origin time */
235 u64 tb; /* last TB value read */
236 u64 purr; /* last PURR value read */
237 u64 stolen; /* stolen time so far */
238 spinlock_t lock;
239};
240
241static DEFINE_PER_CPU(struct cpu_purr_data, cpu_purr_data);
242
243static void snapshot_tb_and_purr(void *data)
244{
245 struct cpu_purr_data *p = &__get_cpu_var(cpu_purr_data);
246
247 p->tb0 = mftb();
248 p->purr0 = mfspr(SPRN_PURR);
249 p->tb = p->tb0;
250 p->purr = 0;
251 wmb();
252 p->initialized = 1;
253}
254
255/*
256 * Called during boot when all cpus have come up.
257 */
258void snapshot_timebases(void)
259{
260 int cpu;
261
262 if (!cpu_has_feature(CPU_FTR_PURR))
263 return;
264 for_each_cpu(cpu)
265 spin_lock_init(&per_cpu(cpu_purr_data, cpu).lock);
266 on_each_cpu(snapshot_tb_and_purr, NULL, 0, 1);
267}
268
269void calculate_steal_time(void)
270{
271 u64 tb, purr, t0;
272 s64 stolen;
273 struct cpu_purr_data *p0, *pme, *phim;
274 int cpu;
275
276 if (!cpu_has_feature(CPU_FTR_PURR))
277 return;
278 cpu = smp_processor_id();
279 pme = &per_cpu(cpu_purr_data, cpu);
280 if (!pme->initialized)
281 return; /* this can happen in early boot */
282 p0 = &per_cpu(cpu_purr_data, cpu & ~1);
283 phim = &per_cpu(cpu_purr_data, cpu ^ 1);
284 spin_lock(&p0->lock);
285 tb = mftb();
286 purr = mfspr(SPRN_PURR) - pme->purr0;
287 if (!phim->initialized || !cpu_online(cpu ^ 1)) {
288 stolen = (tb - pme->tb) - (purr - pme->purr);
289 } else {
290 t0 = pme->tb0;
291 if (phim->tb0 < t0)
292 t0 = phim->tb0;
293 stolen = phim->tb - t0 - phim->purr - purr - p0->stolen;
294 }
295 if (stolen > 0) {
296 account_steal_time(current, stolen);
297 p0->stolen += stolen;
298 }
299 pme->tb = tb;
300 pme->purr = purr;
301 spin_unlock(&p0->lock);
302}
303
304/*
305 * Must be called before the cpu is added to the online map when
306 * a cpu is being brought up at runtime.
307 */
308static void snapshot_purr(void)
309{
310 int cpu;
311 u64 purr;
312 struct cpu_purr_data *p0, *pme, *phim;
313 unsigned long flags;
314
315 if (!cpu_has_feature(CPU_FTR_PURR))
316 return;
317 cpu = smp_processor_id();
318 pme = &per_cpu(cpu_purr_data, cpu);
319 p0 = &per_cpu(cpu_purr_data, cpu & ~1);
320 phim = &per_cpu(cpu_purr_data, cpu ^ 1);
321 spin_lock_irqsave(&p0->lock, flags);
322 pme->tb = pme->tb0 = mftb();
323 purr = mfspr(SPRN_PURR);
324 if (!phim->initialized) {
325 pme->purr = 0;
326 pme->purr0 = purr;
327 } else {
328 /* set p->purr and p->purr0 for no change in p0->stolen */
329 pme->purr = phim->tb - phim->tb0 - phim->purr - p0->stolen;
330 pme->purr0 = purr - pme->purr;
331 }
332 pme->initialized = 1;
333 spin_unlock_irqrestore(&p0->lock, flags);
334}
335
336#endif /* CONFIG_PPC_SPLPAR */
337
338#else /* ! CONFIG_VIRT_CPU_ACCOUNTING */
339#define calc_cputime_factors()
340#define account_process_time(regs) update_process_times(user_mode(regs))
341#define calculate_steal_time() do { } while (0)
342#endif
343
344#if !(defined(CONFIG_VIRT_CPU_ACCOUNTING) && defined(CONFIG_PPC_SPLPAR))
345#define snapshot_purr() do { } while (0)
346#endif
347
348/*
349 * Called when a cpu comes up after the system has finished booting,
350 * i.e. as a result of a hotplug cpu action.
351 */
352void snapshot_timebase(void)
353{
354 __get_cpu_var(last_jiffy) = get_tb();
355 snapshot_purr();
356}
357
138void __delay(unsigned long loops) 358void __delay(unsigned long loops)
139{ 359{
140 unsigned long start; 360 unsigned long start;
@@ -392,6 +612,7 @@ static void iSeries_tb_recal(void)
392 new_tb_ticks_per_jiffy, sign, tick_diff ); 612 new_tb_ticks_per_jiffy, sign, tick_diff );
393 tb_ticks_per_jiffy = new_tb_ticks_per_jiffy; 613 tb_ticks_per_jiffy = new_tb_ticks_per_jiffy;
394 tb_ticks_per_sec = new_tb_ticks_per_sec; 614 tb_ticks_per_sec = new_tb_ticks_per_sec;
615 calc_cputime_factors();
395 div128_by_32( XSEC_PER_SEC, 0, tb_ticks_per_sec, &divres ); 616 div128_by_32( XSEC_PER_SEC, 0, tb_ticks_per_sec, &divres );
396 do_gtod.tb_ticks_per_sec = tb_ticks_per_sec; 617 do_gtod.tb_ticks_per_sec = tb_ticks_per_sec;
397 tb_to_xs = divres.result_low; 618 tb_to_xs = divres.result_low;
@@ -440,6 +661,7 @@ void timer_interrupt(struct pt_regs * regs)
440 irq_enter(); 661 irq_enter();
441 662
442 profile_tick(CPU_PROFILING, regs); 663 profile_tick(CPU_PROFILING, regs);
664 calculate_steal_time();
443 665
444#ifdef CONFIG_PPC_ISERIES 666#ifdef CONFIG_PPC_ISERIES
445 get_lppaca()->int_dword.fields.decr_int = 0; 667 get_lppaca()->int_dword.fields.decr_int = 0;
@@ -461,7 +683,7 @@ void timer_interrupt(struct pt_regs * regs)
461 * is the case. 683 * is the case.
462 */ 684 */
463 if (!cpu_is_offline(cpu)) 685 if (!cpu_is_offline(cpu))
464 update_process_times(user_mode(regs)); 686 account_process_time(regs);
465 687
466 /* 688 /*
467 * No need to check whether cpu is offline here; boot_cpuid 689 * No need to check whether cpu is offline here; boot_cpuid
@@ -518,13 +740,27 @@ void wakeup_decrementer(void)
518void __init smp_space_timers(unsigned int max_cpus) 740void __init smp_space_timers(unsigned int max_cpus)
519{ 741{
520 int i; 742 int i;
743 unsigned long half = tb_ticks_per_jiffy / 2;
521 unsigned long offset = tb_ticks_per_jiffy / max_cpus; 744 unsigned long offset = tb_ticks_per_jiffy / max_cpus;
522 unsigned long previous_tb = per_cpu(last_jiffy, boot_cpuid); 745 unsigned long previous_tb = per_cpu(last_jiffy, boot_cpuid);
523 746
524 /* make sure tb > per_cpu(last_jiffy, cpu) for all cpus always */ 747 /* make sure tb > per_cpu(last_jiffy, cpu) for all cpus always */
525 previous_tb -= tb_ticks_per_jiffy; 748 previous_tb -= tb_ticks_per_jiffy;
749 /*
750 * The stolen time calculation for POWER5 shared-processor LPAR
751 * systems works better if the two threads' timebase interrupts
752 * are staggered by half a jiffy with respect to each other.
753 */
526 for_each_cpu(i) { 754 for_each_cpu(i) {
527 if (i != boot_cpuid) { 755 if (i == boot_cpuid)
756 continue;
757 if (i == (boot_cpuid ^ 1))
758 per_cpu(last_jiffy, i) =
759 per_cpu(last_jiffy, boot_cpuid) - half;
760 else if (i & 1)
761 per_cpu(last_jiffy, i) =
762 per_cpu(last_jiffy, i ^ 1) + half;
763 else {
528 previous_tb += offset; 764 previous_tb += offset;
529 per_cpu(last_jiffy, i) = previous_tb; 765 per_cpu(last_jiffy, i) = previous_tb;
530 } 766 }
@@ -720,6 +956,7 @@ void __init time_init(void)
720 tb_ticks_per_sec = ppc_tb_freq; 956 tb_ticks_per_sec = ppc_tb_freq;
721 tb_ticks_per_usec = ppc_tb_freq / 1000000; 957 tb_ticks_per_usec = ppc_tb_freq / 1000000;
722 tb_to_us = mulhwu_scale_factor(ppc_tb_freq, 1000000); 958 tb_to_us = mulhwu_scale_factor(ppc_tb_freq, 1000000);
959 calc_cputime_factors();
723 960
724 /* 961 /*
725 * Calculate the length of each tick in ns. It will not be 962 * Calculate the length of each tick in ns. It will not be
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index 04f7df39ffbb..ec8370368423 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/ppc64/kernel/vdso.c
3 *
4 * Copyright (C) 2004 Benjamin Herrenschmidt, IBM Corp. 2 * Copyright (C) 2004 Benjamin Herrenschmidt, IBM Corp.
5 * <benh@kernel.crashing.org> 3 * <benh@kernel.crashing.org>
6 * 4 *
diff --git a/arch/powerpc/lib/copypage_64.S b/arch/powerpc/lib/copypage_64.S
index 40523b140109..f9837f44ac0b 100644
--- a/arch/powerpc/lib/copypage_64.S
+++ b/arch/powerpc/lib/copypage_64.S
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/ppc64/lib/copypage.S
3 *
4 * Copyright (C) 2002 Paul Mackerras, IBM Corp. 2 * Copyright (C) 2002 Paul Mackerras, IBM Corp.
5 * 3 *
6 * This program is free software; you can redistribute it and/or 4 * This program is free software; you can redistribute it and/or
diff --git a/arch/powerpc/lib/copyuser_64.S b/arch/powerpc/lib/copyuser_64.S
index 6d69ef39b7df..a6b54cb97c49 100644
--- a/arch/powerpc/lib/copyuser_64.S
+++ b/arch/powerpc/lib/copyuser_64.S
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/ppc64/lib/copyuser.S
3 *
4 * Copyright (C) 2002 Paul Mackerras, IBM Corp. 2 * Copyright (C) 2002 Paul Mackerras, IBM Corp.
5 * 3 *
6 * This program is free software; you can redistribute it and/or 4 * This program is free software; you can redistribute it and/or
diff --git a/arch/powerpc/lib/e2a.c b/arch/powerpc/lib/e2a.c
index d2b834887920..4b72ed8fd50e 100644
--- a/arch/powerpc/lib/e2a.c
+++ b/arch/powerpc/lib/e2a.c
@@ -1,9 +1,7 @@
1/* 1/*
2 * arch/ppc64/lib/e2a.c
3 *
4 * EBCDIC to ASCII conversion 2 * EBCDIC to ASCII conversion
5 * 3 *
6 * This function moved here from arch/ppc64/kernel/viopath.c 4 * This function moved here from arch/powerpc/platforms/iseries/viopath.c
7 * 5 *
8 * (C) Copyright 2000-2004 IBM Corporation 6 * (C) Copyright 2000-2004 IBM Corporation
9 * 7 *
@@ -105,4 +103,14 @@ unsigned char e2a(unsigned char x)
105} 103}
106EXPORT_SYMBOL(e2a); 104EXPORT_SYMBOL(e2a);
107 105
106unsigned char* strne2a(unsigned char *dest, const unsigned char *src, size_t n)
107{
108 int i;
109
110 n = strnlen(src, n);
108 111
112 for (i = 0; i < n; i++)
113 dest[i] = e2a(src[i]);
114
115 return dest;
116}
diff --git a/arch/powerpc/lib/memcpy_64.S b/arch/powerpc/lib/memcpy_64.S
index 9ccacdf5bcb9..fd66acfd3e3e 100644
--- a/arch/powerpc/lib/memcpy_64.S
+++ b/arch/powerpc/lib/memcpy_64.S
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/ppc64/lib/memcpy.S
3 *
4 * Copyright (C) 2002 Paul Mackerras, IBM Corp. 2 * Copyright (C) 2002 Paul Mackerras, IBM Corp.
5 * 3 *
6 * This program is free software; you can redistribute it and/or 4 * This program is free software; you can redistribute it and/or
diff --git a/arch/powerpc/lib/rheap.c b/arch/powerpc/lib/rheap.c
index 42c5de2c898f..31e511856dc5 100644
--- a/arch/powerpc/lib/rheap.c
+++ b/arch/powerpc/lib/rheap.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/ppc/syslib/rheap.c
3 *
4 * A Remote Heap. Remote means that we don't touch the memory that the 2 * A Remote Heap. Remote means that we don't touch the memory that the
5 * heap points to. Normal heap implementations use the memory they manage 3 * heap points to. Normal heap implementations use the memory they manage
6 * to place their list. We cannot do that because the memory we manage may 4 * to place their list. We cannot do that because the memory we manage may
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index a4815d316722..ec4adcb4bc28 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/ppc/mm/fault.c
3 *
4 * PowerPC version 2 * PowerPC version
5 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) 3 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
6 * 4 *
diff --git a/arch/powerpc/mm/hash_low_32.S b/arch/powerpc/mm/hash_low_32.S
index 12ccd7155bac..ea469eefa146 100644
--- a/arch/powerpc/mm/hash_low_32.S
+++ b/arch/powerpc/mm/hash_low_32.S
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/ppc/kernel/hashtable.S
3 *
4 * $Id: hashtable.S,v 1.6 1999/10/08 01:56:15 paulus Exp $ 2 * $Id: hashtable.S,v 1.6 1999/10/08 01:56:15 paulus Exp $
5 * 3 *
6 * PowerPC version 4 * PowerPC version
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index e9d589eefc14..89b35c181314 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -169,7 +169,7 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
169#ifdef CONFIG_PPC_ISERIES 169#ifdef CONFIG_PPC_ISERIES
170 if (_machine == PLATFORM_ISERIES_LPAR) 170 if (_machine == PLATFORM_ISERIES_LPAR)
171 ret = iSeries_hpte_insert(hpteg, va, 171 ret = iSeries_hpte_insert(hpteg, va,
172 __pa(vaddr), 172 paddr,
173 tmp_mode, 173 tmp_mode,
174 HPTE_V_BOLTED, 174 HPTE_V_BOLTED,
175 psize); 175 psize);
@@ -178,7 +178,7 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
178#ifdef CONFIG_PPC_PSERIES 178#ifdef CONFIG_PPC_PSERIES
179 if (_machine & PLATFORM_LPAR) 179 if (_machine & PLATFORM_LPAR)
180 ret = pSeries_lpar_hpte_insert(hpteg, va, 180 ret = pSeries_lpar_hpte_insert(hpteg, va,
181 virt_to_abs(paddr), 181 paddr,
182 tmp_mode, 182 tmp_mode,
183 HPTE_V_BOLTED, 183 HPTE_V_BOLTED,
184 psize); 184 psize);
@@ -186,7 +186,7 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
186#endif 186#endif
187#ifdef CONFIG_PPC_MULTIPLATFORM 187#ifdef CONFIG_PPC_MULTIPLATFORM
188 ret = native_hpte_insert(hpteg, va, 188 ret = native_hpte_insert(hpteg, va,
189 virt_to_abs(paddr), 189 paddr,
190 tmp_mode, HPTE_V_BOLTED, 190 tmp_mode, HPTE_V_BOLTED,
191 psize); 191 psize);
192#endif 192#endif
@@ -392,7 +392,7 @@ static unsigned long __init htab_get_table_size(void)
392#ifdef CONFIG_MEMORY_HOTPLUG 392#ifdef CONFIG_MEMORY_HOTPLUG
393void create_section_mapping(unsigned long start, unsigned long end) 393void create_section_mapping(unsigned long start, unsigned long end)
394{ 394{
395 BUG_ON(htab_bolt_mapping(start, end, start, 395 BUG_ON(htab_bolt_mapping(start, end, __pa(start),
396 _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_COHERENT | PP_RWXX, 396 _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_COHERENT | PP_RWXX,
397 mmu_linear_psize)); 397 mmu_linear_psize));
398} 398}
@@ -422,7 +422,7 @@ void __init htab_initialize(void)
422 422
423 htab_hash_mask = pteg_count - 1; 423 htab_hash_mask = pteg_count - 1;
424 424
425 if (platform_is_lpar()) { 425 if (firmware_has_feature(FW_FEATURE_LPAR)) {
426 /* Using a hypervisor which owns the htab */ 426 /* Using a hypervisor which owns the htab */
427 htab_address = NULL; 427 htab_address = NULL;
428 _SDR1 = 0; 428 _SDR1 = 0;
@@ -431,7 +431,6 @@ void __init htab_initialize(void)
431 * the absolute address space. 431 * the absolute address space.
432 */ 432 */
433 table = lmb_alloc(htab_size_bytes, htab_size_bytes); 433 table = lmb_alloc(htab_size_bytes, htab_size_bytes);
434 BUG_ON(table == 0);
435 434
436 DBG("Hash table allocated at %lx, size: %lx\n", table, 435 DBG("Hash table allocated at %lx, size: %lx\n", table,
437 htab_size_bytes); 436 htab_size_bytes);
@@ -474,21 +473,22 @@ void __init htab_initialize(void)
474 473
475 if (dart_tablebase != 0 && dart_tablebase >= base 474 if (dart_tablebase != 0 && dart_tablebase >= base
476 && dart_tablebase < (base + size)) { 475 && dart_tablebase < (base + size)) {
476 unsigned long dart_table_end = dart_tablebase + 16 * MB;
477 if (base != dart_tablebase) 477 if (base != dart_tablebase)
478 BUG_ON(htab_bolt_mapping(base, dart_tablebase, 478 BUG_ON(htab_bolt_mapping(base, dart_tablebase,
479 base, mode_rw, 479 __pa(base), mode_rw,
480 mmu_linear_psize)); 480 mmu_linear_psize));
481 if ((base + size) > (dart_tablebase + 16*MB)) 481 if ((base + size) > dart_table_end)
482 BUG_ON(htab_bolt_mapping(dart_tablebase+16*MB, 482 BUG_ON(htab_bolt_mapping(dart_tablebase+16*MB,
483 base + size, 483 base + size,
484 dart_tablebase+16*MB, 484 __pa(dart_table_end),
485 mode_rw, 485 mode_rw,
486 mmu_linear_psize)); 486 mmu_linear_psize));
487 continue; 487 continue;
488 } 488 }
489#endif /* CONFIG_U3_DART */ 489#endif /* CONFIG_U3_DART */
490 BUG_ON(htab_bolt_mapping(base, base + size, base, 490 BUG_ON(htab_bolt_mapping(base, base + size, __pa(base),
491 mode_rw, mmu_linear_psize)); 491 mode_rw, mmu_linear_psize));
492 } 492 }
493 493
494 /* 494 /*
@@ -505,8 +505,8 @@ void __init htab_initialize(void)
505 if (base + size >= tce_alloc_start) 505 if (base + size >= tce_alloc_start)
506 tce_alloc_start = base + size + 1; 506 tce_alloc_start = base + size + 1;
507 507
508 BUG_ON(htab_bolt_mapping(tce_alloc_start, tce_alloc_end, 508 BUG_ON(htab_bolt_mapping(tce_alloc_start, tce_alloc_end,
509 tce_alloc_start, mode_rw, 509 __pa(tce_alloc_start), mode_rw,
510 mmu_linear_psize)); 510 mmu_linear_psize));
511 } 511 }
512 512
@@ -517,7 +517,7 @@ void __init htab_initialize(void)
517 517
518void htab_initialize_secondary(void) 518void htab_initialize_secondary(void)
519{ 519{
520 if (!platform_is_lpar()) 520 if (!firmware_has_feature(FW_FEATURE_LPAR))
521 mtspr(SPRN_SDR1, _SDR1); 521 mtspr(SPRN_SDR1, _SDR1);
522} 522}
523 523
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index bacb71c89811..babebd15bdc4 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -84,54 +84,6 @@
84/* max amount of RAM to use */ 84/* max amount of RAM to use */
85unsigned long __max_memory; 85unsigned long __max_memory;
86 86
87/* info on what we think the IO hole is */
88unsigned long io_hole_start;
89unsigned long io_hole_size;
90
91/*
92 * Do very early mm setup.
93 */
94void __init mm_init_ppc64(void)
95{
96#ifndef CONFIG_PPC_ISERIES
97 unsigned long i;
98#endif
99
100 ppc64_boot_msg(0x100, "MM Init");
101
102 /* This is the story of the IO hole... please, keep seated,
103 * unfortunately, we are out of oxygen masks at the moment.
104 * So we need some rough way to tell where your big IO hole
105 * is. On pmac, it's between 2G and 4G, on POWER3, it's around
106 * that area as well, on POWER4 we don't have one, etc...
107 * We need that as a "hint" when sizing the TCE table on POWER3
108 * So far, the simplest way that seem work well enough for us it
109 * to just assume that the first discontinuity in our physical
110 * RAM layout is the IO hole. That may not be correct in the future
111 * (and isn't on iSeries but then we don't care ;)
112 */
113
114#ifndef CONFIG_PPC_ISERIES
115 for (i = 1; i < lmb.memory.cnt; i++) {
116 unsigned long base, prevbase, prevsize;
117
118 prevbase = lmb.memory.region[i-1].base;
119 prevsize = lmb.memory.region[i-1].size;
120 base = lmb.memory.region[i].base;
121 if (base > (prevbase + prevsize)) {
122 io_hole_start = prevbase + prevsize;
123 io_hole_size = base - (prevbase + prevsize);
124 break;
125 }
126 }
127#endif /* CONFIG_PPC_ISERIES */
128 if (io_hole_start)
129 printk("IO Hole assumed to be %lx -> %lx\n",
130 io_hole_start, io_hole_start + io_hole_size - 1);
131
132 ppc64_boot_msg(0x100, "MM Init Done");
133}
134
135void free_initmem(void) 87void free_initmem(void)
136{ 88{
137 unsigned long addr; 89 unsigned long addr;
diff --git a/arch/powerpc/mm/lmb.c b/arch/powerpc/mm/lmb.c
index bbe3eac918e8..417d58518558 100644
--- a/arch/powerpc/mm/lmb.c
+++ b/arch/powerpc/mm/lmb.c
@@ -31,6 +31,8 @@
31#define DBG(fmt...) 31#define DBG(fmt...)
32#endif 32#endif
33 33
34#define LMB_ALLOC_ANYWHERE 0
35
34struct lmb lmb; 36struct lmb lmb;
35 37
36void lmb_dump_all(void) 38void lmb_dump_all(void)
@@ -226,6 +228,20 @@ unsigned long __init lmb_alloc(unsigned long size, unsigned long align)
226unsigned long __init lmb_alloc_base(unsigned long size, unsigned long align, 228unsigned long __init lmb_alloc_base(unsigned long size, unsigned long align,
227 unsigned long max_addr) 229 unsigned long max_addr)
228{ 230{
231 unsigned long alloc;
232
233 alloc = __lmb_alloc_base(size, align, max_addr);
234
235 if (alloc == 0)
236 panic("ERROR: Failed to allocate 0x%lx bytes below 0x%lx.\n",
237 size, max_addr);
238
239 return alloc;
240}
241
242unsigned long __init __lmb_alloc_base(unsigned long size, unsigned long align,
243 unsigned long max_addr)
244{
229 long i, j; 245 long i, j;
230 unsigned long base = 0; 246 unsigned long base = 0;
231 247
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 454cac01d8cc..badac10d700c 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -125,7 +125,7 @@ int __devinit add_memory(u64 start, u64 size)
125 nid = hot_add_scn_to_nid(start); 125 nid = hot_add_scn_to_nid(start);
126 pgdata = NODE_DATA(nid); 126 pgdata = NODE_DATA(nid);
127 127
128 start = __va(start); 128 start = (unsigned long)__va(start);
129 create_section_mapping(start, start + size); 129 create_section_mapping(start, start + size);
130 130
131 /* this should work for most non-highmem platforms */ 131 /* this should work for most non-highmem platforms */
@@ -249,7 +249,6 @@ void __init do_init_bootmem(void)
249 bootmap_pages = bootmem_bootmap_pages(total_pages); 249 bootmap_pages = bootmem_bootmap_pages(total_pages);
250 250
251 start = lmb_alloc(bootmap_pages << PAGE_SHIFT, PAGE_SIZE); 251 start = lmb_alloc(bootmap_pages << PAGE_SHIFT, PAGE_SIZE);
252 BUG_ON(!start);
253 252
254 boot_mapsize = init_bootmem(start >> PAGE_SHIFT, total_pages); 253 boot_mapsize = init_bootmem(start >> PAGE_SHIFT, total_pages);
255 254
diff --git a/arch/powerpc/mm/mmap.c b/arch/powerpc/mm/mmap.c
index fe65f522aff3..972a8e884b9a 100644
--- a/arch/powerpc/mm/mmap.c
+++ b/arch/powerpc/mm/mmap.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/ppc64/mm/mmap.c
3 *
4 * flexible mmap layout support 2 * flexible mmap layout support
5 * 3 *
6 * Copyright 2003-2004 Red Hat Inc., Durham, North Carolina. 4 * Copyright 2003-2004 Red Hat Inc., Durham, North Carolina.
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 2863a912bcd0..e89b22aa539e 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -129,10 +129,12 @@ void __init get_region(unsigned int nid, unsigned long *start_pfn,
129 *start_pfn = 0; 129 *start_pfn = 0;
130} 130}
131 131
132static inline void map_cpu_to_node(int cpu, int node) 132static void __cpuinit map_cpu_to_node(int cpu, int node)
133{ 133{
134 numa_cpu_lookup_table[cpu] = node; 134 numa_cpu_lookup_table[cpu] = node;
135 135
136 dbg("adding cpu %d to node %d\n", cpu, node);
137
136 if (!(cpu_isset(cpu, numa_cpumask_lookup_table[node]))) 138 if (!(cpu_isset(cpu, numa_cpumask_lookup_table[node])))
137 cpu_set(cpu, numa_cpumask_lookup_table[node]); 139 cpu_set(cpu, numa_cpumask_lookup_table[node]);
138} 140}
@@ -153,7 +155,7 @@ static void unmap_cpu_from_node(unsigned long cpu)
153} 155}
154#endif /* CONFIG_HOTPLUG_CPU */ 156#endif /* CONFIG_HOTPLUG_CPU */
155 157
156static struct device_node *find_cpu_node(unsigned int cpu) 158static struct device_node * __cpuinit find_cpu_node(unsigned int cpu)
157{ 159{
158 unsigned int hw_cpuid = get_hard_smp_processor_id(cpu); 160 unsigned int hw_cpuid = get_hard_smp_processor_id(cpu);
159 struct device_node *cpu_node = NULL; 161 struct device_node *cpu_node = NULL;
@@ -189,23 +191,29 @@ static int *of_get_associativity(struct device_node *dev)
189 return (unsigned int *)get_property(dev, "ibm,associativity", NULL); 191 return (unsigned int *)get_property(dev, "ibm,associativity", NULL);
190} 192}
191 193
192static int of_node_numa_domain(struct device_node *device) 194/* Returns nid in the range [0..MAX_NUMNODES-1], or -1 if no useful numa
195 * info is found.
196 */
197static int of_node_to_nid(struct device_node *device)
193{ 198{
194 int numa_domain; 199 int nid = -1;
195 unsigned int *tmp; 200 unsigned int *tmp;
196 201
197 if (min_common_depth == -1) 202 if (min_common_depth == -1)
198 return 0; 203 goto out;
199 204
200 tmp = of_get_associativity(device); 205 tmp = of_get_associativity(device);
201 if (tmp && (tmp[0] >= min_common_depth)) { 206 if (!tmp)
202 numa_domain = tmp[min_common_depth]; 207 goto out;
203 } else { 208
204 dbg("WARNING: no NUMA information for %s\n", 209 if (tmp[0] >= min_common_depth)
205 device->full_name); 210 nid = tmp[min_common_depth];
206 numa_domain = 0; 211
207 } 212 /* POWER4 LPAR uses 0xffff as invalid node */
208 return numa_domain; 213 if (nid == 0xffff || nid >= MAX_NUMNODES)
214 nid = -1;
215out:
216 return nid;
209} 217}
210 218
211/* 219/*
@@ -246,8 +254,7 @@ static int __init find_min_common_depth(void)
246 if ((len >= 1) && ref_points) { 254 if ((len >= 1) && ref_points) {
247 depth = ref_points[1]; 255 depth = ref_points[1];
248 } else { 256 } else {
249 dbg("WARNING: could not find NUMA " 257 dbg("NUMA: ibm,associativity-reference-points not found.\n");
250 "associativity reference point\n");
251 depth = -1; 258 depth = -1;
252 } 259 }
253 of_node_put(rtas_root); 260 of_node_put(rtas_root);
@@ -283,9 +290,9 @@ static unsigned long __devinit read_n_cells(int n, unsigned int **buf)
283 * Figure out to which domain a cpu belongs and stick it there. 290 * Figure out to which domain a cpu belongs and stick it there.
284 * Return the id of the domain used. 291 * Return the id of the domain used.
285 */ 292 */
286static int numa_setup_cpu(unsigned long lcpu) 293static int __cpuinit numa_setup_cpu(unsigned long lcpu)
287{ 294{
288 int numa_domain = 0; 295 int nid = 0;
289 struct device_node *cpu = find_cpu_node(lcpu); 296 struct device_node *cpu = find_cpu_node(lcpu);
290 297
291 if (!cpu) { 298 if (!cpu) {
@@ -293,27 +300,16 @@ static int numa_setup_cpu(unsigned long lcpu)
293 goto out; 300 goto out;
294 } 301 }
295 302
296 numa_domain = of_node_numa_domain(cpu); 303 nid = of_node_to_nid(cpu);
297 304
298 if (numa_domain >= num_online_nodes()) { 305 if (nid < 0 || !node_online(nid))
299 /* 306 nid = any_online_node(NODE_MASK_ALL);
300 * POWER4 LPAR uses 0xffff as invalid node,
301 * dont warn in this case.
302 */
303 if (numa_domain != 0xffff)
304 printk(KERN_ERR "WARNING: cpu %ld "
305 "maps to invalid NUMA node %d\n",
306 lcpu, numa_domain);
307 numa_domain = 0;
308 }
309out: 307out:
310 node_set_online(numa_domain); 308 map_cpu_to_node(lcpu, nid);
311
312 map_cpu_to_node(lcpu, numa_domain);
313 309
314 of_node_put(cpu); 310 of_node_put(cpu);
315 311
316 return numa_domain; 312 return nid;
317} 313}
318 314
319static int cpu_numa_callback(struct notifier_block *nfb, 315static int cpu_numa_callback(struct notifier_block *nfb,
@@ -325,10 +321,7 @@ static int cpu_numa_callback(struct notifier_block *nfb,
325 321
326 switch (action) { 322 switch (action) {
327 case CPU_UP_PREPARE: 323 case CPU_UP_PREPARE:
328 if (min_common_depth == -1 || !numa_enabled) 324 numa_setup_cpu(lcpu);
329 map_cpu_to_node(lcpu, 0);
330 else
331 numa_setup_cpu(lcpu);
332 ret = NOTIFY_OK; 325 ret = NOTIFY_OK;
333 break; 326 break;
334#ifdef CONFIG_HOTPLUG_CPU 327#ifdef CONFIG_HOTPLUG_CPU
@@ -375,7 +368,7 @@ static int __init parse_numa_properties(void)
375{ 368{
376 struct device_node *cpu = NULL; 369 struct device_node *cpu = NULL;
377 struct device_node *memory = NULL; 370 struct device_node *memory = NULL;
378 int max_domain; 371 int default_nid = 0;
379 unsigned long i; 372 unsigned long i;
380 373
381 if (numa_enabled == 0) { 374 if (numa_enabled == 0) {
@@ -385,32 +378,32 @@ static int __init parse_numa_properties(void)
385 378
386 min_common_depth = find_min_common_depth(); 379 min_common_depth = find_min_common_depth();
387 380
388 dbg("NUMA associativity depth for CPU/Memory: %d\n", min_common_depth);
389 if (min_common_depth < 0) 381 if (min_common_depth < 0)
390 return min_common_depth; 382 return min_common_depth;
391 383
392 max_domain = numa_setup_cpu(boot_cpuid); 384 dbg("NUMA associativity depth for CPU/Memory: %d\n", min_common_depth);
393 385
394 /* 386 /*
395 * Even though we connect cpus to numa domains later in SMP init, 387 * Even though we connect cpus to numa domains later in SMP
396 * we need to know the maximum node id now. This is because each 388 * init, we need to know the node ids now. This is because
397 * node id must have NODE_DATA etc backing it. 389 * each node to be onlined must have NODE_DATA etc backing it.
398 * As a result of hotplug we could still have cpus appear later on
399 * with larger node ids. In that case we force the cpu into node 0.
400 */ 390 */
401 for_each_cpu(i) { 391 for_each_present_cpu(i) {
402 int numa_domain; 392 int nid;
403 393
404 cpu = find_cpu_node(i); 394 cpu = find_cpu_node(i);
395 BUG_ON(!cpu);
396 nid = of_node_to_nid(cpu);
397 of_node_put(cpu);
405 398
406 if (cpu) { 399 /*
407 numa_domain = of_node_numa_domain(cpu); 400 * Don't fall back to default_nid yet -- we will plug
408 of_node_put(cpu); 401 * cpus into nodes once the memory scan has discovered
409 402 * the topology.
410 if (numa_domain < MAX_NUMNODES && 403 */
411 max_domain < numa_domain) 404 if (nid < 0)
412 max_domain = numa_domain; 405 continue;
413 } 406 node_set_online(nid);
414 } 407 }
415 408
416 get_n_mem_cells(&n_mem_addr_cells, &n_mem_size_cells); 409 get_n_mem_cells(&n_mem_addr_cells, &n_mem_size_cells);
@@ -418,7 +411,7 @@ static int __init parse_numa_properties(void)
418 while ((memory = of_find_node_by_type(memory, "memory")) != NULL) { 411 while ((memory = of_find_node_by_type(memory, "memory")) != NULL) {
419 unsigned long start; 412 unsigned long start;
420 unsigned long size; 413 unsigned long size;
421 int numa_domain; 414 int nid;
422 int ranges; 415 int ranges;
423 unsigned int *memcell_buf; 416 unsigned int *memcell_buf;
424 unsigned int len; 417 unsigned int len;
@@ -439,18 +432,15 @@ new_range:
439 start = read_n_cells(n_mem_addr_cells, &memcell_buf); 432 start = read_n_cells(n_mem_addr_cells, &memcell_buf);
440 size = read_n_cells(n_mem_size_cells, &memcell_buf); 433 size = read_n_cells(n_mem_size_cells, &memcell_buf);
441 434
442 numa_domain = of_node_numa_domain(memory); 435 /*
443 436 * Assumption: either all memory nodes or none will
444 if (numa_domain >= MAX_NUMNODES) { 437 * have associativity properties. If none, then
445 if (numa_domain != 0xffff) 438 * everything goes to default_nid.
446 printk(KERN_ERR "WARNING: memory at %lx maps " 439 */
447 "to invalid NUMA node %d\n", start, 440 nid = of_node_to_nid(memory);
448 numa_domain); 441 if (nid < 0)
449 numa_domain = 0; 442 nid = default_nid;
450 } 443 node_set_online(nid);
451
452 if (max_domain < numa_domain)
453 max_domain = numa_domain;
454 444
455 if (!(size = numa_enforce_memory_limit(start, size))) { 445 if (!(size = numa_enforce_memory_limit(start, size))) {
456 if (--ranges) 446 if (--ranges)
@@ -459,16 +449,13 @@ new_range:
459 continue; 449 continue;
460 } 450 }
461 451
462 add_region(numa_domain, start >> PAGE_SHIFT, 452 add_region(nid, start >> PAGE_SHIFT,
463 size >> PAGE_SHIFT); 453 size >> PAGE_SHIFT);
464 454
465 if (--ranges) 455 if (--ranges)
466 goto new_range; 456 goto new_range;
467 } 457 }
468 458
469 for (i = 0; i <= max_domain; i++)
470 node_set_online(i);
471
472 return 0; 459 return 0;
473} 460}
474 461
@@ -483,7 +470,6 @@ static void __init setup_nonnuma(void)
483 printk(KERN_INFO "Memory hole size: %ldMB\n", 470 printk(KERN_INFO "Memory hole size: %ldMB\n",
484 (top_of_ram - total_ram) >> 20); 471 (top_of_ram - total_ram) >> 20);
485 472
486 map_cpu_to_node(boot_cpuid, 0);
487 for (i = 0; i < lmb.memory.cnt; ++i) 473 for (i = 0; i < lmb.memory.cnt; ++i)
488 add_region(0, lmb.memory.region[i].base >> PAGE_SHIFT, 474 add_region(0, lmb.memory.region[i].base >> PAGE_SHIFT,
489 lmb_size_pages(&lmb.memory, i)); 475 lmb_size_pages(&lmb.memory, i));
@@ -570,11 +556,11 @@ static void __init *careful_allocation(int nid, unsigned long size,
570 unsigned long end_pfn) 556 unsigned long end_pfn)
571{ 557{
572 int new_nid; 558 int new_nid;
573 unsigned long ret = lmb_alloc_base(size, align, end_pfn << PAGE_SHIFT); 559 unsigned long ret = __lmb_alloc_base(size, align, end_pfn << PAGE_SHIFT);
574 560
575 /* retry over all memory */ 561 /* retry over all memory */
576 if (!ret) 562 if (!ret)
577 ret = lmb_alloc_base(size, align, lmb_end_of_DRAM()); 563 ret = __lmb_alloc_base(size, align, lmb_end_of_DRAM());
578 564
579 if (!ret) 565 if (!ret)
580 panic("numa.c: cannot allocate %lu bytes on node %d", 566 panic("numa.c: cannot allocate %lu bytes on node %d",
@@ -620,6 +606,8 @@ void __init do_init_bootmem(void)
620 dump_numa_memory_topology(); 606 dump_numa_memory_topology();
621 607
622 register_cpu_notifier(&ppc64_numa_nb); 608 register_cpu_notifier(&ppc64_numa_nb);
609 cpu_numa_callback(&ppc64_numa_nb, CPU_UP_PREPARE,
610 (void *)(unsigned long)boot_cpuid);
623 611
624 for_each_online_node(nid) { 612 for_each_online_node(nid) {
625 unsigned long start_pfn, end_pfn, pages_present; 613 unsigned long start_pfn, end_pfn, pages_present;
@@ -767,10 +755,10 @@ int hot_add_scn_to_nid(unsigned long scn_addr)
767{ 755{
768 struct device_node *memory = NULL; 756 struct device_node *memory = NULL;
769 nodemask_t nodes; 757 nodemask_t nodes;
770 int numa_domain = 0; 758 int default_nid = any_online_node(NODE_MASK_ALL);
771 759
772 if (!numa_enabled || (min_common_depth < 0)) 760 if (!numa_enabled || (min_common_depth < 0))
773 return numa_domain; 761 return default_nid;
774 762
775 while ((memory = of_find_node_by_type(memory, "memory")) != NULL) { 763 while ((memory = of_find_node_by_type(memory, "memory")) != NULL) {
776 unsigned long start, size; 764 unsigned long start, size;
@@ -787,15 +775,15 @@ int hot_add_scn_to_nid(unsigned long scn_addr)
787ha_new_range: 775ha_new_range:
788 start = read_n_cells(n_mem_addr_cells, &memcell_buf); 776 start = read_n_cells(n_mem_addr_cells, &memcell_buf);
789 size = read_n_cells(n_mem_size_cells, &memcell_buf); 777 size = read_n_cells(n_mem_size_cells, &memcell_buf);
790 numa_domain = of_node_numa_domain(memory); 778 nid = of_node_to_nid(memory);
791 779
792 /* Domains not present at boot default to 0 */ 780 /* Domains not present at boot default to 0 */
793 if (!node_online(numa_domain)) 781 if (nid < 0 || !node_online(nid))
794 numa_domain = any_online_node(NODE_MASK_ALL); 782 nid = default_nid;
795 783
796 if ((scn_addr >= start) && (scn_addr < (start + size))) { 784 if ((scn_addr >= start) && (scn_addr < (start + size))) {
797 of_node_put(memory); 785 of_node_put(memory);
798 goto got_numa_domain; 786 goto got_nid;
799 } 787 }
800 788
801 if (--ranges) /* process all ranges in cell */ 789 if (--ranges) /* process all ranges in cell */
@@ -804,12 +792,12 @@ ha_new_range:
804 BUG(); /* section address should be found above */ 792 BUG(); /* section address should be found above */
805 793
806 /* Temporary code to ensure that returned node is not empty */ 794 /* Temporary code to ensure that returned node is not empty */
807got_numa_domain: 795got_nid:
808 nodes_setall(nodes); 796 nodes_setall(nodes);
809 while (NODE_DATA(numa_domain)->node_spanned_pages == 0) { 797 while (NODE_DATA(nid)->node_spanned_pages == 0) {
810 node_clear(numa_domain, nodes); 798 node_clear(nid, nodes);
811 numa_domain = any_online_node(nodes); 799 nid = any_online_node(nodes);
812 } 800 }
813 return numa_domain; 801 return nid;
814} 802}
815#endif /* CONFIG_MEMORY_HOTPLUG */ 803#endif /* CONFIG_MEMORY_HOTPLUG */
diff --git a/arch/powerpc/mm/slb_low.S b/arch/powerpc/mm/slb_low.S
index d1acee38f163..abfaabf667bf 100644
--- a/arch/powerpc/mm/slb_low.S
+++ b/arch/powerpc/mm/slb_low.S
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/ppc64/mm/slb_low.S
3 *
4 * Low-level SLB routines 2 * Low-level SLB routines
5 * 3 *
6 * Copyright (C) 2004 David Gibson <dwg@au.ibm.com>, IBM 4 * Copyright (C) 2004 David Gibson <dwg@au.ibm.com>, IBM
diff --git a/arch/powerpc/mm/stab.c b/arch/powerpc/mm/stab.c
index 82e4951826bc..91d25fb27f89 100644
--- a/arch/powerpc/mm/stab.c
+++ b/arch/powerpc/mm/stab.c
@@ -247,10 +247,6 @@ void stabs_alloc(void)
247 247
248 newstab = lmb_alloc_base(HW_PAGE_SIZE, HW_PAGE_SIZE, 248 newstab = lmb_alloc_base(HW_PAGE_SIZE, HW_PAGE_SIZE,
249 1<<SID_SHIFT); 249 1<<SID_SHIFT);
250 if (! newstab)
251 panic("Unable to allocate segment table for CPU %d.\n",
252 cpu);
253
254 newstab = (unsigned long)__va(newstab); 250 newstab = (unsigned long)__va(newstab);
255 251
256 memset((void *)newstab, 0, HW_PAGE_SIZE); 252 memset((void *)newstab, 0, HW_PAGE_SIZE);
diff --git a/arch/powerpc/mm/tlb_64.c b/arch/powerpc/mm/tlb_64.c
index bb3afb6e6317..f734b11566c2 100644
--- a/arch/powerpc/mm/tlb_64.c
+++ b/arch/powerpc/mm/tlb_64.c
@@ -36,7 +36,7 @@
36DEFINE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch); 36DEFINE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch);
37 37
38/* This is declared as we are using the more or less generic 38/* This is declared as we are using the more or less generic
39 * include/asm-ppc64/tlb.h file -- tgall 39 * include/asm-powerpc/tlb.h file -- tgall
40 */ 40 */
41DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); 41DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
42DEFINE_PER_CPU(struct pte_freelist_batch *, pte_freelist_cur); 42DEFINE_PER_CPU(struct pte_freelist_batch *, pte_freelist_cur);
diff --git a/arch/powerpc/oprofile/op_model_power4.c b/arch/powerpc/oprofile/op_model_power4.c
index 659a021da0c7..4b06e53eb9b4 100644
--- a/arch/powerpc/oprofile/op_model_power4.c
+++ b/arch/powerpc/oprofile/op_model_power4.c
@@ -10,6 +10,7 @@
10#include <linux/oprofile.h> 10#include <linux/oprofile.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/smp.h> 12#include <linux/smp.h>
13#include <asm/firmware.h>
13#include <asm/ptrace.h> 14#include <asm/ptrace.h>
14#include <asm/system.h> 15#include <asm/system.h>
15#include <asm/processor.h> 16#include <asm/processor.h>
@@ -232,7 +233,7 @@ static unsigned long get_pc(struct pt_regs *regs)
232 mmcra = mfspr(SPRN_MMCRA); 233 mmcra = mfspr(SPRN_MMCRA);
233 234
234 /* Were we in the hypervisor? */ 235 /* Were we in the hypervisor? */
235 if (platform_is_lpar() && (mmcra & MMCRA_SIHV)) 236 if (firmware_has_feature(FW_FEATURE_LPAR) && (mmcra & MMCRA_SIHV))
236 /* function descriptor madness */ 237 /* function descriptor madness */
237 return *((unsigned long *)hypervisor_bucket); 238 return *((unsigned long *)hypervisor_bucket);
238 239
diff --git a/arch/powerpc/platforms/83xx/Makefile b/arch/powerpc/platforms/83xx/Makefile
index 9d8b28ef3343..5c72367441a8 100644
--- a/arch/powerpc/platforms/83xx/Makefile
+++ b/arch/powerpc/platforms/83xx/Makefile
@@ -1,4 +1,6 @@
1# 1#
2# Makefile for the PowerPC 83xx linux kernel. 2# Makefile for the PowerPC 83xx linux kernel.
3# 3#
4obj-$(CONFIG_MPC834x_SYS) += mpc834x_sys.o pci.o 4obj-y := misc.o
5obj-$(CONFIG_PCI) += pci.o
6obj-$(CONFIG_MPC834x_SYS) += mpc834x_sys.o
diff --git a/arch/powerpc/platforms/83xx/misc.c b/arch/powerpc/platforms/83xx/misc.c
new file mode 100644
index 000000000000..1455bcef4892
--- /dev/null
+++ b/arch/powerpc/platforms/83xx/misc.c
@@ -0,0 +1,55 @@
1/*
2 * misc setup functions for MPC83xx
3 *
4 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
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
16#include <asm/io.h>
17#include <asm/hw_irq.h>
18#include <sysdev/fsl_soc.h>
19
20#include "mpc83xx.h"
21
22void mpc83xx_restart(char *cmd)
23{
24#define RST_OFFSET 0x00000900
25#define RST_PROT_REG 0x00000018
26#define RST_CTRL_REG 0x0000001c
27 __be32 __iomem *reg;
28
29 /* map reset register space */
30 reg = ioremap(get_immrbase() + 0x900, 0xff);
31
32 local_irq_disable();
33
34 /* enable software reset "RSTE" */
35 out_be32(reg + (RST_PROT_REG >> 2), 0x52535445);
36
37 /* set software hard reset */
38 out_be32(reg + (RST_CTRL_REG >> 2), 0x2);
39 for (;;) ;
40}
41
42long __init mpc83xx_time_init(void)
43{
44#define SPCR_OFFSET 0x00000110
45#define SPCR_TBEN 0x00400000
46 __be32 __iomem *spcr = ioremap(get_immrbase() + SPCR_OFFSET, 4);
47 __be32 tmp;
48
49 tmp = in_be32(spcr);
50 out_be32(spcr, tmp | SPCR_TBEN);
51
52 iounmap(spcr);
53
54 return 0;
55}
diff --git a/arch/powerpc/platforms/83xx/mpc834x_sys.c b/arch/powerpc/platforms/83xx/mpc834x_sys.c
index 2098dd05a773..7c18b4cd5db4 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_sys.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_sys.c
@@ -24,22 +24,15 @@
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <linux/seq_file.h> 25#include <linux/seq_file.h>
26#include <linux/root_dev.h> 26#include <linux/root_dev.h>
27#include <linux/module.h>
28#include <linux/fsl_devices.h>
29 27
30#include <asm/system.h> 28#include <asm/system.h>
31#include <asm/pgtable.h>
32#include <asm/page.h>
33#include <asm/atomic.h> 29#include <asm/atomic.h>
34#include <asm/time.h> 30#include <asm/time.h>
35#include <asm/io.h> 31#include <asm/io.h>
36#include <asm/machdep.h> 32#include <asm/machdep.h>
37#include <asm/ipic.h> 33#include <asm/ipic.h>
38#include <asm/bootinfo.h> 34#include <asm/bootinfo.h>
39#include <asm/pci-bridge.h>
40#include <asm/mpc83xx.h>
41#include <asm/irq.h> 35#include <asm/irq.h>
42#include <mm/mmu_decl.h>
43#include <asm/prom.h> 36#include <asm/prom.h>
44#include <asm/udbg.h> 37#include <asm/udbg.h>
45#include <sysdev/fsl_soc.h> 38#include <sysdev/fsl_soc.h>
@@ -52,8 +45,6 @@ unsigned long isa_mem_base = 0;
52#endif 45#endif
53 46
54#ifdef CONFIG_PCI 47#ifdef CONFIG_PCI
55extern int mpc83xx_pci2_busno;
56
57static int 48static int
58mpc83xx_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin) 49mpc83xx_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
59{ 50{
@@ -78,26 +69,14 @@ mpc83xx_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
78 const long min_idsel = 0x11, max_idsel = 0x20, irqs_per_slot = 4; 69 const long min_idsel = 0x11, max_idsel = 0x20, irqs_per_slot = 4;
79 return PCI_IRQ_TABLE_LOOKUP; 70 return PCI_IRQ_TABLE_LOOKUP;
80} 71}
81 72#endif /* CONFIG_PCI */
82static int
83mpc83xx_exclude_device(u_char bus, u_char devfn)
84{
85 if (bus == 0 && PCI_SLOT(devfn) == 0)
86 return PCIBIOS_DEVICE_NOT_FOUND;
87 if (mpc83xx_pci2_busno)
88 if (bus == (mpc83xx_pci2_busno) && PCI_SLOT(devfn) == 0)
89 return PCIBIOS_DEVICE_NOT_FOUND;
90 return PCIBIOS_SUCCESSFUL;
91}
92#endif /* CONFIG_PCI */
93 73
94/* ************************************************************************ 74/* ************************************************************************
95 * 75 *
96 * Setup the architecture 76 * Setup the architecture
97 * 77 *
98 */ 78 */
99static void __init 79static void __init mpc834x_sys_setup_arch(void)
100mpc834x_sys_setup_arch(void)
101{ 80{
102 struct device_node *np; 81 struct device_node *np;
103 82
@@ -106,14 +85,14 @@ mpc834x_sys_setup_arch(void)
106 85
107 np = of_find_node_by_type(NULL, "cpu"); 86 np = of_find_node_by_type(NULL, "cpu");
108 if (np != 0) { 87 if (np != 0) {
109 unsigned int *fp = (int *) get_property(np, "clock-frequency", NULL); 88 unsigned int *fp =
89 (int *)get_property(np, "clock-frequency", NULL);
110 if (fp != 0) 90 if (fp != 0)
111 loops_per_jiffy = *fp / HZ; 91 loops_per_jiffy = *fp / HZ;
112 else 92 else
113 loops_per_jiffy = 50000000 / HZ; 93 loops_per_jiffy = 50000000 / HZ;
114 of_node_put(np); 94 of_node_put(np);
115 } 95 }
116
117#ifdef CONFIG_PCI 96#ifdef CONFIG_PCI
118 for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) 97 for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
119 add_bridge(np); 98 add_bridge(np);
@@ -124,14 +103,13 @@ mpc834x_sys_setup_arch(void)
124#endif 103#endif
125 104
126#ifdef CONFIG_ROOT_NFS 105#ifdef CONFIG_ROOT_NFS
127 ROOT_DEV = Root_NFS; 106 ROOT_DEV = Root_NFS;
128#else 107#else
129 ROOT_DEV = Root_HDA1; 108 ROOT_DEV = Root_HDA1;
130#endif 109#endif
131} 110}
132 111
133void __init 112void __init mpc834x_sys_init_IRQ(void)
134mpc834x_sys_init_IRQ(void)
135{ 113{
136 u8 senses[8] = { 114 u8 senses[8] = {
137 0, /* EXT 0 */ 115 0, /* EXT 0 */
@@ -160,64 +138,27 @@ mpc834x_sys_init_IRQ(void)
160} 138}
161 139
162#if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374) 140#if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374)
163extern ulong ds1374_get_rtc_time(void); 141extern ulong ds1374_get_rtc_time(void);
164extern int ds1374_set_rtc_time(ulong); 142extern int ds1374_set_rtc_time(ulong);
165 143
166static int __init 144static int __init mpc834x_rtc_hookup(void)
167mpc834x_rtc_hookup(void)
168{ 145{
169 struct timespec tv; 146 struct timespec tv;
170 147
171 ppc_md.get_rtc_time = ds1374_get_rtc_time; 148 ppc_md.get_rtc_time = ds1374_get_rtc_time;
172 ppc_md.set_rtc_time = ds1374_set_rtc_time; 149 ppc_md.set_rtc_time = ds1374_set_rtc_time;
173 150
174 tv.tv_nsec = 0; 151 tv.tv_nsec = 0;
175 tv.tv_sec = (ppc_md.get_rtc_time)(); 152 tv.tv_sec = (ppc_md.get_rtc_time) ();
176 do_settimeofday(&tv); 153 do_settimeofday(&tv);
177 154
178 return 0; 155 return 0;
179} 156}
157
180late_initcall(mpc834x_rtc_hookup); 158late_initcall(mpc834x_rtc_hookup);
181#endif 159#endif
182 160
183static void 161void __init platform_init(void)
184mpc83xx_restart(char *cmd)
185{
186#define RST_OFFSET 0x00000900
187#define RST_PROT_REG 0x00000018
188#define RST_CTRL_REG 0x0000001c
189 __be32 __iomem *reg;
190
191 // map reset register space
192 reg = ioremap(get_immrbase() + 0x900, 0xff);
193
194 local_irq_disable();
195
196 /* enable software reset "RSTE" */
197 out_be32(reg + (RST_PROT_REG >> 2), 0x52535445);
198
199 /* set software hard reset */
200 out_be32(reg + (RST_CTRL_REG >> 2), 0x52535445);
201 for(;;);
202}
203
204static long __init
205mpc83xx_time_init(void)
206{
207#define SPCR_OFFSET 0x00000110
208#define SPCR_TBEN 0x00400000
209 __be32 __iomem *spcr = ioremap(get_immrbase() + SPCR_OFFSET, 4);
210 __be32 tmp;
211
212 tmp = in_be32(spcr);
213 out_be32(spcr, tmp|SPCR_TBEN);
214
215 iounmap(spcr);
216
217 return 0;
218}
219void __init
220platform_init(void)
221{ 162{
222 /* setup the PowerPC module struct */ 163 /* setup the PowerPC module struct */
223 ppc_md.setup_arch = mpc834x_sys_setup_arch; 164 ppc_md.setup_arch = mpc834x_sys_setup_arch;
@@ -239,5 +180,3 @@ platform_init(void)
239 180
240 return; 181 return;
241} 182}
242
243
diff --git a/arch/powerpc/platforms/83xx/mpc834x_sys.h b/arch/powerpc/platforms/83xx/mpc834x_sys.h
index e4ca39f6a862..fedecb73f7ff 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_sys.h
+++ b/arch/powerpc/platforms/83xx/mpc834x_sys.h
@@ -20,4 +20,4 @@
20#define PIRQC MPC83xx_IRQ_EXT6 20#define PIRQC MPC83xx_IRQ_EXT6
21#define PIRQD MPC83xx_IRQ_EXT7 21#define PIRQD MPC83xx_IRQ_EXT7
22 22
23#endif /* __MACH_MPC83XX_SYS_H__ */ 23#endif /* __MACH_MPC83XX_SYS_H__ */
diff --git a/arch/powerpc/platforms/83xx/mpc83xx.h b/arch/powerpc/platforms/83xx/mpc83xx.h
index ce9e66abef24..01cae106912b 100644
--- a/arch/powerpc/platforms/83xx/mpc83xx.h
+++ b/arch/powerpc/platforms/83xx/mpc83xx.h
@@ -10,5 +10,8 @@
10 */ 10 */
11 11
12extern int add_bridge(struct device_node *dev); 12extern int add_bridge(struct device_node *dev);
13extern int mpc83xx_exclude_device(u_char bus, u_char devfn);
14extern void mpc83xx_restart(char *cmd);
15extern long mpc83xx_time_init(void);
13 16
14#endif /* __MPC83XX_H__ */ 17#endif /* __MPC83XX_H__ */
diff --git a/arch/powerpc/platforms/83xx/pci.c b/arch/powerpc/platforms/83xx/pci.c
index 469cdacc5bd4..16f7d3b30e1d 100644
--- a/arch/powerpc/platforms/83xx/pci.c
+++ b/arch/powerpc/platforms/83xx/pci.c
@@ -36,7 +36,16 @@
36 36
37int mpc83xx_pci2_busno; 37int mpc83xx_pci2_busno;
38 38
39#ifdef CONFIG_PCI 39int mpc83xx_exclude_device(u_char bus, u_char devfn)
40{
41 if (bus == 0 && PCI_SLOT(devfn) == 0)
42 return PCIBIOS_DEVICE_NOT_FOUND;
43 if (mpc83xx_pci2_busno)
44 if (bus == (mpc83xx_pci2_busno) && PCI_SLOT(devfn) == 0)
45 return PCIBIOS_DEVICE_NOT_FOUND;
46 return PCIBIOS_SUCCESSFUL;
47}
48
40int __init add_bridge(struct device_node *dev) 49int __init add_bridge(struct device_node *dev)
41{ 50{
42 int len; 51 int len;
@@ -52,7 +61,7 @@ int __init add_bridge(struct device_node *dev)
52 has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); 61 has_address = (of_address_to_resource(dev, 0, &rsrc) == 0);
53 62
54 /* Get bus range if any */ 63 /* Get bus range if any */
55 bus_range = (int *) get_property(dev, "bus-range", &len); 64 bus_range = (int *)get_property(dev, "bus-range", &len);
56 if (bus_range == NULL || len < 2 * sizeof(int)) { 65 if (bus_range == NULL || len < 2 * sizeof(int)) {
57 printk(KERN_WARNING "Can't get bus-range for %s, assume" 66 printk(KERN_WARNING "Can't get bus-range for %s, assume"
58 " bus 0\n", dev->full_name); 67 " bus 0\n", dev->full_name);
@@ -74,7 +83,7 @@ int __init add_bridge(struct device_node *dev)
74 if ((rsrc.start & 0xfffff) == 0x8500) { 83 if ((rsrc.start & 0xfffff) == 0x8500) {
75 setup_indirect_pci(hose, immr + 0x8300, immr + 0x8304); 84 setup_indirect_pci(hose, immr + 0x8300, immr + 0x8304);
76 } 85 }
77 /* PCI 2*/ 86 /* PCI 2 */
78 if ((rsrc.start & 0xfffff) == 0x8600) { 87 if ((rsrc.start & 0xfffff) == 0x8600) {
79 setup_indirect_pci(hose, immr + 0x8380, immr + 0x8384); 88 setup_indirect_pci(hose, immr + 0x8380, immr + 0x8384);
80 primary = 0; 89 primary = 0;
@@ -84,10 +93,10 @@ int __init add_bridge(struct device_node *dev)
84 93
85 printk(KERN_INFO "Found MPC83xx PCI host bridge at 0x%08lx. " 94 printk(KERN_INFO "Found MPC83xx PCI host bridge at 0x%08lx. "
86 "Firmware bus number: %d->%d\n", 95 "Firmware bus number: %d->%d\n",
87 rsrc.start, hose->first_busno, hose->last_busno); 96 rsrc.start, hose->first_busno, hose->last_busno);
88 97
89 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",
90 hose, hose->cfg_addr, hose->cfg_data); 99 hose, hose->cfg_addr, hose->cfg_data);
91 100
92 /* Interpret the "ranges" property */ 101 /* Interpret the "ranges" property */
93 /* This also maps the I/O region and sets isa_io/mem_base */ 102 /* This also maps the I/O region and sets isa_io/mem_base */
@@ -95,5 +104,3 @@ int __init add_bridge(struct device_node *dev)
95 104
96 return 0; 105 return 0;
97} 106}
98
99#endif
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index c5bc2821d991..d3d0ff745e84 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -1,86 +1,30 @@
1config 85xx 1menu "Platform support"
2 bool 2 depends on PPC_85xx
3 depends on E500
4 default y
5
6config PPC_INDIRECT_PCI_BE
7 bool
8 depends on 85xx
9 default y
10
11menu "Freescale 85xx options"
12 depends on E500
13 3
14choice 4choice
15 prompt "Machine Type" 5 prompt "Machine Type"
16 depends on 85xx
17 default MPC8540_ADS 6 default MPC8540_ADS
18 7
19config MPC8540_ADS 8config MPC8540_ADS
20 bool "Freescale MPC8540 ADS" 9 bool "Freescale MPC8540 ADS"
21 help 10 help
22 This option enables support for the MPC 8540 ADS evaluation board. 11 This option enables support for the MPC 8540 ADS board
23
24config MPC8548_CDS
25 bool "Freescale MPC8548 CDS"
26 help
27 This option enablese support for the MPC8548 CDS evaluation board.
28
29config MPC8555_CDS
30 bool "Freescale MPC8555 CDS"
31 help
32 This option enablese support for the MPC8555 CDS evaluation board.
33
34config MPC8560_ADS
35 bool "Freescale MPC8560 ADS"
36 help
37 This option enables support for the MPC 8560 ADS evaluation board.
38
39config SBC8560
40 bool "WindRiver PowerQUICC III SBC8560"
41 help
42 This option enables support for the WindRiver PowerQUICC III
43 SBC8560 board.
44
45config STX_GP3
46 bool "Silicon Turnkey Express GP3"
47 help
48 This option enables support for the Silicon Turnkey Express GP3
49 board.
50 12
51endchoice 13endchoice
52 14
53# It's often necessary to know the specific 85xx processor type.
54# Fortunately, it is implied (so far) from the board type, so we
55# don't need to ask more redundant questions.
56config MPC8540 15config MPC8540
57 bool 16 bool
58 depends on MPC8540_ADS 17 select PPC_UDBG_16550
59 default y 18 select PPC_INDIRECT_PCI
60 19 default y if MPC8540_ADS
61config MPC8548
62 bool
63 depends on MPC8548_CDS
64 default y
65 20
66config MPC8555 21config PPC_INDIRECT_PCI_BE
67 bool
68 depends on MPC8555_CDS
69 default y
70
71config MPC8560
72 bool 22 bool
73 depends on SBC8560 || MPC8560_ADS || STX_GP3 23 depends on PPC_85xx
74 default y
75
76config 85xx_PCI2
77 bool "Supprt for 2nd PCI host controller"
78 depends on MPC8555_CDS
79 default y 24 default y
80 25
81config PPC_GEN550 26config MPIC
82 bool 27 bool
83 depends on MPC8540 || SBC8560 || MPC8555
84 default y 28 default y
85 29
86endmenu 30endmenu
diff --git a/arch/powerpc/platforms/85xx/Makefile b/arch/powerpc/platforms/85xx/Makefile
index 6407197ffd89..ffc4139cb214 100644
--- a/arch/powerpc/platforms/85xx/Makefile
+++ b/arch/powerpc/platforms/85xx/Makefile
@@ -1 +1,5 @@
1# empty makefile so make clean works 1#
2# Makefile for the PowerPC 85xx linux kernel.
3#
4obj-$(CONFIG_PPC_85xx) += misc.o pci.o
5obj-$(CONFIG_MPC8540_ADS) += mpc85xx_ads.o
diff --git a/arch/powerpc/platforms/85xx/misc.c b/arch/powerpc/platforms/85xx/misc.c
new file mode 100644
index 000000000000..26c5e822c7c8
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/misc.c
@@ -0,0 +1,31 @@
1/*
2 * MPC85xx generic code.
3 *
4 * Maintained by Kumar Gala (see MAINTAINERS for contact information)
5 *
6 * Copyright 2005 Freescale Semiconductor Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13#include <linux/irq.h>
14#include <linux/module.h>
15#include <asm/irq.h>
16
17extern void abort(void);
18
19void mpc85xx_restart(char *cmd)
20{
21 local_irq_disable();
22 abort();
23}
24
25/* For now this is a pass through */
26phys_addr_t fixup_bigphys_addr(phys_addr_t addr, phys_addr_t size)
27{
28 return addr;
29};
30
31EXPORT_SYMBOL(fixup_bigphys_addr);
diff --git a/arch/powerpc/platforms/85xx/mpc8540_ads.h b/arch/powerpc/platforms/85xx/mpc8540_ads.h
new file mode 100644
index 000000000000..f770cadb2080
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/mpc8540_ads.h
@@ -0,0 +1,36 @@
1/*
2 * arch/ppc/platforms/85xx/mpc8540_ads.h
3 *
4 * MPC8540ADS board definitions
5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com>
7 *
8 * Copyright 2004 Freescale Semiconductor Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 */
16
17#ifndef __MACH_MPC8540ADS_H__
18#define __MACH_MPC8540ADS_H__
19
20#include <linux/config.h>
21#include <linux/initrd.h>
22
23#define BOARD_CCSRBAR ((uint)0xe0000000)
24#define BCSR_ADDR ((uint)0xf8000000)
25#define BCSR_SIZE ((uint)(32 * 1024))
26
27/* PCI interrupt controller */
28#define PIRQA MPC85xx_IRQ_EXT1
29#define PIRQB MPC85xx_IRQ_EXT2
30#define PIRQC MPC85xx_IRQ_EXT3
31#define PIRQD MPC85xx_IRQ_EXT4
32
33/* Offset of CPM register space */
34#define CPM_MAP_ADDR (CCSRBAR + MPC85xx_CPM_OFFSET)
35
36#endif /* __MACH_MPC8540ADS_H__ */
diff --git a/arch/powerpc/platforms/85xx/mpc85xx.h b/arch/powerpc/platforms/85xx/mpc85xx.h
new file mode 100644
index 000000000000..b44db6268f3d
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/mpc85xx.h
@@ -0,0 +1,18 @@
1/*
2 * arch/ppc/platforms/85xx/mpc85xx.h
3 *
4 * MPC85xx soc definitions/function decls
5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com>
7 *
8 * Copyright 2005 Freescale Semiconductor Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 */
16
17extern void mpc85xx_restart(char *);
18extern int add_bridge(struct device_node *dev);
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ads.c b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
new file mode 100644
index 000000000000..b7821dbae00d
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
@@ -0,0 +1,244 @@
1/*
2 * MPC85xx setup and early boot code plus other random bits.
3 *
4 * Maintained by Kumar Gala (see MAINTAINERS for contact information)
5 *
6 * Copyright 2005 Freescale Semiconductor Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#include <linux/config.h>
15#include <linux/stddef.h>
16#include <linux/kernel.h>
17#include <linux/pci.h>
18#include <linux/kdev_t.h>
19#include <linux/delay.h>
20#include <linux/seq_file.h>
21#include <linux/root_dev.h>
22
23#include <asm/system.h>
24#include <asm/time.h>
25#include <asm/machdep.h>
26#include <asm/pci-bridge.h>
27#include <asm/mpc85xx.h>
28#include <asm/prom.h>
29#include <asm/mpic.h>
30#include <mm/mmu_decl.h>
31#include <asm/udbg.h>
32
33#include <sysdev/fsl_soc.h>
34#include "mpc85xx.h"
35
36#ifndef CONFIG_PCI
37unsigned long isa_io_base = 0;
38unsigned long isa_mem_base = 0;
39#endif
40
41/*
42 * Internal interrupts are all Level Sensitive, and Positive Polarity
43 *
44 * Note: Likely, this table and the following function should be
45 * obtained and derived from the OF Device Tree.
46 */
47static u_char mpc85xx_ads_openpic_initsenses[] __initdata = {
48 MPC85XX_INTERNAL_IRQ_SENSES,
49 0x0, /* External 0: */
50#if defined(CONFIG_PCI)
51 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext 1: PCI slot 0 */
52 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext 2: PCI slot 1 */
53 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext 3: PCI slot 2 */
54 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext 4: PCI slot 3 */
55#else
56 0x0, /* External 1: */
57 0x0, /* External 2: */
58 0x0, /* External 3: */
59 0x0, /* External 4: */
60#endif
61 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 5: PHY */
62 0x0, /* External 6: */
63 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 7: PHY */
64 0x0, /* External 8: */
65 0x0, /* External 9: */
66 0x0, /* External 10: */
67 0x0, /* External 11: */
68};
69
70#ifdef CONFIG_PCI
71/*
72 * interrupt routing
73 */
74
75int
76mpc85xx_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
77{
78 static char pci_irq_table[][4] =
79 /*
80 * This is little evil, but works around the fact
81 * that revA boards have IDSEL starting at 18
82 * and others boards (older) start at 12
83 *
84 * PCI IDSEL/INTPIN->INTLINE
85 * A B C D
86 */
87 {
88 {PIRQA, PIRQB, PIRQC, PIRQD}, /* IDSEL 2 */
89 {PIRQD, PIRQA, PIRQB, PIRQC},
90 {PIRQC, PIRQD, PIRQA, PIRQB},
91 {PIRQB, PIRQC, PIRQD, PIRQA}, /* IDSEL 5 */
92 {0, 0, 0, 0}, /* -- */
93 {0, 0, 0, 0}, /* -- */
94 {0, 0, 0, 0}, /* -- */
95 {0, 0, 0, 0}, /* -- */
96 {0, 0, 0, 0}, /* -- */
97 {0, 0, 0, 0}, /* -- */
98 {PIRQA, PIRQB, PIRQC, PIRQD}, /* IDSEL 12 */
99 {PIRQD, PIRQA, PIRQB, PIRQC},
100 {PIRQC, PIRQD, PIRQA, PIRQB},
101 {PIRQB, PIRQC, PIRQD, PIRQA}, /* IDSEL 15 */
102 {0, 0, 0, 0}, /* -- */
103 {0, 0, 0, 0}, /* -- */
104 {PIRQA, PIRQB, PIRQC, PIRQD}, /* IDSEL 18 */
105 {PIRQD, PIRQA, PIRQB, PIRQC},
106 {PIRQC, PIRQD, PIRQA, PIRQB},
107 {PIRQB, PIRQC, PIRQD, PIRQA}, /* IDSEL 21 */
108 };
109
110 const long min_idsel = 2, max_idsel = 21, irqs_per_slot = 4;
111 return PCI_IRQ_TABLE_LOOKUP;
112}
113
114int
115mpc85xx_exclude_device(u_char bus, u_char devfn)
116{
117 if (bus == 0 && PCI_SLOT(devfn) == 0)
118 return PCIBIOS_DEVICE_NOT_FOUND;
119 else
120 return PCIBIOS_SUCCESSFUL;
121}
122
123#endif /* CONFIG_PCI */
124
125
126void __init mpc85xx_ads_pic_init(void)
127{
128 struct mpic *mpic1;
129 phys_addr_t OpenPIC_PAddr;
130
131 /* Determine the Physical Address of the OpenPIC regs */
132 OpenPIC_PAddr = get_immrbase() + MPC85xx_OPENPIC_OFFSET;
133
134 mpic1 = mpic_alloc(OpenPIC_PAddr,
135 MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
136 4, MPC85xx_OPENPIC_IRQ_OFFSET, 0, 250,
137 mpc85xx_ads_openpic_initsenses,
138 sizeof(mpc85xx_ads_openpic_initsenses),
139 " OpenPIC ");
140 BUG_ON(mpic1 == NULL);
141 mpic_assign_isu(mpic1, 0, OpenPIC_PAddr + 0x10200);
142 mpic_assign_isu(mpic1, 1, OpenPIC_PAddr + 0x10280);
143 mpic_assign_isu(mpic1, 2, OpenPIC_PAddr + 0x10300);
144 mpic_assign_isu(mpic1, 3, OpenPIC_PAddr + 0x10380);
145 mpic_assign_isu(mpic1, 4, OpenPIC_PAddr + 0x10400);
146 mpic_assign_isu(mpic1, 5, OpenPIC_PAddr + 0x10480);
147 mpic_assign_isu(mpic1, 6, OpenPIC_PAddr + 0x10500);
148 mpic_assign_isu(mpic1, 7, OpenPIC_PAddr + 0x10580);
149
150 /* dummy mappings to get to 48 */
151 mpic_assign_isu(mpic1, 8, OpenPIC_PAddr + 0x10600);
152 mpic_assign_isu(mpic1, 9, OpenPIC_PAddr + 0x10680);
153 mpic_assign_isu(mpic1, 10, OpenPIC_PAddr + 0x10700);
154 mpic_assign_isu(mpic1, 11, OpenPIC_PAddr + 0x10780);
155
156 /* External ints */
157 mpic_assign_isu(mpic1, 12, OpenPIC_PAddr + 0x10000);
158 mpic_assign_isu(mpic1, 13, OpenPIC_PAddr + 0x10080);
159 mpic_assign_isu(mpic1, 14, OpenPIC_PAddr + 0x10100);
160 mpic_init(mpic1);
161}
162
163/*
164 * Setup the architecture
165 */
166static void __init mpc85xx_ads_setup_arch(void)
167{
168 struct device_node *cpu;
169 struct device_node *np;
170
171 if (ppc_md.progress)
172 ppc_md.progress("mpc85xx_ads_setup_arch()", 0);
173
174 cpu = of_find_node_by_type(NULL, "cpu");
175 if (cpu != 0) {
176 unsigned int *fp;
177
178 fp = (int *)get_property(cpu, "clock-frequency", NULL);
179 if (fp != 0)
180 loops_per_jiffy = *fp / HZ;
181 else
182 loops_per_jiffy = 50000000 / HZ;
183 of_node_put(cpu);
184 }
185
186#ifdef CONFIG_PCI
187 for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
188 add_bridge(np);
189
190 ppc_md.pci_swizzle = common_swizzle;
191 ppc_md.pci_map_irq = mpc85xx_map_irq;
192 ppc_md.pci_exclude_device = mpc85xx_exclude_device;
193#endif
194
195#ifdef CONFIG_ROOT_NFS
196 ROOT_DEV = Root_NFS;
197#else
198 ROOT_DEV = Root_HDA1;
199#endif
200}
201
202void mpc85xx_ads_show_cpuinfo(struct seq_file *m)
203{
204 uint pvid, svid, phid1;
205 uint memsize = total_memory;
206
207 pvid = mfspr(SPRN_PVR);
208 svid = mfspr(SPRN_SVR);
209
210 seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n");
211 seq_printf(m, "Machine\t\t: mpc85xx\n");
212 seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
213 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
214
215 /* Display cpu Pll setting */
216 phid1 = mfspr(SPRN_HID1);
217 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
218
219 /* Display the amount of memory */
220 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
221}
222
223void __init platform_init(void)
224{
225 ppc_md.setup_arch = mpc85xx_ads_setup_arch;
226 ppc_md.show_cpuinfo = mpc85xx_ads_show_cpuinfo;
227
228 ppc_md.init_IRQ = mpc85xx_ads_pic_init;
229 ppc_md.get_irq = mpic_get_irq;
230
231 ppc_md.restart = mpc85xx_restart;
232 ppc_md.power_off = NULL;
233 ppc_md.halt = NULL;
234
235 ppc_md.time_init = NULL;
236 ppc_md.set_rtc_time = NULL;
237 ppc_md.get_rtc_time = NULL;
238 ppc_md.calibrate_decr = generic_calibrate_decr;
239
240 ppc_md.progress = udbg_progress;
241
242 if (ppc_md.progress)
243 ppc_md.progress("mpc85xx_ads platform_init(): exit", 0);
244}
diff --git a/arch/powerpc/platforms/85xx/pci.c b/arch/powerpc/platforms/85xx/pci.c
new file mode 100644
index 000000000000..bad290110ed1
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/pci.c
@@ -0,0 +1,96 @@
1/*
2 * FSL SoC setup code
3 *
4 * Maintained by Kumar Gala (see MAINTAINERS for contact information)
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#include <linux/config.h>
13#include <linux/stddef.h>
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/errno.h>
17#include <linux/pci.h>
18#include <linux/delay.h>
19#include <linux/irq.h>
20#include <linux/module.h>
21
22#include <asm/system.h>
23#include <asm/atomic.h>
24#include <asm/io.h>
25#include <asm/pci-bridge.h>
26#include <asm/prom.h>
27#include <sysdev/fsl_soc.h>
28
29#undef DEBUG
30
31#ifdef DEBUG
32#define DBG(x...) printk(x)
33#else
34#define DBG(x...)
35#endif
36
37int mpc85xx_pci2_busno = 0;
38
39#ifdef CONFIG_PCI
40int __init add_bridge(struct device_node *dev)
41{
42 int len;
43 struct pci_controller *hose;
44 struct resource rsrc;
45 int *bus_range;
46 int primary = 1, has_address = 0;
47 phys_addr_t immr = get_immrbase();
48
49 DBG("Adding PCI host bridge %s\n", dev->full_name);
50
51 /* Fetch host bridge registers address */
52 has_address = (of_address_to_resource(dev, 0, &rsrc) == 0);
53
54 /* Get bus range if any */
55 bus_range = (int *) get_property(dev, "bus-range", &len);
56 if (bus_range == NULL || len < 2 * sizeof(int)) {
57 printk(KERN_WARNING "Can't get bus-range for %s, assume"
58 " bus 0\n", dev->full_name);
59 }
60
61 hose = pcibios_alloc_controller();
62 if (!hose)
63 return -ENOMEM;
64 hose->arch_data = dev;
65 hose->set_cfg_type = 1;
66
67 hose->first_busno = bus_range ? bus_range[0] : 0;
68 hose->last_busno = bus_range ? bus_range[1] : 0xff;
69
70 /* PCI 1 */
71 if ((rsrc.start & 0xfffff) == 0x8000) {
72 setup_indirect_pci(hose, immr + 0x8000, immr + 0x8004);
73 }
74 /* PCI 2 */
75 if ((rsrc.start & 0xfffff) == 0x9000) {
76 setup_indirect_pci(hose, immr + 0x9000, immr + 0x9004);
77 primary = 0;
78 hose->bus_offset = hose->first_busno;
79 mpc85xx_pci2_busno = hose->first_busno;
80 }
81
82 printk(KERN_INFO "Found MPC85xx PCI host bridge at 0x%08lx. "
83 "Firmware bus number: %d->%d\n",
84 rsrc.start, hose->first_busno, hose->last_busno);
85
86 DBG(" ->Hose at 0x%p, cfg_addr=0x%p,cfg_data=0x%p\n",
87 hose, hose->cfg_addr, hose->cfg_data);
88
89 /* Interpret the "ranges" property */
90 /* This also maps the I/O region and sets isa_io/mem_base */
91 pci_process_bridge_OF_ranges(hose, dev, primary);
92
93 return 0;
94}
95
96#endif
diff --git a/arch/powerpc/platforms/Makefile b/arch/powerpc/platforms/Makefile
index 04073fd987ec..c4f6b0d2d140 100644
--- a/arch/powerpc/platforms/Makefile
+++ b/arch/powerpc/platforms/Makefile
@@ -8,7 +8,7 @@ endif
8obj-$(CONFIG_PPC_CHRP) += chrp/ 8obj-$(CONFIG_PPC_CHRP) += chrp/
9obj-$(CONFIG_4xx) += 4xx/ 9obj-$(CONFIG_4xx) += 4xx/
10obj-$(CONFIG_PPC_83xx) += 83xx/ 10obj-$(CONFIG_PPC_83xx) += 83xx/
11obj-$(CONFIG_85xx) += 85xx/ 11obj-$(CONFIG_PPC_85xx) += 85xx/
12obj-$(CONFIG_PPC_PSERIES) += pseries/ 12obj-$(CONFIG_PPC_PSERIES) += pseries/
13obj-$(CONFIG_PPC_ISERIES) += iseries/ 13obj-$(CONFIG_PPC_ISERIES) += iseries/
14obj-$(CONFIG_PPC_MAPLE) += maple/ 14obj-$(CONFIG_PPC_MAPLE) += maple/
diff --git a/arch/powerpc/platforms/chrp/pegasos_eth.c b/arch/powerpc/platforms/chrp/pegasos_eth.c
index 29c86781c493..6ad4b1a72c96 100644
--- a/arch/powerpc/platforms/chrp/pegasos_eth.c
+++ b/arch/powerpc/platforms/chrp/pegasos_eth.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/ppc/platforms/chrp_pegasos_eth.c
3 *
4 * Copyright (C) 2005 Sven Luther <sl@bplan-gmbh.de> 2 * Copyright (C) 2005 Sven Luther <sl@bplan-gmbh.de>
5 * Thanks to : 3 * Thanks to :
6 * Dale Farnsworth <dale@farnsworth.org> 4 * Dale Farnsworth <dale@farnsworth.org>
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index e1fadbf49150..8bf4307e323d 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/ppc/platforms/setup.c
3 *
4 * Copyright (C) 1995 Linus Torvalds 2 * Copyright (C) 1995 Linus Torvalds
5 * Adapted from 'alpha' version by Gary Thomas 3 * Adapted from 'alpha' version by Gary Thomas
6 * Modified by Cort Dougan (cort@cs.nmt.edu) 4 * Modified by Cort Dougan (cort@cs.nmt.edu)
diff --git a/arch/powerpc/platforms/chrp/time.c b/arch/powerpc/platforms/chrp/time.c
index 78df2e7ca88a..12c6f689b1aa 100644
--- a/arch/powerpc/platforms/chrp/time.c
+++ b/arch/powerpc/platforms/chrp/time.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/ppc/platforms/chrp_time.c
3 *
4 * Copyright (C) 1991, 1992, 1995 Linus Torvalds 2 * Copyright (C) 1991, 1992, 1995 Linus Torvalds
5 * 3 *
6 * Adapted for PowerPC (PReP) by Gary Thomas 4 * Adapted for PowerPC (PReP) by Gary Thomas
diff --git a/arch/powerpc/platforms/iseries/mf.c b/arch/powerpc/platforms/iseries/mf.c
index a41d8b78c0cd..d771b8ee857d 100644
--- a/arch/powerpc/platforms/iseries/mf.c
+++ b/arch/powerpc/platforms/iseries/mf.c
@@ -46,6 +46,7 @@
46#include "setup.h" 46#include "setup.h"
47 47
48extern int piranha_simulator; 48extern int piranha_simulator;
49static int mf_initialized;
49 50
50/* 51/*
51 * This is the structure layout for the Machine Facilites LPAR event 52 * This is the structure layout for the Machine Facilites LPAR event
@@ -143,7 +144,8 @@ static spinlock_t pending_event_spinlock;
143static struct pending_event *pending_event_head; 144static struct pending_event *pending_event_head;
144static struct pending_event *pending_event_tail; 145static struct pending_event *pending_event_tail;
145static struct pending_event *pending_event_avail; 146static struct pending_event *pending_event_avail;
146static struct pending_event pending_event_prealloc[16]; 147#define PENDING_EVENT_PREALLOC_LEN 16
148static struct pending_event pending_event_prealloc[PENDING_EVENT_PREALLOC_LEN];
147 149
148/* 150/*
149 * Put a pending event onto the available queue, so it can get reused. 151 * Put a pending event onto the available queue, so it can get reused.
@@ -597,7 +599,7 @@ void mf_power_off(void)
597 * Global kernel interface to tell the VSP object in the primary 599 * Global kernel interface to tell the VSP object in the primary
598 * partition to reboot this partition. 600 * partition to reboot this partition.
599 */ 601 */
600void mf_reboot(void) 602void mf_reboot(char *cmd)
601{ 603{
602 printk(KERN_INFO "mf.c: Preparing to bounce...\n"); 604 printk(KERN_INFO "mf.c: Preparing to bounce...\n");
603 signal_ce_msg_simple(0x4e, NULL); 605 signal_ce_msg_simple(0x4e, NULL);
@@ -625,7 +627,7 @@ void mf_display_src(u32 word)
625/* 627/*
626 * Display a single word SRC of the form "PROGXXXX" on the VSP control panel. 628 * Display a single word SRC of the form "PROGXXXX" on the VSP control panel.
627 */ 629 */
628void mf_display_progress(u16 value) 630static __init void mf_display_progress_src(u16 value)
629{ 631{
630 u8 ce[12]; 632 u8 ce[12];
631 u8 src[72]; 633 u8 src[72];
@@ -649,30 +651,42 @@ void mf_display_progress(u16 value)
649 * Clear the VSP control panel. Used to "erase" an SRC that was 651 * Clear the VSP control panel. Used to "erase" an SRC that was
650 * previously displayed. 652 * previously displayed.
651 */ 653 */
652void mf_clear_src(void) 654static void mf_clear_src(void)
653{ 655{
654 signal_ce_msg_simple(0x4b, NULL); 656 signal_ce_msg_simple(0x4b, NULL);
655} 657}
656 658
659void __init mf_display_progress(u16 value)
660{
661 if (piranha_simulator || !mf_initialized)
662 return;
663
664 if (0xFFFF == value)
665 mf_clear_src();
666 else
667 mf_display_progress_src(value);
668}
669
657/* 670/*
658 * Initialization code here. 671 * Initialization code here.
659 */ 672 */
660void mf_init(void) 673void __init mf_init(void)
661{ 674{
662 int i; 675 int i;
663 676
664 /* initialize */
665 spin_lock_init(&pending_event_spinlock); 677 spin_lock_init(&pending_event_spinlock);
666 for (i = 0; 678
667 i < sizeof(pending_event_prealloc) / sizeof(*pending_event_prealloc); 679 for (i = 0; i < PENDING_EVENT_PREALLOC_LEN; i++)
668 ++i)
669 free_pending_event(&pending_event_prealloc[i]); 680 free_pending_event(&pending_event_prealloc[i]);
681
670 HvLpEvent_registerHandler(HvLpEvent_Type_MachineFac, &hv_handler); 682 HvLpEvent_registerHandler(HvLpEvent_Type_MachineFac, &hv_handler);
671 683
672 /* virtual continue ack */ 684 /* virtual continue ack */
673 signal_ce_msg_simple(0x57, NULL); 685 signal_ce_msg_simple(0x57, NULL);
674 686
675 /* initialization complete */ 687 mf_initialized = 1;
688 mb();
689
676 printk(KERN_NOTICE "mf.c: iSeries Linux LPAR Machine Facilities " 690 printk(KERN_NOTICE "mf.c: iSeries Linux LPAR Machine Facilities "
677 "initialized\n"); 691 "initialized\n");
678} 692}
@@ -692,6 +706,43 @@ static void get_rtc_time_complete(void *token, struct ce_msg_data *ce_msg)
692 complete(&rtc->com); 706 complete(&rtc->com);
693} 707}
694 708
709static int mf_set_rtc(struct rtc_time *tm)
710{
711 char ce_time[12];
712 u8 day, mon, hour, min, sec, y1, y2;
713 unsigned year;
714
715 year = 1900 + tm->tm_year;
716 y1 = year / 100;
717 y2 = year % 100;
718
719 sec = tm->tm_sec;
720 min = tm->tm_min;
721 hour = tm->tm_hour;
722 day = tm->tm_mday;
723 mon = tm->tm_mon + 1;
724
725 BIN_TO_BCD(sec);
726 BIN_TO_BCD(min);
727 BIN_TO_BCD(hour);
728 BIN_TO_BCD(mon);
729 BIN_TO_BCD(day);
730 BIN_TO_BCD(y1);
731 BIN_TO_BCD(y2);
732
733 memset(ce_time, 0, sizeof(ce_time));
734 ce_time[3] = 0x41;
735 ce_time[4] = y1;
736 ce_time[5] = y2;
737 ce_time[6] = sec;
738 ce_time[7] = min;
739 ce_time[8] = hour;
740 ce_time[10] = day;
741 ce_time[11] = mon;
742
743 return signal_ce_msg(ce_time, NULL);
744}
745
695static int rtc_set_tm(int rc, u8 *ce_msg, struct rtc_time *tm) 746static int rtc_set_tm(int rc, u8 *ce_msg, struct rtc_time *tm)
696{ 747{
697 tm->tm_wday = 0; 748 tm->tm_wday = 0;
@@ -747,7 +798,7 @@ static int rtc_set_tm(int rc, u8 *ce_msg, struct rtc_time *tm)
747 return 0; 798 return 0;
748} 799}
749 800
750int mf_get_rtc(struct rtc_time *tm) 801static int mf_get_rtc(struct rtc_time *tm)
751{ 802{
752 struct ce_msg_comp_data ce_complete; 803 struct ce_msg_comp_data ce_complete;
753 struct rtc_time_data rtc_data; 804 struct rtc_time_data rtc_data;
@@ -780,7 +831,7 @@ static void get_boot_rtc_time_complete(void *token, struct ce_msg_data *ce_msg)
780 rtc->busy = 0; 831 rtc->busy = 0;
781} 832}
782 833
783int mf_get_boot_rtc(struct rtc_time *tm) 834static int mf_get_boot_rtc(struct rtc_time *tm)
784{ 835{
785 struct ce_msg_comp_data ce_complete; 836 struct ce_msg_comp_data ce_complete;
786 struct boot_rtc_time_data rtc_data; 837 struct boot_rtc_time_data rtc_data;
@@ -802,43 +853,6 @@ int mf_get_boot_rtc(struct rtc_time *tm)
802 return rtc_set_tm(rtc_data.rc, rtc_data.ce_msg.ce_msg, tm); 853 return rtc_set_tm(rtc_data.rc, rtc_data.ce_msg.ce_msg, tm);
803} 854}
804 855
805int mf_set_rtc(struct rtc_time *tm)
806{
807 char ce_time[12];
808 u8 day, mon, hour, min, sec, y1, y2;
809 unsigned year;
810
811 year = 1900 + tm->tm_year;
812 y1 = year / 100;
813 y2 = year % 100;
814
815 sec = tm->tm_sec;
816 min = tm->tm_min;
817 hour = tm->tm_hour;
818 day = tm->tm_mday;
819 mon = tm->tm_mon + 1;
820
821 BIN_TO_BCD(sec);
822 BIN_TO_BCD(min);
823 BIN_TO_BCD(hour);
824 BIN_TO_BCD(mon);
825 BIN_TO_BCD(day);
826 BIN_TO_BCD(y1);
827 BIN_TO_BCD(y2);
828
829 memset(ce_time, 0, sizeof(ce_time));
830 ce_time[3] = 0x41;
831 ce_time[4] = y1;
832 ce_time[5] = y2;
833 ce_time[6] = sec;
834 ce_time[7] = min;
835 ce_time[8] = hour;
836 ce_time[10] = day;
837 ce_time[11] = mon;
838
839 return signal_ce_msg(ce_time, NULL);
840}
841
842#ifdef CONFIG_PROC_FS 856#ifdef CONFIG_PROC_FS
843 857
844static int proc_mf_dump_cmdline(char *page, char **start, off_t off, 858static int proc_mf_dump_cmdline(char *page, char **start, off_t off,
diff --git a/arch/powerpc/platforms/iseries/setup.c b/arch/powerpc/platforms/iseries/setup.c
index 3ecc4a652d82..fa4550611c11 100644
--- a/arch/powerpc/platforms/iseries/setup.c
+++ b/arch/powerpc/platforms/iseries/setup.c
@@ -50,6 +50,7 @@
50#include <asm/iseries/hv_call_xm.h> 50#include <asm/iseries/hv_call_xm.h>
51#include <asm/iseries/it_lp_queue.h> 51#include <asm/iseries/it_lp_queue.h>
52#include <asm/iseries/mf.h> 52#include <asm/iseries/mf.h>
53#include <asm/iseries/it_exp_vpd_panel.h>
53#include <asm/iseries/hv_lp_event.h> 54#include <asm/iseries/hv_lp_event.h>
54#include <asm/iseries/lpar_map.h> 55#include <asm/iseries/lpar_map.h>
55#include <asm/udbg.h> 56#include <asm/udbg.h>
@@ -89,8 +90,6 @@ extern unsigned long embedded_sysmap_end;
89extern unsigned long iSeries_recal_tb; 90extern unsigned long iSeries_recal_tb;
90extern unsigned long iSeries_recal_titan; 91extern unsigned long iSeries_recal_titan;
91 92
92static int mf_initialized;
93
94static unsigned long cmd_mem_limit; 93static unsigned long cmd_mem_limit;
95 94
96struct MemoryBlock { 95struct MemoryBlock {
@@ -303,8 +302,6 @@ static void __init iSeries_init_early(void)
303{ 302{
304 DBG(" -> iSeries_init_early()\n"); 303 DBG(" -> iSeries_init_early()\n");
305 304
306 ppc64_firmware_features = FW_FEATURE_ISERIES;
307
308 ppc64_interrupt_controller = IC_ISERIES; 305 ppc64_interrupt_controller = IC_ISERIES;
309 306
310#if defined(CONFIG_BLK_DEV_INITRD) 307#if defined(CONFIG_BLK_DEV_INITRD)
@@ -349,8 +346,6 @@ static void __init iSeries_init_early(void)
349 HvCallEvent_setLpEventQueueInterruptProc(0, 0); 346 HvCallEvent_setLpEventQueueInterruptProc(0, 0);
350 347
351 mf_init(); 348 mf_init();
352 mf_initialized = 1;
353 mb();
354 349
355 /* If we were passed an initrd, set the ROOT_DEV properly if the values 350 /* If we were passed an initrd, set the ROOT_DEV properly if the values
356 * look sensible. If not, clear initrd reference. 351 * look sensible. If not, clear initrd reference.
@@ -560,39 +555,10 @@ static void iSeries_show_cpuinfo(struct seq_file *m)
560 seq_printf(m, "machine\t\t: 64-bit iSeries Logical Partition\n"); 555 seq_printf(m, "machine\t\t: 64-bit iSeries Logical Partition\n");
561} 556}
562 557
563/*
564 * Document me.
565 */
566static void iSeries_restart(char *cmd)
567{
568 mf_reboot();
569}
570
571/*
572 * Document me.
573 */
574static void iSeries_power_off(void)
575{
576 mf_power_off();
577}
578
579/*
580 * Document me.
581 */
582static void iSeries_halt(void)
583{
584 mf_power_off();
585}
586
587static void __init iSeries_progress(char * st, unsigned short code) 558static void __init iSeries_progress(char * st, unsigned short code)
588{ 559{
589 printk("Progress: [%04x] - %s\n", (unsigned)code, st); 560 printk("Progress: [%04x] - %s\n", (unsigned)code, st);
590 if (!piranha_simulator && mf_initialized) { 561 mf_display_progress(code);
591 if (code != 0xffff)
592 mf_display_progress(code);
593 else
594 mf_clear_src();
595 }
596} 562}
597 563
598static void __init iSeries_fixup_klimit(void) 564static void __init iSeries_fixup_klimit(void)
@@ -711,7 +677,13 @@ void __init iSeries_init_IRQ(void) { }
711 677
712static int __init iseries_probe(int platform) 678static int __init iseries_probe(int platform)
713{ 679{
714 return PLATFORM_ISERIES_LPAR == platform; 680 if (PLATFORM_ISERIES_LPAR != platform)
681 return 0;
682
683 ppc64_firmware_features |= FW_FEATURE_ISERIES;
684 ppc64_firmware_features |= FW_FEATURE_LPAR;
685
686 return 1;
715} 687}
716 688
717struct machdep_calls __initdata iseries_md = { 689struct machdep_calls __initdata iseries_md = {
@@ -721,9 +693,9 @@ struct machdep_calls __initdata iseries_md = {
721 .get_irq = iSeries_get_irq, 693 .get_irq = iSeries_get_irq,
722 .init_early = iSeries_init_early, 694 .init_early = iSeries_init_early,
723 .pcibios_fixup = iSeries_pci_final_fixup, 695 .pcibios_fixup = iSeries_pci_final_fixup,
724 .restart = iSeries_restart, 696 .restart = mf_reboot,
725 .power_off = iSeries_power_off, 697 .power_off = mf_power_off,
726 .halt = iSeries_halt, 698 .halt = mf_power_off,
727 .get_boot_time = iSeries_get_boot_time, 699 .get_boot_time = iSeries_get_boot_time,
728 .set_rtc_time = iSeries_set_rtc_time, 700 .set_rtc_time = iSeries_set_rtc_time,
729 .get_rtc_time = iSeries_get_rtc_time, 701 .get_rtc_time = iSeries_get_rtc_time,
@@ -917,6 +889,24 @@ void dt_cpus(struct iseries_flat_dt *dt)
917 dt_end_node(dt); 889 dt_end_node(dt);
918} 890}
919 891
892void dt_model(struct iseries_flat_dt *dt)
893{
894 char buf[16] = "IBM,";
895
896 /* "IBM," + mfgId[2:3] + systemSerial[1:5] */
897 strne2a(buf + 4, xItExtVpdPanel.mfgID + 2, 2);
898 strne2a(buf + 6, xItExtVpdPanel.systemSerial + 1, 5);
899 buf[11] = '\0';
900 dt_prop_str(dt, "system-id", buf);
901
902 /* "IBM," + machineType[0:4] */
903 strne2a(buf + 4, xItExtVpdPanel.machineType, 4);
904 buf[8] = '\0';
905 dt_prop_str(dt, "model", buf);
906
907 dt_prop_str(dt, "compatible", "IBM,iSeries");
908}
909
920void build_flat_dt(struct iseries_flat_dt *dt, unsigned long phys_mem_size) 910void build_flat_dt(struct iseries_flat_dt *dt, unsigned long phys_mem_size)
921{ 911{
922 u64 tmp[2]; 912 u64 tmp[2];
@@ -927,6 +917,7 @@ void build_flat_dt(struct iseries_flat_dt *dt, unsigned long phys_mem_size)
927 917
928 dt_prop_u32(dt, "#address-cells", 2); 918 dt_prop_u32(dt, "#address-cells", 2);
929 dt_prop_u32(dt, "#size-cells", 2); 919 dt_prop_u32(dt, "#size-cells", 2);
920 dt_model(dt);
930 921
931 /* /memory */ 922 /* /memory */
932 dt_start_node(dt, "memory@0"); 923 dt_start_node(dt, "memory@0");
@@ -940,6 +931,7 @@ void build_flat_dt(struct iseries_flat_dt *dt, unsigned long phys_mem_size)
940 /* /chosen */ 931 /* /chosen */
941 dt_start_node(dt, "chosen"); 932 dt_start_node(dt, "chosen");
942 dt_prop_u32(dt, "linux,platform", PLATFORM_ISERIES_LPAR); 933 dt_prop_u32(dt, "linux,platform", PLATFORM_ISERIES_LPAR);
934 dt_prop_str(dt, "bootargs", cmd_line);
943 if (cmd_mem_limit) 935 if (cmd_mem_limit)
944 dt_prop_u64(dt, "linux,memory-limit", cmd_mem_limit); 936 dt_prop_u64(dt, "linux,memory-limit", cmd_mem_limit);
945 dt_end_node(dt); 937 dt_end_node(dt);
diff --git a/arch/powerpc/platforms/maple/time.c b/arch/powerpc/platforms/maple/time.c
index 50bc4eb85353..5e6981d17379 100644
--- a/arch/powerpc/platforms/maple/time.c
+++ b/arch/powerpc/platforms/maple/time.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/ppc64/kernel/maple_time.c
3 *
4 * (c) Copyright 2004 Benjamin Herrenschmidt (benh@kernel.crashing.org), 2 * (c) Copyright 2004 Benjamin Herrenschmidt (benh@kernel.crashing.org),
5 * IBM Corp. 3 * IBM Corp.
6 * 4 *
diff --git a/arch/powerpc/platforms/powermac/cpufreq_32.c b/arch/powerpc/platforms/powermac/cpufreq_32.c
index 56fd4e05fede..cfd6527a0d7e 100644
--- a/arch/powerpc/platforms/powermac/cpufreq_32.c
+++ b/arch/powerpc/platforms/powermac/cpufreq_32.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/ppc/platforms/pmac_cpufreq.c
3 *
4 * Copyright (C) 2002 - 2005 Benjamin Herrenschmidt <benh@kernel.crashing.org> 2 * Copyright (C) 2002 - 2005 Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 * Copyright (C) 2004 John Steele Scott <toojays@toojays.net> 3 * Copyright (C) 2004 John Steele Scott <toojays@toojays.net>
6 * 4 *
diff --git a/arch/powerpc/platforms/powermac/feature.c b/arch/powerpc/platforms/powermac/feature.c
index bbe794891a20..e49eddd5042d 100644
--- a/arch/powerpc/platforms/powermac/feature.c
+++ b/arch/powerpc/platforms/powermac/feature.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/ppc/platforms/pmac_feature.c
3 *
4 * Copyright (C) 1996-2001 Paul Mackerras (paulus@cs.anu.edu.au) 2 * Copyright (C) 1996-2001 Paul Mackerras (paulus@cs.anu.edu.au)
5 * Ben. Herrenschmidt (benh@kernel.crashing.org) 3 * Ben. Herrenschmidt (benh@kernel.crashing.org)
6 * 4 *
diff --git a/arch/powerpc/platforms/powermac/nvram.c b/arch/powerpc/platforms/powermac/nvram.c
index 3ebd045a3350..5fd28995c74c 100644
--- a/arch/powerpc/platforms/powermac/nvram.c
+++ b/arch/powerpc/platforms/powermac/nvram.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/ppc/platforms/pmac_nvram.c
3 *
4 * Copyright (C) 2002 Benjamin Herrenschmidt (benh@kernel.crashing.org) 2 * Copyright (C) 2002 Benjamin Herrenschmidt (benh@kernel.crashing.org)
5 * 3 *
6 * This program is free software; you can redistribute it and/or 4 * This program is free software; you can redistribute it and/or
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index 29c2946f1c77..385aab90c4d2 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -86,11 +86,10 @@ int ppc_override_l2cr = 0;
86int ppc_override_l2cr_value; 86int ppc_override_l2cr_value;
87int has_l2cache = 0; 87int has_l2cache = 0;
88 88
89int pmac_newworld = 1; 89int pmac_newworld;
90 90
91static int current_root_goodness = -1; 91static int current_root_goodness = -1;
92 92
93extern int pmac_newworld;
94extern struct machdep_calls pmac_md; 93extern struct machdep_calls pmac_md;
95 94
96#define DEFAULT_ROOT_DEVICE Root_SDA1 /* sda1 - slightly silly choice */ 95#define DEFAULT_ROOT_DEVICE Root_SDA1 /* sda1 - slightly silly choice */
@@ -308,9 +307,10 @@ static void __init pmac_setup_arch(void)
308 for (ic = NULL; (ic = of_find_all_nodes(ic)) != NULL; ) 307 for (ic = NULL; (ic = of_find_all_nodes(ic)) != NULL; )
309 if (get_property(ic, "interrupt-controller", NULL)) 308 if (get_property(ic, "interrupt-controller", NULL))
310 break; 309 break;
311 pmac_newworld = (ic != NULL); 310 if (ic) {
312 if (ic) 311 pmac_newworld = 1;
313 of_node_put(ic); 312 of_node_put(ic);
313 }
314 314
315 /* Lookup PCI hosts */ 315 /* Lookup PCI hosts */
316 pmac_pci_init(); 316 pmac_pci_init();
diff --git a/arch/powerpc/platforms/pseries/Makefile b/arch/powerpc/platforms/pseries/Makefile
index 61616d144072..930898635c9f 100644
--- a/arch/powerpc/platforms/pseries/Makefile
+++ b/arch/powerpc/platforms/pseries/Makefile
@@ -1,5 +1,6 @@
1obj-y := pci.o lpar.o hvCall.o nvram.o reconfig.o \ 1obj-y := pci.o lpar.o hvCall.o nvram.o reconfig.o \
2 setup.o iommu.o ras.o rtasd.o pci_dlpar.o 2 setup.o iommu.o ras.o rtasd.o pci_dlpar.o \
3 firmware.o
3obj-$(CONFIG_SMP) += smp.o 4obj-$(CONFIG_SMP) += smp.o
4obj-$(CONFIG_IBMVIO) += vio.o 5obj-$(CONFIG_IBMVIO) += vio.o
5obj-$(CONFIG_XICS) += xics.o 6obj-$(CONFIG_XICS) += xics.o
diff --git a/arch/powerpc/platforms/pseries/firmware.c b/arch/powerpc/platforms/pseries/firmware.c
new file mode 100644
index 000000000000..989f4bc136cb
--- /dev/null
+++ b/arch/powerpc/platforms/pseries/firmware.c
@@ -0,0 +1,103 @@
1/*
2 * pSeries firmware setup code.
3 *
4 * Portions from arch/powerpc/platforms/pseries/setup.c:
5 * Copyright (C) 1995 Linus Torvalds
6 * Adapted from 'alpha' version by Gary Thomas
7 * Modified by Cort Dougan (cort@cs.nmt.edu)
8 * Modified by PPC64 Team, IBM Corp
9 *
10 * Portions from arch/powerpc/kernel/firmware.c
11 * Copyright (C) 2001 Ben. Herrenschmidt (benh@kernel.crashing.org)
12 * Modifications for ppc64:
13 * Copyright (C) 2003 Dave Engebretsen <engebret@us.ibm.com>
14 * Copyright (C) 2005 Stephen Rothwell, IBM Corporation
15 *
16 * Copyright 2006 IBM Corporation.
17 *
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License
20 * as published by the Free Software Foundation; either version
21 * 2 of the License, or (at your option) any later version.
22 */
23
24#undef DEBUG
25
26#include <asm/firmware.h>
27#include <asm/prom.h>
28
29#ifdef DEBUG
30#define DBG(fmt...) udbg_printf(fmt)
31#else
32#define DBG(fmt...)
33#endif
34
35typedef struct {
36 unsigned long val;
37 char * name;
38} firmware_feature_t;
39
40static __initdata firmware_feature_t
41firmware_features_table[FIRMWARE_MAX_FEATURES] = {
42 {FW_FEATURE_PFT, "hcall-pft"},
43 {FW_FEATURE_TCE, "hcall-tce"},
44 {FW_FEATURE_SPRG0, "hcall-sprg0"},
45 {FW_FEATURE_DABR, "hcall-dabr"},
46 {FW_FEATURE_COPY, "hcall-copy"},
47 {FW_FEATURE_ASR, "hcall-asr"},
48 {FW_FEATURE_DEBUG, "hcall-debug"},
49 {FW_FEATURE_PERF, "hcall-perf"},
50 {FW_FEATURE_DUMP, "hcall-dump"},
51 {FW_FEATURE_INTERRUPT, "hcall-interrupt"},
52 {FW_FEATURE_MIGRATE, "hcall-migrate"},
53 {FW_FEATURE_PERFMON, "hcall-perfmon"},
54 {FW_FEATURE_CRQ, "hcall-crq"},
55 {FW_FEATURE_VIO, "hcall-vio"},
56 {FW_FEATURE_RDMA, "hcall-rdma"},
57 {FW_FEATURE_LLAN, "hcall-lLAN"},
58 {FW_FEATURE_BULK, "hcall-bulk"},
59 {FW_FEATURE_XDABR, "hcall-xdabr"},
60 {FW_FEATURE_MULTITCE, "hcall-multi-tce"},
61 {FW_FEATURE_SPLPAR, "hcall-splpar"},
62};
63
64/* Build up the firmware features bitmask using the contents of
65 * device-tree/ibm,hypertas-functions. Ultimately this functionality may
66 * be moved into prom.c prom_init().
67 */
68void __init fw_feature_init(void)
69{
70 struct device_node *dn;
71 char *hypertas, *s;
72 int len, i;
73
74 DBG(" -> fw_feature_init()\n");
75
76 dn = of_find_node_by_path("/rtas");
77 if (dn == NULL) {
78 printk(KERN_ERR "WARNING! Cannot find RTAS in device-tree!\n");
79 goto out;
80 }
81
82 hypertas = get_property(dn, "ibm,hypertas-functions", &len);
83 if (hypertas == NULL)
84 goto out;
85
86 for (s = hypertas; s < hypertas + len; s += strlen(s) + 1) {
87 for (i = 0; i < FIRMWARE_MAX_FEATURES; i++) {
88 /* check value against table of strings */
89 if (!firmware_features_table[i].name ||
90 strcmp(firmware_features_table[i].name, s))
91 continue;
92
93 /* we have a match */
94 ppc64_firmware_features |=
95 firmware_features_table[i].val;
96 break;
97 }
98 }
99
100out:
101 of_node_put(dn);
102 DBG(" <- fw_feature_init()\n");
103}
diff --git a/arch/powerpc/platforms/pseries/firmware.h b/arch/powerpc/platforms/pseries/firmware.h
new file mode 100644
index 000000000000..714f56f55362
--- /dev/null
+++ b/arch/powerpc/platforms/pseries/firmware.h
@@ -0,0 +1,17 @@
1/*
2 * Copyright 2006 IBM Corporation.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9
10#ifndef _PSERIES_FIRMWARE_H
11#define _PSERIES_FIRMWARE_H
12
13#include <asm/firmware.h>
14
15extern void __init fw_feature_init(void);
16
17#endif /* _PSERIES_FIRMWARE_H */
diff --git a/arch/powerpc/platforms/pseries/hvCall.S b/arch/powerpc/platforms/pseries/hvCall.S
index 176e8da76466..db7c19fe9297 100644
--- a/arch/powerpc/platforms/pseries/hvCall.S
+++ b/arch/powerpc/platforms/pseries/hvCall.S
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/ppc64/kernel/pSeries_hvCall.S
3 *
4 * This file contains the generic code to perform a call to the 2 * This file contains the generic code to perform a call to the
5 * pSeries LPAR hypervisor. 3 * pSeries LPAR hypervisor.
6 * NOTE: this file will go away when we move to inline this work. 4 * NOTE: this file will go away when we move to inline this work.
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index 48cfbfc43f99..2643078433f0 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/ppc64/kernel/pSeries_iommu.c
3 *
4 * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen, IBM Corporation 2 * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen, IBM Corporation
5 * 3 *
6 * Rewrite, cleanup: 4 * Rewrite, cleanup:
@@ -582,7 +580,7 @@ void iommu_init_early_pSeries(void)
582 return; 580 return;
583 } 581 }
584 582
585 if (platform_is_lpar()) { 583 if (firmware_has_feature(FW_FEATURE_LPAR)) {
586 if (firmware_has_feature(FW_FEATURE_MULTITCE)) { 584 if (firmware_has_feature(FW_FEATURE_MULTITCE)) {
587 ppc_md.tce_build = tce_buildmulti_pSeriesLP; 585 ppc_md.tce_build = tce_buildmulti_pSeriesLP;
588 ppc_md.tce_free = tce_freemulti_pSeriesLP; 586 ppc_md.tce_free = tce_freemulti_pSeriesLP;
diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c
index 999a9620b5ce..946ad59e3352 100644
--- a/arch/powerpc/platforms/pseries/pci.c
+++ b/arch/powerpc/platforms/pseries/pci.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/ppc64/kernel/pSeries_pci.c
3 *
4 * Copyright (C) 2001 Dave Engebretsen, IBM Corporation 2 * Copyright (C) 2001 Dave Engebretsen, IBM Corporation
5 * Copyright (C) 2003 Anton Blanchard <anton@au.ibm.com>, IBM 3 * Copyright (C) 2003 Anton Blanchard <anton@au.ibm.com>, IBM
6 * 4 *
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 9edeca83f434..44d5c7fdcd97 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -60,7 +60,6 @@
60#include <asm/time.h> 60#include <asm/time.h>
61#include <asm/nvram.h> 61#include <asm/nvram.h>
62#include "xics.h" 62#include "xics.h"
63#include <asm/firmware.h>
64#include <asm/pmc.h> 63#include <asm/pmc.h>
65#include <asm/mpic.h> 64#include <asm/mpic.h>
66#include <asm/ppc-pci.h> 65#include <asm/ppc-pci.h>
@@ -70,6 +69,7 @@
70 69
71#include "plpar_wrappers.h" 70#include "plpar_wrappers.h"
72#include "ras.h" 71#include "ras.h"
72#include "firmware.h"
73 73
74#ifdef DEBUG 74#ifdef DEBUG
75#define DBG(fmt...) udbg_printf(fmt) 75#define DBG(fmt...) udbg_printf(fmt)
@@ -246,7 +246,7 @@ static void __init pSeries_setup_arch(void)
246 ppc_md.idle_loop = default_idle; 246 ppc_md.idle_loop = default_idle;
247 } 247 }
248 248
249 if (platform_is_lpar()) 249 if (firmware_has_feature(FW_FEATURE_LPAR))
250 ppc_md.enable_pmcs = pseries_lpar_enable_pmcs; 250 ppc_md.enable_pmcs = pseries_lpar_enable_pmcs;
251 else 251 else
252 ppc_md.enable_pmcs = power4_enable_pmcs; 252 ppc_md.enable_pmcs = power4_enable_pmcs;
@@ -262,53 +262,6 @@ static int __init pSeries_init_panel(void)
262} 262}
263arch_initcall(pSeries_init_panel); 263arch_initcall(pSeries_init_panel);
264 264
265
266/* Build up the ppc64_firmware_features bitmask field
267 * using contents of device-tree/ibm,hypertas-functions.
268 * Ultimately this functionality may be moved into prom.c prom_init().
269 */
270static void __init fw_feature_init(void)
271{
272 struct device_node * dn;
273 char * hypertas;
274 unsigned int len;
275
276 DBG(" -> fw_feature_init()\n");
277
278 ppc64_firmware_features = 0;
279 dn = of_find_node_by_path("/rtas");
280 if (dn == NULL) {
281 printk(KERN_ERR "WARNING ! Cannot find RTAS in device-tree !\n");
282 goto no_rtas;
283 }
284
285 hypertas = get_property(dn, "ibm,hypertas-functions", &len);
286 if (hypertas) {
287 while (len > 0){
288 int i, hypertas_len;
289 /* check value against table of strings */
290 for(i=0; i < FIRMWARE_MAX_FEATURES ;i++) {
291 if ((firmware_features_table[i].name) &&
292 (strcmp(firmware_features_table[i].name,hypertas))==0) {
293 /* we have a match */
294 ppc64_firmware_features |=
295 (firmware_features_table[i].val);
296 break;
297 }
298 }
299 hypertas_len = strlen(hypertas);
300 len -= hypertas_len +1;
301 hypertas+= hypertas_len +1;
302 }
303 }
304
305 of_node_put(dn);
306no_rtas:
307
308 DBG(" <- fw_feature_init()\n");
309}
310
311
312static void __init pSeries_discover_pic(void) 265static void __init pSeries_discover_pic(void)
313{ 266{
314 struct device_node *np; 267 struct device_node *np;
@@ -367,21 +320,16 @@ static int pseries_set_xdabr(unsigned long dabr)
367 */ 320 */
368static void __init pSeries_init_early(void) 321static void __init pSeries_init_early(void)
369{ 322{
370 int iommu_off = 0;
371
372 DBG(" -> pSeries_init_early()\n"); 323 DBG(" -> pSeries_init_early()\n");
373 324
374 fw_feature_init(); 325 fw_feature_init();
375 326
376 if (platform_is_lpar()) 327 if (firmware_has_feature(FW_FEATURE_LPAR))
377 hpte_init_lpar(); 328 hpte_init_lpar();
378 else { 329 else
379 hpte_init_native(); 330 hpte_init_native();
380 iommu_off = (of_chosen &&
381 get_property(of_chosen, "linux,iommu-off", NULL));
382 }
383 331
384 if (platform_is_lpar()) 332 if (firmware_has_feature(FW_FEATURE_LPAR))
385 find_udbg_vterm(); 333 find_udbg_vterm();
386 334
387 if (firmware_has_feature(FW_FEATURE_DABR)) 335 if (firmware_has_feature(FW_FEATURE_DABR))
@@ -437,6 +385,9 @@ static int __init pSeries_probe(int platform)
437 * it here ... 385 * it here ...
438 */ 386 */
439 387
388 if (platform == PLATFORM_PSERIES_LPAR)
389 ppc64_firmware_features |= FW_FEATURE_LPAR;
390
440 return 1; 391 return 1;
441} 392}
442 393
@@ -576,7 +527,7 @@ static void pseries_shared_idle(void)
576 527
577static int pSeries_pci_probe_mode(struct pci_bus *bus) 528static int pSeries_pci_probe_mode(struct pci_bus *bus)
578{ 529{
579 if (platform_is_lpar()) 530 if (firmware_has_feature(FW_FEATURE_LPAR))
580 return PCI_PROBE_DEVTREE; 531 return PCI_PROBE_DEVTREE;
581 return PCI_PROBE_NORMAL; 532 return PCI_PROBE_NORMAL;
582} 533}
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c
index 8d710af50756..3cf78a6cd27c 100644
--- a/arch/powerpc/platforms/pseries/smp.c
+++ b/arch/powerpc/platforms/pseries/smp.c
@@ -443,7 +443,7 @@ void __init smp_init_pSeries(void)
443 smp_ops->cpu_die = pSeries_cpu_die; 443 smp_ops->cpu_die = pSeries_cpu_die;
444 444
445 /* Processors can be added/removed only on LPAR */ 445 /* Processors can be added/removed only on LPAR */
446 if (platform_is_lpar()) 446 if (firmware_has_feature(FW_FEATURE_LPAR))
447 pSeries_reconfig_notifier_register(&pSeries_smp_nb); 447 pSeries_reconfig_notifier_register(&pSeries_smp_nb);
448#endif 448#endif
449 449
diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c
index fd823c7c9ac8..eb86cdb9b802 100644
--- a/arch/powerpc/platforms/pseries/xics.c
+++ b/arch/powerpc/platforms/pseries/xics.c
@@ -20,6 +20,7 @@
20#include <linux/gfp.h> 20#include <linux/gfp.h>
21#include <linux/radix-tree.h> 21#include <linux/radix-tree.h>
22#include <linux/cpu.h> 22#include <linux/cpu.h>
23#include <asm/firmware.h>
23#include <asm/prom.h> 24#include <asm/prom.h>
24#include <asm/io.h> 25#include <asm/io.h>
25#include <asm/pgtable.h> 26#include <asm/pgtable.h>
@@ -536,7 +537,7 @@ nextnode:
536 of_node_put(np); 537 of_node_put(np);
537 } 538 }
538 539
539 if (platform_is_lpar()) 540 if (firmware_has_feature(FW_FEATURE_LPAR))
540 ops = &pSeriesLP_ops; 541 ops = &pSeriesLP_ops;
541 else { 542 else {
542#ifdef CONFIG_SMP 543#ifdef CONFIG_SMP
diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c
index 6298264efe36..61d317428610 100644
--- a/arch/powerpc/sysdev/dart_iommu.c
+++ b/arch/powerpc/sysdev/dart_iommu.c
@@ -194,8 +194,6 @@ static int dart_init(struct device_node *dart_node)
194 * prefetching into invalid pages and corrupting data 194 * prefetching into invalid pages and corrupting data
195 */ 195 */
196 tmp = lmb_alloc(DART_PAGE_SIZE, DART_PAGE_SIZE); 196 tmp = lmb_alloc(DART_PAGE_SIZE, DART_PAGE_SIZE);
197 if (!tmp)
198 panic("DART: Cannot allocate spare page!");
199 dart_emptyval = DARTMAP_VALID | ((tmp >> DART_PAGE_SHIFT) & 197 dart_emptyval = DARTMAP_VALID | ((tmp >> DART_PAGE_SHIFT) &
200 DARTMAP_RPNMASK); 198 DARTMAP_RPNMASK);
201 199
diff --git a/arch/powerpc/sysdev/dcr.S b/arch/powerpc/sysdev/dcr.S
index 895f10243a43..2078f39e2f17 100644
--- a/arch/powerpc/sysdev/dcr.S
+++ b/arch/powerpc/sysdev/dcr.S
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/ppc/syslib/dcr.S
3 *
4 * "Indirect" DCR access 2 * "Indirect" DCR access
5 * 3 *
6 * Copyright (c) 2004 Eugene Surovegin <ebs@ebshome.net> 4 * Copyright (c) 2004 Eugene Surovegin <ebs@ebshome.net>
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 064c9de47732..ceb584682fa3 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -40,7 +40,7 @@ phys_addr_t get_immrbase(void)
40 return immrbase; 40 return immrbase;
41 41
42 soc = of_find_node_by_type(NULL, "soc"); 42 soc = of_find_node_by_type(NULL, "soc");
43 if (soc != 0) { 43 if (soc) {
44 unsigned int size; 44 unsigned int size;
45 void *prop = get_property(soc, "reg", &size); 45 void *prop = get_property(soc, "reg", &size);
46 immrbase = of_translate_address(soc, prop); 46 immrbase = of_translate_address(soc, prop);
@@ -49,21 +49,20 @@ phys_addr_t get_immrbase(void)
49 49
50 return immrbase; 50 return immrbase;
51} 51}
52EXPORT_SYMBOL(get_immrbase);
53 52
54static const char * gfar_tx_intr = "tx"; 53EXPORT_SYMBOL(get_immrbase);
55static const char * gfar_rx_intr = "rx";
56static const char * gfar_err_intr = "error";
57 54
58static int __init gfar_of_init(void) 55static int __init gfar_mdio_of_init(void)
59{ 56{
60 struct device_node *np; 57 struct device_node *np;
61 unsigned int i; 58 unsigned int i;
62 struct platform_device *mdio_dev, *gfar_dev; 59 struct platform_device *mdio_dev;
63 struct resource res; 60 struct resource res;
64 int ret; 61 int ret;
65 62
66 for (np = NULL, i = 0; (np = of_find_compatible_node(np, "mdio", "gianfar")) != NULL; i++) { 63 for (np = NULL, i = 0;
64 (np = of_find_compatible_node(np, "mdio", "gianfar")) != NULL;
65 i++) {
67 int k; 66 int k;
68 struct device_node *child = NULL; 67 struct device_node *child = NULL;
69 struct gianfar_mdio_data mdio_data; 68 struct gianfar_mdio_data mdio_data;
@@ -73,12 +72,14 @@ static int __init gfar_of_init(void)
73 72
74 ret = of_address_to_resource(np, 0, &res); 73 ret = of_address_to_resource(np, 0, &res);
75 if (ret) 74 if (ret)
76 goto mdio_err; 75 goto err;
77 76
78 mdio_dev = platform_device_register_simple("fsl-gianfar_mdio", res.start, &res, 1); 77 mdio_dev =
78 platform_device_register_simple("fsl-gianfar_mdio",
79 res.start, &res, 1);
79 if (IS_ERR(mdio_dev)) { 80 if (IS_ERR(mdio_dev)) {
80 ret = PTR_ERR(mdio_dev); 81 ret = PTR_ERR(mdio_dev);
81 goto mdio_err; 82 goto err;
82 } 83 }
83 84
84 for (k = 0; k < 32; k++) 85 for (k = 0; k < 32; k++)
@@ -86,17 +87,44 @@ static int __init gfar_of_init(void)
86 87
87 while ((child = of_get_next_child(np, child)) != NULL) { 88 while ((child = of_get_next_child(np, child)) != NULL) {
88 if (child->n_intrs) { 89 if (child->n_intrs) {
89 u32 *id = (u32 *) get_property(child, "reg", NULL); 90 u32 *id =
91 (u32 *) get_property(child, "reg", NULL);
90 mdio_data.irq[*id] = child->intrs[0].line; 92 mdio_data.irq[*id] = child->intrs[0].line;
91 } 93 }
92 } 94 }
93 95
94 ret = platform_device_add_data(mdio_dev, &mdio_data, sizeof(struct gianfar_mdio_data)); 96 ret =
97 platform_device_add_data(mdio_dev, &mdio_data,
98 sizeof(struct gianfar_mdio_data));
95 if (ret) 99 if (ret)
96 goto mdio_unreg; 100 goto unreg;
97 } 101 }
98 102
99 for (np = NULL, i = 0; (np = of_find_compatible_node(np, "network", "gianfar")) != NULL; i++) { 103 return 0;
104
105unreg:
106 platform_device_unregister(mdio_dev);
107err:
108 return ret;
109}
110
111arch_initcall(gfar_mdio_of_init);
112
113static const char *gfar_tx_intr = "tx";
114static const char *gfar_rx_intr = "rx";
115static const char *gfar_err_intr = "error";
116
117static int __init gfar_of_init(void)
118{
119 struct device_node *np;
120 unsigned int i;
121 struct platform_device *gfar_dev;
122 struct resource res;
123 int ret;
124
125 for (np = NULL, i = 0;
126 (np = of_find_compatible_node(np, "network", "gianfar")) != NULL;
127 i++) {
100 struct resource r[4]; 128 struct resource r[4];
101 struct device_node *phy, *mdio; 129 struct device_node *phy, *mdio;
102 struct gianfar_platform_data gfar_data; 130 struct gianfar_platform_data gfar_data;
@@ -110,7 +138,7 @@ static int __init gfar_of_init(void)
110 138
111 ret = of_address_to_resource(np, 0, &r[0]); 139 ret = of_address_to_resource(np, 0, &r[0]);
112 if (ret) 140 if (ret)
113 goto gfar_err; 141 goto err;
114 142
115 r[1].start = np->intrs[0].line; 143 r[1].start = np->intrs[0].line;
116 r[1].end = np->intrs[0].line; 144 r[1].end = np->intrs[0].line;
@@ -133,11 +161,13 @@ static int __init gfar_of_init(void)
133 r[3].flags = IORESOURCE_IRQ; 161 r[3].flags = IORESOURCE_IRQ;
134 } 162 }
135 163
136 gfar_dev = platform_device_register_simple("fsl-gianfar", i, &r[0], np->n_intrs + 1); 164 gfar_dev =
165 platform_device_register_simple("fsl-gianfar", i, &r[0],
166 np->n_intrs + 1);
137 167
138 if (IS_ERR(gfar_dev)) { 168 if (IS_ERR(gfar_dev)) {
139 ret = PTR_ERR(gfar_dev); 169 ret = PTR_ERR(gfar_dev);
140 goto gfar_err; 170 goto err;
141 } 171 }
142 172
143 mac_addr = get_property(np, "address", NULL); 173 mac_addr = get_property(np, "address", NULL);
@@ -145,26 +175,26 @@ static int __init gfar_of_init(void)
145 175
146 if (model && !strcasecmp(model, "TSEC")) 176 if (model && !strcasecmp(model, "TSEC"))
147 gfar_data.device_flags = 177 gfar_data.device_flags =
148 FSL_GIANFAR_DEV_HAS_GIGABIT | 178 FSL_GIANFAR_DEV_HAS_GIGABIT |
149 FSL_GIANFAR_DEV_HAS_COALESCE | 179 FSL_GIANFAR_DEV_HAS_COALESCE |
150 FSL_GIANFAR_DEV_HAS_RMON | 180 FSL_GIANFAR_DEV_HAS_RMON |
151 FSL_GIANFAR_DEV_HAS_MULTI_INTR; 181 FSL_GIANFAR_DEV_HAS_MULTI_INTR;
152 if (model && !strcasecmp(model, "eTSEC")) 182 if (model && !strcasecmp(model, "eTSEC"))
153 gfar_data.device_flags = 183 gfar_data.device_flags =
154 FSL_GIANFAR_DEV_HAS_GIGABIT | 184 FSL_GIANFAR_DEV_HAS_GIGABIT |
155 FSL_GIANFAR_DEV_HAS_COALESCE | 185 FSL_GIANFAR_DEV_HAS_COALESCE |
156 FSL_GIANFAR_DEV_HAS_RMON | 186 FSL_GIANFAR_DEV_HAS_RMON |
157 FSL_GIANFAR_DEV_HAS_MULTI_INTR | 187 FSL_GIANFAR_DEV_HAS_MULTI_INTR |
158 FSL_GIANFAR_DEV_HAS_CSUM | 188 FSL_GIANFAR_DEV_HAS_CSUM |
159 FSL_GIANFAR_DEV_HAS_VLAN | 189 FSL_GIANFAR_DEV_HAS_VLAN |
160 FSL_GIANFAR_DEV_HAS_EXTENDED_HASH; 190 FSL_GIANFAR_DEV_HAS_EXTENDED_HASH;
161 191
162 ph = (phandle *) get_property(np, "phy-handle", NULL); 192 ph = (phandle *) get_property(np, "phy-handle", NULL);
163 phy = of_find_node_by_phandle(*ph); 193 phy = of_find_node_by_phandle(*ph);
164 194
165 if (phy == NULL) { 195 if (phy == NULL) {
166 ret = -ENODEV; 196 ret = -ENODEV;
167 goto gfar_unreg; 197 goto unreg;
168 } 198 }
169 199
170 mdio = of_get_parent(phy); 200 mdio = of_get_parent(phy);
@@ -174,7 +204,7 @@ static int __init gfar_of_init(void)
174 if (ret) { 204 if (ret) {
175 of_node_put(phy); 205 of_node_put(phy);
176 of_node_put(mdio); 206 of_node_put(mdio);
177 goto gfar_unreg; 207 goto unreg;
178 } 208 }
179 209
180 gfar_data.phy_id = *id; 210 gfar_data.phy_id = *id;
@@ -183,23 +213,22 @@ static int __init gfar_of_init(void)
183 of_node_put(phy); 213 of_node_put(phy);
184 of_node_put(mdio); 214 of_node_put(mdio);
185 215
186 ret = platform_device_add_data(gfar_dev, &gfar_data, sizeof(struct gianfar_platform_data)); 216 ret =
217 platform_device_add_data(gfar_dev, &gfar_data,
218 sizeof(struct
219 gianfar_platform_data));
187 if (ret) 220 if (ret)
188 goto gfar_unreg; 221 goto unreg;
189 } 222 }
190 223
191 return 0; 224 return 0;
192 225
193mdio_unreg: 226unreg:
194 platform_device_unregister(mdio_dev);
195mdio_err:
196 return ret;
197
198gfar_unreg:
199 platform_device_unregister(gfar_dev); 227 platform_device_unregister(gfar_dev);
200gfar_err: 228err:
201 return ret; 229 return ret;
202} 230}
231
203arch_initcall(gfar_of_init); 232arch_initcall(gfar_of_init);
204 233
205static int __init fsl_i2c_of_init(void) 234static int __init fsl_i2c_of_init(void)
@@ -209,17 +238,19 @@ static int __init fsl_i2c_of_init(void)
209 struct platform_device *i2c_dev; 238 struct platform_device *i2c_dev;
210 int ret; 239 int ret;
211 240
212 for (np = NULL, i = 0; (np = of_find_compatible_node(np, "i2c", "fsl-i2c")) != NULL; i++) { 241 for (np = NULL, i = 0;
242 (np = of_find_compatible_node(np, "i2c", "fsl-i2c")) != NULL;
243 i++) {
213 struct resource r[2]; 244 struct resource r[2];
214 struct fsl_i2c_platform_data i2c_data; 245 struct fsl_i2c_platform_data i2c_data;
215 unsigned char * flags = NULL; 246 unsigned char *flags = NULL;
216 247
217 memset(&r, 0, sizeof(r)); 248 memset(&r, 0, sizeof(r));
218 memset(&i2c_data, 0, sizeof(i2c_data)); 249 memset(&i2c_data, 0, sizeof(i2c_data));
219 250
220 ret = of_address_to_resource(np, 0, &r[0]); 251 ret = of_address_to_resource(np, 0, &r[0]);
221 if (ret) 252 if (ret)
222 goto i2c_err; 253 goto err;
223 254
224 r[1].start = np->intrs[0].line; 255 r[1].start = np->intrs[0].line;
225 r[1].end = np->intrs[0].line; 256 r[1].end = np->intrs[0].line;
@@ -228,7 +259,7 @@ static int __init fsl_i2c_of_init(void)
228 i2c_dev = platform_device_register_simple("fsl-i2c", i, r, 2); 259 i2c_dev = platform_device_register_simple("fsl-i2c", i, r, 2);
229 if (IS_ERR(i2c_dev)) { 260 if (IS_ERR(i2c_dev)) {
230 ret = PTR_ERR(i2c_dev); 261 ret = PTR_ERR(i2c_dev);
231 goto i2c_err; 262 goto err;
232 } 263 }
233 264
234 i2c_data.device_flags = 0; 265 i2c_data.device_flags = 0;
@@ -240,18 +271,22 @@ static int __init fsl_i2c_of_init(void)
240 if (flags) 271 if (flags)
241 i2c_data.device_flags |= FSL_I2C_DEV_CLOCK_5200; 272 i2c_data.device_flags |= FSL_I2C_DEV_CLOCK_5200;
242 273
243 ret = platform_device_add_data(i2c_dev, &i2c_data, sizeof(struct fsl_i2c_platform_data)); 274 ret =
275 platform_device_add_data(i2c_dev, &i2c_data,
276 sizeof(struct
277 fsl_i2c_platform_data));
244 if (ret) 278 if (ret)
245 goto i2c_unreg; 279 goto unreg;
246 } 280 }
247 281
248 return 0; 282 return 0;
249 283
250i2c_unreg: 284unreg:
251 platform_device_unregister(i2c_dev); 285 platform_device_unregister(i2c_dev);
252i2c_err: 286err:
253 return ret; 287 return ret;
254} 288}
289
255arch_initcall(fsl_i2c_of_init); 290arch_initcall(fsl_i2c_of_init);
256 291
257#ifdef CONFIG_PPC_83xx 292#ifdef CONFIG_PPC_83xx
@@ -267,51 +302,192 @@ static int __init mpc83xx_wdt_init(void)
267 302
268 if (!np) { 303 if (!np) {
269 ret = -ENODEV; 304 ret = -ENODEV;
270 goto mpc83xx_wdt_nodev; 305 goto nodev;
271 } 306 }
272 307
273 soc = of_find_node_by_type(NULL, "soc"); 308 soc = of_find_node_by_type(NULL, "soc");
274 309
275 if (!soc) { 310 if (!soc) {
276 ret = -ENODEV; 311 ret = -ENODEV;
277 goto mpc83xx_wdt_nosoc; 312 goto nosoc;
278 } 313 }
279 314
280 freq = (unsigned int *)get_property(soc, "bus-frequency", NULL); 315 freq = (unsigned int *)get_property(soc, "bus-frequency", NULL);
281 if (!freq) { 316 if (!freq) {
282 ret = -ENODEV; 317 ret = -ENODEV;
283 goto mpc83xx_wdt_err; 318 goto err;
284 } 319 }
285 320
286 memset(&r, 0, sizeof(r)); 321 memset(&r, 0, sizeof(r));
287 322
288 ret = of_address_to_resource(np, 0, &r); 323 ret = of_address_to_resource(np, 0, &r);
289 if (ret) 324 if (ret)
290 goto mpc83xx_wdt_err; 325 goto err;
291 326
292 dev = platform_device_register_simple("mpc83xx_wdt", 0, &r, 1); 327 dev = platform_device_register_simple("mpc83xx_wdt", 0, &r, 1);
293 if (IS_ERR(dev)) { 328 if (IS_ERR(dev)) {
294 ret = PTR_ERR(dev); 329 ret = PTR_ERR(dev);
295 goto mpc83xx_wdt_err; 330 goto err;
296 } 331 }
297 332
298 ret = platform_device_add_data(dev, freq, sizeof(int)); 333 ret = platform_device_add_data(dev, freq, sizeof(int));
299 if (ret) 334 if (ret)
300 goto mpc83xx_wdt_unreg; 335 goto unreg;
301 336
302 of_node_put(soc); 337 of_node_put(soc);
303 of_node_put(np); 338 of_node_put(np);
304 339
305 return 0; 340 return 0;
306 341
307mpc83xx_wdt_unreg: 342unreg:
308 platform_device_unregister(dev); 343 platform_device_unregister(dev);
309mpc83xx_wdt_err: 344err:
310 of_node_put(soc); 345 of_node_put(soc);
311mpc83xx_wdt_nosoc: 346nosoc:
312 of_node_put(np); 347 of_node_put(np);
313mpc83xx_wdt_nodev: 348nodev:
314 return ret; 349 return ret;
315} 350}
351
316arch_initcall(mpc83xx_wdt_init); 352arch_initcall(mpc83xx_wdt_init);
317#endif 353#endif
354
355static enum fsl_usb2_phy_modes determine_usb_phy(char * phy_type)
356{
357 if (!phy_type)
358 return FSL_USB2_PHY_NONE;
359 if (!strcasecmp(phy_type, "ulpi"))
360 return FSL_USB2_PHY_ULPI;
361 if (!strcasecmp(phy_type, "utmi"))
362 return FSL_USB2_PHY_UTMI;
363 if (!strcasecmp(phy_type, "utmi_wide"))
364 return FSL_USB2_PHY_UTMI_WIDE;
365 if (!strcasecmp(phy_type, "serial"))
366 return FSL_USB2_PHY_SERIAL;
367
368 return FSL_USB2_PHY_NONE;
369}
370
371static int __init fsl_usb_of_init(void)
372{
373 struct device_node *np;
374 unsigned int i;
375 struct platform_device *usb_dev;
376 int ret;
377
378 for (np = NULL, i = 0;
379 (np = of_find_compatible_node(np, "usb", "fsl-usb2-mph")) != NULL;
380 i++) {
381 struct resource r[2];
382 struct fsl_usb2_platform_data usb_data;
383 unsigned char *prop = NULL;
384
385 memset(&r, 0, sizeof(r));
386 memset(&usb_data, 0, sizeof(usb_data));
387
388 ret = of_address_to_resource(np, 0, &r[0]);
389 if (ret)
390 goto err;
391
392 r[1].start = np->intrs[0].line;
393 r[1].end = np->intrs[0].line;
394 r[1].flags = IORESOURCE_IRQ;
395
396 usb_dev =
397 platform_device_register_simple("fsl-usb2-mph", i, r, 2);
398 if (IS_ERR(usb_dev)) {
399 ret = PTR_ERR(usb_dev);
400 goto err;
401 }
402
403 usb_dev->dev.coherent_dma_mask = 0xffffffffUL;
404 usb_dev->dev.dma_mask = &usb_dev->dev.coherent_dma_mask;
405
406 usb_data.operating_mode = FSL_USB2_MPH_HOST;
407
408 prop = get_property(np, "port0", NULL);
409 if (prop)
410 usb_data.port_enables |= FSL_USB2_PORT0_ENABLED;
411
412 prop = get_property(np, "port1", NULL);
413 if (prop)
414 usb_data.port_enables |= FSL_USB2_PORT1_ENABLED;
415
416 prop = get_property(np, "phy_type", NULL);
417 usb_data.phy_mode = determine_usb_phy(prop);
418
419 ret =
420 platform_device_add_data(usb_dev, &usb_data,
421 sizeof(struct
422 fsl_usb2_platform_data));
423 if (ret)
424 goto unreg;
425 }
426
427 return 0;
428
429unreg:
430 platform_device_unregister(usb_dev);
431err:
432 return ret;
433}
434
435arch_initcall(fsl_usb_of_init);
436
437static int __init fsl_usb_dr_of_init(void)
438{
439 struct device_node *np;
440 unsigned int i;
441 struct platform_device *usb_dev;
442 int ret;
443
444 for (np = NULL, i = 0;
445 (np = of_find_compatible_node(np, "usb", "fsl-usb2-dr")) != NULL;
446 i++) {
447 struct resource r[2];
448 struct fsl_usb2_platform_data usb_data;
449 unsigned char *prop = NULL;
450
451 memset(&r, 0, sizeof(r));
452 memset(&usb_data, 0, sizeof(usb_data));
453
454 ret = of_address_to_resource(np, 0, &r[0]);
455 if (ret)
456 goto err;
457
458 r[1].start = np->intrs[0].line;
459 r[1].end = np->intrs[0].line;
460 r[1].flags = IORESOURCE_IRQ;
461
462 usb_dev =
463 platform_device_register_simple("fsl-usb2-dr", i, r, 2);
464 if (IS_ERR(usb_dev)) {
465 ret = PTR_ERR(usb_dev);
466 goto err;
467 }
468
469 usb_dev->dev.coherent_dma_mask = 0xffffffffUL;
470 usb_dev->dev.dma_mask = &usb_dev->dev.coherent_dma_mask;
471
472 usb_data.operating_mode = FSL_USB2_DR_HOST;
473
474 prop = get_property(np, "phy_type", NULL);
475 usb_data.phy_mode = determine_usb_phy(prop);
476
477 ret =
478 platform_device_add_data(usb_dev, &usb_data,
479 sizeof(struct
480 fsl_usb2_platform_data));
481 if (ret)
482 goto unreg;
483 }
484
485 return 0;
486
487unreg:
488 platform_device_unregister(usb_dev);
489err:
490 return ret;
491}
492
493arch_initcall(fsl_usb_dr_of_init);
diff --git a/arch/powerpc/sysdev/ipic.h b/arch/powerpc/sysdev/ipic.h
index a7ce7da8785c..a60c9d18bb7f 100644
--- a/arch/powerpc/sysdev/ipic.h
+++ b/arch/powerpc/sysdev/ipic.h
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/ppc/kernel/ipic.h
3 *
4 * IPIC private definitions and structure. 2 * IPIC private definitions and structure.
5 * 3 *
6 * Maintainer: Kumar Gala <galak@kernel.crashing.org> 4 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 7d02fa2a8990..4735b41c113c 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -191,6 +191,7 @@ Commands:\n\
191 di dump instructions\n\ 191 di dump instructions\n\
192 df dump float values\n\ 192 df dump float values\n\
193 dd dump double values\n\ 193 dd dump double values\n\
194 dr dump stream of raw bytes\n\
194 e print exception information\n\ 195 e print exception information\n\
195 f flush cache\n\ 196 f flush cache\n\
196 la lookup symbol+offset of specified address\n\ 197 la lookup symbol+offset of specified address\n\
@@ -1938,6 +1939,28 @@ bsesc(void)
1938 return c; 1939 return c;
1939} 1940}
1940 1941
1942static void xmon_rawdump (unsigned long adrs, long ndump)
1943{
1944 long n, m, r, nr;
1945 unsigned char temp[16];
1946
1947 for (n = ndump; n > 0;) {
1948 r = n < 16? n: 16;
1949 nr = mread(adrs, temp, r);
1950 adrs += nr;
1951 for (m = 0; m < r; ++m) {
1952 if (m < nr)
1953 printf("%.2x", temp[m]);
1954 else
1955 printf("%s", fault_chars[fault_type]);
1956 }
1957 n -= r;
1958 if (nr < r)
1959 break;
1960 }
1961 printf("\n");
1962}
1963
1941#define isxdigit(c) (('0' <= (c) && (c) <= '9') \ 1964#define isxdigit(c) (('0' <= (c) && (c) <= '9') \
1942 || ('a' <= (c) && (c) <= 'f') \ 1965 || ('a' <= (c) && (c) <= 'f') \
1943 || ('A' <= (c) && (c) <= 'F')) 1966 || ('A' <= (c) && (c) <= 'F'))
@@ -1960,6 +1983,13 @@ dump(void)
1960 nidump = MAX_DUMP; 1983 nidump = MAX_DUMP;
1961 adrs += ppc_inst_dump(adrs, nidump, 1); 1984 adrs += ppc_inst_dump(adrs, nidump, 1);
1962 last_cmd = "di\n"; 1985 last_cmd = "di\n";
1986 } else if (c == 'r') {
1987 scanhex(&ndump);
1988 if (ndump == 0)
1989 ndump = 64;
1990 xmon_rawdump(adrs, ndump);
1991 adrs += ndump;
1992 last_cmd = "dr\n";
1963 } else { 1993 } else {
1964 scanhex(&ndump); 1994 scanhex(&ndump);
1965 if (ndump == 0) 1995 if (ndump == 0)