aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/Kconfig4
-rw-r--r--arch/powerpc/Kconfig.debug13
-rw-r--r--arch/powerpc/configs/mpc85xx_cds_defconfig846
-rw-r--r--arch/powerpc/kernel/cpu_setup_power4.S17
-rw-r--r--arch/powerpc/kernel/cputable.c19
-rw-r--r--arch/powerpc/kernel/crash.c13
-rw-r--r--arch/powerpc/kernel/crash_dump.c11
-rw-r--r--arch/powerpc/kernel/iomap.c2
-rw-r--r--arch/powerpc/kernel/lparcfg.c4
-rw-r--r--arch/powerpc/kernel/machine_kexec_64.c99
-rw-r--r--arch/powerpc/kernel/misc_32.S2
-rw-r--r--arch/powerpc/kernel/misc_64.S5
-rw-r--r--arch/powerpc/kernel/nvram_64.c2
-rw-r--r--arch/powerpc/kernel/pci_64.c47
-rw-r--r--arch/powerpc/kernel/pci_dn.c6
-rw-r--r--arch/powerpc/kernel/pci_iommu.c20
-rw-r--r--arch/powerpc/kernel/proc_ppc64.c2
-rw-r--r--arch/powerpc/kernel/prom.c100
-rw-r--r--arch/powerpc/kernel/prom_init.c118
-rw-r--r--arch/powerpc/kernel/prom_parse.c22
-rw-r--r--arch/powerpc/kernel/setup-common.c20
-rw-r--r--arch/powerpc/kernel/setup.h3
-rw-r--r--arch/powerpc/kernel/setup_32.c18
-rw-r--r--arch/powerpc/kernel/setup_64.c31
-rw-r--r--arch/powerpc/kernel/time.c10
-rw-r--r--arch/powerpc/kernel/vio.c342
-rw-r--r--arch/powerpc/kernel/vmlinux.lds.S5
-rw-r--r--arch/powerpc/lib/Makefile1
-rw-r--r--arch/powerpc/lib/bitops.c150
-rw-r--r--arch/powerpc/mm/hash_utils_64.c2
-rw-r--r--arch/powerpc/mm/lmb.c43
-rw-r--r--arch/powerpc/mm/mem.c6
-rw-r--r--arch/powerpc/mm/numa.c8
-rw-r--r--arch/powerpc/oprofile/common.c2
-rw-r--r--arch/powerpc/platforms/85xx/Kconfig9
-rw-r--r--arch/powerpc/platforms/85xx/Makefile1
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_cds.c359
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_cds.h43
-rw-r--r--arch/powerpc/platforms/cell/spufs/context.c12
-rw-r--r--arch/powerpc/platforms/iseries/Makefile6
-rw-r--r--arch/powerpc/platforms/iseries/call_pci.h19
-rw-r--r--arch/powerpc/platforms/iseries/dt.c615
-rw-r--r--arch/powerpc/platforms/iseries/iommu.c44
-rw-r--r--arch/powerpc/platforms/iseries/iommu.h35
-rw-r--r--arch/powerpc/platforms/iseries/irq.c7
-rw-r--r--arch/powerpc/platforms/iseries/irq.h2
-rw-r--r--arch/powerpc/platforms/iseries/mf.c9
-rw-r--r--arch/powerpc/platforms/iseries/pci.c347
-rw-r--r--arch/powerpc/platforms/iseries/setup.c271
-rw-r--r--arch/powerpc/platforms/iseries/setup.h2
-rw-r--r--arch/powerpc/platforms/iseries/vio.c131
-rw-r--r--arch/powerpc/platforms/maple/pci.c3
-rw-r--r--arch/powerpc/platforms/maple/setup.c2
-rw-r--r--arch/powerpc/platforms/powermac/feature.c2
-rw-r--r--arch/powerpc/platforms/powermac/pci.c3
-rw-r--r--arch/powerpc/platforms/pseries/Makefile1
-rw-r--r--arch/powerpc/platforms/pseries/eeh_driver.c20
-rw-r--r--arch/powerpc/platforms/pseries/eeh_event.c50
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c151
-rw-r--r--arch/powerpc/platforms/pseries/rtasd.c6
-rw-r--r--arch/powerpc/platforms/pseries/setup.c6
-rw-r--r--arch/powerpc/platforms/pseries/vio.c274
-rw-r--r--arch/powerpc/platforms/pseries/xics.c25
-rw-r--r--arch/ppc/Kconfig4
64 files changed, 2759 insertions, 1693 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 6729c98b66f9..75ba0ec49e54 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -45,6 +45,10 @@ config GENERIC_CALIBRATE_DELAY
45 bool 45 bool
46 default y 46 default y
47 47
48config GENERIC_FIND_NEXT_BIT
49 bool
50 default y
51
48config PPC 52config PPC
49 bool 53 bool
50 default y 54 default y
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index 8d48e9e7162a..c69006ae8246 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -110,13 +110,16 @@ config SERIAL_TEXT_DEBUG
110 depends on 4xx || LOPEC || MV64X60 || PPLUS || PRPMC800 || \ 110 depends on 4xx || LOPEC || MV64X60 || PPLUS || PRPMC800 || \
111 PPC_GEN550 || PPC_MPC52xx 111 PPC_GEN550 || PPC_MPC52xx
112 112
113config PPC_EARLY_DEBUG
114 bool "Early debugging (dangerous)"
115
113choice 116choice
114 prompt "Early debugging (dangerous)" 117 prompt "Early debugging console"
115 bool 118 depends on PPC_EARLY_DEBUG
116 optional
117 help 119 help
118 Enable early debugging. Careful, if you enable debugging for the 120 Use the selected console for early debugging. Careful, if you
119 wrong type of machine your kernel _will not boot_. 121 enable debugging for the wrong type of machine your kernel
122 _will not boot_.
120 123
121config PPC_EARLY_DEBUG_LPAR 124config PPC_EARLY_DEBUG_LPAR
122 bool "LPAR HV Console" 125 bool "LPAR HV Console"
diff --git a/arch/powerpc/configs/mpc85xx_cds_defconfig b/arch/powerpc/configs/mpc85xx_cds_defconfig
new file mode 100644
index 000000000000..9bb022a523fe
--- /dev/null
+++ b/arch/powerpc/configs/mpc85xx_cds_defconfig
@@ -0,0 +1,846 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.16
4# Sun Apr 2 11:23:42 2006
5#
6# CONFIG_PPC64 is not set
7CONFIG_PPC32=y
8CONFIG_PPC_MERGE=y
9CONFIG_MMU=y
10CONFIG_GENERIC_HARDIRQS=y
11CONFIG_RWSEM_XCHGADD_ALGORITHM=y
12CONFIG_GENERIC_HWEIGHT=y
13CONFIG_GENERIC_CALIBRATE_DELAY=y
14CONFIG_PPC=y
15CONFIG_EARLY_PRINTK=y
16CONFIG_GENERIC_NVRAM=y
17CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
18CONFIG_ARCH_MAY_HAVE_PC_FDC=y
19CONFIG_PPC_OF=y
20CONFIG_PPC_UDBG_16550=y
21# CONFIG_GENERIC_TBSYNC is not set
22# CONFIG_DEFAULT_UIMAGE is not set
23
24#
25# Processor support
26#
27# CONFIG_CLASSIC32 is not set
28# CONFIG_PPC_52xx is not set
29# CONFIG_PPC_82xx is not set
30# CONFIG_PPC_83xx is not set
31CONFIG_PPC_85xx=y
32# CONFIG_40x is not set
33# CONFIG_44x is not set
34# CONFIG_8xx is not set
35# CONFIG_E200 is not set
36CONFIG_85xx=y
37CONFIG_E500=y
38CONFIG_BOOKE=y
39CONFIG_FSL_BOOKE=y
40# CONFIG_PHYS_64BIT is not set
41CONFIG_SPE=y
42
43#
44# Code maturity level options
45#
46CONFIG_EXPERIMENTAL=y
47CONFIG_BROKEN_ON_SMP=y
48CONFIG_INIT_ENV_ARG_LIMIT=32
49
50#
51# General setup
52#
53CONFIG_LOCALVERSION=""
54CONFIG_LOCALVERSION_AUTO=y
55CONFIG_SWAP=y
56CONFIG_SYSVIPC=y
57# CONFIG_POSIX_MQUEUE is not set
58# CONFIG_BSD_PROCESS_ACCT is not set
59CONFIG_SYSCTL=y
60# CONFIG_AUDIT is not set
61# CONFIG_IKCONFIG is not set
62# CONFIG_RELAY is not set
63CONFIG_INITRAMFS_SOURCE=""
64# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
65CONFIG_EMBEDDED=y
66CONFIG_KALLSYMS=y
67# CONFIG_KALLSYMS_ALL is not set
68# CONFIG_KALLSYMS_EXTRA_PASS is not set
69CONFIG_HOTPLUG=y
70CONFIG_PRINTK=y
71CONFIG_BUG=y
72CONFIG_ELF_CORE=y
73CONFIG_BASE_FULL=y
74CONFIG_FUTEX=y
75CONFIG_EPOLL=y
76CONFIG_SHMEM=y
77CONFIG_SLAB=y
78# CONFIG_TINY_SHMEM is not set
79CONFIG_BASE_SMALL=0
80# CONFIG_SLOB is not set
81
82#
83# Loadable module support
84#
85# CONFIG_MODULES is not set
86
87#
88# Block layer
89#
90# CONFIG_LBD is not set
91# CONFIG_BLK_DEV_IO_TRACE is not set
92# CONFIG_LSF 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#
112# CONFIG_MPC8540_ADS is not set
113CONFIG_MPC85xx_CDS=y
114CONFIG_MPC8540=y
115CONFIG_PPC_INDIRECT_PCI_BE=y
116
117#
118# Kernel options
119#
120# CONFIG_HIGHMEM is not set
121# CONFIG_HZ_100 is not set
122CONFIG_HZ_250=y
123# CONFIG_HZ_1000 is not set
124CONFIG_HZ=250
125CONFIG_PREEMPT_NONE=y
126# CONFIG_PREEMPT_VOLUNTARY is not set
127# CONFIG_PREEMPT is not set
128CONFIG_BINFMT_ELF=y
129CONFIG_BINFMT_MISC=y
130CONFIG_MATH_EMULATION=y
131CONFIG_ARCH_FLATMEM_ENABLE=y
132CONFIG_SELECT_MEMORY_MODEL=y
133CONFIG_FLATMEM_MANUAL=y
134# CONFIG_DISCONTIGMEM_MANUAL is not set
135# CONFIG_SPARSEMEM_MANUAL is not set
136CONFIG_FLATMEM=y
137CONFIG_FLAT_NODE_MEM_MAP=y
138# CONFIG_SPARSEMEM_STATIC is not set
139CONFIG_SPLIT_PTLOCK_CPUS=4
140CONFIG_PROC_DEVICETREE=y
141# CONFIG_CMDLINE_BOOL is not set
142# CONFIG_PM is not set
143# CONFIG_SOFTWARE_SUSPEND is not set
144# CONFIG_SECCOMP is not set
145CONFIG_ISA_DMA_API=y
146
147#
148# Bus options
149#
150CONFIG_PPC_I8259=y
151CONFIG_PPC_INDIRECT_PCI=y
152CONFIG_FSL_SOC=y
153CONFIG_PCI=y
154CONFIG_PCI_DOMAINS=y
155# CONFIG_PCI_DEBUG is not set
156
157#
158# PCCARD (PCMCIA/CardBus) support
159#
160# CONFIG_PCCARD is not set
161
162#
163# PCI Hotplug Support
164#
165# CONFIG_HOTPLUG_PCI is not set
166
167#
168# Advanced setup
169#
170# CONFIG_ADVANCED_OPTIONS is not set
171
172#
173# Default settings for advanced configuration options are used
174#
175CONFIG_HIGHMEM_START=0xfe000000
176CONFIG_LOWMEM_SIZE=0x30000000
177CONFIG_KERNEL_START=0xc0000000
178CONFIG_TASK_SIZE=0x80000000
179CONFIG_BOOT_LOAD=0x00800000
180
181#
182# Networking
183#
184CONFIG_NET=y
185
186#
187# Networking options
188#
189# CONFIG_NETDEBUG is not set
190CONFIG_PACKET=y
191# CONFIG_PACKET_MMAP is not set
192CONFIG_UNIX=y
193# CONFIG_NET_KEY is not set
194CONFIG_INET=y
195CONFIG_IP_MULTICAST=y
196# CONFIG_IP_ADVANCED_ROUTER is not set
197CONFIG_IP_FIB_HASH=y
198CONFIG_IP_PNP=y
199CONFIG_IP_PNP_DHCP=y
200CONFIG_IP_PNP_BOOTP=y
201# CONFIG_IP_PNP_RARP is not set
202# CONFIG_NET_IPIP is not set
203# CONFIG_NET_IPGRE is not set
204# CONFIG_IP_MROUTE is not set
205# CONFIG_ARPD is not set
206CONFIG_SYN_COOKIES=y
207# CONFIG_INET_AH is not set
208# CONFIG_INET_ESP is not set
209# CONFIG_INET_IPCOMP is not set
210# CONFIG_INET_XFRM_TUNNEL is not set
211# CONFIG_INET_TUNNEL is not set
212CONFIG_INET_DIAG=y
213CONFIG_INET_TCP_DIAG=y
214# CONFIG_TCP_CONG_ADVANCED is not set
215CONFIG_TCP_CONG_BIC=y
216# CONFIG_IPV6 is not set
217# CONFIG_INET6_XFRM_TUNNEL is not set
218# CONFIG_INET6_TUNNEL is not set
219# CONFIG_NETFILTER is not set
220
221#
222# DCCP Configuration (EXPERIMENTAL)
223#
224# CONFIG_IP_DCCP is not set
225
226#
227# SCTP Configuration (EXPERIMENTAL)
228#
229# CONFIG_IP_SCTP is not set
230
231#
232# TIPC Configuration (EXPERIMENTAL)
233#
234# CONFIG_TIPC is not set
235# CONFIG_ATM is not set
236# CONFIG_BRIDGE is not set
237# CONFIG_VLAN_8021Q is not set
238# CONFIG_DECNET is not set
239# CONFIG_LLC2 is not set
240# CONFIG_IPX is not set
241# CONFIG_ATALK is not set
242# CONFIG_X25 is not set
243# CONFIG_LAPB is not set
244# CONFIG_NET_DIVERT is not set
245# CONFIG_ECONET is not set
246# CONFIG_WAN_ROUTER is not set
247
248#
249# QoS and/or fair queueing
250#
251# CONFIG_NET_SCHED is not set
252
253#
254# Network testing
255#
256# CONFIG_NET_PKTGEN is not set
257# CONFIG_HAMRADIO is not set
258# CONFIG_IRDA is not set
259# CONFIG_BT is not set
260# CONFIG_IEEE80211 is not set
261
262#
263# Device Drivers
264#
265
266#
267# Generic Driver Options
268#
269CONFIG_STANDALONE=y
270CONFIG_PREVENT_FIRMWARE_BUILD=y
271# CONFIG_FW_LOADER is not set
272# CONFIG_DEBUG_DRIVER is not set
273
274#
275# Connector - unified userspace <-> kernelspace linker
276#
277# CONFIG_CONNECTOR is not set
278
279#
280# Memory Technology Devices (MTD)
281#
282# CONFIG_MTD is not set
283
284#
285# Parallel port support
286#
287# CONFIG_PARPORT is not set
288
289#
290# Plug and Play support
291#
292
293#
294# Block devices
295#
296# CONFIG_BLK_DEV_FD is not set
297# CONFIG_BLK_CPQ_DA is not set
298# CONFIG_BLK_CPQ_CISS_DA is not set
299# CONFIG_BLK_DEV_DAC960 is not set
300# CONFIG_BLK_DEV_UMEM is not set
301# CONFIG_BLK_DEV_COW_COMMON is not set
302CONFIG_BLK_DEV_LOOP=y
303# CONFIG_BLK_DEV_CRYPTOLOOP is not set
304# CONFIG_BLK_DEV_NBD is not set
305# CONFIG_BLK_DEV_SX8 is not set
306CONFIG_BLK_DEV_RAM=y
307CONFIG_BLK_DEV_RAM_COUNT=16
308CONFIG_BLK_DEV_RAM_SIZE=32768
309CONFIG_BLK_DEV_INITRD=y
310# CONFIG_CDROM_PKTCDVD is not set
311# CONFIG_ATA_OVER_ETH is not set
312
313#
314# ATA/ATAPI/MFM/RLL support
315#
316CONFIG_IDE=y
317CONFIG_BLK_DEV_IDE=y
318
319#
320# Please see Documentation/ide.txt for help/info on IDE drives
321#
322# CONFIG_BLK_DEV_IDE_SATA is not set
323# CONFIG_BLK_DEV_IDEDISK is not set
324# CONFIG_IDEDISK_MULTI_MODE is not set
325# CONFIG_BLK_DEV_IDECD is not set
326# CONFIG_BLK_DEV_IDETAPE is not set
327# CONFIG_BLK_DEV_IDEFLOPPY is not set
328# CONFIG_IDE_TASK_IOCTL is not set
329
330#
331# IDE chipset support/bugfixes
332#
333CONFIG_IDE_GENERIC=y
334CONFIG_BLK_DEV_IDEPCI=y
335CONFIG_IDEPCI_SHARE_IRQ=y
336# CONFIG_BLK_DEV_OFFBOARD is not set
337CONFIG_BLK_DEV_GENERIC=y
338# CONFIG_BLK_DEV_OPTI621 is not set
339# CONFIG_BLK_DEV_SL82C105 is not set
340CONFIG_BLK_DEV_IDEDMA_PCI=y
341# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
342# CONFIG_IDEDMA_PCI_AUTO is not set
343# CONFIG_BLK_DEV_AEC62XX is not set
344# CONFIG_BLK_DEV_ALI15X3 is not set
345# CONFIG_BLK_DEV_AMD74XX is not set
346# CONFIG_BLK_DEV_CMD64X is not set
347# CONFIG_BLK_DEV_TRIFLEX is not set
348# CONFIG_BLK_DEV_CY82C693 is not set
349# CONFIG_BLK_DEV_CS5520 is not set
350# CONFIG_BLK_DEV_CS5530 is not set
351# CONFIG_BLK_DEV_HPT34X is not set
352# CONFIG_BLK_DEV_HPT366 is not set
353# CONFIG_BLK_DEV_SC1200 is not set
354# CONFIG_BLK_DEV_PIIX is not set
355# CONFIG_BLK_DEV_IT821X is not set
356# CONFIG_BLK_DEV_NS87415 is not set
357# CONFIG_BLK_DEV_PDC202XX_OLD is not set
358# CONFIG_BLK_DEV_PDC202XX_NEW is not set
359# CONFIG_BLK_DEV_SVWKS is not set
360# CONFIG_BLK_DEV_SIIMAGE is not set
361# CONFIG_BLK_DEV_SLC90E66 is not set
362# CONFIG_BLK_DEV_TRM290 is not set
363CONFIG_BLK_DEV_VIA82CXXX=y
364# CONFIG_IDE_ARM is not set
365CONFIG_BLK_DEV_IDEDMA=y
366# CONFIG_IDEDMA_IVB is not set
367# CONFIG_IDEDMA_AUTO is not set
368# CONFIG_BLK_DEV_HD is not set
369
370#
371# SCSI device support
372#
373# CONFIG_RAID_ATTRS is not set
374# CONFIG_SCSI is not set
375
376#
377# Multi-device support (RAID and LVM)
378#
379# CONFIG_MD is not set
380
381#
382# Fusion MPT device support
383#
384# CONFIG_FUSION is not set
385
386#
387# IEEE 1394 (FireWire) support
388#
389# CONFIG_IEEE1394 is not set
390
391#
392# I2O device support
393#
394# CONFIG_I2O is not set
395
396#
397# Macintosh device drivers
398#
399# CONFIG_WINDFARM is not set
400
401#
402# Network device support
403#
404CONFIG_NETDEVICES=y
405# CONFIG_DUMMY is not set
406# CONFIG_BONDING is not set
407# CONFIG_EQUALIZER is not set
408# CONFIG_TUN is not set
409
410#
411# ARCnet devices
412#
413# CONFIG_ARCNET is not set
414
415#
416# PHY device support
417#
418CONFIG_PHYLIB=y
419
420#
421# MII PHY device drivers
422#
423# CONFIG_MARVELL_PHY is not set
424# CONFIG_DAVICOM_PHY is not set
425# CONFIG_QSEMI_PHY is not set
426# CONFIG_LXT_PHY is not set
427# CONFIG_CICADA_PHY is not set
428
429#
430# Ethernet (10 or 100Mbit)
431#
432CONFIG_NET_ETHERNET=y
433CONFIG_MII=y
434# CONFIG_HAPPYMEAL is not set
435# CONFIG_SUNGEM is not set
436# CONFIG_CASSINI is not set
437# CONFIG_NET_VENDOR_3COM is not set
438
439#
440# Tulip family network device support
441#
442# CONFIG_NET_TULIP is not set
443# CONFIG_HP100 is not set
444# CONFIG_NET_PCI is not set
445
446#
447# Ethernet (1000 Mbit)
448#
449# CONFIG_ACENIC is not set
450# CONFIG_DL2K is not set
451CONFIG_E1000=y
452CONFIG_E1000_NAPI=y
453# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
454# CONFIG_NS83820 is not set
455# CONFIG_HAMACHI is not set
456# CONFIG_YELLOWFIN is not set
457# CONFIG_R8169 is not set
458# CONFIG_SIS190 is not set
459# CONFIG_SKGE is not set
460# CONFIG_SKY2 is not set
461# CONFIG_SK98LIN is not set
462# CONFIG_TIGON3 is not set
463# CONFIG_BNX2 is not set
464CONFIG_GIANFAR=y
465CONFIG_GFAR_NAPI=y
466
467#
468# Ethernet (10000 Mbit)
469#
470# CONFIG_CHELSIO_T1 is not set
471# CONFIG_IXGB is not set
472# CONFIG_S2IO is not set
473
474#
475# Token Ring devices
476#
477# CONFIG_TR is not set
478
479#
480# Wireless LAN (non-hamradio)
481#
482# CONFIG_NET_RADIO is not set
483
484#
485# Wan interfaces
486#
487# CONFIG_WAN is not set
488# CONFIG_FDDI is not set
489# CONFIG_HIPPI is not set
490# CONFIG_PPP is not set
491# CONFIG_SLIP is not set
492# CONFIG_SHAPER is not set
493# CONFIG_NETCONSOLE is not set
494# CONFIG_NETPOLL is not set
495# CONFIG_NET_POLL_CONTROLLER is not set
496
497#
498# ISDN subsystem
499#
500# CONFIG_ISDN is not set
501
502#
503# Telephony Support
504#
505# CONFIG_PHONE is not set
506
507#
508# Input device support
509#
510CONFIG_INPUT=y
511
512#
513# Userland interfaces
514#
515# CONFIG_INPUT_MOUSEDEV is not set
516# CONFIG_INPUT_JOYDEV is not set
517# CONFIG_INPUT_TSDEV is not set
518# CONFIG_INPUT_EVDEV is not set
519# CONFIG_INPUT_EVBUG is not set
520
521#
522# Input Device Drivers
523#
524# CONFIG_INPUT_KEYBOARD is not set
525# CONFIG_INPUT_MOUSE is not set
526# CONFIG_INPUT_JOYSTICK is not set
527# CONFIG_INPUT_TOUCHSCREEN is not set
528# CONFIG_INPUT_MISC is not set
529
530#
531# Hardware I/O ports
532#
533# CONFIG_SERIO is not set
534# CONFIG_GAMEPORT is not set
535
536#
537# Character devices
538#
539# CONFIG_VT is not set
540# CONFIG_SERIAL_NONSTANDARD is not set
541
542#
543# Serial drivers
544#
545CONFIG_SERIAL_8250=y
546CONFIG_SERIAL_8250_CONSOLE=y
547CONFIG_SERIAL_8250_PCI=y
548CONFIG_SERIAL_8250_NR_UARTS=4
549CONFIG_SERIAL_8250_RUNTIME_UARTS=4
550# CONFIG_SERIAL_8250_EXTENDED is not set
551
552#
553# Non-8250 serial port support
554#
555CONFIG_SERIAL_CORE=y
556CONFIG_SERIAL_CORE_CONSOLE=y
557# CONFIG_SERIAL_JSM is not set
558CONFIG_UNIX98_PTYS=y
559CONFIG_LEGACY_PTYS=y
560CONFIG_LEGACY_PTY_COUNT=256
561
562#
563# IPMI
564#
565# CONFIG_IPMI_HANDLER is not set
566
567#
568# Watchdog Cards
569#
570# CONFIG_WATCHDOG is not set
571# CONFIG_NVRAM is not set
572CONFIG_GEN_RTC=y
573# CONFIG_GEN_RTC_X is not set
574# CONFIG_DTLK is not set
575# CONFIG_R3964 is not set
576# CONFIG_APPLICOM is not set
577
578#
579# Ftape, the floppy tape device driver
580#
581# CONFIG_AGP is not set
582# CONFIG_DRM is not set
583# CONFIG_RAW_DRIVER is not set
584
585#
586# TPM devices
587#
588# CONFIG_TCG_TPM is not set
589# CONFIG_TELCLOCK is not set
590
591#
592# I2C support
593#
594# CONFIG_I2C is not set
595
596#
597# SPI support
598#
599# CONFIG_SPI is not set
600# CONFIG_SPI_MASTER is not set
601
602#
603# Dallas's 1-wire bus
604#
605# CONFIG_W1 is not set
606
607#
608# Hardware Monitoring support
609#
610CONFIG_HWMON=y
611# CONFIG_HWMON_VID is not set
612# CONFIG_SENSORS_F71805F is not set
613# CONFIG_HWMON_DEBUG_CHIP is not set
614
615#
616# Misc devices
617#
618
619#
620# Multimedia devices
621#
622# CONFIG_VIDEO_DEV is not set
623
624#
625# Digital Video Broadcasting Devices
626#
627# CONFIG_DVB is not set
628
629#
630# Graphics support
631#
632# CONFIG_FB is not set
633
634#
635# Sound
636#
637# CONFIG_SOUND is not set
638
639#
640# USB support
641#
642CONFIG_USB_ARCH_HAS_HCD=y
643CONFIG_USB_ARCH_HAS_OHCI=y
644CONFIG_USB_ARCH_HAS_EHCI=y
645# CONFIG_USB is not set
646
647#
648# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
649#
650
651#
652# USB Gadget Support
653#
654# CONFIG_USB_GADGET is not set
655
656#
657# MMC/SD Card support
658#
659# CONFIG_MMC is not set
660
661#
662# LED devices
663#
664# CONFIG_NEW_LEDS is not set
665
666#
667# InfiniBand support
668#
669# CONFIG_INFINIBAND is not set
670
671#
672# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
673#
674
675#
676# Real Time Clock
677#
678# CONFIG_RTC_CLASS is not set
679
680#
681# File systems
682#
683CONFIG_EXT2_FS=y
684# CONFIG_EXT2_FS_XATTR is not set
685# CONFIG_EXT2_FS_XIP is not set
686CONFIG_EXT3_FS=y
687CONFIG_EXT3_FS_XATTR=y
688# CONFIG_EXT3_FS_POSIX_ACL is not set
689# CONFIG_EXT3_FS_SECURITY is not set
690CONFIG_JBD=y
691# CONFIG_JBD_DEBUG is not set
692CONFIG_FS_MBCACHE=y
693# CONFIG_REISERFS_FS is not set
694# CONFIG_JFS_FS is not set
695# CONFIG_FS_POSIX_ACL is not set
696# CONFIG_XFS_FS is not set
697# CONFIG_OCFS2_FS is not set
698# CONFIG_MINIX_FS is not set
699# CONFIG_ROMFS_FS is not set
700CONFIG_INOTIFY=y
701# CONFIG_QUOTA is not set
702CONFIG_DNOTIFY=y
703# CONFIG_AUTOFS_FS is not set
704# CONFIG_AUTOFS4_FS is not set
705# CONFIG_FUSE_FS is not set
706
707#
708# CD-ROM/DVD Filesystems
709#
710# CONFIG_ISO9660_FS is not set
711# CONFIG_UDF_FS is not set
712
713#
714# DOS/FAT/NT Filesystems
715#
716# CONFIG_MSDOS_FS is not set
717# CONFIG_VFAT_FS is not set
718# CONFIG_NTFS_FS is not set
719
720#
721# Pseudo filesystems
722#
723CONFIG_PROC_FS=y
724CONFIG_PROC_KCORE=y
725CONFIG_SYSFS=y
726CONFIG_TMPFS=y
727# CONFIG_HUGETLB_PAGE is not set
728CONFIG_RAMFS=y
729# CONFIG_CONFIGFS_FS is not set
730
731#
732# Miscellaneous filesystems
733#
734# CONFIG_ADFS_FS is not set
735# CONFIG_AFFS_FS is not set
736# CONFIG_HFS_FS is not set
737# CONFIG_HFSPLUS_FS is not set
738# CONFIG_BEFS_FS is not set
739# CONFIG_BFS_FS is not set
740# CONFIG_EFS_FS is not set
741# CONFIG_CRAMFS is not set
742# CONFIG_VXFS_FS is not set
743# CONFIG_HPFS_FS is not set
744# CONFIG_QNX4FS_FS is not set
745# CONFIG_SYSV_FS is not set
746# CONFIG_UFS_FS is not set
747
748#
749# Network File Systems
750#
751CONFIG_NFS_FS=y
752# CONFIG_NFS_V3 is not set
753# CONFIG_NFS_V4 is not set
754# CONFIG_NFS_DIRECTIO is not set
755# CONFIG_NFSD is not set
756CONFIG_ROOT_NFS=y
757CONFIG_LOCKD=y
758CONFIG_NFS_COMMON=y
759CONFIG_SUNRPC=y
760# CONFIG_RPCSEC_GSS_KRB5 is not set
761# CONFIG_RPCSEC_GSS_SPKM3 is not set
762# CONFIG_SMB_FS is not set
763# CONFIG_CIFS is not set
764# CONFIG_NCP_FS is not set
765# CONFIG_CODA_FS is not set
766# CONFIG_AFS_FS is not set
767# CONFIG_9P_FS is not set
768
769#
770# Partition Types
771#
772CONFIG_PARTITION_ADVANCED=y
773# CONFIG_ACORN_PARTITION is not set
774# CONFIG_OSF_PARTITION is not set
775# CONFIG_AMIGA_PARTITION is not set
776# CONFIG_ATARI_PARTITION is not set
777# CONFIG_MAC_PARTITION is not set
778# CONFIG_MSDOS_PARTITION is not set
779# CONFIG_LDM_PARTITION is not set
780# CONFIG_SGI_PARTITION is not set
781# CONFIG_ULTRIX_PARTITION is not set
782# CONFIG_SUN_PARTITION is not set
783# CONFIG_KARMA_PARTITION is not set
784# CONFIG_EFI_PARTITION is not set
785
786#
787# Native Language Support
788#
789# CONFIG_NLS is not set
790
791#
792# Library routines
793#
794# CONFIG_CRC_CCITT is not set
795# CONFIG_CRC16 is not set
796CONFIG_CRC32=y
797# CONFIG_LIBCRC32C is not set
798
799#
800# Instrumentation Support
801#
802# CONFIG_PROFILING is not set
803
804#
805# Kernel hacking
806#
807# CONFIG_PRINTK_TIME is not set
808# CONFIG_MAGIC_SYSRQ is not set
809CONFIG_DEBUG_KERNEL=y
810CONFIG_LOG_BUF_SHIFT=14
811CONFIG_DETECT_SOFTLOCKUP=y
812# CONFIG_SCHEDSTATS is not set
813# CONFIG_DEBUG_SLAB is not set
814CONFIG_DEBUG_MUTEXES=y
815# CONFIG_DEBUG_SPINLOCK is not set
816# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
817# CONFIG_DEBUG_KOBJECT is not set
818# CONFIG_DEBUG_INFO is not set
819# CONFIG_DEBUG_FS is not set
820# CONFIG_DEBUG_VM is not set
821# CONFIG_UNWIND_INFO is not set
822CONFIG_FORCED_INLINING=y
823# CONFIG_RCU_TORTURE_TEST is not set
824# CONFIG_DEBUGGER is not set
825# CONFIG_BDI_SWITCH is not set
826# CONFIG_BOOTX_TEXT is not set
827# CONFIG_PPC_EARLY_DEBUG_LPAR is not set
828# CONFIG_PPC_EARLY_DEBUG_G5 is not set
829# CONFIG_PPC_EARLY_DEBUG_RTAS is not set
830# CONFIG_PPC_EARLY_DEBUG_MAPLE is not set
831# CONFIG_PPC_EARLY_DEBUG_ISERIES is not set
832
833#
834# Security options
835#
836# CONFIG_KEYS is not set
837# CONFIG_SECURITY is not set
838
839#
840# Cryptographic options
841#
842# CONFIG_CRYPTO is not set
843
844#
845# Hardware crypto devices
846#
diff --git a/arch/powerpc/kernel/cpu_setup_power4.S b/arch/powerpc/kernel/cpu_setup_power4.S
index b61d86e7ceb6..271418308d53 100644
--- a/arch/powerpc/kernel/cpu_setup_power4.S
+++ b/arch/powerpc/kernel/cpu_setup_power4.S
@@ -73,23 +73,6 @@ _GLOBAL(__970_cpu_preinit)
73 isync 73 isync
74 blr 74 blr
75 75
76_GLOBAL(__setup_cpu_power4)
77 blr
78
79_GLOBAL(__setup_cpu_be)
80 /* Set large page sizes LP=0: 16MB, LP=1: 64KB */
81 addi r3, 0, 0
82 ori r3, r3, HID6_LB
83 sldi r3, r3, 32
84 nor r3, r3, r3
85 mfspr r4, SPRN_HID6
86 and r4, r4, r3
87 addi r3, 0, 0x02000
88 sldi r3, r3, 32
89 or r4, r4, r3
90 mtspr SPRN_HID6, r4
91 blr
92
93_GLOBAL(__setup_cpu_ppc970) 76_GLOBAL(__setup_cpu_ppc970)
94 mfspr r0,SPRN_HID0 77 mfspr r0,SPRN_HID0
95 li r11,5 /* clear DOZE and SLEEP */ 78 li r11,5 /* clear DOZE and SLEEP */
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 3f7182db9ed5..0c487ee4d483 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -30,11 +30,7 @@ EXPORT_SYMBOL(cur_cpu_spec);
30 * part of the cputable though. That has to be fixed for both ppc32 30 * part of the cputable though. That has to be fixed for both ppc32
31 * and ppc64 31 * and ppc64
32 */ 32 */
33#ifdef CONFIG_PPC64 33#ifdef CONFIG_PPC32
34extern void __setup_cpu_power3(unsigned long offset, struct cpu_spec* spec);
35extern void __setup_cpu_power4(unsigned long offset, struct cpu_spec* spec);
36extern void __setup_cpu_be(unsigned long offset, struct cpu_spec* spec);
37#else
38extern void __setup_cpu_603(unsigned long offset, struct cpu_spec* spec); 34extern void __setup_cpu_603(unsigned long offset, struct cpu_spec* spec);
39extern void __setup_cpu_604(unsigned long offset, struct cpu_spec* spec); 35extern void __setup_cpu_604(unsigned long offset, struct cpu_spec* spec);
40extern void __setup_cpu_750(unsigned long offset, struct cpu_spec* spec); 36extern void __setup_cpu_750(unsigned long offset, struct cpu_spec* spec);
@@ -82,7 +78,6 @@ struct cpu_spec cpu_specs[] = {
82 .icache_bsize = 128, 78 .icache_bsize = 128,
83 .dcache_bsize = 128, 79 .dcache_bsize = 128,
84 .num_pmcs = 8, 80 .num_pmcs = 8,
85 .cpu_setup = __setup_cpu_power3,
86 .oprofile_cpu_type = "ppc64/power3", 81 .oprofile_cpu_type = "ppc64/power3",
87 .oprofile_type = PPC_OPROFILE_RS64, 82 .oprofile_type = PPC_OPROFILE_RS64,
88 .platform = "power3", 83 .platform = "power3",
@@ -96,7 +91,6 @@ struct cpu_spec cpu_specs[] = {
96 .icache_bsize = 128, 91 .icache_bsize = 128,
97 .dcache_bsize = 128, 92 .dcache_bsize = 128,
98 .num_pmcs = 8, 93 .num_pmcs = 8,
99 .cpu_setup = __setup_cpu_power3,
100 .oprofile_cpu_type = "ppc64/power3", 94 .oprofile_cpu_type = "ppc64/power3",
101 .oprofile_type = PPC_OPROFILE_RS64, 95 .oprofile_type = PPC_OPROFILE_RS64,
102 .platform = "power3", 96 .platform = "power3",
@@ -110,7 +104,6 @@ struct cpu_spec cpu_specs[] = {
110 .icache_bsize = 128, 104 .icache_bsize = 128,
111 .dcache_bsize = 128, 105 .dcache_bsize = 128,
112 .num_pmcs = 8, 106 .num_pmcs = 8,
113 .cpu_setup = __setup_cpu_power3,
114 .oprofile_cpu_type = "ppc64/rs64", 107 .oprofile_cpu_type = "ppc64/rs64",
115 .oprofile_type = PPC_OPROFILE_RS64, 108 .oprofile_type = PPC_OPROFILE_RS64,
116 .platform = "rs64", 109 .platform = "rs64",
@@ -124,7 +117,6 @@ struct cpu_spec cpu_specs[] = {
124 .icache_bsize = 128, 117 .icache_bsize = 128,
125 .dcache_bsize = 128, 118 .dcache_bsize = 128,
126 .num_pmcs = 8, 119 .num_pmcs = 8,
127 .cpu_setup = __setup_cpu_power3,
128 .oprofile_cpu_type = "ppc64/rs64", 120 .oprofile_cpu_type = "ppc64/rs64",
129 .oprofile_type = PPC_OPROFILE_RS64, 121 .oprofile_type = PPC_OPROFILE_RS64,
130 .platform = "rs64", 122 .platform = "rs64",
@@ -138,7 +130,6 @@ struct cpu_spec cpu_specs[] = {
138 .icache_bsize = 128, 130 .icache_bsize = 128,
139 .dcache_bsize = 128, 131 .dcache_bsize = 128,
140 .num_pmcs = 8, 132 .num_pmcs = 8,
141 .cpu_setup = __setup_cpu_power3,
142 .oprofile_cpu_type = "ppc64/rs64", 133 .oprofile_cpu_type = "ppc64/rs64",
143 .oprofile_type = PPC_OPROFILE_RS64, 134 .oprofile_type = PPC_OPROFILE_RS64,
144 .platform = "rs64", 135 .platform = "rs64",
@@ -152,7 +143,6 @@ struct cpu_spec cpu_specs[] = {
152 .icache_bsize = 128, 143 .icache_bsize = 128,
153 .dcache_bsize = 128, 144 .dcache_bsize = 128,
154 .num_pmcs = 8, 145 .num_pmcs = 8,
155 .cpu_setup = __setup_cpu_power3,
156 .oprofile_cpu_type = "ppc64/rs64", 146 .oprofile_cpu_type = "ppc64/rs64",
157 .oprofile_type = PPC_OPROFILE_RS64, 147 .oprofile_type = PPC_OPROFILE_RS64,
158 .platform = "rs64", 148 .platform = "rs64",
@@ -166,7 +156,6 @@ struct cpu_spec cpu_specs[] = {
166 .icache_bsize = 128, 156 .icache_bsize = 128,
167 .dcache_bsize = 128, 157 .dcache_bsize = 128,
168 .num_pmcs = 8, 158 .num_pmcs = 8,
169 .cpu_setup = __setup_cpu_power4,
170 .oprofile_cpu_type = "ppc64/power4", 159 .oprofile_cpu_type = "ppc64/power4",
171 .oprofile_type = PPC_OPROFILE_POWER4, 160 .oprofile_type = PPC_OPROFILE_POWER4,
172 .platform = "power4", 161 .platform = "power4",
@@ -180,7 +169,6 @@ struct cpu_spec cpu_specs[] = {
180 .icache_bsize = 128, 169 .icache_bsize = 128,
181 .dcache_bsize = 128, 170 .dcache_bsize = 128,
182 .num_pmcs = 8, 171 .num_pmcs = 8,
183 .cpu_setup = __setup_cpu_power4,
184 .oprofile_cpu_type = "ppc64/power4", 172 .oprofile_cpu_type = "ppc64/power4",
185 .oprofile_type = PPC_OPROFILE_POWER4, 173 .oprofile_type = PPC_OPROFILE_POWER4,
186 .platform = "power4", 174 .platform = "power4",
@@ -246,7 +234,6 @@ struct cpu_spec cpu_specs[] = {
246 .icache_bsize = 128, 234 .icache_bsize = 128,
247 .dcache_bsize = 128, 235 .dcache_bsize = 128,
248 .num_pmcs = 6, 236 .num_pmcs = 6,
249 .cpu_setup = __setup_cpu_power4,
250 .oprofile_cpu_type = "ppc64/power5", 237 .oprofile_cpu_type = "ppc64/power5",
251 .oprofile_type = PPC_OPROFILE_POWER4, 238 .oprofile_type = PPC_OPROFILE_POWER4,
252 .platform = "power5", 239 .platform = "power5",
@@ -260,7 +247,6 @@ struct cpu_spec cpu_specs[] = {
260 .icache_bsize = 128, 247 .icache_bsize = 128,
261 .dcache_bsize = 128, 248 .dcache_bsize = 128,
262 .num_pmcs = 6, 249 .num_pmcs = 6,
263 .cpu_setup = __setup_cpu_power4,
264 .oprofile_cpu_type = "ppc64/power5+", 250 .oprofile_cpu_type = "ppc64/power5+",
265 .oprofile_type = PPC_OPROFILE_POWER4, 251 .oprofile_type = PPC_OPROFILE_POWER4,
266 .platform = "power5+", 252 .platform = "power5+",
@@ -274,7 +260,6 @@ struct cpu_spec cpu_specs[] = {
274 .icache_bsize = 128, 260 .icache_bsize = 128,
275 .dcache_bsize = 128, 261 .dcache_bsize = 128,
276 .num_pmcs = 6, 262 .num_pmcs = 6,
277 .cpu_setup = __setup_cpu_power4,
278 .oprofile_cpu_type = "ppc64/power6", 263 .oprofile_cpu_type = "ppc64/power6",
279 .oprofile_type = PPC_OPROFILE_POWER4, 264 .oprofile_type = PPC_OPROFILE_POWER4,
280 .platform = "power6", 265 .platform = "power6",
@@ -289,7 +274,6 @@ struct cpu_spec cpu_specs[] = {
289 PPC_FEATURE_SMT, 274 PPC_FEATURE_SMT,
290 .icache_bsize = 128, 275 .icache_bsize = 128,
291 .dcache_bsize = 128, 276 .dcache_bsize = 128,
292 .cpu_setup = __setup_cpu_be,
293 .platform = "ppc-cell-be", 277 .platform = "ppc-cell-be",
294 }, 278 },
295 { /* default match */ 279 { /* default match */
@@ -301,7 +285,6 @@ struct cpu_spec cpu_specs[] = {
301 .icache_bsize = 128, 285 .icache_bsize = 128,
302 .dcache_bsize = 128, 286 .dcache_bsize = 128,
303 .num_pmcs = 6, 287 .num_pmcs = 6,
304 .cpu_setup = __setup_cpu_power4,
305 .platform = "power4", 288 .platform = "power4",
306 } 289 }
307#endif /* CONFIG_PPC64 */ 290#endif /* CONFIG_PPC64 */
diff --git a/arch/powerpc/kernel/crash.c b/arch/powerpc/kernel/crash.c
index 778f22fd85d2..dbcb85994f46 100644
--- a/arch/powerpc/kernel/crash.c
+++ b/arch/powerpc/kernel/crash.c
@@ -22,6 +22,7 @@
22#include <linux/elf.h> 22#include <linux/elf.h>
23#include <linux/elfcore.h> 23#include <linux/elfcore.h>
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/irq.h>
25#include <linux/types.h> 26#include <linux/types.h>
26 27
27#include <asm/processor.h> 28#include <asm/processor.h>
@@ -174,6 +175,8 @@ static void crash_kexec_prepare_cpus(void)
174 175
175void default_machine_crash_shutdown(struct pt_regs *regs) 176void default_machine_crash_shutdown(struct pt_regs *regs)
176{ 177{
178 unsigned int irq;
179
177 /* 180 /*
178 * This function is only called after the system 181 * This function is only called after the system
179 * has paniced or is otherwise in a critical state. 182 * has paniced or is otherwise in a critical state.
@@ -186,6 +189,16 @@ void default_machine_crash_shutdown(struct pt_regs *regs)
186 */ 189 */
187 local_irq_disable(); 190 local_irq_disable();
188 191
192 for_each_irq(irq) {
193 struct irq_desc *desc = irq_descp(irq);
194
195 if (desc->status & IRQ_INPROGRESS)
196 desc->handler->end(irq);
197
198 if (!(desc->status & IRQ_DISABLED))
199 desc->handler->disable(irq);
200 }
201
189 if (ppc_md.kexec_cpu_down) 202 if (ppc_md.kexec_cpu_down)
190 ppc_md.kexec_cpu_down(1, 0); 203 ppc_md.kexec_cpu_down(1, 0);
191 204
diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c
index 764d07329716..371973be8d71 100644
--- a/arch/powerpc/kernel/crash_dump.c
+++ b/arch/powerpc/kernel/crash_dump.c
@@ -25,6 +25,11 @@
25#define DBG(fmt...) 25#define DBG(fmt...)
26#endif 26#endif
27 27
28void reserve_kdump_trampoline(void)
29{
30 lmb_reserve(0, KDUMP_RESERVE_LIMIT);
31}
32
28static void __init create_trampoline(unsigned long addr) 33static void __init create_trampoline(unsigned long addr)
29{ 34{
30 /* The maximum range of a single instruction branch, is the current 35 /* The maximum range of a single instruction branch, is the current
@@ -39,11 +44,11 @@ static void __init create_trampoline(unsigned long addr)
39 create_branch(addr + 4, addr + PHYSICAL_START, 0); 44 create_branch(addr + 4, addr + PHYSICAL_START, 0);
40} 45}
41 46
42void __init kdump_setup(void) 47void __init setup_kdump_trampoline(void)
43{ 48{
44 unsigned long i; 49 unsigned long i;
45 50
46 DBG(" -> kdump_setup()\n"); 51 DBG(" -> setup_kdump_trampoline()\n");
47 52
48 for (i = KDUMP_TRAMPOLINE_START; i < KDUMP_TRAMPOLINE_END; i += 8) { 53 for (i = KDUMP_TRAMPOLINE_START; i < KDUMP_TRAMPOLINE_END; i += 8) {
49 create_trampoline(i); 54 create_trampoline(i);
@@ -52,7 +57,7 @@ void __init kdump_setup(void)
52 create_trampoline(__pa(system_reset_fwnmi) - PHYSICAL_START); 57 create_trampoline(__pa(system_reset_fwnmi) - PHYSICAL_START);
53 create_trampoline(__pa(machine_check_fwnmi) - PHYSICAL_START); 58 create_trampoline(__pa(machine_check_fwnmi) - PHYSICAL_START);
54 59
55 DBG(" <- kdump_setup()\n"); 60 DBG(" <- setup_kdump_trampoline()\n");
56} 61}
57 62
58#ifdef CONFIG_PROC_VMCORE 63#ifdef CONFIG_PROC_VMCORE
diff --git a/arch/powerpc/kernel/iomap.c b/arch/powerpc/kernel/iomap.c
index fd8214caedee..a13a93dfc655 100644
--- a/arch/powerpc/kernel/iomap.c
+++ b/arch/powerpc/kernel/iomap.c
@@ -106,8 +106,6 @@ EXPORT_SYMBOL(iowrite32_rep);
106 106
107void __iomem *ioport_map(unsigned long port, unsigned int len) 107void __iomem *ioport_map(unsigned long port, unsigned int len)
108{ 108{
109 if (!_IO_IS_VALID(port))
110 return NULL;
111 return (void __iomem *) (port+pci_io_base); 109 return (void __iomem *) (port+pci_io_base);
112} 110}
113 111
diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c
index 2cbde865d4f5..c02deaab26c7 100644
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -521,10 +521,10 @@ static ssize_t lparcfg_write(struct file *file, const char __user * buf,
521 521
522 current_weight = (resource >> 5 * 8) & 0xFF; 522 current_weight = (resource >> 5 * 8) & 0xFF;
523 523
524 pr_debug("%s: current_entitled = %lu, current_weight = %lu\n", 524 pr_debug("%s: current_entitled = %lu, current_weight = %u\n",
525 __FUNCTION__, current_entitled, current_weight); 525 __FUNCTION__, current_entitled, current_weight);
526 526
527 pr_debug("%s: new_entitled = %lu, new_weight = %lu\n", 527 pr_debug("%s: new_entitled = %lu, new_weight = %u\n",
528 __FUNCTION__, *new_entitled_ptr, *new_weight_ptr); 528 __FUNCTION__, *new_entitled_ptr, *new_weight_ptr);
529 529
530 retval = plpar_hcall_norets(H_SET_PPP, *new_entitled_ptr, 530 retval = plpar_hcall_norets(H_SET_PPP, *new_entitled_ptr,
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
index ee166c586642..a8fa04ef27cd 100644
--- a/arch/powerpc/kernel/machine_kexec_64.c
+++ b/arch/powerpc/kernel/machine_kexec_64.c
@@ -21,6 +21,7 @@
21#include <asm/machdep.h> 21#include <asm/machdep.h>
22#include <asm/cacheflush.h> 22#include <asm/cacheflush.h>
23#include <asm/paca.h> 23#include <asm/paca.h>
24#include <asm/lmb.h>
24#include <asm/mmu.h> 25#include <asm/mmu.h>
25#include <asm/sections.h> /* _end */ 26#include <asm/sections.h> /* _end */
26#include <asm/prom.h> 27#include <asm/prom.h>
@@ -335,7 +336,105 @@ static void __init export_htab_values(void)
335 of_node_put(node); 336 of_node_put(node);
336} 337}
337 338
339static struct property crashk_base_prop = {
340 .name = "linux,crashkernel-base",
341 .length = sizeof(unsigned long),
342 .value = (unsigned char *)&crashk_res.start,
343};
344
345static unsigned long crashk_size;
346
347static struct property crashk_size_prop = {
348 .name = "linux,crashkernel-size",
349 .length = sizeof(unsigned long),
350 .value = (unsigned char *)&crashk_size,
351};
352
353static void __init export_crashk_values(void)
354{
355 struct device_node *node;
356 struct property *prop;
357
358 node = of_find_node_by_path("/chosen");
359 if (!node)
360 return;
361
362 /* There might be existing crash kernel properties, but we can't
363 * be sure what's in them, so remove them. */
364 prop = of_find_property(node, "linux,crashkernel-base", NULL);
365 if (prop)
366 prom_remove_property(node, prop);
367
368 prop = of_find_property(node, "linux,crashkernel-size", NULL);
369 if (prop)
370 prom_remove_property(node, prop);
371
372 if (crashk_res.start != 0) {
373 prom_add_property(node, &crashk_base_prop);
374 crashk_size = crashk_res.end - crashk_res.start + 1;
375 prom_add_property(node, &crashk_size_prop);
376 }
377
378 of_node_put(node);
379}
380
338void __init kexec_setup(void) 381void __init kexec_setup(void)
339{ 382{
340 export_htab_values(); 383 export_htab_values();
384 export_crashk_values();
385}
386
387static int __init early_parse_crashk(char *p)
388{
389 unsigned long size;
390
391 if (!p)
392 return 1;
393
394 size = memparse(p, &p);
395
396 if (*p == '@')
397 crashk_res.start = memparse(p + 1, &p);
398 else
399 crashk_res.start = KDUMP_KERNELBASE;
400
401 crashk_res.end = crashk_res.start + size - 1;
402
403 return 0;
404}
405early_param("crashkernel", early_parse_crashk);
406
407void __init reserve_crashkernel(void)
408{
409 unsigned long size;
410
411 if (crashk_res.start == 0)
412 return;
413
414 /* We might have got these values via the command line or the
415 * device tree, either way sanitise them now. */
416
417 size = crashk_res.end - crashk_res.start + 1;
418
419 if (crashk_res.start != KDUMP_KERNELBASE)
420 printk("Crash kernel location must be 0x%x\n",
421 KDUMP_KERNELBASE);
422
423 crashk_res.start = KDUMP_KERNELBASE;
424 size = PAGE_ALIGN(size);
425 crashk_res.end = crashk_res.start + size - 1;
426
427 /* Crash kernel trumps memory limit */
428 if (memory_limit && memory_limit <= crashk_res.end) {
429 memory_limit = crashk_res.end + 1;
430 printk("Adjusted memory limit for crashkernel, now 0x%lx\n",
431 memory_limit);
432 }
433
434 lmb_reserve(crashk_res.start, size);
435}
436
437int overlaps_crashkernel(unsigned long start, unsigned long size)
438{
439 return (start + size) > crashk_res.start && start <= crashk_res.end;
341} 440}
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index be982023409e..01d3916c4cb1 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -216,7 +216,7 @@ _GLOBAL(call_setup_cpu)
216 lwz r4,0(r4) 216 lwz r4,0(r4)
217 add r4,r4,r3 217 add r4,r4,r3
218 lwz r5,CPU_SPEC_SETUP(r4) 218 lwz r5,CPU_SPEC_SETUP(r4)
219 cmpi 0,r5,0 219 cmpwi 0,r5,0
220 add r5,r5,r3 220 add r5,r5,r3
221 beqlr 221 beqlr
222 mtctr r5 222 mtctr r5
diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
index 2778cce058e2..e8883d42c43c 100644
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -482,7 +482,9 @@ _GLOBAL(identify_cpu)
482 sub r0,r3,r5 482 sub r0,r3,r5
483 std r0,0(r4) 483 std r0,0(r4)
484 ld r4,CPU_SPEC_SETUP(r3) 484 ld r4,CPU_SPEC_SETUP(r3)
485 cmpdi 0,r4,0
485 add r4,r4,r5 486 add r4,r4,r5
487 beqlr
486 ld r4,0(r4) 488 ld r4,0(r4)
487 add r4,r4,r5 489 add r4,r4,r5
488 mtctr r4 490 mtctr r4
@@ -768,9 +770,6 @@ _GLOBAL(giveup_altivec)
768 770
769#endif /* CONFIG_ALTIVEC */ 771#endif /* CONFIG_ALTIVEC */
770 772
771_GLOBAL(__setup_cpu_power3)
772 blr
773
774_GLOBAL(execve) 773_GLOBAL(execve)
775 li r0,__NR_execve 774 li r0,__NR_execve
776 sc 775 sc
diff --git a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c
index ada50aa5b600..6960f090991e 100644
--- a/arch/powerpc/kernel/nvram_64.c
+++ b/arch/powerpc/kernel/nvram_64.c
@@ -204,7 +204,7 @@ static void nvram_print_partitions(char * label)
204 printk(KERN_WARNING "indx\t\tsig\tchks\tlen\tname\n"); 204 printk(KERN_WARNING "indx\t\tsig\tchks\tlen\tname\n");
205 list_for_each(p, &nvram_part->partition) { 205 list_for_each(p, &nvram_part->partition) {
206 tmp_part = list_entry(p, struct nvram_partition, partition); 206 tmp_part = list_entry(p, struct nvram_partition, partition);
207 printk(KERN_WARNING "%d \t%02x\t%02x\t%d\t%s\n", 207 printk(KERN_WARNING "%4d \t%02x\t%02x\t%d\t%s\n",
208 tmp_part->index, tmp_part->header.signature, 208 tmp_part->index, tmp_part->header.signature,
209 tmp_part->header.checksum, tmp_part->header.length, 209 tmp_part->header.checksum, tmp_part->header.length,
210 tmp_part->header.name); 210 tmp_part->header.name);
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 4c4449be81ce..30a4e6a1368a 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -42,14 +42,6 @@
42unsigned long pci_probe_only = 1; 42unsigned long pci_probe_only = 1;
43int pci_assign_all_buses = 0; 43int pci_assign_all_buses = 0;
44 44
45/*
46 * legal IO pages under MAX_ISA_PORT. This is to ensure we don't touch
47 * devices we don't have access to.
48 */
49unsigned long io_page_mask;
50
51EXPORT_SYMBOL(io_page_mask);
52
53#ifdef CONFIG_PPC_MULTIPLATFORM 45#ifdef CONFIG_PPC_MULTIPLATFORM
54static void fixup_resource(struct resource *res, struct pci_dev *dev); 46static void fixup_resource(struct resource *res, struct pci_dev *dev);
55static void do_bus_setup(struct pci_bus *bus); 47static void do_bus_setup(struct pci_bus *bus);
@@ -605,7 +597,7 @@ static int __init pcibios_init(void)
605 iSeries_pcibios_init(); 597 iSeries_pcibios_init();
606#endif 598#endif
607 599
608 printk("PCI: Probing PCI hardware\n"); 600 printk(KERN_DEBUG "PCI: Probing PCI hardware\n");
609 601
610 /* Scan all of the recorded PCI controllers. */ 602 /* Scan all of the recorded PCI controllers. */
611 list_for_each_entry_safe(hose, tmp, &hose_list, list_node) { 603 list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
@@ -630,14 +622,14 @@ static int __init pcibios_init(void)
630 /* Cache the location of the ISA bridge (if we have one) */ 622 /* Cache the location of the ISA bridge (if we have one) */
631 ppc64_isabridge_dev = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, NULL); 623 ppc64_isabridge_dev = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, NULL);
632 if (ppc64_isabridge_dev != NULL) 624 if (ppc64_isabridge_dev != NULL)
633 printk("ISA bridge at %s\n", pci_name(ppc64_isabridge_dev)); 625 printk(KERN_DEBUG "ISA bridge at %s\n", pci_name(ppc64_isabridge_dev));
634 626
635#ifdef CONFIG_PPC_MULTIPLATFORM 627#ifdef CONFIG_PPC_MULTIPLATFORM
636 /* map in PCI I/O space */ 628 /* map in PCI I/O space */
637 phbs_remap_io(); 629 phbs_remap_io();
638#endif 630#endif
639 631
640 printk("PCI: Probing PCI hardware done\n"); 632 printk(KERN_DEBUG "PCI: Probing PCI hardware done\n");
641 633
642 return 0; 634 return 0;
643} 635}
@@ -804,7 +796,7 @@ static pgprot_t __pci_mmap_set_pgprot(struct pci_dev *dev, struct resource *rp,
804 else 796 else
805 prot |= _PAGE_GUARDED; 797 prot |= _PAGE_GUARDED;
806 798
807 printk("PCI map for %s:%lx, prot: %lx\n", pci_name(dev), rp->start, 799 printk(KERN_DEBUG "PCI map for %s:%lx, prot: %lx\n", pci_name(dev), rp->start,
808 prot); 800 prot);
809 801
810 return __pgprot(prot); 802 return __pgprot(prot);
@@ -894,8 +886,8 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
894 return ret; 886 return ret;
895} 887}
896 888
897#ifdef CONFIG_PPC_MULTIPLATFORM 889static ssize_t pci_show_devspec(struct device *dev,
898static ssize_t pci_show_devspec(struct device *dev, struct device_attribute *attr, char *buf) 890 struct device_attribute *attr, char *buf)
899{ 891{
900 struct pci_dev *pdev; 892 struct pci_dev *pdev;
901 struct device_node *np; 893 struct device_node *np;
@@ -907,13 +899,10 @@ static ssize_t pci_show_devspec(struct device *dev, struct device_attribute *att
907 return sprintf(buf, "%s", np->full_name); 899 return sprintf(buf, "%s", np->full_name);
908} 900}
909static DEVICE_ATTR(devspec, S_IRUGO, pci_show_devspec, NULL); 901static DEVICE_ATTR(devspec, S_IRUGO, pci_show_devspec, NULL);
910#endif /* CONFIG_PPC_MULTIPLATFORM */
911 902
912void pcibios_add_platform_entries(struct pci_dev *pdev) 903void pcibios_add_platform_entries(struct pci_dev *pdev)
913{ 904{
914#ifdef CONFIG_PPC_MULTIPLATFORM
915 device_create_file(&pdev->dev, &dev_attr_devspec); 905 device_create_file(&pdev->dev, &dev_attr_devspec);
916#endif /* CONFIG_PPC_MULTIPLATFORM */
917} 906}
918 907
919#ifdef CONFIG_PPC_MULTIPLATFORM 908#ifdef CONFIG_PPC_MULTIPLATFORM
@@ -1104,8 +1093,6 @@ void __init pci_setup_phb_io(struct pci_controller *hose, int primary)
1104 pci_process_ISA_OF_ranges(isa_dn, hose->io_base_phys, 1093 pci_process_ISA_OF_ranges(isa_dn, hose->io_base_phys,
1105 hose->io_base_virt); 1094 hose->io_base_virt);
1106 of_node_put(isa_dn); 1095 of_node_put(isa_dn);
1107 /* Allow all IO */
1108 io_page_mask = -1;
1109 } 1096 }
1110 } 1097 }
1111 1098
@@ -1212,7 +1199,7 @@ int remap_bus_range(struct pci_bus *bus)
1212 return 1; 1199 return 1;
1213 if (start_phys == 0) 1200 if (start_phys == 0)
1214 return 1; 1201 return 1;
1215 printk("mapping IO %lx -> %lx, size: %lx\n", start_phys, start_virt, size); 1202 printk(KERN_DEBUG "mapping IO %lx -> %lx, size: %lx\n", start_phys, start_virt, size);
1216 if (__ioremap_explicit(start_phys, start_virt, size, 1203 if (__ioremap_explicit(start_phys, start_virt, size,
1217 _PAGE_NO_CACHE | _PAGE_GUARDED)) 1204 _PAGE_NO_CACHE | _PAGE_GUARDED))
1218 return 1; 1205 return 1;
@@ -1232,27 +1219,13 @@ static void phbs_remap_io(void)
1232static void __devinit fixup_resource(struct resource *res, struct pci_dev *dev) 1219static void __devinit fixup_resource(struct resource *res, struct pci_dev *dev)
1233{ 1220{
1234 struct pci_controller *hose = pci_bus_to_host(dev->bus); 1221 struct pci_controller *hose = pci_bus_to_host(dev->bus);
1235 unsigned long start, end, mask, offset; 1222 unsigned long offset;
1236 1223
1237 if (res->flags & IORESOURCE_IO) { 1224 if (res->flags & IORESOURCE_IO) {
1238 offset = (unsigned long)hose->io_base_virt - pci_io_base; 1225 offset = (unsigned long)hose->io_base_virt - pci_io_base;
1239 1226
1240 start = res->start += offset; 1227 res->start += offset;
1241 end = res->end += offset; 1228 res->end += offset;
1242
1243 /* Need to allow IO access to pages that are in the
1244 ISA range */
1245 if (start < MAX_ISA_PORT) {
1246 if (end > MAX_ISA_PORT)
1247 end = MAX_ISA_PORT;
1248
1249 start >>= PAGE_SHIFT;
1250 end >>= PAGE_SHIFT;
1251
1252 /* get the range of pages for the map */
1253 mask = ((1 << (end+1)) - 1) ^ ((1 << start) - 1);
1254 io_page_mask |= mask;
1255 }
1256 } else if (res->flags & IORESOURCE_MEM) { 1229 } else if (res->flags & IORESOURCE_MEM) {
1257 res->start += hose->pci_mem_offset; 1230 res->start += hose->pci_mem_offset;
1258 res->end += hose->pci_mem_offset; 1231 res->end += hose->pci_mem_offset;
diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c
index 12c4c9e9bbc7..1c18953514c3 100644
--- a/arch/powerpc/kernel/pci_dn.c
+++ b/arch/powerpc/kernel/pci_dn.c
@@ -31,6 +31,7 @@
31#include <asm/pci-bridge.h> 31#include <asm/pci-bridge.h>
32#include <asm/pSeries_reconfig.h> 32#include <asm/pSeries_reconfig.h>
33#include <asm/ppc-pci.h> 33#include <asm/ppc-pci.h>
34#include <asm/firmware.h>
34 35
35/* 36/*
36 * Traverse_func that inits the PCI fields of the device node. 37 * Traverse_func that inits the PCI fields of the device node.
@@ -59,6 +60,11 @@ static void * __devinit update_dn_pci_info(struct device_node *dn, void *data)
59 pdn->busno = (regs[0] >> 16) & 0xff; 60 pdn->busno = (regs[0] >> 16) & 0xff;
60 pdn->devfn = (regs[0] >> 8) & 0xff; 61 pdn->devfn = (regs[0] >> 8) & 0xff;
61 } 62 }
63 if (firmware_has_feature(FW_FEATURE_ISERIES)) {
64 u32 *busp = (u32 *)get_property(dn, "linux,subbus", NULL);
65 if (busp)
66 pdn->bussubno = *busp;
67 }
62 68
63 pdn->pci_ext_config_space = (type && *type == 1); 69 pdn->pci_ext_config_space = (type && *type == 1);
64 return NULL; 70 return NULL;
diff --git a/arch/powerpc/kernel/pci_iommu.c b/arch/powerpc/kernel/pci_iommu.c
index c1d95e14bbed..48aa82d01624 100644
--- a/arch/powerpc/kernel/pci_iommu.c
+++ b/arch/powerpc/kernel/pci_iommu.c
@@ -44,16 +44,16 @@
44 */ 44 */
45#define PCI_GET_DN(dev) ((struct device_node *)((dev)->sysdata)) 45#define PCI_GET_DN(dev) ((struct device_node *)((dev)->sysdata))
46 46
47static inline struct iommu_table *devnode_table(struct device *dev) 47static inline struct iommu_table *device_to_table(struct device *hwdev)
48{ 48{
49 struct pci_dev *pdev; 49 struct pci_dev *pdev;
50 50
51 if (!dev) { 51 if (!hwdev) {
52 pdev = ppc64_isabridge_dev; 52 pdev = ppc64_isabridge_dev;
53 if (!pdev) 53 if (!pdev)
54 return NULL; 54 return NULL;
55 } else 55 } else
56 pdev = to_pci_dev(dev); 56 pdev = to_pci_dev(hwdev);
57 57
58 return PCI_DN(PCI_GET_DN(pdev))->iommu_table; 58 return PCI_DN(PCI_GET_DN(pdev))->iommu_table;
59} 59}
@@ -85,14 +85,14 @@ static inline unsigned long device_to_mask(struct device *hwdev)
85static void *pci_iommu_alloc_coherent(struct device *hwdev, size_t size, 85static void *pci_iommu_alloc_coherent(struct device *hwdev, size_t size,
86 dma_addr_t *dma_handle, gfp_t flag) 86 dma_addr_t *dma_handle, gfp_t flag)
87{ 87{
88 return iommu_alloc_coherent(devnode_table(hwdev), size, dma_handle, 88 return iommu_alloc_coherent(device_to_table(hwdev), size, dma_handle,
89 device_to_mask(hwdev), flag); 89 device_to_mask(hwdev), flag);
90} 90}
91 91
92static void pci_iommu_free_coherent(struct device *hwdev, size_t size, 92static void pci_iommu_free_coherent(struct device *hwdev, size_t size,
93 void *vaddr, dma_addr_t dma_handle) 93 void *vaddr, dma_addr_t dma_handle)
94{ 94{
95 iommu_free_coherent(devnode_table(hwdev), size, vaddr, dma_handle); 95 iommu_free_coherent(device_to_table(hwdev), size, vaddr, dma_handle);
96} 96}
97 97
98/* Creates TCEs for a user provided buffer. The user buffer must be 98/* Creates TCEs for a user provided buffer. The user buffer must be
@@ -104,7 +104,7 @@ static void pci_iommu_free_coherent(struct device *hwdev, size_t size,
104static dma_addr_t pci_iommu_map_single(struct device *hwdev, void *vaddr, 104static dma_addr_t pci_iommu_map_single(struct device *hwdev, void *vaddr,
105 size_t size, enum dma_data_direction direction) 105 size_t size, enum dma_data_direction direction)
106{ 106{
107 return iommu_map_single(devnode_table(hwdev), vaddr, size, 107 return iommu_map_single(device_to_table(hwdev), vaddr, size,
108 device_to_mask(hwdev), direction); 108 device_to_mask(hwdev), direction);
109} 109}
110 110
@@ -112,27 +112,27 @@ static dma_addr_t pci_iommu_map_single(struct device *hwdev, void *vaddr,
112static void pci_iommu_unmap_single(struct device *hwdev, dma_addr_t dma_handle, 112static void pci_iommu_unmap_single(struct device *hwdev, dma_addr_t dma_handle,
113 size_t size, enum dma_data_direction direction) 113 size_t size, enum dma_data_direction direction)
114{ 114{
115 iommu_unmap_single(devnode_table(hwdev), dma_handle, size, direction); 115 iommu_unmap_single(device_to_table(hwdev), dma_handle, size, direction);
116} 116}
117 117
118 118
119static int pci_iommu_map_sg(struct device *pdev, struct scatterlist *sglist, 119static int pci_iommu_map_sg(struct device *pdev, struct scatterlist *sglist,
120 int nelems, enum dma_data_direction direction) 120 int nelems, enum dma_data_direction direction)
121{ 121{
122 return iommu_map_sg(pdev, devnode_table(pdev), sglist, 122 return iommu_map_sg(pdev, device_to_table(pdev), sglist,
123 nelems, device_to_mask(pdev), direction); 123 nelems, device_to_mask(pdev), direction);
124} 124}
125 125
126static void pci_iommu_unmap_sg(struct device *pdev, struct scatterlist *sglist, 126static void pci_iommu_unmap_sg(struct device *pdev, struct scatterlist *sglist,
127 int nelems, enum dma_data_direction direction) 127 int nelems, enum dma_data_direction direction)
128{ 128{
129 iommu_unmap_sg(devnode_table(pdev), sglist, nelems, direction); 129 iommu_unmap_sg(device_to_table(pdev), sglist, nelems, direction);
130} 130}
131 131
132/* We support DMA to/from any memory page via the iommu */ 132/* We support DMA to/from any memory page via the iommu */
133static int pci_iommu_dma_supported(struct device *dev, u64 mask) 133static int pci_iommu_dma_supported(struct device *dev, u64 mask)
134{ 134{
135 struct iommu_table *tbl = devnode_table(dev); 135 struct iommu_table *tbl = device_to_table(dev);
136 136
137 if (!tbl || tbl->it_offset > mask) { 137 if (!tbl || tbl->it_offset > mask) {
138 printk(KERN_INFO "Warning: IOMMU table offset too big for device mask\n"); 138 printk(KERN_INFO "Warning: IOMMU table offset too big for device mask\n");
diff --git a/arch/powerpc/kernel/proc_ppc64.c b/arch/powerpc/kernel/proc_ppc64.c
index 3c2cf661f6d9..2b87f82df135 100644
--- a/arch/powerpc/kernel/proc_ppc64.c
+++ b/arch/powerpc/kernel/proc_ppc64.c
@@ -52,7 +52,7 @@ static int __init proc_ppc64_create(void)
52 if (!root) 52 if (!root)
53 return 1; 53 return 1;
54 54
55 if (!machine_is(pseries) && !machine_is(cell)) 55 if (!of_find_node_by_path("/rtas"))
56 return 0; 56 return 0;
57 57
58 if (!proc_mkdir("rtas", root)) 58 if (!proc_mkdir("rtas", root))
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 9a07f97f0712..969f4abcc0be 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -50,6 +50,7 @@
50#include <asm/machdep.h> 50#include <asm/machdep.h>
51#include <asm/pSeries_reconfig.h> 51#include <asm/pSeries_reconfig.h>
52#include <asm/pci-bridge.h> 52#include <asm/pci-bridge.h>
53#include <asm/kexec.h>
53 54
54#ifdef DEBUG 55#ifdef DEBUG
55#define DBG(fmt...) printk(KERN_ERR fmt) 56#define DBG(fmt...) printk(KERN_ERR fmt)
@@ -836,6 +837,42 @@ static unsigned long __init unflatten_dt_node(unsigned long mem,
836 return mem; 837 return mem;
837} 838}
838 839
840static int __init early_parse_mem(char *p)
841{
842 if (!p)
843 return 1;
844
845 memory_limit = PAGE_ALIGN(memparse(p, &p));
846 DBG("memory limit = 0x%lx\n", memory_limit);
847
848 return 0;
849}
850early_param("mem", early_parse_mem);
851
852/*
853 * The device tree may be allocated below our memory limit, or inside the
854 * crash kernel region for kdump. If so, move it out now.
855 */
856static void move_device_tree(void)
857{
858 unsigned long start, size;
859 void *p;
860
861 DBG("-> move_device_tree\n");
862
863 start = __pa(initial_boot_params);
864 size = initial_boot_params->totalsize;
865
866 if ((memory_limit && (start + size) > memory_limit) ||
867 overlaps_crashkernel(start, size)) {
868 p = __va(lmb_alloc_base(size, PAGE_SIZE, lmb.rmo_size));
869 memcpy(p, initial_boot_params, size);
870 initial_boot_params = (struct boot_param_header *)p;
871 DBG("Moved device tree to 0x%p\n", p);
872 }
873
874 DBG("<- move_device_tree\n");
875}
839 876
840/** 877/**
841 * unflattens the device-tree passed by the firmware, creating the 878 * unflattens the device-tree passed by the firmware, creating the
@@ -1070,6 +1107,7 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
1070 iommu_force_on = 1; 1107 iommu_force_on = 1;
1071#endif 1108#endif
1072 1109
1110 /* mem=x on the command line is the preferred mechanism */
1073 lprop = of_get_flat_dt_prop(node, "linux,memory-limit", NULL); 1111 lprop = of_get_flat_dt_prop(node, "linux,memory-limit", NULL);
1074 if (lprop) 1112 if (lprop)
1075 memory_limit = *lprop; 1113 memory_limit = *lprop;
@@ -1123,17 +1161,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
1123 1161
1124 DBG("Command line is: %s\n", cmd_line); 1162 DBG("Command line is: %s\n", cmd_line);
1125 1163
1126 if (strstr(cmd_line, "mem=")) {
1127 char *p, *q;
1128
1129 for (q = cmd_line; (p = strstr(q, "mem=")) != 0; ) {
1130 q = p + 4;
1131 if (p > cmd_line && p[-1] != ' ')
1132 continue;
1133 memory_limit = memparse(q, &q);
1134 }
1135 }
1136
1137 /* break now */ 1164 /* break now */
1138 return 1; 1165 return 1;
1139} 1166}
@@ -1240,6 +1267,11 @@ static void __init early_reserve_mem(void)
1240 1267
1241 reserve_map = (u64 *)(((unsigned long)initial_boot_params) + 1268 reserve_map = (u64 *)(((unsigned long)initial_boot_params) +
1242 initial_boot_params->off_mem_rsvmap); 1269 initial_boot_params->off_mem_rsvmap);
1270
1271 /* before we do anything, lets reserve the dt blob */
1272 lmb_reserve(__pa((unsigned long)initial_boot_params),
1273 initial_boot_params->totalsize);
1274
1243#ifdef CONFIG_PPC32 1275#ifdef CONFIG_PPC32
1244 /* 1276 /*
1245 * Handle the case where we might be booting from an old kexec 1277 * Handle the case where we might be booting from an old kexec
@@ -1292,18 +1324,26 @@ void __init early_init_devtree(void *params)
1292 lmb_init(); 1324 lmb_init();
1293 of_scan_flat_dt(early_init_dt_scan_root, NULL); 1325 of_scan_flat_dt(early_init_dt_scan_root, NULL);
1294 of_scan_flat_dt(early_init_dt_scan_memory, NULL); 1326 of_scan_flat_dt(early_init_dt_scan_memory, NULL);
1295 lmb_enforce_memory_limit(memory_limit);
1296 lmb_analyze();
1297 1327
1298 DBG("Phys. mem: %lx\n", lmb_phys_mem_size()); 1328 /* Save command line for /proc/cmdline and then parse parameters */
1329 strlcpy(saved_command_line, cmd_line, COMMAND_LINE_SIZE);
1330 parse_early_param();
1299 1331
1300 /* Reserve LMB regions used by kernel, initrd, dt, etc... */ 1332 /* Reserve LMB regions used by kernel, initrd, dt, etc... */
1301 lmb_reserve(PHYSICAL_START, __pa(klimit) - PHYSICAL_START); 1333 lmb_reserve(PHYSICAL_START, __pa(klimit) - PHYSICAL_START);
1302#ifdef CONFIG_CRASH_DUMP 1334 reserve_kdump_trampoline();
1303 lmb_reserve(0, KDUMP_RESERVE_LIMIT); 1335 reserve_crashkernel();
1304#endif
1305 early_reserve_mem(); 1336 early_reserve_mem();
1306 1337
1338 lmb_enforce_memory_limit(memory_limit);
1339 lmb_analyze();
1340
1341 DBG("Phys. mem: %lx\n", lmb_phys_mem_size());
1342
1343 /* We may need to relocate the flat tree, do it now.
1344 * FIXME .. and the initrd too? */
1345 move_device_tree();
1346
1307 DBG("Scanning CPUs ...\n"); 1347 DBG("Scanning CPUs ...\n");
1308 1348
1309 /* Retreive CPU related informations from the flat tree 1349 /* Retreive CPU related informations from the flat tree
@@ -2053,29 +2093,3 @@ int prom_update_property(struct device_node *np,
2053 return 0; 2093 return 0;
2054} 2094}
2055 2095
2056#ifdef CONFIG_KEXEC
2057/* We may have allocated the flat device tree inside the crash kernel region
2058 * in prom_init. If so we need to move it out into regular memory. */
2059void kdump_move_device_tree(void)
2060{
2061 unsigned long start, end;
2062 struct boot_param_header *new;
2063
2064 start = __pa((unsigned long)initial_boot_params);
2065 end = start + initial_boot_params->totalsize;
2066
2067 if (end < crashk_res.start || start > crashk_res.end)
2068 return;
2069
2070 new = (struct boot_param_header*)
2071 __va(lmb_alloc(initial_boot_params->totalsize, PAGE_SIZE));
2072
2073 memcpy(new, initial_boot_params, initial_boot_params->totalsize);
2074
2075 initial_boot_params = new;
2076
2077 DBG("Flat device tree blob moved to %p\n", initial_boot_params);
2078
2079 /* XXX should we unreserve the old DT? */
2080}
2081#endif /* CONFIG_KEXEC */
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 41e9ab40cd54..5908690d0868 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -194,19 +194,12 @@ static int __initdata of_platform;
194 194
195static char __initdata prom_cmd_line[COMMAND_LINE_SIZE]; 195static char __initdata prom_cmd_line[COMMAND_LINE_SIZE];
196 196
197static unsigned long __initdata prom_memory_limit;
198
199static unsigned long __initdata alloc_top; 197static unsigned long __initdata alloc_top;
200static unsigned long __initdata alloc_top_high; 198static unsigned long __initdata alloc_top_high;
201static unsigned long __initdata alloc_bottom; 199static unsigned long __initdata alloc_bottom;
202static unsigned long __initdata rmo_top; 200static unsigned long __initdata rmo_top;
203static unsigned long __initdata ram_top; 201static unsigned long __initdata ram_top;
204 202
205#ifdef CONFIG_KEXEC
206static unsigned long __initdata prom_crashk_base;
207static unsigned long __initdata prom_crashk_size;
208#endif
209
210static struct mem_map_entry __initdata mem_reserve_map[MEM_RESERVE_MAP_SIZE]; 203static struct mem_map_entry __initdata mem_reserve_map[MEM_RESERVE_MAP_SIZE];
211static int __initdata mem_reserve_cnt; 204static int __initdata mem_reserve_cnt;
212 205
@@ -593,45 +586,6 @@ static void __init early_cmdline_parse(void)
593 RELOC(iommu_force_on) = 1; 586 RELOC(iommu_force_on) = 1;
594 } 587 }
595#endif 588#endif
596
597 opt = strstr(RELOC(prom_cmd_line), RELOC("mem="));
598 if (opt) {
599 opt += 4;
600 RELOC(prom_memory_limit) = prom_memparse(opt, (const char **)&opt);
601#ifdef CONFIG_PPC64
602 /* Align to 16 MB == size of ppc64 large page */
603 RELOC(prom_memory_limit) = ALIGN(RELOC(prom_memory_limit), 0x1000000);
604#endif
605 }
606
607#ifdef CONFIG_KEXEC
608 /*
609 * crashkernel=size@addr specifies the location to reserve for
610 * crash kernel.
611 */
612 opt = strstr(RELOC(prom_cmd_line), RELOC("crashkernel="));
613 if (opt) {
614 opt += 12;
615 RELOC(prom_crashk_size) =
616 prom_memparse(opt, (const char **)&opt);
617
618 if (ALIGN(RELOC(prom_crashk_size), 0x1000000) !=
619 RELOC(prom_crashk_size)) {
620 prom_printf("Warning: crashkernel size is not "
621 "aligned to 16MB\n");
622 }
623
624 /*
625 * At present, the crash kernel always run at 32MB.
626 * Just ignore whatever user passed.
627 */
628 RELOC(prom_crashk_base) = 0x2000000;
629 if (*opt == '@') {
630 prom_printf("Warning: PPC64 kdump kernel always runs "
631 "at 32 MB\n");
632 }
633 }
634#endif
635} 589}
636 590
637#ifdef CONFIG_PPC_PSERIES 591#ifdef CONFIG_PPC_PSERIES
@@ -1115,29 +1069,6 @@ static void __init prom_init_mem(void)
1115 } 1069 }
1116 1070
1117 /* 1071 /*
1118 * If prom_memory_limit is set we reduce the upper limits *except* for
1119 * alloc_top_high. This must be the real top of RAM so we can put
1120 * TCE's up there.
1121 */
1122
1123 RELOC(alloc_top_high) = RELOC(ram_top);
1124
1125 if (RELOC(prom_memory_limit)) {
1126 if (RELOC(prom_memory_limit) <= RELOC(alloc_bottom)) {
1127 prom_printf("Ignoring mem=%x <= alloc_bottom.\n",
1128 RELOC(prom_memory_limit));
1129 RELOC(prom_memory_limit) = 0;
1130 } else if (RELOC(prom_memory_limit) >= RELOC(ram_top)) {
1131 prom_printf("Ignoring mem=%x >= ram_top.\n",
1132 RELOC(prom_memory_limit));
1133 RELOC(prom_memory_limit) = 0;
1134 } else {
1135 RELOC(ram_top) = RELOC(prom_memory_limit);
1136 RELOC(rmo_top) = min(RELOC(rmo_top), RELOC(prom_memory_limit));
1137 }
1138 }
1139
1140 /*
1141 * Setup our top alloc point, that is top of RMO or top of 1072 * Setup our top alloc point, that is top of RMO or top of
1142 * segment 0 when running non-LPAR. 1073 * segment 0 when running non-LPAR.
1143 * Some RS64 machines have buggy firmware where claims up at 1074 * Some RS64 machines have buggy firmware where claims up at
@@ -1149,20 +1080,14 @@ static void __init prom_init_mem(void)
1149 RELOC(rmo_top) = RELOC(ram_top); 1080 RELOC(rmo_top) = RELOC(ram_top);
1150 RELOC(rmo_top) = min(0x30000000ul, RELOC(rmo_top)); 1081 RELOC(rmo_top) = min(0x30000000ul, RELOC(rmo_top));
1151 RELOC(alloc_top) = RELOC(rmo_top); 1082 RELOC(alloc_top) = RELOC(rmo_top);
1083 RELOC(alloc_top_high) = RELOC(ram_top);
1152 1084
1153 prom_printf("memory layout at init:\n"); 1085 prom_printf("memory layout at init:\n");
1154 prom_printf(" memory_limit : %x (16 MB aligned)\n", RELOC(prom_memory_limit));
1155 prom_printf(" alloc_bottom : %x\n", RELOC(alloc_bottom)); 1086 prom_printf(" alloc_bottom : %x\n", RELOC(alloc_bottom));
1156 prom_printf(" alloc_top : %x\n", RELOC(alloc_top)); 1087 prom_printf(" alloc_top : %x\n", RELOC(alloc_top));
1157 prom_printf(" alloc_top_hi : %x\n", RELOC(alloc_top_high)); 1088 prom_printf(" alloc_top_hi : %x\n", RELOC(alloc_top_high));
1158 prom_printf(" rmo_top : %x\n", RELOC(rmo_top)); 1089 prom_printf(" rmo_top : %x\n", RELOC(rmo_top));
1159 prom_printf(" ram_top : %x\n", RELOC(ram_top)); 1090 prom_printf(" ram_top : %x\n", RELOC(ram_top));
1160#ifdef CONFIG_KEXEC
1161 if (RELOC(prom_crashk_base)) {
1162 prom_printf(" crashk_base : %x\n", RELOC(prom_crashk_base));
1163 prom_printf(" crashk_size : %x\n", RELOC(prom_crashk_size));
1164 }
1165#endif
1166} 1091}
1167 1092
1168 1093
@@ -1348,16 +1273,10 @@ static void __init prom_initialize_tce_table(void)
1348 1273
1349 reserve_mem(local_alloc_bottom, local_alloc_top - local_alloc_bottom); 1274 reserve_mem(local_alloc_bottom, local_alloc_top - local_alloc_bottom);
1350 1275
1351 if (RELOC(prom_memory_limit)) { 1276 /* These are only really needed if there is a memory limit in
1352 /* 1277 * effect, but we don't know so export them always. */
1353 * We align the start to a 16MB boundary so we can map 1278 RELOC(prom_tce_alloc_start) = local_alloc_bottom;
1354 * the TCE area using large pages if possible. 1279 RELOC(prom_tce_alloc_end) = local_alloc_top;
1355 * The end should be the top of RAM so no need to align it.
1356 */
1357 RELOC(prom_tce_alloc_start) = _ALIGN_DOWN(local_alloc_bottom,
1358 0x1000000);
1359 RELOC(prom_tce_alloc_end) = local_alloc_top;
1360 }
1361 1280
1362 /* Flag the first invalid entry */ 1281 /* Flag the first invalid entry */
1363 prom_debug("ending prom_initialize_tce_table\n"); 1282 prom_debug("ending prom_initialize_tce_table\n");
@@ -2031,11 +1950,7 @@ static void __init flatten_device_tree(void)
2031 /* Version 16 is not backward compatible */ 1950 /* Version 16 is not backward compatible */
2032 hdr->last_comp_version = 0x10; 1951 hdr->last_comp_version = 0x10;
2033 1952
2034 /* Reserve the whole thing and copy the reserve map in, we 1953 /* Copy the reserve map in */
2035 * also bump mem_reserve_cnt to cause further reservations to
2036 * fail since it's too late.
2037 */
2038 reserve_mem(RELOC(dt_header_start), hdr->totalsize);
2039 memcpy(rsvmap, RELOC(mem_reserve_map), sizeof(mem_reserve_map)); 1954 memcpy(rsvmap, RELOC(mem_reserve_map), sizeof(mem_reserve_map));
2040 1955
2041#ifdef DEBUG_PROM 1956#ifdef DEBUG_PROM
@@ -2048,6 +1963,9 @@ static void __init flatten_device_tree(void)
2048 RELOC(mem_reserve_map)[i].size); 1963 RELOC(mem_reserve_map)[i].size);
2049 } 1964 }
2050#endif 1965#endif
1966 /* Bump mem_reserve_cnt to cause further reservations to fail
1967 * since it's too late.
1968 */
2051 RELOC(mem_reserve_cnt) = MEM_RESERVE_MAP_SIZE; 1969 RELOC(mem_reserve_cnt) = MEM_RESERVE_MAP_SIZE;
2052 1970
2053 prom_printf("Device tree strings 0x%x -> 0x%x\n", 1971 prom_printf("Device tree strings 0x%x -> 0x%x\n",
@@ -2270,10 +2188,6 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
2270 */ 2188 */
2271 prom_init_mem(); 2189 prom_init_mem();
2272 2190
2273#ifdef CONFIG_KEXEC
2274 if (RELOC(prom_crashk_base))
2275 reserve_mem(RELOC(prom_crashk_base), RELOC(prom_crashk_size));
2276#endif
2277 /* 2191 /*
2278 * Determine which cpu is actually running right _now_ 2192 * Determine which cpu is actually running right _now_
2279 */ 2193 */
@@ -2307,10 +2221,6 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
2307 /* 2221 /*
2308 * Fill in some infos for use by the kernel later on 2222 * Fill in some infos for use by the kernel later on
2309 */ 2223 */
2310 if (RELOC(prom_memory_limit))
2311 prom_setprop(_prom->chosen, "/chosen", "linux,memory-limit",
2312 &RELOC(prom_memory_limit),
2313 sizeof(prom_memory_limit));
2314#ifdef CONFIG_PPC64 2224#ifdef CONFIG_PPC64
2315 if (RELOC(ppc64_iommu_off)) 2225 if (RELOC(ppc64_iommu_off))
2316 prom_setprop(_prom->chosen, "/chosen", "linux,iommu-off", 2226 prom_setprop(_prom->chosen, "/chosen", "linux,iommu-off",
@@ -2330,16 +2240,6 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
2330 } 2240 }
2331#endif 2241#endif
2332 2242
2333#ifdef CONFIG_KEXEC
2334 if (RELOC(prom_crashk_base)) {
2335 prom_setprop(_prom->chosen, "/chosen", "linux,crashkernel-base",
2336 PTRRELOC(&prom_crashk_base),
2337 sizeof(RELOC(prom_crashk_base)));
2338 prom_setprop(_prom->chosen, "/chosen", "linux,crashkernel-size",
2339 PTRRELOC(&prom_crashk_size),
2340 sizeof(RELOC(prom_crashk_size)));
2341 }
2342#endif
2343 /* 2243 /*
2344 * Fixup any known bugs in the device-tree 2244 * Fixup any known bugs in the device-tree
2345 */ 2245 */
diff --git a/arch/powerpc/kernel/prom_parse.c b/arch/powerpc/kernel/prom_parse.c
index 3934c227549b..23bb060330ef 100644
--- a/arch/powerpc/kernel/prom_parse.c
+++ b/arch/powerpc/kernel/prom_parse.c
@@ -548,3 +548,25 @@ int of_pci_address_to_resource(struct device_node *dev, int bar,
548 return __of_address_to_resource(dev, addrp, size, flags, r); 548 return __of_address_to_resource(dev, addrp, size, flags, r);
549} 549}
550EXPORT_SYMBOL_GPL(of_pci_address_to_resource); 550EXPORT_SYMBOL_GPL(of_pci_address_to_resource);
551
552void of_parse_dma_window(struct device_node *dn, unsigned char *dma_window_prop,
553 unsigned long *busno, unsigned long *phys, unsigned long *size)
554{
555 u32 *dma_window, cells;
556 unsigned char *prop;
557
558 dma_window = (u32 *)dma_window_prop;
559
560 /* busno is always one cell */
561 *busno = *(dma_window++);
562
563 prop = get_property(dn, "ibm,#dma-address-cells", NULL);
564 cells = prop ? *(u32 *)prop : prom_n_addr_cells(dn);
565 *phys = of_read_addr(dma_window, cells);
566
567 dma_window += cells;
568
569 prop = get_property(dn, "ibm,#dma-size-cells", NULL);
570 cells = prop ? *(u32 *)prop : prom_n_size_cells(dn);
571 *size = of_read_addr(dma_window, cells);
572}
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 684ab1d49c65..bd328123af75 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -443,6 +443,7 @@ void __init smp_setup_cpu_maps(void)
443} 443}
444#endif /* CONFIG_SMP */ 444#endif /* CONFIG_SMP */
445 445
446int __initdata do_early_xmon;
446#ifdef CONFIG_XMON 447#ifdef CONFIG_XMON
447static int __init early_xmon(char *p) 448static int __init early_xmon(char *p)
448{ 449{
@@ -456,7 +457,7 @@ static int __init early_xmon(char *p)
456 return 0; 457 return 0;
457 } 458 }
458 xmon_init(1); 459 xmon_init(1);
459 debugger(NULL); 460 do_early_xmon = 1;
460 461
461 return 0; 462 return 0;
462} 463}
@@ -524,3 +525,20 @@ int check_legacy_ioport(unsigned long base_port)
524 return ppc_md.check_legacy_ioport(base_port); 525 return ppc_md.check_legacy_ioport(base_port);
525} 526}
526EXPORT_SYMBOL(check_legacy_ioport); 527EXPORT_SYMBOL(check_legacy_ioport);
528
529static int ppc_panic_event(struct notifier_block *this,
530 unsigned long event, void *ptr)
531{
532 ppc_md.panic(ptr); /* May not return */
533 return NOTIFY_DONE;
534}
535
536static struct notifier_block ppc_panic_block = {
537 .notifier_call = ppc_panic_event,
538 .priority = INT_MIN /* may not return; must be done last */
539};
540
541void __init setup_panic(void)
542{
543 atomic_notifier_chain_register(&panic_notifier_list, &ppc_panic_block);
544}
diff --git a/arch/powerpc/kernel/setup.h b/arch/powerpc/kernel/setup.h
index 2ebba755272e..4c67ad7fae08 100644
--- a/arch/powerpc/kernel/setup.h
+++ b/arch/powerpc/kernel/setup.h
@@ -2,5 +2,8 @@
2#define _POWERPC_KERNEL_SETUP_H 2#define _POWERPC_KERNEL_SETUP_H
3 3
4void check_for_initrd(void); 4void check_for_initrd(void);
5void do_init_bootmem(void);
6void setup_panic(void);
7extern int do_early_xmon;
5 8
6#endif /* _POWERPC_KERNEL_SETUP_H */ 9#endif /* _POWERPC_KERNEL_SETUP_H */
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index 69ac25701344..e5a44812441a 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -131,12 +131,6 @@ void __init machine_init(unsigned long dt_ptr, unsigned long phys)
131 /* Do some early initialization based on the flat device tree */ 131 /* Do some early initialization based on the flat device tree */
132 early_init_devtree(__va(dt_ptr)); 132 early_init_devtree(__va(dt_ptr));
133 133
134 /* Check default command line */
135#ifdef CONFIG_CMDLINE
136 if (cmd_line[0] == 0)
137 strlcpy(cmd_line, CONFIG_CMDLINE, sizeof(cmd_line));
138#endif /* CONFIG_CMDLINE */
139
140 probe_machine(); 134 probe_machine();
141 135
142#ifdef CONFIG_6xx 136#ifdef CONFIG_6xx
@@ -235,7 +229,7 @@ arch_initcall(ppc_init);
235/* Warning, IO base is not yet inited */ 229/* Warning, IO base is not yet inited */
236void __init setup_arch(char **cmdline_p) 230void __init setup_arch(char **cmdline_p)
237{ 231{
238 extern void do_init_bootmem(void); 232 *cmdline_p = cmd_line;
239 233
240 /* so udelay does something sensible, assume <= 1000 bogomips */ 234 /* so udelay does something sensible, assume <= 1000 bogomips */
241 loops_per_jiffy = 500000000 / HZ; 235 loops_per_jiffy = 500000000 / HZ;
@@ -285,16 +279,16 @@ void __init setup_arch(char **cmdline_p)
285 /* reboot on panic */ 279 /* reboot on panic */
286 panic_timeout = 180; 280 panic_timeout = 180;
287 281
282 if (ppc_md.panic)
283 setup_panic();
284
288 init_mm.start_code = PAGE_OFFSET; 285 init_mm.start_code = PAGE_OFFSET;
289 init_mm.end_code = (unsigned long) _etext; 286 init_mm.end_code = (unsigned long) _etext;
290 init_mm.end_data = (unsigned long) _edata; 287 init_mm.end_data = (unsigned long) _edata;
291 init_mm.brk = klimit; 288 init_mm.brk = klimit;
292 289
293 /* Save unparsed command line copy for /proc/cmdline */ 290 if (do_early_xmon)
294 strlcpy(saved_command_line, cmd_line, COMMAND_LINE_SIZE); 291 debugger(NULL);
295 *cmdline_p = cmd_line;
296
297 parse_early_param();
298 292
299 /* set up the bootmem stuff with available memory */ 293 /* set up the bootmem stuff with available memory */
300 do_init_bootmem(); 294 do_init_bootmem();
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 4467c49903b6..78f3a5fd43f6 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -100,12 +100,6 @@ unsigned long SYSRQ_KEY;
100#endif /* CONFIG_MAGIC_SYSRQ */ 100#endif /* CONFIG_MAGIC_SYSRQ */
101 101
102 102
103static int ppc64_panic_event(struct notifier_block *, unsigned long, void *);
104static struct notifier_block ppc64_panic_block = {
105 .notifier_call = ppc64_panic_event,
106 .priority = INT_MIN /* may not return; must be done last */
107};
108
109#ifdef CONFIG_SMP 103#ifdef CONFIG_SMP
110 104
111static int smt_enabled_cmdline; 105static int smt_enabled_cmdline;
@@ -199,9 +193,7 @@ void __init early_setup(unsigned long dt_ptr)
199 /* Probe the machine type */ 193 /* Probe the machine type */
200 probe_machine(); 194 probe_machine();
201 195
202#ifdef CONFIG_CRASH_DUMP 196 setup_kdump_trampoline();
203 kdump_setup();
204#endif
205 197
206 DBG("Found, Initializing memory management...\n"); 198 DBG("Found, Initializing memory management...\n");
207 199
@@ -353,9 +345,6 @@ void __init setup_system(void)
353{ 345{
354 DBG(" -> setup_system()\n"); 346 DBG(" -> setup_system()\n");
355 347
356#ifdef CONFIG_KEXEC
357 kdump_move_device_tree();
358#endif
359 /* 348 /*
360 * Unflatten the device-tree passed by prom_init or kexec 349 * Unflatten the device-tree passed by prom_init or kexec
361 */ 350 */
@@ -420,10 +409,8 @@ void __init setup_system(void)
420 */ 409 */
421 register_early_udbg_console(); 410 register_early_udbg_console();
422 411
423 /* Save unparsed command line copy for /proc/cmdline */ 412 if (do_early_xmon)
424 strlcpy(saved_command_line, cmd_line, COMMAND_LINE_SIZE); 413 debugger(NULL);
425
426 parse_early_param();
427 414
428 check_smt_enabled(); 415 check_smt_enabled();
429 smp_setup_cpu_maps(); 416 smp_setup_cpu_maps();
@@ -456,13 +443,6 @@ void __init setup_system(void)
456 DBG(" <- setup_system()\n"); 443 DBG(" <- setup_system()\n");
457} 444}
458 445
459static int ppc64_panic_event(struct notifier_block *this,
460 unsigned long event, void *ptr)
461{
462 ppc_md.panic((char *)ptr); /* May not return */
463 return NOTIFY_DONE;
464}
465
466#ifdef CONFIG_IRQSTACKS 446#ifdef CONFIG_IRQSTACKS
467static void __init irqstack_early_init(void) 447static void __init irqstack_early_init(void)
468{ 448{
@@ -517,8 +497,6 @@ static void __init emergency_stack_init(void)
517 */ 497 */
518void __init setup_arch(char **cmdline_p) 498void __init setup_arch(char **cmdline_p)
519{ 499{
520 extern void do_init_bootmem(void);
521
522 ppc64_boot_msg(0x12, "Setup Arch"); 500 ppc64_boot_msg(0x12, "Setup Arch");
523 501
524 *cmdline_p = cmd_line; 502 *cmdline_p = cmd_line;
@@ -535,8 +513,7 @@ void __init setup_arch(char **cmdline_p)
535 panic_timeout = 180; 513 panic_timeout = 180;
536 514
537 if (ppc_md.panic) 515 if (ppc_md.panic)
538 atomic_notifier_chain_register(&panic_notifier_list, 516 setup_panic();
539 &ppc64_panic_block);
540 517
541 init_mm.start_code = PAGE_OFFSET; 518 init_mm.start_code = PAGE_OFFSET;
542 init_mm.end_code = (unsigned long) _etext; 519 init_mm.end_code = (unsigned long) _etext;
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 24e3ad756de0..528e7f84cb67 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -76,7 +76,6 @@
76 76
77/* keep track of when we need to update the rtc */ 77/* keep track of when we need to update the rtc */
78time_t last_rtc_update; 78time_t last_rtc_update;
79extern int piranha_simulator;
80#ifdef CONFIG_PPC_ISERIES 79#ifdef CONFIG_PPC_ISERIES
81unsigned long iSeries_recal_titan = 0; 80unsigned long iSeries_recal_titan = 0;
82unsigned long iSeries_recal_tb = 0; 81unsigned long iSeries_recal_tb = 0;
@@ -945,9 +944,9 @@ void __init time_init(void)
945 } else { 944 } else {
946 /* Normal PowerPC with timebase register */ 945 /* Normal PowerPC with timebase register */
947 ppc_md.calibrate_decr(); 946 ppc_md.calibrate_decr();
948 printk(KERN_INFO "time_init: decrementer frequency = %lu.%.6lu MHz\n", 947 printk(KERN_DEBUG "time_init: decrementer frequency = %lu.%.6lu MHz\n",
949 ppc_tb_freq / 1000000, ppc_tb_freq % 1000000); 948 ppc_tb_freq / 1000000, ppc_tb_freq % 1000000);
950 printk(KERN_INFO "time_init: processor frequency = %lu.%.6lu MHz\n", 949 printk(KERN_DEBUG "time_init: processor frequency = %lu.%.6lu MHz\n",
951 ppc_proc_freq / 1000000, ppc_proc_freq % 1000000); 950 ppc_proc_freq / 1000000, ppc_proc_freq % 1000000);
952 tb_last_stamp = tb_last_jiffy = get_tb(); 951 tb_last_stamp = tb_last_jiffy = get_tb();
953 } 952 }
@@ -1010,10 +1009,7 @@ void __init time_init(void)
1010 tb_to_ns_scale = scale; 1009 tb_to_ns_scale = scale;
1011 tb_to_ns_shift = shift; 1010 tb_to_ns_shift = shift;
1012 1011
1013#ifdef CONFIG_PPC_ISERIES 1012 tm = get_boot_time();
1014 if (!piranha_simulator)
1015#endif
1016 tm = get_boot_time();
1017 1013
1018 write_seqlock_irqsave(&xtime_lock, flags); 1014 write_seqlock_irqsave(&xtime_lock, flags);
1019 1015
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index 971020cf3f7d..fe92727aca30 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -13,27 +13,116 @@
13 * 2 of the License, or (at your option) any later version. 13 * 2 of the License, or (at your option) any later version.
14 */ 14 */
15 15
16#include <linux/types.h>
17#include <linux/device.h>
16#include <linux/init.h> 18#include <linux/init.h>
17#include <linux/console.h> 19#include <linux/console.h>
18#include <linux/module.h> 20#include <linux/module.h>
19#include <linux/mm.h> 21#include <linux/mm.h>
20#include <linux/dma-mapping.h> 22#include <linux/dma-mapping.h>
23#include <linux/kobject.h>
24
21#include <asm/iommu.h> 25#include <asm/iommu.h>
22#include <asm/dma.h> 26#include <asm/dma.h>
23#include <asm/vio.h> 27#include <asm/vio.h>
24#include <asm/prom.h> 28#include <asm/prom.h>
25 29#include <asm/firmware.h>
26static const struct vio_device_id *vio_match_device( 30#include <asm/tce.h>
27 const struct vio_device_id *, const struct vio_dev *); 31#include <asm/abs_addr.h>
28 32#include <asm/page.h>
29struct vio_dev vio_bus_device = { /* fake "parent" device */ 33#include <asm/hvcall.h>
34#include <asm/iseries/vio.h>
35#include <asm/iseries/hv_types.h>
36#include <asm/iseries/hv_lp_config.h>
37#include <asm/iseries/hv_call_xm.h>
38#include <asm/iseries/iommu.h>
39
40extern struct subsystem devices_subsys; /* needed for vio_find_name() */
41
42static struct vio_dev vio_bus_device = { /* fake "parent" device */
30 .name = vio_bus_device.dev.bus_id, 43 .name = vio_bus_device.dev.bus_id,
31 .type = "", 44 .type = "",
32 .dev.bus_id = "vio", 45 .dev.bus_id = "vio",
33 .dev.bus = &vio_bus_type, 46 .dev.bus = &vio_bus_type,
34}; 47};
35 48
36static struct vio_bus_ops vio_bus_ops; 49#ifdef CONFIG_PPC_ISERIES
50struct device *iSeries_vio_dev = &vio_bus_device.dev;
51EXPORT_SYMBOL(iSeries_vio_dev);
52
53static struct iommu_table veth_iommu_table;
54static struct iommu_table vio_iommu_table;
55
56static void __init iommu_vio_init(void)
57{
58 iommu_table_getparms_iSeries(255, 0, 0xff, &veth_iommu_table);
59 veth_iommu_table.it_size /= 2;
60 vio_iommu_table = veth_iommu_table;
61 vio_iommu_table.it_offset += veth_iommu_table.it_size;
62
63 if (!iommu_init_table(&veth_iommu_table))
64 printk("Virtual Bus VETH TCE table failed.\n");
65 if (!iommu_init_table(&vio_iommu_table))
66 printk("Virtual Bus VIO TCE table failed.\n");
67}
68#endif
69
70static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev)
71{
72#ifdef CONFIG_PPC_ISERIES
73 if (firmware_has_feature(FW_FEATURE_ISERIES)) {
74 if (strcmp(dev->type, "network") == 0)
75 return &veth_iommu_table;
76 return &vio_iommu_table;
77 } else
78#endif
79 {
80 unsigned char *dma_window;
81 struct iommu_table *tbl;
82 unsigned long offset, size;
83
84 dma_window = get_property(dev->dev.platform_data,
85 "ibm,my-dma-window", NULL);
86 if (!dma_window)
87 return NULL;
88
89 tbl = kmalloc(sizeof(*tbl), GFP_KERNEL);
90
91 of_parse_dma_window(dev->dev.platform_data, dma_window,
92 &tbl->it_index, &offset, &size);
93
94 /* TCE table size - measured in tce entries */
95 tbl->it_size = size >> PAGE_SHIFT;
96 /* offset for VIO should always be 0 */
97 tbl->it_offset = offset >> PAGE_SHIFT;
98 tbl->it_busno = 0;
99 tbl->it_type = TCE_VB;
100
101 return iommu_init_table(tbl);
102 }
103}
104
105/**
106 * vio_match_device: - Tell if a VIO device has a matching
107 * VIO device id structure.
108 * @ids: array of VIO device id structures to search in
109 * @dev: the VIO device structure to match against
110 *
111 * Used by a driver to check whether a VIO device present in the
112 * system is in its list of supported devices. Returns the matching
113 * vio_device_id structure or NULL if there is no match.
114 */
115static const struct vio_device_id *vio_match_device(
116 const struct vio_device_id *ids, const struct vio_dev *dev)
117{
118 while (ids->type[0] != '\0') {
119 if ((strncmp(dev->type, ids->type, strlen(ids->type)) == 0) &&
120 device_is_compatible(dev->dev.platform_data, ids->compat))
121 return ids;
122 ids++;
123 }
124 return NULL;
125}
37 126
38/* 127/*
39 * Convert from struct device to struct vio_dev and pass to driver. 128 * Convert from struct device to struct vio_dev and pass to driver.
@@ -106,35 +195,110 @@ void vio_unregister_driver(struct vio_driver *viodrv)
106} 195}
107EXPORT_SYMBOL(vio_unregister_driver); 196EXPORT_SYMBOL(vio_unregister_driver);
108 197
198/* vio_dev refcount hit 0 */
199static void __devinit vio_dev_release(struct device *dev)
200{
201 if (dev->platform_data) {
202 /* XXX free TCE table */
203 of_node_put(dev->platform_data);
204 }
205 kfree(to_vio_dev(dev));
206}
207
109/** 208/**
110 * vio_match_device: - Tell if a VIO device has a matching 209 * vio_register_device_node: - Register a new vio device.
111 * VIO device id structure. 210 * @of_node: The OF node for this device.
112 * @ids: array of VIO device id structures to search in
113 * @dev: the VIO device structure to match against
114 * 211 *
115 * Used by a driver to check whether a VIO device present in the 212 * Creates and initializes a vio_dev structure from the data in
116 * system is in its list of supported devices. Returns the matching 213 * of_node (dev.platform_data) and adds it to the list of virtual devices.
117 * vio_device_id structure or NULL if there is no match. 214 * Returns a pointer to the created vio_dev or NULL if node has
215 * NULL device_type or compatible fields.
118 */ 216 */
119static const struct vio_device_id *vio_match_device( 217struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node)
120 const struct vio_device_id *ids, const struct vio_dev *dev)
121{ 218{
122 while (ids->type[0] != '\0') { 219 struct vio_dev *viodev;
123 if (vio_bus_ops.match(ids, dev)) 220 unsigned int *unit_address;
124 return ids; 221 unsigned int *irq_p;
125 ids++; 222
223 /* we need the 'device_type' property, in order to match with drivers */
224 if (of_node->type == NULL) {
225 printk(KERN_WARNING "%s: node %s missing 'device_type'\n",
226 __FUNCTION__,
227 of_node->name ? of_node->name : "<unknown>");
228 return NULL;
126 } 229 }
127 return NULL; 230
231 unit_address = (unsigned int *)get_property(of_node, "reg", NULL);
232 if (unit_address == NULL) {
233 printk(KERN_WARNING "%s: node %s missing 'reg'\n",
234 __FUNCTION__,
235 of_node->name ? of_node->name : "<unknown>");
236 return NULL;
237 }
238
239 /* allocate a vio_dev for this node */
240 viodev = kzalloc(sizeof(struct vio_dev), GFP_KERNEL);
241 if (viodev == NULL)
242 return NULL;
243
244 viodev->dev.platform_data = of_node_get(of_node);
245
246 viodev->irq = NO_IRQ;
247 irq_p = (unsigned int *)get_property(of_node, "interrupts", NULL);
248 if (irq_p) {
249 int virq = virt_irq_create_mapping(*irq_p);
250 if (virq == NO_IRQ) {
251 printk(KERN_ERR "Unable to allocate interrupt "
252 "number for %s\n", of_node->full_name);
253 } else
254 viodev->irq = irq_offset_up(virq);
255 }
256
257 snprintf(viodev->dev.bus_id, BUS_ID_SIZE, "%x", *unit_address);
258 viodev->name = of_node->name;
259 viodev->type = of_node->type;
260 viodev->unit_address = *unit_address;
261 if (firmware_has_feature(FW_FEATURE_ISERIES)) {
262 unit_address = (unsigned int *)get_property(of_node,
263 "linux,unit_address", NULL);
264 if (unit_address != NULL)
265 viodev->unit_address = *unit_address;
266 }
267 viodev->iommu_table = vio_build_iommu_table(viodev);
268
269 /* init generic 'struct device' fields: */
270 viodev->dev.parent = &vio_bus_device.dev;
271 viodev->dev.bus = &vio_bus_type;
272 viodev->dev.release = vio_dev_release;
273
274 /* register with generic device framework */
275 if (device_register(&viodev->dev)) {
276 printk(KERN_ERR "%s: failed to register device %s\n",
277 __FUNCTION__, viodev->dev.bus_id);
278 /* XXX free TCE table */
279 kfree(viodev);
280 return NULL;
281 }
282
283 return viodev;
128} 284}
285EXPORT_SYMBOL(vio_register_device_node);
129 286
130/** 287/**
131 * vio_bus_init: - Initialize the virtual IO bus 288 * vio_bus_init: - Initialize the virtual IO bus
132 */ 289 */
133int __init vio_bus_init(struct vio_bus_ops *ops) 290static int __init vio_bus_init(void)
134{ 291{
135 int err; 292 int err;
293 struct device_node *node_vroot;
136 294
137 vio_bus_ops = *ops; 295#ifdef CONFIG_PPC_ISERIES
296 if (firmware_has_feature(FW_FEATURE_ISERIES)) {
297 iommu_vio_init();
298 vio_bus_device.iommu_table = &vio_iommu_table;
299 iSeries_vio_dev = &vio_bus_device.dev;
300 }
301#endif
138 302
139 err = bus_register(&vio_bus_type); 303 err = bus_register(&vio_bus_type);
140 if (err) { 304 if (err) {
@@ -153,47 +317,48 @@ int __init vio_bus_init(struct vio_bus_ops *ops)
153 return err; 317 return err;
154 } 318 }
155 319
156 return 0; 320 node_vroot = find_devices("vdevice");
157} 321 if (node_vroot) {
322 struct device_node *of_node;
323
324 /*
325 * Create struct vio_devices for each virtual device in
326 * the device tree. Drivers will associate with them later.
327 */
328 for (of_node = node_vroot->child; of_node != NULL;
329 of_node = of_node->sibling) {
330 printk(KERN_DEBUG "%s: processing %p\n",
331 __FUNCTION__, of_node);
332 vio_register_device_node(of_node);
333 }
334 }
158 335
159/* vio_dev refcount hit 0 */ 336 return 0;
160static void __devinit vio_dev_release(struct device *dev)
161{
162 if (vio_bus_ops.release_device)
163 vio_bus_ops.release_device(dev);
164 kfree(to_vio_dev(dev));
165} 337}
338__initcall(vio_bus_init);
166 339
167static ssize_t viodev_show_name(struct device *dev, 340static ssize_t name_show(struct device *dev,
168 struct device_attribute *attr, char *buf) 341 struct device_attribute *attr, char *buf)
169{ 342{
170 return sprintf(buf, "%s\n", to_vio_dev(dev)->name); 343 return sprintf(buf, "%s\n", to_vio_dev(dev)->name);
171} 344}
172DEVICE_ATTR(name, S_IRUSR | S_IRGRP | S_IROTH, viodev_show_name, NULL);
173 345
174struct vio_dev * __devinit vio_register_device(struct vio_dev *viodev) 346static ssize_t devspec_show(struct device *dev,
347 struct device_attribute *attr, char *buf)
175{ 348{
176 /* init generic 'struct device' fields: */ 349 struct device_node *of_node = dev->platform_data;
177 viodev->dev.parent = &vio_bus_device.dev;
178 viodev->dev.bus = &vio_bus_type;
179 viodev->dev.release = vio_dev_release;
180
181 /* register with generic device framework */
182 if (device_register(&viodev->dev)) {
183 printk(KERN_ERR "%s: failed to register device %s\n",
184 __FUNCTION__, viodev->dev.bus_id);
185 return NULL;
186 }
187 device_create_file(&viodev->dev, &dev_attr_name);
188 350
189 return viodev; 351 return sprintf(buf, "%s\n", of_node ? of_node->full_name : "none");
190} 352}
191 353
354static struct device_attribute vio_dev_attrs[] = {
355 __ATTR_RO(name),
356 __ATTR_RO(devspec),
357 __ATTR_NULL
358};
359
192void __devinit vio_unregister_device(struct vio_dev *viodev) 360void __devinit vio_unregister_device(struct vio_dev *viodev)
193{ 361{
194 if (vio_bus_ops.unregister_device)
195 vio_bus_ops.unregister_device(viodev);
196 device_remove_file(&viodev->dev, &dev_attr_name);
197 device_unregister(&viodev->dev); 362 device_unregister(&viodev->dev);
198} 363}
199EXPORT_SYMBOL(vio_unregister_device); 364EXPORT_SYMBOL(vio_unregister_device);
@@ -267,22 +432,23 @@ static int vio_hotplug(struct device *dev, char **envp, int num_envp,
267 char *buffer, int buffer_size) 432 char *buffer, int buffer_size)
268{ 433{
269 const struct vio_dev *vio_dev = to_vio_dev(dev); 434 const struct vio_dev *vio_dev = to_vio_dev(dev);
435 struct device_node *dn = dev->platform_data;
270 char *cp; 436 char *cp;
271 int length; 437 int length;
272 438
273 if (!num_envp) 439 if (!num_envp)
274 return -ENOMEM; 440 return -ENOMEM;
275 441
276 if (!vio_dev->dev.platform_data) 442 if (!dn)
277 return -ENODEV; 443 return -ENODEV;
278 cp = (char *)get_property(vio_dev->dev.platform_data, "compatible", &length); 444 cp = (char *)get_property(dn, "compatible", &length);
279 if (!cp) 445 if (!cp)
280 return -ENODEV; 446 return -ENODEV;
281 447
282 envp[0] = buffer; 448 envp[0] = buffer;
283 length = scnprintf(buffer, buffer_size, "MODALIAS=vio:T%sS%s", 449 length = scnprintf(buffer, buffer_size, "MODALIAS=vio:T%sS%s",
284 vio_dev->type, cp); 450 vio_dev->type, cp);
285 if (buffer_size - length <= 0) 451 if ((buffer_size - length) <= 0)
286 return -ENOMEM; 452 return -ENOMEM;
287 envp[1] = NULL; 453 envp[1] = NULL;
288 return 0; 454 return 0;
@@ -290,9 +456,81 @@ static int vio_hotplug(struct device *dev, char **envp, int num_envp,
290 456
291struct bus_type vio_bus_type = { 457struct bus_type vio_bus_type = {
292 .name = "vio", 458 .name = "vio",
459 .dev_attrs = vio_dev_attrs,
293 .uevent = vio_hotplug, 460 .uevent = vio_hotplug,
294 .match = vio_bus_match, 461 .match = vio_bus_match,
295 .probe = vio_bus_probe, 462 .probe = vio_bus_probe,
296 .remove = vio_bus_remove, 463 .remove = vio_bus_remove,
297 .shutdown = vio_bus_shutdown, 464 .shutdown = vio_bus_shutdown,
298}; 465};
466
467/**
468 * vio_get_attribute: - get attribute for virtual device
469 * @vdev: The vio device to get property.
470 * @which: The property/attribute to be extracted.
471 * @length: Pointer to length of returned data size (unused if NULL).
472 *
473 * Calls prom.c's get_property() to return the value of the
474 * attribute specified by @which
475*/
476const void *vio_get_attribute(struct vio_dev *vdev, char *which, int *length)
477{
478 return get_property(vdev->dev.platform_data, which, length);
479}
480EXPORT_SYMBOL(vio_get_attribute);
481
482#ifdef CONFIG_PPC_PSERIES
483/* vio_find_name() - internal because only vio.c knows how we formatted the
484 * kobject name
485 * XXX once vio_bus_type.devices is actually used as a kset in
486 * drivers/base/bus.c, this function should be removed in favor of
487 * "device_find(kobj_name, &vio_bus_type)"
488 */
489static struct vio_dev *vio_find_name(const char *kobj_name)
490{
491 struct kobject *found;
492
493 found = kset_find_obj(&devices_subsys.kset, kobj_name);
494 if (!found)
495 return NULL;
496
497 return to_vio_dev(container_of(found, struct device, kobj));
498}
499
500/**
501 * vio_find_node - find an already-registered vio_dev
502 * @vnode: device_node of the virtual device we're looking for
503 */
504struct vio_dev *vio_find_node(struct device_node *vnode)
505{
506 uint32_t *unit_address;
507 char kobj_name[BUS_ID_SIZE];
508
509 /* construct the kobject name from the device node */
510 unit_address = (uint32_t *)get_property(vnode, "reg", NULL);
511 if (!unit_address)
512 return NULL;
513 snprintf(kobj_name, BUS_ID_SIZE, "%x", *unit_address);
514
515 return vio_find_name(kobj_name);
516}
517EXPORT_SYMBOL(vio_find_node);
518
519int vio_enable_interrupts(struct vio_dev *dev)
520{
521 int rc = h_vio_signal(dev->unit_address, VIO_IRQ_ENABLE);
522 if (rc != H_SUCCESS)
523 printk(KERN_ERR "vio: Error 0x%x enabling interrupts\n", rc);
524 return rc;
525}
526EXPORT_SYMBOL(vio_enable_interrupts);
527
528int vio_disable_interrupts(struct vio_dev *dev)
529{
530 int rc = h_vio_signal(dev->unit_address, VIO_IRQ_DISABLE);
531 if (rc != H_SUCCESS)
532 printk(KERN_ERR "vio: Error 0x%x disabling interrupts\n", rc);
533 return rc;
534}
535EXPORT_SYMBOL(vio_disable_interrupts);
536#endif /* CONFIG_PPC_PSERIES */
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index fe79c2584cb0..8b25953dc4f0 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -93,6 +93,11 @@ SECTIONS
93 __ptov_table_begin = .; 93 __ptov_table_begin = .;
94 *(.ptov_fixup); 94 *(.ptov_fixup);
95 __ptov_table_end = .; 95 __ptov_table_end = .;
96#ifdef CONFIG_PPC_ISERIES
97 __dt_strings_start = .;
98 *(.dt_strings);
99 __dt_strings_end = .;
100#endif
96 } 101 }
97 102
98 . = ALIGN(16); 103 . = ALIGN(16);
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index 34f5c2e074c9..ae354d65b82c 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -7,7 +7,6 @@ obj-y := string.o strcase.o
7obj-$(CONFIG_PPC32) += div64.o copy_32.o checksum_32.o 7obj-$(CONFIG_PPC32) += div64.o copy_32.o checksum_32.o
8endif 8endif
9 9
10obj-y += bitops.o
11obj-$(CONFIG_PPC64) += checksum_64.o copypage_64.o copyuser_64.o \ 10obj-$(CONFIG_PPC64) += checksum_64.o copypage_64.o copyuser_64.o \
12 memcpy_64.o usercopy_64.o mem_64.o string.o \ 11 memcpy_64.o usercopy_64.o mem_64.o string.o \
13 strcase.o 12 strcase.o
diff --git a/arch/powerpc/lib/bitops.c b/arch/powerpc/lib/bitops.c
deleted file mode 100644
index f68ad71a0187..000000000000
--- a/arch/powerpc/lib/bitops.c
+++ /dev/null
@@ -1,150 +0,0 @@
1#include <linux/types.h>
2#include <linux/module.h>
3#include <asm/byteorder.h>
4#include <asm/bitops.h>
5
6/**
7 * find_next_bit - find the next set bit in a memory region
8 * @addr: The address to base the search on
9 * @offset: The bitnumber to start searching at
10 * @size: The maximum size to search
11 */
12unsigned long find_next_bit(const unsigned long *addr, unsigned long size,
13 unsigned long offset)
14{
15 const unsigned long *p = addr + BITOP_WORD(offset);
16 unsigned long result = offset & ~(BITS_PER_LONG-1);
17 unsigned long tmp;
18
19 if (offset >= size)
20 return size;
21 size -= result;
22 offset %= BITS_PER_LONG;
23 if (offset) {
24 tmp = *(p++);
25 tmp &= (~0UL << offset);
26 if (size < BITS_PER_LONG)
27 goto found_first;
28 if (tmp)
29 goto found_middle;
30 size -= BITS_PER_LONG;
31 result += BITS_PER_LONG;
32 }
33 while (size & ~(BITS_PER_LONG-1)) {
34 if ((tmp = *(p++)))
35 goto found_middle;
36 result += BITS_PER_LONG;
37 size -= BITS_PER_LONG;
38 }
39 if (!size)
40 return result;
41 tmp = *p;
42
43found_first:
44 tmp &= (~0UL >> (BITS_PER_LONG - size));
45 if (tmp == 0UL) /* Are any bits set? */
46 return result + size; /* Nope. */
47found_middle:
48 return result + __ffs(tmp);
49}
50EXPORT_SYMBOL(find_next_bit);
51
52/*
53 * This implementation of find_{first,next}_zero_bit was stolen from
54 * Linus' asm-alpha/bitops.h.
55 */
56unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size,
57 unsigned long offset)
58{
59 const unsigned long *p = addr + BITOP_WORD(offset);
60 unsigned long result = offset & ~(BITS_PER_LONG-1);
61 unsigned long tmp;
62
63 if (offset >= size)
64 return size;
65 size -= result;
66 offset %= BITS_PER_LONG;
67 if (offset) {
68 tmp = *(p++);
69 tmp |= ~0UL >> (BITS_PER_LONG - offset);
70 if (size < BITS_PER_LONG)
71 goto found_first;
72 if (~tmp)
73 goto found_middle;
74 size -= BITS_PER_LONG;
75 result += BITS_PER_LONG;
76 }
77 while (size & ~(BITS_PER_LONG-1)) {
78 if (~(tmp = *(p++)))
79 goto found_middle;
80 result += BITS_PER_LONG;
81 size -= BITS_PER_LONG;
82 }
83 if (!size)
84 return result;
85 tmp = *p;
86
87found_first:
88 tmp |= ~0UL << size;
89 if (tmp == ~0UL) /* Are any bits zero? */
90 return result + size; /* Nope. */
91found_middle:
92 return result + ffz(tmp);
93}
94EXPORT_SYMBOL(find_next_zero_bit);
95
96static inline unsigned int ext2_ilog2(unsigned int x)
97{
98 int lz;
99
100 asm("cntlzw %0,%1": "=r"(lz):"r"(x));
101 return 31 - lz;
102}
103
104static inline unsigned int ext2_ffz(unsigned int x)
105{
106 u32 rc;
107 if ((x = ~x) == 0)
108 return 32;
109 rc = ext2_ilog2(x & -x);
110 return rc;
111}
112
113unsigned long find_next_zero_le_bit(const unsigned long *addr,
114 unsigned long size, unsigned long offset)
115{
116 const unsigned int *p = ((const unsigned int *)addr) + (offset >> 5);
117 unsigned int result = offset & ~31;
118 unsigned int tmp;
119
120 if (offset >= size)
121 return size;
122 size -= result;
123 offset &= 31;
124 if (offset) {
125 tmp = cpu_to_le32p(p++);
126 tmp |= ~0U >> (32 - offset); /* bug or feature ? */
127 if (size < 32)
128 goto found_first;
129 if (tmp != ~0)
130 goto found_middle;
131 size -= 32;
132 result += 32;
133 }
134 while (size >= 32) {
135 if ((tmp = cpu_to_le32p(p++)) != ~0)
136 goto found_middle;
137 result += 32;
138 size -= 32;
139 }
140 if (!size)
141 return result;
142 tmp = cpu_to_le32p(p);
143found_first:
144 tmp |= ~0 << size;
145 if (tmp == ~0) /* Are any bits zero? */
146 return result + size; /* Nope. */
147found_middle:
148 return result + ext2_ffz(tmp);
149}
150EXPORT_SYMBOL(find_next_zero_le_bit);
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index c006d9039633..b43ed92ef471 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -319,7 +319,7 @@ static void __init htab_init_page_sizes(void)
319 mmu_virtual_psize = MMU_PAGE_64K; 319 mmu_virtual_psize = MMU_PAGE_64K;
320#endif 320#endif
321 321
322 printk(KERN_INFO "Page orders: linear mapping = %d, others = %d\n", 322 printk(KERN_DEBUG "Page orders: linear mapping = %d, others = %d\n",
323 mmu_psize_defs[mmu_linear_psize].shift, 323 mmu_psize_defs[mmu_linear_psize].shift,
324 mmu_psize_defs[mmu_virtual_psize].shift); 324 mmu_psize_defs[mmu_virtual_psize].shift);
325 325
diff --git a/arch/powerpc/mm/lmb.c b/arch/powerpc/mm/lmb.c
index 417d58518558..8b6f522655a6 100644
--- a/arch/powerpc/mm/lmb.c
+++ b/arch/powerpc/mm/lmb.c
@@ -89,20 +89,25 @@ static long __init lmb_regions_adjacent(struct lmb_region *rgn,
89 return lmb_addrs_adjacent(base1, size1, base2, size2); 89 return lmb_addrs_adjacent(base1, size1, base2, size2);
90} 90}
91 91
92/* Assumption: base addr of region 1 < base addr of region 2 */ 92static void __init lmb_remove_region(struct lmb_region *rgn, unsigned long r)
93static void __init lmb_coalesce_regions(struct lmb_region *rgn,
94 unsigned long r1, unsigned long r2)
95{ 93{
96 unsigned long i; 94 unsigned long i;
97 95
98 rgn->region[r1].size += rgn->region[r2].size; 96 for (i = r; i < rgn->cnt - 1; i++) {
99 for (i=r2; i < rgn->cnt-1; i++) { 97 rgn->region[i].base = rgn->region[i + 1].base;
100 rgn->region[i].base = rgn->region[i+1].base; 98 rgn->region[i].size = rgn->region[i + 1].size;
101 rgn->region[i].size = rgn->region[i+1].size;
102 } 99 }
103 rgn->cnt--; 100 rgn->cnt--;
104} 101}
105 102
103/* Assumption: base addr of region 1 < base addr of region 2 */
104static void __init lmb_coalesce_regions(struct lmb_region *rgn,
105 unsigned long r1, unsigned long r2)
106{
107 rgn->region[r1].size += rgn->region[r2].size;
108 lmb_remove_region(rgn, r2);
109}
110
106/* This routine called with relocation disabled. */ 111/* This routine called with relocation disabled. */
107void __init lmb_init(void) 112void __init lmb_init(void)
108{ 113{
@@ -294,17 +299,16 @@ unsigned long __init lmb_end_of_DRAM(void)
294 return (lmb.memory.region[idx].base + lmb.memory.region[idx].size); 299 return (lmb.memory.region[idx].base + lmb.memory.region[idx].size);
295} 300}
296 301
297/* 302/* You must call lmb_analyze() after this. */
298 * Truncate the lmb list to memory_limit if it's set
299 * You must call lmb_analyze() after this.
300 */
301void __init lmb_enforce_memory_limit(unsigned long memory_limit) 303void __init lmb_enforce_memory_limit(unsigned long memory_limit)
302{ 304{
303 unsigned long i, limit; 305 unsigned long i, limit;
306 struct lmb_property *p;
304 307
305 if (! memory_limit) 308 if (! memory_limit)
306 return; 309 return;
307 310
311 /* Truncate the lmb regions to satisfy the memory limit. */
308 limit = memory_limit; 312 limit = memory_limit;
309 for (i = 0; i < lmb.memory.cnt; i++) { 313 for (i = 0; i < lmb.memory.cnt; i++) {
310 if (limit > lmb.memory.region[i].size) { 314 if (limit > lmb.memory.region[i].size) {
@@ -316,4 +320,21 @@ void __init lmb_enforce_memory_limit(unsigned long memory_limit)
316 lmb.memory.cnt = i + 1; 320 lmb.memory.cnt = i + 1;
317 break; 321 break;
318 } 322 }
323
324 lmb.rmo_size = lmb.memory.region[0].size;
325
326 /* And truncate any reserves above the limit also. */
327 for (i = 0; i < lmb.reserved.cnt; i++) {
328 p = &lmb.reserved.region[i];
329
330 if (p->base > memory_limit)
331 p->size = 0;
332 else if ((p->base + p->size) > memory_limit)
333 p->size = memory_limit - p->base;
334
335 if (p->size == 0) {
336 lmb_remove_region(&lmb.reserved, i);
337 i--;
338 }
339 }
319} 340}
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 741dd8802d49..69f3b9a20beb 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -299,9 +299,9 @@ void __init paging_init(void)
299 kmap_prot = PAGE_KERNEL; 299 kmap_prot = PAGE_KERNEL;
300#endif /* CONFIG_HIGHMEM */ 300#endif /* CONFIG_HIGHMEM */
301 301
302 printk(KERN_INFO "Top of RAM: 0x%lx, Total RAM: 0x%lx\n", 302 printk(KERN_DEBUG "Top of RAM: 0x%lx, Total RAM: 0x%lx\n",
303 top_of_ram, total_ram); 303 top_of_ram, total_ram);
304 printk(KERN_INFO "Memory hole size: %ldMB\n", 304 printk(KERN_DEBUG "Memory hole size: %ldMB\n",
305 (top_of_ram - total_ram) >> 20); 305 (top_of_ram - total_ram) >> 20);
306 /* 306 /*
307 * All pages are DMA-able so we put them all in the DMA zone. 307 * All pages are DMA-able so we put them all in the DMA zone.
@@ -380,7 +380,7 @@ void __init mem_init(void)
380 totalhigh_pages++; 380 totalhigh_pages++;
381 } 381 }
382 totalram_pages += totalhigh_pages; 382 totalram_pages += totalhigh_pages;
383 printk(KERN_INFO "High memory: %luk\n", 383 printk(KERN_DEBUG "High memory: %luk\n",
384 totalhigh_pages << (PAGE_SHIFT-10)); 384 totalhigh_pages << (PAGE_SHIFT-10));
385 } 385 }
386#endif /* CONFIG_HIGHMEM */ 386#endif /* CONFIG_HIGHMEM */
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 092355f37399..aa98cb3b59d8 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -487,9 +487,9 @@ static void __init setup_nonnuma(void)
487 unsigned long total_ram = lmb_phys_mem_size(); 487 unsigned long total_ram = lmb_phys_mem_size();
488 unsigned int i; 488 unsigned int i;
489 489
490 printk(KERN_INFO "Top of RAM: 0x%lx, Total RAM: 0x%lx\n", 490 printk(KERN_DEBUG "Top of RAM: 0x%lx, Total RAM: 0x%lx\n",
491 top_of_ram, total_ram); 491 top_of_ram, total_ram);
492 printk(KERN_INFO "Memory hole size: %ldMB\n", 492 printk(KERN_DEBUG "Memory hole size: %ldMB\n",
493 (top_of_ram - total_ram) >> 20); 493 (top_of_ram - total_ram) >> 20);
494 494
495 for (i = 0; i < lmb.memory.cnt; ++i) 495 for (i = 0; i < lmb.memory.cnt; ++i)
@@ -507,7 +507,7 @@ void __init dump_numa_cpu_topology(void)
507 return; 507 return;
508 508
509 for_each_online_node(node) { 509 for_each_online_node(node) {
510 printk(KERN_INFO "Node %d CPUs:", node); 510 printk(KERN_DEBUG "Node %d CPUs:", node);
511 511
512 count = 0; 512 count = 0;
513 /* 513 /*
@@ -543,7 +543,7 @@ static void __init dump_numa_memory_topology(void)
543 for_each_online_node(node) { 543 for_each_online_node(node) {
544 unsigned long i; 544 unsigned long i;
545 545
546 printk(KERN_INFO "Node %d Memory:", node); 546 printk(KERN_DEBUG "Node %d Memory:", node);
547 547
548 count = 0; 548 count = 0;
549 549
diff --git a/arch/powerpc/oprofile/common.c b/arch/powerpc/oprofile/common.c
index 5b1de7e8041e..38a2f9c17187 100644
--- a/arch/powerpc/oprofile/common.c
+++ b/arch/powerpc/oprofile/common.c
@@ -162,7 +162,7 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
162 ops->stop = op_powerpc_stop; 162 ops->stop = op_powerpc_stop;
163 ops->backtrace = op_powerpc_backtrace; 163 ops->backtrace = op_powerpc_backtrace;
164 164
165 printk(KERN_INFO "oprofile: using %s performance monitoring.\n", 165 printk(KERN_DEBUG "oprofile: using %s performance monitoring.\n",
166 ops->cpu_type); 166 ops->cpu_type);
167 167
168 return 0; 168 return 0;
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index 06e371282f57..454fc53289ab 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -11,13 +11,20 @@ config MPC8540_ADS
11 help 11 help
12 This option enables support for the MPC 8540 ADS board 12 This option enables support for the MPC 8540 ADS board
13 13
14config MPC85xx_CDS
15 bool "Freescale MPC85xx CDS"
16 select DEFAULT_UIMAGE
17 select PPC_I8259 if PCI
18 help
19 This option enables support for the MPC85xx CDS board
20
14endchoice 21endchoice
15 22
16config MPC8540 23config MPC8540
17 bool 24 bool
18 select PPC_UDBG_16550 25 select PPC_UDBG_16550
19 select PPC_INDIRECT_PCI 26 select PPC_INDIRECT_PCI
20 default y if MPC8540_ADS 27 default y if MPC8540_ADS || MPC85xx_CDS
21 28
22config PPC_INDIRECT_PCI_BE 29config PPC_INDIRECT_PCI_BE
23 bool 30 bool
diff --git a/arch/powerpc/platforms/85xx/Makefile b/arch/powerpc/platforms/85xx/Makefile
index ffc4139cb214..7615aa59c78b 100644
--- a/arch/powerpc/platforms/85xx/Makefile
+++ b/arch/powerpc/platforms/85xx/Makefile
@@ -3,3 +3,4 @@
3# 3#
4obj-$(CONFIG_PPC_85xx) += misc.o pci.o 4obj-$(CONFIG_PPC_85xx) += misc.o pci.o
5obj-$(CONFIG_MPC8540_ADS) += mpc85xx_ads.o 5obj-$(CONFIG_MPC8540_ADS) += mpc85xx_ads.o
6obj-$(CONFIG_MPC85xx_CDS) += mpc85xx_cds.o
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_cds.c b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
new file mode 100644
index 000000000000..18e6e11f7020
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
@@ -0,0 +1,359 @@
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/init.h>
18#include <linux/errno.h>
19#include <linux/reboot.h>
20#include <linux/pci.h>
21#include <linux/kdev_t.h>
22#include <linux/major.h>
23#include <linux/console.h>
24#include <linux/delay.h>
25#include <linux/seq_file.h>
26#include <linux/root_dev.h>
27#include <linux/initrd.h>
28#include <linux/module.h>
29#include <linux/fsl_devices.h>
30
31#include <asm/system.h>
32#include <asm/pgtable.h>
33#include <asm/page.h>
34#include <asm/atomic.h>
35#include <asm/time.h>
36#include <asm/io.h>
37#include <asm/machdep.h>
38#include <asm/ipic.h>
39#include <asm/bootinfo.h>
40#include <asm/pci-bridge.h>
41#include <asm/mpc85xx.h>
42#include <asm/irq.h>
43#include <mm/mmu_decl.h>
44#include <asm/prom.h>
45#include <asm/udbg.h>
46#include <asm/mpic.h>
47#include <asm/i8259.h>
48
49#include <sysdev/fsl_soc.h>
50#include "mpc85xx.h"
51
52#ifndef CONFIG_PCI
53unsigned long isa_io_base = 0;
54unsigned long isa_mem_base = 0;
55#endif
56
57static int cds_pci_slot = 2;
58static volatile u8 *cadmus;
59
60/*
61 * Internal interrupts are all Level Sensitive, and Positive Polarity
62 *
63 * Note: Likely, this table and the following function should be
64 * obtained and derived from the OF Device Tree.
65 */
66static u_char mpc85xx_cds_openpic_initsenses[] __initdata = {
67 MPC85XX_INTERNAL_IRQ_SENSES,
68#if defined(CONFIG_PCI)
69 (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* Ext 0: PCI slot 0 */
70 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext 1: PCI slot 1 */
71 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext 2: PCI slot 2 */
72 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext 3: PCI slot 3 */
73#else
74 0x0, /* External 0: */
75 0x0, /* External 1: */
76 0x0, /* External 2: */
77 0x0, /* External 3: */
78#endif
79 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 5: PHY */
80 0x0, /* External 6: */
81 0x0, /* External 7: */
82 0x0, /* External 8: */
83 0x0, /* External 9: */
84 0x0, /* External 10: */
85#ifdef CONFIG_PCI
86 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* Ext 11: PCI2 slot 0 */
87#else
88 0x0, /* External 11: */
89#endif
90};
91
92
93#ifdef CONFIG_PCI
94/*
95 * interrupt routing
96 */
97int
98mpc85xx_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
99{
100 struct pci_controller *hose = pci_bus_to_hose(dev->bus->number);
101
102 if (!hose->index)
103 {
104 /* Handle PCI1 interrupts */
105 char pci_irq_table[][4] =
106 /*
107 * PCI IDSEL/INTPIN->INTLINE
108 * A B C D
109 */
110
111 /* Note IRQ assignment for slots is based on which slot the elysium is
112 * in -- in this setup elysium is in slot #2 (this PIRQA as first
113 * interrupt on slot */
114 {
115 { 0, 1, 2, 3 }, /* 16 - PMC */
116 { 0, 1, 2, 3 }, /* 17 P2P (Tsi320) */
117 { 0, 1, 2, 3 }, /* 18 - Slot 1 */
118 { 1, 2, 3, 0 }, /* 19 - Slot 2 */
119 { 2, 3, 0, 1 }, /* 20 - Slot 3 */
120 { 3, 0, 1, 2 }, /* 21 - Slot 4 */
121 };
122
123 const long min_idsel = 16, max_idsel = 21, irqs_per_slot = 4;
124 int i, j;
125
126 for (i = 0; i < 6; i++)
127 for (j = 0; j < 4; j++)
128 pci_irq_table[i][j] =
129 ((pci_irq_table[i][j] + 5 -
130 cds_pci_slot) & 0x3) + PIRQ0A;
131
132 return PCI_IRQ_TABLE_LOOKUP;
133 } else {
134 /* Handle PCI2 interrupts (if we have one) */
135 char pci_irq_table[][4] =
136 {
137 /*
138 * We only have one slot and one interrupt
139 * going to PIRQA - PIRQD */
140 { PIRQ1A, PIRQ1A, PIRQ1A, PIRQ1A }, /* 21 - slot 0 */
141 };
142
143 const long min_idsel = 21, max_idsel = 21, irqs_per_slot = 4;
144
145 return PCI_IRQ_TABLE_LOOKUP;
146 }
147}
148
149#define ARCADIA_HOST_BRIDGE_IDSEL 17
150#define ARCADIA_2ND_BRIDGE_IDSEL 3
151
152extern int mpc85xx_pci2_busno;
153
154int
155mpc85xx_exclude_device(u_char bus, u_char devfn)
156{
157 if (bus == 0 && PCI_SLOT(devfn) == 0)
158 return PCIBIOS_DEVICE_NOT_FOUND;
159 if (mpc85xx_pci2_busno)
160 if (bus == (mpc85xx_pci2_busno) && PCI_SLOT(devfn) == 0)
161 return PCIBIOS_DEVICE_NOT_FOUND;
162 /* We explicitly do not go past the Tundra 320 Bridge */
163 if ((bus == 1) && (PCI_SLOT(devfn) == ARCADIA_2ND_BRIDGE_IDSEL))
164 return PCIBIOS_DEVICE_NOT_FOUND;
165 if ((bus == 0) && (PCI_SLOT(devfn) == ARCADIA_2ND_BRIDGE_IDSEL))
166 return PCIBIOS_DEVICE_NOT_FOUND;
167 else
168 return PCIBIOS_SUCCESSFUL;
169}
170
171void __init
172mpc85xx_cds_pcibios_fixup(void)
173{
174 struct pci_dev *dev;
175 u_char c;
176
177 if ((dev = pci_get_device(PCI_VENDOR_ID_VIA,
178 PCI_DEVICE_ID_VIA_82C586_1, NULL))) {
179 /*
180 * U-Boot does not set the enable bits
181 * for the IDE device. Force them on here.
182 */
183 pci_read_config_byte(dev, 0x40, &c);
184 c |= 0x03; /* IDE: Chip Enable Bits */
185 pci_write_config_byte(dev, 0x40, c);
186
187 /*
188 * Since only primary interface works, force the
189 * IDE function to standard primary IDE interrupt
190 * w/ 8259 offset
191 */
192 dev->irq = 14;
193 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
194 pci_dev_put(dev);
195 }
196
197 /*
198 * Force legacy USB interrupt routing
199 */
200 if ((dev = pci_get_device(PCI_VENDOR_ID_VIA,
201 PCI_DEVICE_ID_VIA_82C586_2, NULL))) {
202 dev->irq = 10;
203 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, 10);
204 pci_dev_put(dev);
205 }
206
207 if ((dev = pci_get_device(PCI_VENDOR_ID_VIA,
208 PCI_DEVICE_ID_VIA_82C586_2, dev))) {
209 dev->irq = 11;
210 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, 11);
211 pci_dev_put(dev);
212 }
213}
214#endif /* CONFIG_PCI */
215
216void __init mpc85xx_cds_pic_init(void)
217{
218 struct mpic *mpic1;
219 phys_addr_t OpenPIC_PAddr;
220
221 /* Determine the Physical Address of the OpenPIC regs */
222 OpenPIC_PAddr = get_immrbase() + MPC85xx_OPENPIC_OFFSET;
223
224 mpic1 = mpic_alloc(OpenPIC_PAddr,
225 MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
226 4, MPC85xx_OPENPIC_IRQ_OFFSET, 0, 250,
227 mpc85xx_cds_openpic_initsenses,
228 sizeof(mpc85xx_cds_openpic_initsenses), " OpenPIC ");
229 BUG_ON(mpic1 == NULL);
230 mpic_assign_isu(mpic1, 0, OpenPIC_PAddr + 0x10200);
231 mpic_assign_isu(mpic1, 1, OpenPIC_PAddr + 0x10280);
232 mpic_assign_isu(mpic1, 2, OpenPIC_PAddr + 0x10300);
233 mpic_assign_isu(mpic1, 3, OpenPIC_PAddr + 0x10380);
234 mpic_assign_isu(mpic1, 4, OpenPIC_PAddr + 0x10400);
235 mpic_assign_isu(mpic1, 5, OpenPIC_PAddr + 0x10480);
236 mpic_assign_isu(mpic1, 6, OpenPIC_PAddr + 0x10500);
237 mpic_assign_isu(mpic1, 7, OpenPIC_PAddr + 0x10580);
238
239 /* dummy mappings to get to 48 */
240 mpic_assign_isu(mpic1, 8, OpenPIC_PAddr + 0x10600);
241 mpic_assign_isu(mpic1, 9, OpenPIC_PAddr + 0x10680);
242 mpic_assign_isu(mpic1, 10, OpenPIC_PAddr + 0x10700);
243 mpic_assign_isu(mpic1, 11, OpenPIC_PAddr + 0x10780);
244
245 /* External ints */
246 mpic_assign_isu(mpic1, 12, OpenPIC_PAddr + 0x10000);
247 mpic_assign_isu(mpic1, 13, OpenPIC_PAddr + 0x10080);
248 mpic_assign_isu(mpic1, 14, OpenPIC_PAddr + 0x10100);
249
250 mpic_init(mpic1);
251
252#ifdef CONFIG_PCI
253 mpic_setup_cascade(PIRQ0A, i8259_irq_cascade, NULL);
254
255 i8259_init(0,0);
256#endif
257}
258
259
260/*
261 * Setup the architecture
262 */
263static void __init
264mpc85xx_cds_setup_arch(void)
265{
266 struct device_node *cpu;
267#ifdef CONFIG_PCI
268 struct device_node *np;
269#endif
270
271 if (ppc_md.progress)
272 ppc_md.progress("mpc85xx_cds_setup_arch()", 0);
273
274 cpu = of_find_node_by_type(NULL, "cpu");
275 if (cpu != 0) {
276 unsigned int *fp;
277
278 fp = (int *)get_property(cpu, "clock-frequency", NULL);
279 if (fp != 0)
280 loops_per_jiffy = *fp / HZ;
281 else
282 loops_per_jiffy = 500000000 / HZ;
283 of_node_put(cpu);
284 }
285
286 cadmus = ioremap(CADMUS_BASE, CADMUS_SIZE);
287 cds_pci_slot = ((cadmus[CM_CSR] >> 6) & 0x3) + 1;
288
289 if (ppc_md.progress) {
290 char buf[40];
291 snprintf(buf, 40, "CDS Version = 0x%x in slot %d\n",
292 cadmus[CM_VER], cds_pci_slot);
293 ppc_md.progress(buf, 0);
294 }
295
296#ifdef CONFIG_PCI
297 for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
298 add_bridge(np);
299
300 ppc_md.pcibios_fixup = mpc85xx_cds_pcibios_fixup;
301 ppc_md.pci_swizzle = common_swizzle;
302 ppc_md.pci_map_irq = mpc85xx_map_irq;
303 ppc_md.pci_exclude_device = mpc85xx_exclude_device;
304#endif
305
306#ifdef CONFIG_ROOT_NFS
307 ROOT_DEV = Root_NFS;
308#else
309 ROOT_DEV = Root_HDA1;
310#endif
311}
312
313
314void
315mpc85xx_cds_show_cpuinfo(struct seq_file *m)
316{
317 uint pvid, svid, phid1;
318 uint memsize = total_memory;
319
320 pvid = mfspr(SPRN_PVR);
321 svid = mfspr(SPRN_SVR);
322
323 seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n");
324 seq_printf(m, "Machine\t\t: MPC85xx CDS (0x%x)\n", cadmus[CM_VER]);
325 seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
326 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
327
328 /* Display cpu Pll setting */
329 phid1 = mfspr(SPRN_HID1);
330 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
331
332 /* Display the amount of memory */
333 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
334}
335
336
337/*
338 * Called very early, device-tree isn't unflattened
339 */
340static int __init mpc85xx_cds_probe(void)
341{
342 /* We always match for now, eventually we should look at
343 * the flat dev tree to ensure this is the board we are
344 * supposed to run on
345 */
346 return 1;
347}
348
349define_machine(mpc85xx_cds) {
350 .name = "MPC85xx CDS",
351 .probe = mpc85xx_cds_probe,
352 .setup_arch = mpc85xx_cds_setup_arch,
353 .init_IRQ = mpc85xx_cds_pic_init,
354 .show_cpuinfo = mpc85xx_cds_show_cpuinfo,
355 .get_irq = mpic_get_irq,
356 .restart = mpc85xx_restart,
357 .calibrate_decr = generic_calibrate_decr,
358 .progress = udbg_progress,
359};
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_cds.h b/arch/powerpc/platforms/85xx/mpc85xx_cds.h
new file mode 100644
index 000000000000..671f54ff185a
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/mpc85xx_cds.h
@@ -0,0 +1,43 @@
1/*
2 * arch/ppc/platforms/85xx/mpc85xx_cds_common.h
3 *
4 * MPC85xx CDS board definitions
5 *
6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
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_MPC85XX_CDS_H__
18#define __MACH_MPC85XX_CDS_H__
19
20/* CADMUS info */
21#define CADMUS_BASE (0xf8004000)
22#define CADMUS_SIZE (256)
23#define CM_VER (0)
24#define CM_CSR (1)
25#define CM_RST (2)
26
27/* CDS NVRAM/RTC */
28#define CDS_RTC_ADDR (0xf8000000)
29#define CDS_RTC_SIZE (8 * 1024)
30
31/* PCI interrupt controller */
32#define PIRQ0A MPC85xx_IRQ_EXT0
33#define PIRQ0B MPC85xx_IRQ_EXT1
34#define PIRQ0C MPC85xx_IRQ_EXT2
35#define PIRQ0D MPC85xx_IRQ_EXT3
36#define PIRQ1A MPC85xx_IRQ_EXT11
37
38#define NR_8259_INTS 16
39#define CPM_IRQ_OFFSET NR_8259_INTS
40
41#define MPC85xx_OPENPIC_IRQ_OFFSET 80
42
43#endif /* __MACH_MPC85XX_CDS_H__ */
diff --git a/arch/powerpc/platforms/cell/spufs/context.c b/arch/powerpc/platforms/cell/spufs/context.c
index 8bb33abfad17..36439c5e9f2d 100644
--- a/arch/powerpc/platforms/cell/spufs/context.c
+++ b/arch/powerpc/platforms/cell/spufs/context.c
@@ -30,7 +30,7 @@
30struct spu_context *alloc_spu_context(void) 30struct spu_context *alloc_spu_context(void)
31{ 31{
32 struct spu_context *ctx; 32 struct spu_context *ctx;
33 ctx = kmalloc(sizeof *ctx, GFP_KERNEL); 33 ctx = kzalloc(sizeof *ctx, GFP_KERNEL);
34 if (!ctx) 34 if (!ctx)
35 goto out; 35 goto out;
36 /* Binding to physical processor deferred 36 /* Binding to physical processor deferred
@@ -48,17 +48,7 @@ struct spu_context *alloc_spu_context(void)
48 init_waitqueue_head(&ctx->wbox_wq); 48 init_waitqueue_head(&ctx->wbox_wq);
49 init_waitqueue_head(&ctx->stop_wq); 49 init_waitqueue_head(&ctx->stop_wq);
50 init_waitqueue_head(&ctx->mfc_wq); 50 init_waitqueue_head(&ctx->mfc_wq);
51 ctx->ibox_fasync = NULL;
52 ctx->wbox_fasync = NULL;
53 ctx->mfc_fasync = NULL;
54 ctx->mfc = NULL;
55 ctx->tagwait = 0;
56 ctx->state = SPU_STATE_SAVED; 51 ctx->state = SPU_STATE_SAVED;
57 ctx->local_store = NULL;
58 ctx->cntl = NULL;
59 ctx->signal1 = NULL;
60 ctx->signal2 = NULL;
61 ctx->spu = NULL;
62 ctx->ops = &spu_backing_ops; 52 ctx->ops = &spu_backing_ops;
63 ctx->owner = get_task_mm(current); 53 ctx->owner = get_task_mm(current);
64 goto out; 54 goto out;
diff --git a/arch/powerpc/platforms/iseries/Makefile b/arch/powerpc/platforms/iseries/Makefile
index ce8c0b943fa0..dee4eb4d8bec 100644
--- a/arch/powerpc/platforms/iseries/Makefile
+++ b/arch/powerpc/platforms/iseries/Makefile
@@ -1,9 +1,11 @@
1EXTRA_CFLAGS += -mno-minimal-toc 1EXTRA_CFLAGS += -mno-minimal-toc
2 2
3obj-y += hvlog.o hvlpconfig.o lpardata.o setup.o mf.o lpevents.o \ 3obj-y += hvlog.o hvlpconfig.o lpardata.o setup.o dt_mod.o mf.o lpevents.o \
4 hvcall.o proc.o htab.o iommu.o misc.o irq.o 4 hvcall.o proc.o htab.o iommu.o misc.o irq.o
5obj-$(CONFIG_PCI) += pci.o vpdinfo.o 5obj-$(CONFIG_PCI) += pci.o vpdinfo.o
6obj-$(CONFIG_IBMVIO) += vio.o
7obj-$(CONFIG_SMP) += smp.o 6obj-$(CONFIG_SMP) += smp.o
8obj-$(CONFIG_VIOPATH) += viopath.o 7obj-$(CONFIG_VIOPATH) += viopath.o
9obj-$(CONFIG_MODULES) += ksyms.o 8obj-$(CONFIG_MODULES) += ksyms.o
9
10$(obj)/dt_mod.o: $(obj)/dt.o
11 @$(OBJCOPY) --rename-section .rodata.str1.8=.dt_strings $(obj)/dt.o $(obj)/dt_mod.o
diff --git a/arch/powerpc/platforms/iseries/call_pci.h b/arch/powerpc/platforms/iseries/call_pci.h
index 59d4e0ad5cf3..dbdf69850ed9 100644
--- a/arch/powerpc/platforms/iseries/call_pci.h
+++ b/arch/powerpc/platforms/iseries/call_pci.h
@@ -145,6 +145,25 @@ static inline u64 HvCallPci_configLoad16(u16 busNumber, u8 subBusNumber,
145 return retVal.rc; 145 return retVal.rc;
146} 146}
147 147
148static inline u64 HvCallPci_configLoad32(u16 busNumber, u8 subBusNumber,
149 u8 deviceId, u32 offset, u32 *value)
150{
151 struct HvCallPci_DsaAddr dsa;
152 struct HvCallPci_LoadReturn retVal;
153
154 *((u64*)&dsa) = 0;
155
156 dsa.busNumber = busNumber;
157 dsa.subBusNumber = subBusNumber;
158 dsa.deviceId = deviceId;
159
160 HvCall3Ret16(HvCallPciConfigLoad32, &retVal, *(u64 *)&dsa, offset, 0);
161
162 *value = retVal.value;
163
164 return retVal.rc;
165}
166
148static inline u64 HvCallPci_configStore8(u16 busNumber, u8 subBusNumber, 167static inline u64 HvCallPci_configStore8(u16 busNumber, u8 subBusNumber,
149 u8 deviceId, u32 offset, u8 value) 168 u8 deviceId, u32 offset, u8 value)
150{ 169{
diff --git a/arch/powerpc/platforms/iseries/dt.c b/arch/powerpc/platforms/iseries/dt.c
new file mode 100644
index 000000000000..d3444aabe76e
--- /dev/null
+++ b/arch/powerpc/platforms/iseries/dt.c
@@ -0,0 +1,615 @@
1/*
2 * Copyright (c) 2005-2006 Michael Ellerman, IBM Corporation
3 *
4 * Description:
5 * This file contains all the routines to build a flattened device
6 * tree for a legacy iSeries machine.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 */
13
14#undef DEBUG
15
16#include <linux/types.h>
17#include <linux/init.h>
18#include <linux/pci.h>
19#include <linux/pci_regs.h>
20#include <linux/pci_ids.h>
21#include <linux/threads.h>
22#include <linux/bitops.h>
23#include <linux/string.h>
24#include <linux/kernel.h>
25#include <linux/if_ether.h> /* ETH_ALEN */
26
27#include <asm/machdep.h>
28#include <asm/prom.h>
29#include <asm/lppaca.h>
30#include <asm/cputable.h>
31#include <asm/abs_addr.h>
32#include <asm/system.h>
33#include <asm/iseries/hv_types.h>
34#include <asm/iseries/hv_lp_config.h>
35#include <asm/iseries/hv_call_xm.h>
36#include <asm/iseries/it_exp_vpd_panel.h>
37#include <asm/udbg.h>
38
39#include "processor_vpd.h"
40#include "call_hpt.h"
41#include "call_pci.h"
42#include "pci.h"
43
44#ifdef DEBUG
45#define DBG(fmt...) udbg_printf(fmt)
46#else
47#define DBG(fmt...)
48#endif
49
50/*
51 * These are created by the linker script at the start and end
52 * of the section containing all the strings from this file.
53 */
54extern char __dt_strings_start[];
55extern char __dt_strings_end[];
56
57struct iseries_flat_dt {
58 struct boot_param_header header;
59 u64 reserve_map[2];
60};
61
62static void * __initdata dt_data;
63
64/*
65 * Putting these strings here keeps them out of the section
66 * that we rename to .dt_strings using objcopy and capture
67 * for the strings blob of the flattened device tree.
68 */
69static char __initdata device_type_cpu[] = "cpu";
70static char __initdata device_type_memory[] = "memory";
71static char __initdata device_type_serial[] = "serial";
72static char __initdata device_type_network[] = "network";
73static char __initdata device_type_block[] = "block";
74static char __initdata device_type_byte[] = "byte";
75static char __initdata device_type_pci[] = "pci";
76static char __initdata device_type_vdevice[] = "vdevice";
77static char __initdata device_type_vscsi[] = "vscsi";
78
79static struct iseries_flat_dt * __init dt_init(void)
80{
81 struct iseries_flat_dt *dt;
82 unsigned long str_len;
83
84 str_len = __dt_strings_end - __dt_strings_start;
85 dt = (struct iseries_flat_dt *)ALIGN(klimit, 8);
86 dt->header.off_mem_rsvmap =
87 offsetof(struct iseries_flat_dt, reserve_map);
88 dt->header.off_dt_strings = ALIGN(sizeof(*dt), 8);
89 dt->header.off_dt_struct = dt->header.off_dt_strings
90 + ALIGN(str_len, 8);
91 dt_data = (void *)((unsigned long)dt + dt->header.off_dt_struct);
92 dt->header.dt_strings_size = str_len;
93
94 /* There is no notion of hardware cpu id on iSeries */
95 dt->header.boot_cpuid_phys = smp_processor_id();
96
97 memcpy((char *)dt + dt->header.off_dt_strings, __dt_strings_start,
98 str_len);
99
100 dt->header.magic = OF_DT_HEADER;
101 dt->header.version = 0x10;
102 dt->header.last_comp_version = 0x10;
103
104 dt->reserve_map[0] = 0;
105 dt->reserve_map[1] = 0;
106
107 return dt;
108}
109
110static void __init dt_push_u32(struct iseries_flat_dt *dt, u32 value)
111{
112 *((u32 *)dt_data) = value;
113 dt_data += sizeof(u32);
114}
115
116#ifdef notyet
117static void __init dt_push_u64(struct iseries_flat_dt *dt, u64 value)
118{
119 *((u64 *)dt_data) = value;
120 dt_data += sizeof(u64);
121}
122#endif
123
124static void __init dt_push_bytes(struct iseries_flat_dt *dt, const char *data,
125 int len)
126{
127 memcpy(dt_data, data, len);
128 dt_data += ALIGN(len, 4);
129}
130
131static void __init dt_start_node(struct iseries_flat_dt *dt, const char *name)
132{
133 dt_push_u32(dt, OF_DT_BEGIN_NODE);
134 dt_push_bytes(dt, name, strlen(name) + 1);
135}
136
137#define dt_end_node(dt) dt_push_u32(dt, OF_DT_END_NODE)
138
139static void __init dt_prop(struct iseries_flat_dt *dt, const char *name,
140 const void *data, int len)
141{
142 unsigned long offset;
143
144 dt_push_u32(dt, OF_DT_PROP);
145
146 /* Length of the data */
147 dt_push_u32(dt, len);
148
149 offset = name - __dt_strings_start;
150
151 /* The offset of the properties name in the string blob. */
152 dt_push_u32(dt, (u32)offset);
153
154 /* The actual data. */
155 dt_push_bytes(dt, data, len);
156}
157
158static void __init dt_prop_str(struct iseries_flat_dt *dt, const char *name,
159 const char *data)
160{
161 dt_prop(dt, name, data, strlen(data) + 1); /* + 1 for NULL */
162}
163
164static void __init dt_prop_u32(struct iseries_flat_dt *dt, const char *name,
165 u32 data)
166{
167 dt_prop(dt, name, &data, sizeof(u32));
168}
169
170#ifdef notyet
171static void __init dt_prop_u64(struct iseries_flat_dt *dt, const char *name,
172 u64 data)
173{
174 dt_prop(dt, name, &data, sizeof(u64));
175}
176#endif
177
178static void __init dt_prop_u64_list(struct iseries_flat_dt *dt,
179 const char *name, u64 *data, int n)
180{
181 dt_prop(dt, name, data, sizeof(u64) * n);
182}
183
184static void __init dt_prop_u32_list(struct iseries_flat_dt *dt,
185 const char *name, u32 *data, int n)
186{
187 dt_prop(dt, name, data, sizeof(u32) * n);
188}
189
190#ifdef notyet
191static void __init dt_prop_empty(struct iseries_flat_dt *dt, const char *name)
192{
193 dt_prop(dt, name, NULL, 0);
194}
195#endif
196
197static void __init dt_cpus(struct iseries_flat_dt *dt)
198{
199 unsigned char buf[32];
200 unsigned char *p;
201 unsigned int i, index;
202 struct IoHriProcessorVpd *d;
203 u32 pft_size[2];
204
205 /* yuck */
206 snprintf(buf, 32, "PowerPC,%s", cur_cpu_spec->cpu_name);
207 p = strchr(buf, ' ');
208 if (!p) p = buf + strlen(buf);
209
210 dt_start_node(dt, "cpus");
211 dt_prop_u32(dt, "#address-cells", 1);
212 dt_prop_u32(dt, "#size-cells", 0);
213
214 pft_size[0] = 0; /* NUMA CEC cookie, 0 for non NUMA */
215 pft_size[1] = __ilog2(HvCallHpt_getHptPages() * HW_PAGE_SIZE);
216
217 for (i = 0; i < NR_CPUS; i++) {
218 if (lppaca[i].dyn_proc_status >= 2)
219 continue;
220
221 snprintf(p, 32 - (p - buf), "@%d", i);
222 dt_start_node(dt, buf);
223
224 dt_prop_str(dt, "device_type", device_type_cpu);
225
226 index = lppaca[i].dyn_hv_phys_proc_index;
227 d = &xIoHriProcessorVpd[index];
228
229 dt_prop_u32(dt, "i-cache-size", d->xInstCacheSize * 1024);
230 dt_prop_u32(dt, "i-cache-line-size", d->xInstCacheOperandSize);
231
232 dt_prop_u32(dt, "d-cache-size", d->xDataL1CacheSizeKB * 1024);
233 dt_prop_u32(dt, "d-cache-line-size", d->xDataCacheOperandSize);
234
235 /* magic conversions to Hz copied from old code */
236 dt_prop_u32(dt, "clock-frequency",
237 ((1UL << 34) * 1000000) / d->xProcFreq);
238 dt_prop_u32(dt, "timebase-frequency",
239 ((1UL << 32) * 1000000) / d->xTimeBaseFreq);
240
241 dt_prop_u32(dt, "reg", i);
242
243 dt_prop_u32_list(dt, "ibm,pft-size", pft_size, 2);
244
245 dt_end_node(dt);
246 }
247
248 dt_end_node(dt);
249}
250
251static void __init dt_model(struct iseries_flat_dt *dt)
252{
253 char buf[16] = "IBM,";
254
255 /* "IBM," + mfgId[2:3] + systemSerial[1:5] */
256 strne2a(buf + 4, xItExtVpdPanel.mfgID + 2, 2);
257 strne2a(buf + 6, xItExtVpdPanel.systemSerial + 1, 5);
258 buf[11] = '\0';
259 dt_prop_str(dt, "system-id", buf);
260
261 /* "IBM," + machineType[0:4] */
262 strne2a(buf + 4, xItExtVpdPanel.machineType, 4);
263 buf[8] = '\0';
264 dt_prop_str(dt, "model", buf);
265
266 dt_prop_str(dt, "compatible", "IBM,iSeries");
267}
268
269static void __init dt_do_vdevice(struct iseries_flat_dt *dt,
270 const char *name, u32 reg, int unit,
271 const char *type, const char *compat, int end)
272{
273 char buf[32];
274
275 snprintf(buf, 32, "%s@%08x", name, reg + ((unit >= 0) ? unit : 0));
276 dt_start_node(dt, buf);
277 dt_prop_str(dt, "device_type", type);
278 if (compat)
279 dt_prop_str(dt, "compatible", compat);
280 dt_prop_u32(dt, "reg", reg + ((unit >= 0) ? unit : 0));
281 if (unit >= 0)
282 dt_prop_u32(dt, "linux,unit_address", unit);
283 if (end)
284 dt_end_node(dt);
285}
286
287static void __init dt_vdevices(struct iseries_flat_dt *dt)
288{
289 u32 reg = 0;
290 HvLpIndexMap vlan_map;
291 int i;
292
293 dt_start_node(dt, "vdevice");
294 dt_prop_str(dt, "device_type", device_type_vdevice);
295 dt_prop_str(dt, "compatible", "IBM,iSeries-vdevice");
296 dt_prop_u32(dt, "#address-cells", 1);
297 dt_prop_u32(dt, "#size-cells", 0);
298
299 dt_do_vdevice(dt, "vty", reg, -1, device_type_serial, NULL, 1);
300 reg++;
301
302 dt_do_vdevice(dt, "v-scsi", reg, -1, device_type_vscsi,
303 "IBM,v-scsi", 1);
304 reg++;
305
306 vlan_map = HvLpConfig_getVirtualLanIndexMap();
307 for (i = 0; i < HVMAXARCHITECTEDVIRTUALLANS; i++) {
308 unsigned char mac_addr[ETH_ALEN];
309
310 if ((vlan_map & (0x8000 >> i)) == 0)
311 continue;
312 dt_do_vdevice(dt, "l-lan", reg, i, device_type_network,
313 "IBM,iSeries-l-lan", 0);
314 mac_addr[0] = 0x02;
315 mac_addr[1] = 0x01;
316 mac_addr[2] = 0xff;
317 mac_addr[3] = i;
318 mac_addr[4] = 0xff;
319 mac_addr[5] = HvLpConfig_getLpIndex_outline();
320 dt_prop(dt, "local-mac-address", (char *)mac_addr, ETH_ALEN);
321 dt_prop(dt, "mac-address", (char *)mac_addr, ETH_ALEN);
322 dt_prop_u32(dt, "max-frame-size", 9000);
323 dt_prop_u32(dt, "address-bits", 48);
324
325 dt_end_node(dt);
326 }
327 reg += HVMAXARCHITECTEDVIRTUALLANS;
328
329 for (i = 0; i < HVMAXARCHITECTEDVIRTUALDISKS; i++)
330 dt_do_vdevice(dt, "viodasd", reg, i, device_type_block,
331 "IBM,iSeries-viodasd", 1);
332 reg += HVMAXARCHITECTEDVIRTUALDISKS;
333
334 for (i = 0; i < HVMAXARCHITECTEDVIRTUALCDROMS; i++)
335 dt_do_vdevice(dt, "viocd", reg, i, device_type_block,
336 "IBM,iSeries-viocd", 1);
337 reg += HVMAXARCHITECTEDVIRTUALCDROMS;
338
339 for (i = 0; i < HVMAXARCHITECTEDVIRTUALTAPES; i++)
340 dt_do_vdevice(dt, "viotape", reg, i, device_type_byte,
341 "IBM,iSeries-viotape", 1);
342
343 dt_end_node(dt);
344}
345
346struct pci_class_name {
347 u16 code;
348 const char *name;
349 const char *type;
350};
351
352static struct pci_class_name __initdata pci_class_name[] = {
353 { PCI_CLASS_NETWORK_ETHERNET, "ethernet", device_type_network },
354};
355
356static struct pci_class_name * __init dt_find_pci_class_name(u16 class_code)
357{
358 struct pci_class_name *cp;
359
360 for (cp = pci_class_name;
361 cp < &pci_class_name[ARRAY_SIZE(pci_class_name)]; cp++)
362 if (cp->code == class_code)
363 return cp;
364 return NULL;
365}
366
367/*
368 * This assumes that the node slot is always on the primary bus!
369 */
370static void __init scan_bridge_slot(struct iseries_flat_dt *dt,
371 HvBusNumber bus, struct HvCallPci_BridgeInfo *bridge_info)
372{
373 HvSubBusNumber sub_bus = bridge_info->subBusNumber;
374 u16 vendor_id;
375 u16 device_id;
376 u32 class_id;
377 int err;
378 char buf[32];
379 u32 reg[5];
380 int id_sel = ISERIES_GET_DEVICE_FROM_SUBBUS(sub_bus);
381 int function = ISERIES_GET_FUNCTION_FROM_SUBBUS(sub_bus);
382 HvAgentId eads_id_sel = ISERIES_PCI_AGENTID(id_sel, function);
383 u8 devfn;
384 struct pci_class_name *cp;
385
386 /*
387 * Connect all functions of any device found.
388 */
389 for (id_sel = 1; id_sel <= bridge_info->maxAgents; id_sel++) {
390 for (function = 0; function < 8; function++) {
391 HvAgentId agent_id = ISERIES_PCI_AGENTID(id_sel,
392 function);
393 err = HvCallXm_connectBusUnit(bus, sub_bus,
394 agent_id, 0);
395 if (err) {
396 if (err != 0x302)
397 DBG("connectBusUnit(%x, %x, %x) %x\n",
398 bus, sub_bus, agent_id, err);
399 continue;
400 }
401
402 err = HvCallPci_configLoad16(bus, sub_bus, agent_id,
403 PCI_VENDOR_ID, &vendor_id);
404 if (err) {
405 DBG("ReadVendor(%x, %x, %x) %x\n",
406 bus, sub_bus, agent_id, err);
407 continue;
408 }
409 err = HvCallPci_configLoad16(bus, sub_bus, agent_id,
410 PCI_DEVICE_ID, &device_id);
411 if (err) {
412 DBG("ReadDevice(%x, %x, %x) %x\n",
413 bus, sub_bus, agent_id, err);
414 continue;
415 }
416 err = HvCallPci_configLoad32(bus, sub_bus, agent_id,
417 PCI_CLASS_REVISION , &class_id);
418 if (err) {
419 DBG("ReadClass(%x, %x, %x) %x\n",
420 bus, sub_bus, agent_id, err);
421 continue;
422 }
423
424 devfn = PCI_DEVFN(ISERIES_ENCODE_DEVICE(eads_id_sel),
425 function);
426 cp = dt_find_pci_class_name(class_id >> 16);
427 if (cp && cp->name)
428 strncpy(buf, cp->name, sizeof(buf) - 1);
429 else
430 snprintf(buf, sizeof(buf), "pci%x,%x",
431 vendor_id, device_id);
432 buf[sizeof(buf) - 1] = '\0';
433 snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
434 "@%x", PCI_SLOT(devfn));
435 buf[sizeof(buf) - 1] = '\0';
436 if (function != 0)
437 snprintf(buf + strlen(buf),
438 sizeof(buf) - strlen(buf),
439 ",%x", function);
440 dt_start_node(dt, buf);
441 reg[0] = (bus << 16) | (devfn << 8);
442 reg[1] = 0;
443 reg[2] = 0;
444 reg[3] = 0;
445 reg[4] = 0;
446 dt_prop_u32_list(dt, "reg", reg, 5);
447 if (cp && (cp->type || cp->name))
448 dt_prop_str(dt, "device_type",
449 cp->type ? cp->type : cp->name);
450 dt_prop_u32(dt, "vendor-id", vendor_id);
451 dt_prop_u32(dt, "device-id", device_id);
452 dt_prop_u32(dt, "class-code", class_id >> 8);
453 dt_prop_u32(dt, "revision-id", class_id & 0xff);
454 dt_prop_u32(dt, "linux,subbus", sub_bus);
455 dt_prop_u32(dt, "linux,agent-id", agent_id);
456 dt_prop_u32(dt, "linux,logical-slot-number",
457 bridge_info->logicalSlotNumber);
458 dt_end_node(dt);
459
460 }
461 }
462}
463
464static void __init scan_bridge(struct iseries_flat_dt *dt, HvBusNumber bus,
465 HvSubBusNumber sub_bus, int id_sel)
466{
467 struct HvCallPci_BridgeInfo bridge_info;
468 HvAgentId agent_id;
469 int function;
470 int ret;
471
472 /* Note: hvSubBus and irq is always be 0 at this level! */
473 for (function = 0; function < 8; ++function) {
474 agent_id = ISERIES_PCI_AGENTID(id_sel, function);
475 ret = HvCallXm_connectBusUnit(bus, sub_bus, agent_id, 0);
476 if (ret != 0) {
477 if (ret != 0xb)
478 DBG("connectBusUnit(%x, %x, %x) %x\n",
479 bus, sub_bus, agent_id, ret);
480 continue;
481 }
482 DBG("found device at bus %d idsel %d func %d (AgentId %x)\n",
483 bus, id_sel, function, agent_id);
484 ret = HvCallPci_getBusUnitInfo(bus, sub_bus, agent_id,
485 iseries_hv_addr(&bridge_info),
486 sizeof(struct HvCallPci_BridgeInfo));
487 if (ret != 0)
488 continue;
489 DBG("bridge info: type %x subbus %x "
490 "maxAgents %x maxsubbus %x logslot %x\n",
491 bridge_info.busUnitInfo.deviceType,
492 bridge_info.subBusNumber,
493 bridge_info.maxAgents,
494 bridge_info.maxSubBusNumber,
495 bridge_info.logicalSlotNumber);
496 if (bridge_info.busUnitInfo.deviceType ==
497 HvCallPci_BridgeDevice)
498 scan_bridge_slot(dt, bus, &bridge_info);
499 else
500 DBG("PCI: Invalid Bridge Configuration(0x%02X)",
501 bridge_info.busUnitInfo.deviceType);
502 }
503}
504
505static void __init scan_phb(struct iseries_flat_dt *dt, HvBusNumber bus)
506{
507 struct HvCallPci_DeviceInfo dev_info;
508 const HvSubBusNumber sub_bus = 0; /* EADs is always 0. */
509 int err;
510 int id_sel;
511 const int max_agents = 8;
512
513 /*
514 * Probe for EADs Bridges
515 */
516 for (id_sel = 1; id_sel < max_agents; ++id_sel) {
517 err = HvCallPci_getDeviceInfo(bus, sub_bus, id_sel,
518 iseries_hv_addr(&dev_info),
519 sizeof(struct HvCallPci_DeviceInfo));
520 if (err) {
521 if (err != 0x302)
522 DBG("getDeviceInfo(%x, %x, %x) %x\n",
523 bus, sub_bus, id_sel, err);
524 continue;
525 }
526 if (dev_info.deviceType != HvCallPci_NodeDevice) {
527 DBG("PCI: Invalid System Configuration"
528 "(0x%02X) for bus 0x%02x id 0x%02x.\n",
529 dev_info.deviceType, bus, id_sel);
530 continue;
531 }
532 scan_bridge(dt, bus, sub_bus, id_sel);
533 }
534}
535
536static void __init dt_pci_devices(struct iseries_flat_dt *dt)
537{
538 HvBusNumber bus;
539 char buf[32];
540 u32 buses[2];
541 int phb_num = 0;
542
543 /* Check all possible buses. */
544 for (bus = 0; bus < 256; bus++) {
545 int err = HvCallXm_testBus(bus);
546
547 if (err) {
548 /*
549 * Check for Unexpected Return code, a clue that
550 * something has gone wrong.
551 */
552 if (err != 0x0301)
553 DBG("Unexpected Return on Probe(0x%02X) "
554 "0x%04X\n", bus, err);
555 continue;
556 }
557 DBG("bus %d appears to exist\n", bus);
558 snprintf(buf, 32, "pci@%d", phb_num);
559 dt_start_node(dt, buf);
560 dt_prop_str(dt, "device_type", device_type_pci);
561 dt_prop_str(dt, "compatible", "IBM,iSeries-Logical-PHB");
562 dt_prop_u32(dt, "#address-cells", 3);
563 dt_prop_u32(dt, "#size-cells", 2);
564 buses[0] = buses[1] = bus;
565 dt_prop_u32_list(dt, "bus-range", buses, 2);
566 scan_phb(dt, bus);
567 dt_end_node(dt);
568 phb_num++;
569 }
570}
571
572static void dt_finish(struct iseries_flat_dt *dt)
573{
574 dt_push_u32(dt, OF_DT_END);
575 dt->header.totalsize = (unsigned long)dt_data - (unsigned long)dt;
576 klimit = ALIGN((unsigned long)dt_data, 8);
577}
578
579void * __init build_flat_dt(unsigned long phys_mem_size)
580{
581 struct iseries_flat_dt *iseries_dt;
582 u64 tmp[2];
583
584 iseries_dt = dt_init();
585
586 dt_start_node(iseries_dt, "");
587
588 dt_prop_u32(iseries_dt, "#address-cells", 2);
589 dt_prop_u32(iseries_dt, "#size-cells", 2);
590 dt_model(iseries_dt);
591
592 /* /memory */
593 dt_start_node(iseries_dt, "memory@0");
594 dt_prop_str(iseries_dt, "device_type", device_type_memory);
595 tmp[0] = 0;
596 tmp[1] = phys_mem_size;
597 dt_prop_u64_list(iseries_dt, "reg", tmp, 2);
598 dt_end_node(iseries_dt);
599
600 /* /chosen */
601 dt_start_node(iseries_dt, "chosen");
602 dt_prop_str(iseries_dt, "bootargs", cmd_line);
603 dt_end_node(iseries_dt);
604
605 dt_cpus(iseries_dt);
606
607 dt_vdevices(iseries_dt);
608 dt_pci_devices(iseries_dt);
609
610 dt_end_node(iseries_dt);
611
612 dt_finish(iseries_dt);
613
614 return iseries_dt;
615}
diff --git a/arch/powerpc/platforms/iseries/iommu.c b/arch/powerpc/platforms/iseries/iommu.c
index bea0b703f409..a992f6af249f 100644
--- a/arch/powerpc/platforms/iseries/iommu.c
+++ b/arch/powerpc/platforms/iseries/iommu.c
@@ -4,6 +4,7 @@
4 * Rewrite, cleanup: 4 * Rewrite, cleanup:
5 * 5 *
6 * Copyright (C) 2004 Olof Johansson <olof@lixom.net>, IBM Corporation 6 * Copyright (C) 2004 Olof Johansson <olof@lixom.net>, IBM Corporation
7 * Copyright (C) 2006 Olof Johansson <olof@lixom.net>
7 * 8 *
8 * Dynamic DMA mapping support, iSeries-specific parts. 9 * Dynamic DMA mapping support, iSeries-specific parts.
9 * 10 *
@@ -31,42 +32,37 @@
31#include <asm/tce.h> 32#include <asm/tce.h>
32#include <asm/machdep.h> 33#include <asm/machdep.h>
33#include <asm/abs_addr.h> 34#include <asm/abs_addr.h>
35#include <asm/prom.h>
34#include <asm/pci-bridge.h> 36#include <asm/pci-bridge.h>
35#include <asm/iseries/hv_call_xm.h> 37#include <asm/iseries/hv_call_xm.h>
36 38#include <asm/iseries/iommu.h>
37#include "iommu.h"
38
39extern struct list_head iSeries_Global_Device_List;
40
41 39
42static void tce_build_iSeries(struct iommu_table *tbl, long index, long npages, 40static void tce_build_iSeries(struct iommu_table *tbl, long index, long npages,
43 unsigned long uaddr, enum dma_data_direction direction) 41 unsigned long uaddr, enum dma_data_direction direction)
44{ 42{
45 u64 rc; 43 u64 rc;
46 union tce_entry tce; 44 u64 tce, rpn;
47 45
48 index <<= TCE_PAGE_FACTOR; 46 index <<= TCE_PAGE_FACTOR;
49 npages <<= TCE_PAGE_FACTOR; 47 npages <<= TCE_PAGE_FACTOR;
50 48
51 while (npages--) { 49 while (npages--) {
52 tce.te_word = 0; 50 rpn = virt_to_abs(uaddr) >> TCE_SHIFT;
53 tce.te_bits.tb_rpn = virt_to_abs(uaddr) >> TCE_SHIFT; 51 tce = (rpn & TCE_RPN_MASK) << TCE_RPN_SHIFT;
54 52
55 if (tbl->it_type == TCE_VB) { 53 if (tbl->it_type == TCE_VB) {
56 /* Virtual Bus */ 54 /* Virtual Bus */
57 tce.te_bits.tb_valid = 1; 55 tce |= TCE_VALID|TCE_ALLIO;
58 tce.te_bits.tb_allio = 1;
59 if (direction != DMA_TO_DEVICE) 56 if (direction != DMA_TO_DEVICE)
60 tce.te_bits.tb_rdwr = 1; 57 tce |= TCE_VB_WRITE;
61 } else { 58 } else {
62 /* PCI Bus */ 59 /* PCI Bus */
63 tce.te_bits.tb_rdwr = 1; /* Read allowed */ 60 tce |= TCE_PCI_READ; /* Read allowed */
64 if (direction != DMA_TO_DEVICE) 61 if (direction != DMA_TO_DEVICE)
65 tce.te_bits.tb_pciwr = 1; 62 tce |= TCE_PCI_WRITE;
66 } 63 }
67 64
68 rc = HvCallXm_setTce((u64)tbl->it_index, (u64)index, 65 rc = HvCallXm_setTce((u64)tbl->it_index, (u64)index, tce);
69 tce.te_word);
70 if (rc) 66 if (rc)
71 panic("PCI_DMA: HvCallXm_setTce failed, Rc: 0x%lx\n", 67 panic("PCI_DMA: HvCallXm_setTce failed, Rc: 0x%lx\n",
72 rc); 68 rc);
@@ -124,7 +120,7 @@ void iommu_table_getparms_iSeries(unsigned long busno,
124 120
125 /* itc_size is in pages worth of table, it_size is in # of entries */ 121 /* itc_size is in pages worth of table, it_size is in # of entries */
126 tbl->it_size = ((parms->itc_size * TCE_PAGE_SIZE) / 122 tbl->it_size = ((parms->itc_size * TCE_PAGE_SIZE) /
127 sizeof(union tce_entry)) >> TCE_PAGE_FACTOR; 123 TCE_ENTRY_SIZE) >> TCE_PAGE_FACTOR;
128 tbl->it_busno = parms->itc_busno; 124 tbl->it_busno = parms->itc_busno;
129 tbl->it_offset = parms->itc_offset >> TCE_PAGE_FACTOR; 125 tbl->it_offset = parms->itc_offset >> TCE_PAGE_FACTOR;
130 tbl->it_index = parms->itc_index; 126 tbl->it_index = parms->itc_index;
@@ -142,10 +138,15 @@ void iommu_table_getparms_iSeries(unsigned long busno,
142 */ 138 */
143static struct iommu_table *iommu_table_find(struct iommu_table * tbl) 139static struct iommu_table *iommu_table_find(struct iommu_table * tbl)
144{ 140{
145 struct pci_dn *pdn; 141 struct device_node *node;
146 142
147 list_for_each_entry(pdn, &iSeries_Global_Device_List, Device_List) { 143 for (node = NULL; (node = of_find_all_nodes(node)); ) {
148 struct iommu_table *it = pdn->iommu_table; 144 struct pci_dn *pdn = PCI_DN(node);
145 struct iommu_table *it;
146
147 if (pdn == NULL)
148 continue;
149 it = pdn->iommu_table;
149 if ((it != NULL) && 150 if ((it != NULL) &&
150 (it->it_type == TCE_PCI) && 151 (it->it_type == TCE_PCI) &&
151 (it->it_offset == tbl->it_offset) && 152 (it->it_offset == tbl->it_offset) &&
@@ -161,10 +162,13 @@ void iommu_devnode_init_iSeries(struct device_node *dn)
161{ 162{
162 struct iommu_table *tbl; 163 struct iommu_table *tbl;
163 struct pci_dn *pdn = PCI_DN(dn); 164 struct pci_dn *pdn = PCI_DN(dn);
165 u32 *lsn = (u32 *)get_property(dn, "linux,logical-slot-number", NULL);
166
167 BUG_ON(lsn == NULL);
164 168
165 tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL); 169 tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL);
166 170
167 iommu_table_getparms_iSeries(pdn->busno, pdn->LogicalSlot, 0, tbl); 171 iommu_table_getparms_iSeries(pdn->busno, *lsn, 0, tbl);
168 172
169 /* Look for existing tce table */ 173 /* Look for existing tce table */
170 pdn->iommu_table = iommu_table_find(tbl); 174 pdn->iommu_table = iommu_table_find(tbl);
diff --git a/arch/powerpc/platforms/iseries/iommu.h b/arch/powerpc/platforms/iseries/iommu.h
deleted file mode 100644
index cb5658fbe657..000000000000
--- a/arch/powerpc/platforms/iseries/iommu.h
+++ /dev/null
@@ -1,35 +0,0 @@
1#ifndef _PLATFORMS_ISERIES_IOMMU_H
2#define _PLATFORMS_ISERIES_IOMMU_H
3
4/*
5 * Copyright (C) 2005 Stephen Rothwell, IBM Corporation
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the:
19 * Free Software Foundation, Inc.,
20 * 59 Temple Place, Suite 330,
21 * Boston, MA 02111-1307 USA
22 */
23
24struct device_node;
25struct iommu_table;
26
27/* Creates table for an individual device node */
28extern void iommu_devnode_init_iSeries(struct device_node *dn);
29
30/* Get table parameters from HV */
31extern void iommu_table_getparms_iSeries(unsigned long busno,
32 unsigned char slotno, unsigned char virtbus,
33 struct iommu_table *tbl);
34
35#endif /* _PLATFORMS_ISERIES_IOMMU_H */
diff --git a/arch/powerpc/platforms/iseries/irq.c b/arch/powerpc/platforms/iseries/irq.c
index be3fbfc24e6c..62bbbcf5ded3 100644
--- a/arch/powerpc/platforms/iseries/irq.c
+++ b/arch/powerpc/platforms/iseries/irq.c
@@ -42,6 +42,7 @@
42#include <asm/iseries/it_lp_queue.h> 42#include <asm/iseries/it_lp_queue.h>
43 43
44#include "irq.h" 44#include "irq.h"
45#include "pci.h"
45#include "call_pci.h" 46#include "call_pci.h"
46 47
47#if defined(CONFIG_SMP) 48#if defined(CONFIG_SMP)
@@ -312,12 +313,12 @@ static hw_irq_controller iSeries_IRQ_handler = {
312 * Note that sub_bus is always 0 (at the moment at least). 313 * Note that sub_bus is always 0 (at the moment at least).
313 */ 314 */
314int __init iSeries_allocate_IRQ(HvBusNumber bus, 315int __init iSeries_allocate_IRQ(HvBusNumber bus,
315 HvSubBusNumber sub_bus, HvAgentId dev_id) 316 HvSubBusNumber sub_bus, u32 bsubbus)
316{ 317{
317 int virtirq; 318 int virtirq;
318 unsigned int realirq; 319 unsigned int realirq;
319 u8 idsel = (dev_id >> 4); 320 u8 idsel = ISERIES_GET_DEVICE_FROM_SUBBUS(bsubbus);
320 u8 function = dev_id & 7; 321 u8 function = ISERIES_GET_FUNCTION_FROM_SUBBUS(bsubbus);
321 322
322 realirq = (((((sub_bus << 8) + (bus - 1)) << 3) + (idsel - 1)) << 3) 323 realirq = (((((sub_bus << 8) + (bus - 1)) << 3) + (idsel - 1)) << 3)
323 + function; 324 + function;
diff --git a/arch/powerpc/platforms/iseries/irq.h b/arch/powerpc/platforms/iseries/irq.h
index b9c801ba5a47..188aa808abd7 100644
--- a/arch/powerpc/platforms/iseries/irq.h
+++ b/arch/powerpc/platforms/iseries/irq.h
@@ -2,7 +2,7 @@
2#define _ISERIES_IRQ_H 2#define _ISERIES_IRQ_H
3 3
4extern void iSeries_init_IRQ(void); 4extern void iSeries_init_IRQ(void);
5extern int iSeries_allocate_IRQ(HvBusNumber, HvSubBusNumber, HvAgentId); 5extern int iSeries_allocate_IRQ(HvBusNumber, HvSubBusNumber, u32);
6extern void iSeries_activate_IRQs(void); 6extern void iSeries_activate_IRQs(void);
7extern int iSeries_get_irq(struct pt_regs *); 7extern int iSeries_get_irq(struct pt_regs *);
8 8
diff --git a/arch/powerpc/platforms/iseries/mf.c b/arch/powerpc/platforms/iseries/mf.c
index d771b8ee857d..1a2c2a50f922 100644
--- a/arch/powerpc/platforms/iseries/mf.c
+++ b/arch/powerpc/platforms/iseries/mf.c
@@ -45,7 +45,6 @@
45 45
46#include "setup.h" 46#include "setup.h"
47 47
48extern int piranha_simulator;
49static int mf_initialized; 48static int mf_initialized;
50 49
51/* 50/*
@@ -658,7 +657,7 @@ static void mf_clear_src(void)
658 657
659void __init mf_display_progress(u16 value) 658void __init mf_display_progress(u16 value)
660{ 659{
661 if (piranha_simulator || !mf_initialized) 660 if (!mf_initialized)
662 return; 661 return;
663 662
664 if (0xFFFF == value) 663 if (0xFFFF == value)
@@ -1295,9 +1294,6 @@ __initcall(mf_proc_init);
1295 */ 1294 */
1296void iSeries_get_rtc_time(struct rtc_time *rtc_tm) 1295void iSeries_get_rtc_time(struct rtc_time *rtc_tm)
1297{ 1296{
1298 if (piranha_simulator)
1299 return;
1300
1301 mf_get_rtc(rtc_tm); 1297 mf_get_rtc(rtc_tm);
1302 rtc_tm->tm_mon--; 1298 rtc_tm->tm_mon--;
1303} 1299}
@@ -1316,9 +1312,6 @@ unsigned long iSeries_get_boot_time(void)
1316{ 1312{
1317 struct rtc_time tm; 1313 struct rtc_time tm;
1318 1314
1319 if (piranha_simulator)
1320 return 0;
1321
1322 mf_get_boot_rtc(&tm); 1315 mf_get_boot_rtc(&tm);
1323 return mktime(tm.tm_year + 1900, tm.tm_mon, tm.tm_mday, 1316 return mktime(tm.tm_year + 1900, tm.tm_mon, tm.tm_mday,
1324 tm.tm_hour, tm.tm_min, tm.tm_sec); 1317 tm.tm_hour, tm.tm_min, tm.tm_sec);
diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c
index a19833b880e4..35bcc98111f5 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -37,36 +37,18 @@
37 37
38#include <asm/iseries/hv_call_xm.h> 38#include <asm/iseries/hv_call_xm.h>
39#include <asm/iseries/mf.h> 39#include <asm/iseries/mf.h>
40#include <asm/iseries/iommu.h>
40 41
41#include <asm/ppc-pci.h> 42#include <asm/ppc-pci.h>
42 43
43#include "irq.h" 44#include "irq.h"
44#include "pci.h" 45#include "pci.h"
45#include "call_pci.h" 46#include "call_pci.h"
46#include "iommu.h"
47
48extern unsigned long io_page_mask;
49 47
50/* 48/*
51 * Forward declares of prototypes. 49 * Forward declares of prototypes.
52 */ 50 */
53static struct device_node *find_Device_Node(int bus, int devfn); 51static struct device_node *find_Device_Node(int bus, int devfn);
54static void scan_PHB_slots(struct pci_controller *Phb);
55static void scan_EADS_bridge(HvBusNumber Bus, HvSubBusNumber SubBus, int IdSel);
56static int scan_bridge_slot(HvBusNumber Bus, struct HvCallPci_BridgeInfo *Info);
57
58LIST_HEAD(iSeries_Global_Device_List);
59
60static int DeviceCount;
61
62/* Counters and control flags. */
63static long Pci_Io_Read_Count;
64static long Pci_Io_Write_Count;
65#if 0
66static long Pci_Cfg_Read_Count;
67static long Pci_Cfg_Write_Count;
68#endif
69static long Pci_Error_Count;
70 52
71static int Pci_Retry_Max = 3; /* Only retry 3 times */ 53static int Pci_Retry_Max = 3; /* Only retry 3 times */
72static int Pci_Error_Flag = 1; /* Set Retry Error on. */ 54static int Pci_Error_Flag = 1; /* Set Retry Error on. */
@@ -81,41 +63,19 @@ static struct pci_ops iSeries_pci_ops;
81#define IOMM_TABLE_ENTRY_SIZE 0x0000000000400000UL 63#define IOMM_TABLE_ENTRY_SIZE 0x0000000000400000UL
82#define BASE_IO_MEMORY 0xE000000000000000UL 64#define BASE_IO_MEMORY 0xE000000000000000UL
83 65
84static unsigned long max_io_memory = 0xE000000000000000UL; 66static unsigned long max_io_memory = BASE_IO_MEMORY;
85static long current_iomm_table_entry; 67static long current_iomm_table_entry;
86 68
87/* 69/*
88 * Lookup Tables. 70 * Lookup Tables.
89 */ 71 */
90static struct device_node **iomm_table; 72static struct device_node *iomm_table[IOMM_TABLE_MAX_ENTRIES];
91static u8 *iobar_table; 73static u8 iobar_table[IOMM_TABLE_MAX_ENTRIES];
92 74
93/* 75static const char pci_io_text[] = "iSeries PCI I/O";
94 * Static and Global variables
95 */
96static char *pci_io_text = "iSeries PCI I/O";
97static DEFINE_SPINLOCK(iomm_table_lock); 76static DEFINE_SPINLOCK(iomm_table_lock);
98 77
99/* 78/*
100 * iomm_table_initialize
101 *
102 * Allocates and initalizes the Address Translation Table and Bar
103 * Tables to get them ready for use. Must be called before any
104 * I/O space is handed out to the device BARs.
105 */
106static void iomm_table_initialize(void)
107{
108 spin_lock(&iomm_table_lock);
109 iomm_table = kmalloc(sizeof(*iomm_table) * IOMM_TABLE_MAX_ENTRIES,
110 GFP_KERNEL);
111 iobar_table = kmalloc(sizeof(*iobar_table) * IOMM_TABLE_MAX_ENTRIES,
112 GFP_KERNEL);
113 spin_unlock(&iomm_table_lock);
114 if ((iomm_table == NULL) || (iobar_table == NULL))
115 panic("PCI: I/O tables allocation failed.\n");
116}
117
118/*
119 * iomm_table_allocate_entry 79 * iomm_table_allocate_entry
120 * 80 *
121 * Adds pci_dev entry in address translation table 81 * Adds pci_dev entry in address translation table
@@ -142,9 +102,8 @@ static void iomm_table_allocate_entry(struct pci_dev *dev, int bar_num)
142 */ 102 */
143 spin_lock(&iomm_table_lock); 103 spin_lock(&iomm_table_lock);
144 bar_res->name = pci_io_text; 104 bar_res->name = pci_io_text;
145 bar_res->start = 105 bar_res->start = BASE_IO_MEMORY +
146 IOMM_TABLE_ENTRY_SIZE * current_iomm_table_entry; 106 IOMM_TABLE_ENTRY_SIZE * current_iomm_table_entry;
147 bar_res->start += BASE_IO_MEMORY;
148 bar_res->end = bar_res->start + bar_size - 1; 107 bar_res->end = bar_res->start + bar_size - 1;
149 /* 108 /*
150 * Allocate the number of table entries needed for BAR. 109 * Allocate the number of table entries needed for BAR.
@@ -156,7 +115,7 @@ static void iomm_table_allocate_entry(struct pci_dev *dev, int bar_num)
156 ++current_iomm_table_entry; 115 ++current_iomm_table_entry;
157 } 116 }
158 max_io_memory = BASE_IO_MEMORY + 117 max_io_memory = BASE_IO_MEMORY +
159 (IOMM_TABLE_ENTRY_SIZE * current_iomm_table_entry); 118 IOMM_TABLE_ENTRY_SIZE * current_iomm_table_entry;
160 spin_unlock(&iomm_table_lock); 119 spin_unlock(&iomm_table_lock);
161} 120}
162 121
@@ -173,13 +132,10 @@ static void iomm_table_allocate_entry(struct pci_dev *dev, int bar_num)
173 */ 132 */
174static void allocate_device_bars(struct pci_dev *dev) 133static void allocate_device_bars(struct pci_dev *dev)
175{ 134{
176 struct resource *bar_res;
177 int bar_num; 135 int bar_num;
178 136
179 for (bar_num = 0; bar_num <= PCI_ROM_RESOURCE; ++bar_num) { 137 for (bar_num = 0; bar_num <= PCI_ROM_RESOURCE; ++bar_num)
180 bar_res = &dev->resource[bar_num];
181 iomm_table_allocate_entry(dev, bar_num); 138 iomm_table_allocate_entry(dev, bar_num);
182 }
183} 139}
184 140
185/* 141/*
@@ -199,34 +155,7 @@ static void pci_Log_Error(char *Error_Text, int Bus, int SubBus,
199} 155}
200 156
201/* 157/*
202 * build_device_node(u16 Bus, int SubBus, u8 DevFn) 158 * iSeries_pcibios_init
203 */
204static struct device_node *build_device_node(HvBusNumber Bus,
205 HvSubBusNumber SubBus, int AgentId, int Function)
206{
207 struct device_node *node;
208 struct pci_dn *pdn;
209
210 node = kmalloc(sizeof(struct device_node), GFP_KERNEL);
211 if (node == NULL)
212 return NULL;
213 memset(node, 0, sizeof(struct device_node));
214 pdn = kzalloc(sizeof(*pdn), GFP_KERNEL);
215 if (pdn == NULL) {
216 kfree(node);
217 return NULL;
218 }
219 node->data = pdn;
220 pdn->node = node;
221 list_add_tail(&pdn->Device_List, &iSeries_Global_Device_List);
222 pdn->busno = Bus;
223 pdn->bussubno = SubBus;
224 pdn->devfn = PCI_DEVFN(ISERIES_ENCODE_DEVICE(AgentId), Function);
225 return node;
226}
227
228/*
229 * unsigned long __init find_and_init_phbs(void)
230 * 159 *
231 * Description: 160 * Description:
232 * This function checks for all possible system PCI host bridges that connect 161 * This function checks for all possible system PCI host bridges that connect
@@ -234,50 +163,42 @@ static struct device_node *build_device_node(HvBusNumber Bus,
234 * ownership status. A pci_controller is built for any bus which is partially 163 * ownership status. A pci_controller is built for any bus which is partially
235 * owned or fully owned by this guest partition. 164 * owned or fully owned by this guest partition.
236 */ 165 */
237unsigned long __init find_and_init_phbs(void) 166void iSeries_pcibios_init(void)
238{ 167{
239 struct pci_controller *phb; 168 struct pci_controller *phb;
240 HvBusNumber bus; 169 struct device_node *root = of_find_node_by_path("/");
241 170 struct device_node *node = NULL;
242 /* Check all possible buses. */
243 for (bus = 0; bus < 256; bus++) {
244 int ret = HvCallXm_testBus(bus);
245 if (ret == 0) {
246 printk("bus %d appears to exist\n", bus);
247 171
248 phb = pcibios_alloc_controller(NULL); 172 if (root == NULL) {
249 if (phb == NULL) 173 printk(KERN_CRIT "iSeries_pcibios_init: can't find root "
250 return -ENOMEM; 174 "of device tree\n");
251 175 return;
252 phb->pci_mem_offset = phb->local_number = bus; 176 }
253 phb->first_busno = bus; 177 while ((node = of_get_next_child(root, node)) != NULL) {
254 phb->last_busno = bus; 178 HvBusNumber bus;
255 phb->ops = &iSeries_pci_ops; 179 u32 *busp;
256 180
257 /* Find and connect the devices. */ 181 if ((node->type == NULL) || (strcmp(node->type, "pci") != 0))
258 scan_PHB_slots(phb); 182 continue;
259 } 183
260 /* 184 busp = (u32 *)get_property(node, "bus-range", NULL);
261 * Check for Unexpected Return code, a clue that something 185 if (busp == NULL)
262 * has gone wrong. 186 continue;
263 */ 187 bus = *busp;
264 else if (ret != 0x0301) 188 printk("bus %d appears to exist\n", bus);
265 printk(KERN_ERR "Unexpected Return on Probe(0x%04X): 0x%04X", 189 phb = pcibios_alloc_controller(node);
266 bus, ret); 190 if (phb == NULL)
191 continue;
192
193 phb->pci_mem_offset = phb->local_number = bus;
194 phb->first_busno = bus;
195 phb->last_busno = bus;
196 phb->ops = &iSeries_pci_ops;
267 } 197 }
268 return 0;
269}
270 198
271/* 199 of_node_put(root);
272 * iSeries_pcibios_init 200
273 * 201 pci_devs_phb_init();
274 * Chance to initialize and structures or variable before PCI Bus walk.
275 */
276void iSeries_pcibios_init(void)
277{
278 iomm_table_initialize();
279 find_and_init_phbs();
280 io_page_mask = -1;
281} 202}
282 203
283/* 204/*
@@ -299,6 +220,34 @@ void __init iSeries_pci_final_fixup(void)
299 pdev->bus->number, pdev->devfn, node); 220 pdev->bus->number, pdev->devfn, node);
300 221
301 if (node != NULL) { 222 if (node != NULL) {
223 struct pci_dn *pdn = PCI_DN(node);
224 u32 *agent;
225
226 agent = (u32 *)get_property(node, "linux,agent-id",
227 NULL);
228 if ((pdn != NULL) && (agent != NULL)) {
229 u8 irq = iSeries_allocate_IRQ(pdn->busno, 0,
230 pdn->bussubno);
231 int err;
232
233 err = HvCallXm_connectBusUnit(pdn->busno, pdn->bussubno,
234 *agent, irq);
235 if (err)
236 pci_Log_Error("Connect Bus Unit",
237 pdn->busno, pdn->bussubno, *agent, err);
238 else {
239 err = HvCallPci_configStore8(pdn->busno, pdn->bussubno,
240 *agent,
241 PCI_INTERRUPT_LINE,
242 irq);
243 if (err)
244 pci_Log_Error("PciCfgStore Irq Failed!",
245 pdn->busno, pdn->bussubno, *agent, err);
246 }
247 if (!err)
248 pdev->irq = irq;
249 }
250
302 ++DeviceCount; 251 ++DeviceCount;
303 pdev->sysdata = (void *)node; 252 pdev->sysdata = (void *)node;
304 PCI_DN(node)->pcidev = pdev; 253 PCI_DN(node)->pcidev = pdev;
@@ -308,7 +257,6 @@ void __init iSeries_pci_final_fixup(void)
308 } else 257 } else
309 printk("PCI: Device Tree not found for 0x%016lX\n", 258 printk("PCI: Device Tree not found for 0x%016lX\n",
310 (unsigned long)pdev); 259 (unsigned long)pdev);
311 pdev->irq = PCI_DN(node)->Irq;
312 } 260 }
313 iSeries_activate_IRQs(); 261 iSeries_activate_IRQs();
314 mf_display_src(0xC9000200); 262 mf_display_src(0xC9000200);
@@ -323,148 +271,6 @@ void pcibios_fixup_resources(struct pci_dev *pdev)
323} 271}
324 272
325/* 273/*
326 * Loop through each node function to find usable EADs bridges.
327 */
328static void scan_PHB_slots(struct pci_controller *Phb)
329{
330 struct HvCallPci_DeviceInfo *DevInfo;
331 HvBusNumber bus = Phb->local_number; /* System Bus */
332 const HvSubBusNumber SubBus = 0; /* EADs is always 0. */
333 int HvRc = 0;
334 int IdSel;
335 const int MaxAgents = 8;
336
337 DevInfo = (struct HvCallPci_DeviceInfo*)
338 kmalloc(sizeof(struct HvCallPci_DeviceInfo), GFP_KERNEL);
339 if (DevInfo == NULL)
340 return;
341
342 /*
343 * Probe for EADs Bridges
344 */
345 for (IdSel = 1; IdSel < MaxAgents; ++IdSel) {
346 HvRc = HvCallPci_getDeviceInfo(bus, SubBus, IdSel,
347 iseries_hv_addr(DevInfo),
348 sizeof(struct HvCallPci_DeviceInfo));
349 if (HvRc == 0) {
350 if (DevInfo->deviceType == HvCallPci_NodeDevice)
351 scan_EADS_bridge(bus, SubBus, IdSel);
352 else
353 printk("PCI: Invalid System Configuration(0x%02X)"
354 " for bus 0x%02x id 0x%02x.\n",
355 DevInfo->deviceType, bus, IdSel);
356 }
357 else
358 pci_Log_Error("getDeviceInfo", bus, SubBus, IdSel, HvRc);
359 }
360 kfree(DevInfo);
361}
362
363static void scan_EADS_bridge(HvBusNumber bus, HvSubBusNumber SubBus,
364 int IdSel)
365{
366 struct HvCallPci_BridgeInfo *BridgeInfo;
367 HvAgentId AgentId;
368 int Function;
369 int HvRc;
370
371 BridgeInfo = (struct HvCallPci_BridgeInfo *)
372 kmalloc(sizeof(struct HvCallPci_BridgeInfo), GFP_KERNEL);
373 if (BridgeInfo == NULL)
374 return;
375
376 /* Note: hvSubBus and irq is always be 0 at this level! */
377 for (Function = 0; Function < 8; ++Function) {
378 AgentId = ISERIES_PCI_AGENTID(IdSel, Function);
379 HvRc = HvCallXm_connectBusUnit(bus, SubBus, AgentId, 0);
380 if (HvRc == 0) {
381 printk("found device at bus %d idsel %d func %d (AgentId %x)\n",
382 bus, IdSel, Function, AgentId);
383 /* Connect EADs: 0x18.00.12 = 0x00 */
384 HvRc = HvCallPci_getBusUnitInfo(bus, SubBus, AgentId,
385 iseries_hv_addr(BridgeInfo),
386 sizeof(struct HvCallPci_BridgeInfo));
387 if (HvRc == 0) {
388 printk("bridge info: type %x subbus %x maxAgents %x maxsubbus %x logslot %x\n",
389 BridgeInfo->busUnitInfo.deviceType,
390 BridgeInfo->subBusNumber,
391 BridgeInfo->maxAgents,
392 BridgeInfo->maxSubBusNumber,
393 BridgeInfo->logicalSlotNumber);
394 if (BridgeInfo->busUnitInfo.deviceType ==
395 HvCallPci_BridgeDevice) {
396 /* Scan_Bridge_Slot...: 0x18.00.12 */
397 scan_bridge_slot(bus, BridgeInfo);
398 } else
399 printk("PCI: Invalid Bridge Configuration(0x%02X)",
400 BridgeInfo->busUnitInfo.deviceType);
401 }
402 } else if (HvRc != 0x000B)
403 pci_Log_Error("EADs Connect",
404 bus, SubBus, AgentId, HvRc);
405 }
406 kfree(BridgeInfo);
407}
408
409/*
410 * This assumes that the node slot is always on the primary bus!
411 */
412static int scan_bridge_slot(HvBusNumber Bus,
413 struct HvCallPci_BridgeInfo *BridgeInfo)
414{
415 struct device_node *node;
416 HvSubBusNumber SubBus = BridgeInfo->subBusNumber;
417 u16 VendorId = 0;
418 int HvRc = 0;
419 u8 Irq = 0;
420 int IdSel = ISERIES_GET_DEVICE_FROM_SUBBUS(SubBus);
421 int Function = ISERIES_GET_FUNCTION_FROM_SUBBUS(SubBus);
422 HvAgentId EADsIdSel = ISERIES_PCI_AGENTID(IdSel, Function);
423
424 /* iSeries_allocate_IRQ.: 0x18.00.12(0xA3) */
425 Irq = iSeries_allocate_IRQ(Bus, 0, EADsIdSel);
426
427 /*
428 * Connect all functions of any device found.
429 */
430 for (IdSel = 1; IdSel <= BridgeInfo->maxAgents; ++IdSel) {
431 for (Function = 0; Function < 8; ++Function) {
432 HvAgentId AgentId = ISERIES_PCI_AGENTID(IdSel, Function);
433 HvRc = HvCallXm_connectBusUnit(Bus, SubBus,
434 AgentId, Irq);
435 if (HvRc != 0) {
436 pci_Log_Error("Connect Bus Unit",
437 Bus, SubBus, AgentId, HvRc);
438 continue;
439 }
440
441 HvRc = HvCallPci_configLoad16(Bus, SubBus, AgentId,
442 PCI_VENDOR_ID, &VendorId);
443 if (HvRc != 0) {
444 pci_Log_Error("Read Vendor",
445 Bus, SubBus, AgentId, HvRc);
446 continue;
447 }
448 printk("read vendor ID: %x\n", VendorId);
449
450 /* FoundDevice: 0x18.28.10 = 0x12AE */
451 HvRc = HvCallPci_configStore8(Bus, SubBus, AgentId,
452 PCI_INTERRUPT_LINE, Irq);
453 if (HvRc != 0)
454 pci_Log_Error("PciCfgStore Irq Failed!",
455 Bus, SubBus, AgentId, HvRc);
456
457 ++DeviceCount;
458 node = build_device_node(Bus, SubBus, EADsIdSel, Function);
459 PCI_DN(node)->Irq = Irq;
460 PCI_DN(node)->LogicalSlot = BridgeInfo->logicalSlotNumber;
461
462 } /* for (Function = 0; Function < 8; ++Function) */
463 } /* for (IdSel = 1; IdSel <= MaxAgents; ++IdSel) */
464 return HvRc;
465}
466
467/*
468 * I/0 Memory copy MUST use mmio commands on iSeries 274 * I/0 Memory copy MUST use mmio commands on iSeries
469 * To do; For performance, include the hv call directly 275 * To do; For performance, include the hv call directly
470 */ 276 */
@@ -509,11 +315,13 @@ EXPORT_SYMBOL(iSeries_memcpy_fromio);
509 */ 315 */
510static struct device_node *find_Device_Node(int bus, int devfn) 316static struct device_node *find_Device_Node(int bus, int devfn)
511{ 317{
512 struct pci_dn *pdn; 318 struct device_node *node;
319
320 for (node = NULL; (node = of_find_all_nodes(node)); ) {
321 struct pci_dn *pdn = PCI_DN(node);
513 322
514 list_for_each_entry(pdn, &iSeries_Global_Device_List, Device_List) { 323 if (pdn && (bus == pdn->busno) && (devfn == pdn->devfn))
515 if ((bus == pdn->busno) && (devfn == pdn->devfn)) 324 return node;
516 return pdn->node;
517 } 325 }
518 return NULL; 326 return NULL;
519} 327}
@@ -625,7 +433,6 @@ static int CheckReturnCode(char *TextHdr, struct device_node *DevNode,
625 if (ret != 0) { 433 if (ret != 0) {
626 struct pci_dn *pdn = PCI_DN(DevNode); 434 struct pci_dn *pdn = PCI_DN(DevNode);
627 435
628 ++Pci_Error_Count;
629 (*retry)++; 436 (*retry)++;
630 printk("PCI: %s: Device 0x%04X:%02X I/O Error(%2d): 0x%04X\n", 437 printk("PCI: %s: Device 0x%04X:%02X I/O Error(%2d): 0x%04X\n",
631 TextHdr, pdn->busno, pdn->devfn, 438 TextHdr, pdn->busno, pdn->devfn,
@@ -707,7 +514,6 @@ u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress)
707 return 0xff; 514 return 0xff;
708 } 515 }
709 do { 516 do {
710 ++Pci_Io_Read_Count;
711 HvCall3Ret16(HvCallPciBarLoad8, &ret, dsa, BarOffset, 0); 517 HvCall3Ret16(HvCallPciBarLoad8, &ret, dsa, BarOffset, 0);
712 } while (CheckReturnCode("RDB", DevNode, &retry, ret.rc) != 0); 518 } while (CheckReturnCode("RDB", DevNode, &retry, ret.rc) != 0);
713 519
@@ -737,7 +543,6 @@ u16 iSeries_Read_Word(const volatile void __iomem *IoAddress)
737 return 0xffff; 543 return 0xffff;
738 } 544 }
739 do { 545 do {
740 ++Pci_Io_Read_Count;
741 HvCall3Ret16(HvCallPciBarLoad16, &ret, dsa, 546 HvCall3Ret16(HvCallPciBarLoad16, &ret, dsa,
742 BarOffset, 0); 547 BarOffset, 0);
743 } while (CheckReturnCode("RDW", DevNode, &retry, ret.rc) != 0); 548 } while (CheckReturnCode("RDW", DevNode, &retry, ret.rc) != 0);
@@ -768,7 +573,6 @@ u32 iSeries_Read_Long(const volatile void __iomem *IoAddress)
768 return 0xffffffff; 573 return 0xffffffff;
769 } 574 }
770 do { 575 do {
771 ++Pci_Io_Read_Count;
772 HvCall3Ret16(HvCallPciBarLoad32, &ret, dsa, 576 HvCall3Ret16(HvCallPciBarLoad32, &ret, dsa,
773 BarOffset, 0); 577 BarOffset, 0);
774 } while (CheckReturnCode("RDL", DevNode, &retry, ret.rc) != 0); 578 } while (CheckReturnCode("RDL", DevNode, &retry, ret.rc) != 0);
@@ -806,7 +610,6 @@ void iSeries_Write_Byte(u8 data, volatile void __iomem *IoAddress)
806 return; 610 return;
807 } 611 }
808 do { 612 do {
809 ++Pci_Io_Write_Count;
810 rc = HvCall4(HvCallPciBarStore8, dsa, BarOffset, data, 0); 613 rc = HvCall4(HvCallPciBarStore8, dsa, BarOffset, data, 0);
811 } while (CheckReturnCode("WWB", DevNode, &retry, rc) != 0); 614 } while (CheckReturnCode("WWB", DevNode, &retry, rc) != 0);
812} 615}
@@ -834,7 +637,6 @@ void iSeries_Write_Word(u16 data, volatile void __iomem *IoAddress)
834 return; 637 return;
835 } 638 }
836 do { 639 do {
837 ++Pci_Io_Write_Count;
838 rc = HvCall4(HvCallPciBarStore16, dsa, BarOffset, swab16(data), 0); 640 rc = HvCall4(HvCallPciBarStore16, dsa, BarOffset, swab16(data), 0);
839 } while (CheckReturnCode("WWW", DevNode, &retry, rc) != 0); 641 } while (CheckReturnCode("WWW", DevNode, &retry, rc) != 0);
840} 642}
@@ -862,7 +664,6 @@ void iSeries_Write_Long(u32 data, volatile void __iomem *IoAddress)
862 return; 664 return;
863 } 665 }
864 do { 666 do {
865 ++Pci_Io_Write_Count;
866 rc = HvCall4(HvCallPciBarStore32, dsa, BarOffset, swab32(data), 0); 667 rc = HvCall4(HvCallPciBarStore32, dsa, BarOffset, swab32(data), 0);
867 } while (CheckReturnCode("WWL", DevNode, &retry, rc) != 0); 668 } while (CheckReturnCode("WWL", DevNode, &retry, rc) != 0);
868} 669}
diff --git a/arch/powerpc/platforms/iseries/setup.c b/arch/powerpc/platforms/iseries/setup.c
index a6fd9bedb074..617c724c4590 100644
--- a/arch/powerpc/platforms/iseries/setup.c
+++ b/arch/powerpc/platforms/iseries/setup.c
@@ -50,7 +50,6 @@
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>
54#include <asm/iseries/hv_lp_event.h> 53#include <asm/iseries/hv_lp_event.h>
55#include <asm/iseries/lpar_map.h> 54#include <asm/iseries/lpar_map.h>
56#include <asm/udbg.h> 55#include <asm/udbg.h>
@@ -81,9 +80,6 @@ extern void iSeries_pci_final_fixup(void);
81static void iSeries_pci_final_fixup(void) { } 80static void iSeries_pci_final_fixup(void) { }
82#endif 81#endif
83 82
84/* Global Variables */
85int piranha_simulator;
86
87extern int rd_size; /* Defined in drivers/block/rd.c */ 83extern int rd_size; /* Defined in drivers/block/rd.c */
88extern unsigned long embedded_sysmap_start; 84extern unsigned long embedded_sysmap_start;
89extern unsigned long embedded_sysmap_end; 85extern unsigned long embedded_sysmap_end;
@@ -91,8 +87,6 @@ extern unsigned long embedded_sysmap_end;
91extern unsigned long iSeries_recal_tb; 87extern unsigned long iSeries_recal_tb;
92extern unsigned long iSeries_recal_titan; 88extern unsigned long iSeries_recal_titan;
93 89
94static unsigned long cmd_mem_limit;
95
96struct MemoryBlock { 90struct MemoryBlock {
97 unsigned long absStart; 91 unsigned long absStart;
98 unsigned long absEnd; 92 unsigned long absEnd;
@@ -340,8 +334,6 @@ static void __init iSeries_init_early(void)
340#ifdef CONFIG_SMP 334#ifdef CONFIG_SMP
341 smp_init_iSeries(); 335 smp_init_iSeries();
342#endif 336#endif
343 if (itLpNaca.xPirEnvironMode == 0)
344 piranha_simulator = 1;
345 337
346 /* Associate Lp Event Queue 0 with processor 0 */ 338 /* Associate Lp Event Queue 0 with processor 0 */
347 HvCallEvent_setLpEventQueueInterruptProc(0, 0); 339 HvCallEvent_setLpEventQueueInterruptProc(0, 0);
@@ -536,10 +528,10 @@ static void __init iSeries_setup_arch(void)
536{ 528{
537 if (get_lppaca()->shared_proc) { 529 if (get_lppaca()->shared_proc) {
538 ppc_md.idle_loop = iseries_shared_idle; 530 ppc_md.idle_loop = iseries_shared_idle;
539 printk(KERN_INFO "Using shared processor idle loop\n"); 531 printk(KERN_DEBUG "Using shared processor idle loop\n");
540 } else { 532 } else {
541 ppc_md.idle_loop = iseries_dedicated_idle; 533 ppc_md.idle_loop = iseries_dedicated_idle;
542 printk(KERN_INFO "Using dedicated idle loop\n"); 534 printk(KERN_DEBUG "Using dedicated idle loop\n");
543 } 535 }
544 536
545 /* Setup the Lp Event Queue */ 537 /* Setup the Lp Event Queue */
@@ -714,243 +706,6 @@ define_machine(iseries) {
714 /* XXX Implement enable_pmcs for iSeries */ 706 /* XXX Implement enable_pmcs for iSeries */
715}; 707};
716 708
717struct blob {
718 unsigned char data[PAGE_SIZE];
719 unsigned long next;
720};
721
722struct iseries_flat_dt {
723 struct boot_param_header header;
724 u64 reserve_map[2];
725 struct blob dt;
726 struct blob strings;
727};
728
729struct iseries_flat_dt iseries_dt;
730
731void dt_init(struct iseries_flat_dt *dt)
732{
733 dt->header.off_mem_rsvmap =
734 offsetof(struct iseries_flat_dt, reserve_map);
735 dt->header.off_dt_struct = offsetof(struct iseries_flat_dt, dt);
736 dt->header.off_dt_strings = offsetof(struct iseries_flat_dt, strings);
737 dt->header.totalsize = sizeof(struct iseries_flat_dt);
738 dt->header.dt_strings_size = sizeof(struct blob);
739
740 /* There is no notion of hardware cpu id on iSeries */
741 dt->header.boot_cpuid_phys = smp_processor_id();
742
743 dt->dt.next = (unsigned long)&dt->dt.data;
744 dt->strings.next = (unsigned long)&dt->strings.data;
745
746 dt->header.magic = OF_DT_HEADER;
747 dt->header.version = 0x10;
748 dt->header.last_comp_version = 0x10;
749
750 dt->reserve_map[0] = 0;
751 dt->reserve_map[1] = 0;
752}
753
754void dt_check_blob(struct blob *b)
755{
756 if (b->next >= (unsigned long)&b->next) {
757 DBG("Ran out of space in flat device tree blob!\n");
758 BUG();
759 }
760}
761
762void dt_push_u32(struct iseries_flat_dt *dt, u32 value)
763{
764 *((u32*)dt->dt.next) = value;
765 dt->dt.next += sizeof(u32);
766
767 dt_check_blob(&dt->dt);
768}
769
770void dt_push_u64(struct iseries_flat_dt *dt, u64 value)
771{
772 *((u64*)dt->dt.next) = value;
773 dt->dt.next += sizeof(u64);
774
775 dt_check_blob(&dt->dt);
776}
777
778unsigned long dt_push_bytes(struct blob *blob, char *data, int len)
779{
780 unsigned long start = blob->next - (unsigned long)blob->data;
781
782 memcpy((char *)blob->next, data, len);
783 blob->next = _ALIGN(blob->next + len, 4);
784
785 dt_check_blob(blob);
786
787 return start;
788}
789
790void dt_start_node(struct iseries_flat_dt *dt, char *name)
791{
792 dt_push_u32(dt, OF_DT_BEGIN_NODE);
793 dt_push_bytes(&dt->dt, name, strlen(name) + 1);
794}
795
796#define dt_end_node(dt) dt_push_u32(dt, OF_DT_END_NODE)
797
798void dt_prop(struct iseries_flat_dt *dt, char *name, char *data, int len)
799{
800 unsigned long offset;
801
802 dt_push_u32(dt, OF_DT_PROP);
803
804 /* Length of the data */
805 dt_push_u32(dt, len);
806
807 /* Put the property name in the string blob. */
808 offset = dt_push_bytes(&dt->strings, name, strlen(name) + 1);
809
810 /* The offset of the properties name in the string blob. */
811 dt_push_u32(dt, (u32)offset);
812
813 /* The actual data. */
814 dt_push_bytes(&dt->dt, data, len);
815}
816
817void dt_prop_str(struct iseries_flat_dt *dt, char *name, char *data)
818{
819 dt_prop(dt, name, data, strlen(data) + 1); /* + 1 for NULL */
820}
821
822void dt_prop_u32(struct iseries_flat_dt *dt, char *name, u32 data)
823{
824 dt_prop(dt, name, (char *)&data, sizeof(u32));
825}
826
827void dt_prop_u64(struct iseries_flat_dt *dt, char *name, u64 data)
828{
829 dt_prop(dt, name, (char *)&data, sizeof(u64));
830}
831
832void dt_prop_u64_list(struct iseries_flat_dt *dt, char *name, u64 *data, int n)
833{
834 dt_prop(dt, name, (char *)data, sizeof(u64) * n);
835}
836
837void dt_prop_u32_list(struct iseries_flat_dt *dt, char *name, u32 *data, int n)
838{
839 dt_prop(dt, name, (char *)data, sizeof(u32) * n);
840}
841
842void dt_prop_empty(struct iseries_flat_dt *dt, char *name)
843{
844 dt_prop(dt, name, NULL, 0);
845}
846
847void dt_cpus(struct iseries_flat_dt *dt)
848{
849 unsigned char buf[32];
850 unsigned char *p;
851 unsigned int i, index;
852 struct IoHriProcessorVpd *d;
853 u32 pft_size[2];
854
855 /* yuck */
856 snprintf(buf, 32, "PowerPC,%s", cur_cpu_spec->cpu_name);
857 p = strchr(buf, ' ');
858 if (!p) p = buf + strlen(buf);
859
860 dt_start_node(dt, "cpus");
861 dt_prop_u32(dt, "#address-cells", 1);
862 dt_prop_u32(dt, "#size-cells", 0);
863
864 pft_size[0] = 0; /* NUMA CEC cookie, 0 for non NUMA */
865 pft_size[1] = __ilog2(HvCallHpt_getHptPages() * HW_PAGE_SIZE);
866
867 for (i = 0; i < NR_CPUS; i++) {
868 if (lppaca[i].dyn_proc_status >= 2)
869 continue;
870
871 snprintf(p, 32 - (p - buf), "@%d", i);
872 dt_start_node(dt, buf);
873
874 dt_prop_str(dt, "device_type", "cpu");
875
876 index = lppaca[i].dyn_hv_phys_proc_index;
877 d = &xIoHriProcessorVpd[index];
878
879 dt_prop_u32(dt, "i-cache-size", d->xInstCacheSize * 1024);
880 dt_prop_u32(dt, "i-cache-line-size", d->xInstCacheOperandSize);
881
882 dt_prop_u32(dt, "d-cache-size", d->xDataL1CacheSizeKB * 1024);
883 dt_prop_u32(dt, "d-cache-line-size", d->xDataCacheOperandSize);
884
885 /* magic conversions to Hz copied from old code */
886 dt_prop_u32(dt, "clock-frequency",
887 ((1UL << 34) * 1000000) / d->xProcFreq);
888 dt_prop_u32(dt, "timebase-frequency",
889 ((1UL << 32) * 1000000) / d->xTimeBaseFreq);
890
891 dt_prop_u32(dt, "reg", i);
892
893 dt_prop_u32_list(dt, "ibm,pft-size", pft_size, 2);
894
895 dt_end_node(dt);
896 }
897
898 dt_end_node(dt);
899}
900
901void dt_model(struct iseries_flat_dt *dt)
902{
903 char buf[16] = "IBM,";
904
905 /* "IBM," + mfgId[2:3] + systemSerial[1:5] */
906 strne2a(buf + 4, xItExtVpdPanel.mfgID + 2, 2);
907 strne2a(buf + 6, xItExtVpdPanel.systemSerial + 1, 5);
908 buf[11] = '\0';
909 dt_prop_str(dt, "system-id", buf);
910
911 /* "IBM," + machineType[0:4] */
912 strne2a(buf + 4, xItExtVpdPanel.machineType, 4);
913 buf[8] = '\0';
914 dt_prop_str(dt, "model", buf);
915
916 dt_prop_str(dt, "compatible", "IBM,iSeries");
917}
918
919void build_flat_dt(struct iseries_flat_dt *dt, unsigned long phys_mem_size)
920{
921 u64 tmp[2];
922
923 dt_init(dt);
924
925 dt_start_node(dt, "");
926
927 dt_prop_u32(dt, "#address-cells", 2);
928 dt_prop_u32(dt, "#size-cells", 2);
929 dt_model(dt);
930
931 /* /memory */
932 dt_start_node(dt, "memory@0");
933 dt_prop_str(dt, "name", "memory");
934 dt_prop_str(dt, "device_type", "memory");
935 tmp[0] = 0;
936 tmp[1] = phys_mem_size;
937 dt_prop_u64_list(dt, "reg", tmp, 2);
938 dt_end_node(dt);
939
940 /* /chosen */
941 dt_start_node(dt, "chosen");
942 dt_prop_str(dt, "bootargs", cmd_line);
943 if (cmd_mem_limit)
944 dt_prop_u64(dt, "linux,memory-limit", cmd_mem_limit);
945 dt_end_node(dt);
946
947 dt_cpus(dt);
948
949 dt_end_node(dt);
950
951 dt_push_u32(dt, OF_DT_END);
952}
953
954void * __init iSeries_early_setup(void) 709void * __init iSeries_early_setup(void)
955{ 710{
956 unsigned long phys_mem_size; 711 unsigned long phys_mem_size;
@@ -965,28 +720,8 @@ void * __init iSeries_early_setup(void)
965 720
966 iSeries_get_cmdline(); 721 iSeries_get_cmdline();
967 722
968 /* Save unparsed command line copy for /proc/cmdline */ 723 return (void *) __pa(build_flat_dt(phys_mem_size));
969 strlcpy(saved_command_line, cmd_line, COMMAND_LINE_SIZE);
970
971 /* Parse early parameters, in particular mem=x */
972 parse_early_param();
973
974 build_flat_dt(&iseries_dt, phys_mem_size);
975
976 return (void *) __pa(&iseries_dt);
977}
978
979/*
980 * On iSeries we just parse the mem=X option from the command line.
981 * On pSeries it's a bit more complicated, see prom_init_mem()
982 */
983static int __init early_parsemem(char *p)
984{
985 if (p)
986 cmd_mem_limit = ALIGN(memparse(p, &p), PAGE_SIZE);
987 return 0;
988} 724}
989early_param("mem", early_parsemem);
990 725
991static void hvputc(char c) 726static void hvputc(char c)
992{ 727{
diff --git a/arch/powerpc/platforms/iseries/setup.h b/arch/powerpc/platforms/iseries/setup.h
index 5213044ec411..0a47ac53c959 100644
--- a/arch/powerpc/platforms/iseries/setup.h
+++ b/arch/powerpc/platforms/iseries/setup.h
@@ -21,4 +21,6 @@ extern unsigned long iSeries_get_boot_time(void);
21extern int iSeries_set_rtc_time(struct rtc_time *tm); 21extern int iSeries_set_rtc_time(struct rtc_time *tm);
22extern void iSeries_get_rtc_time(struct rtc_time *tm); 22extern void iSeries_get_rtc_time(struct rtc_time *tm);
23 23
24extern void *build_flat_dt(unsigned long phys_mem_size);
25
24#endif /* __ISERIES_SETUP_H__ */ 26#endif /* __ISERIES_SETUP_H__ */
diff --git a/arch/powerpc/platforms/iseries/vio.c b/arch/powerpc/platforms/iseries/vio.c
deleted file mode 100644
index ad36ab0639f0..000000000000
--- a/arch/powerpc/platforms/iseries/vio.c
+++ /dev/null
@@ -1,131 +0,0 @@
1/*
2 * IBM PowerPC iSeries Virtual I/O Infrastructure Support.
3 *
4 * Copyright (c) 2005 Stephen Rothwell, IBM Corp.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11#include <linux/types.h>
12#include <linux/device.h>
13#include <linux/init.h>
14
15#include <asm/vio.h>
16#include <asm/iommu.h>
17#include <asm/tce.h>
18#include <asm/abs_addr.h>
19#include <asm/page.h>
20#include <asm/iseries/vio.h>
21#include <asm/iseries/hv_types.h>
22#include <asm/iseries/hv_lp_config.h>
23#include <asm/iseries/hv_call_xm.h>
24
25#include "iommu.h"
26
27struct device *iSeries_vio_dev = &vio_bus_device.dev;
28EXPORT_SYMBOL(iSeries_vio_dev);
29
30static struct iommu_table veth_iommu_table;
31static struct iommu_table vio_iommu_table;
32
33static void __init iommu_vio_init(void)
34{
35 iommu_table_getparms_iSeries(255, 0, 0xff, &veth_iommu_table);
36 veth_iommu_table.it_size /= 2;
37 vio_iommu_table = veth_iommu_table;
38 vio_iommu_table.it_offset += veth_iommu_table.it_size;
39
40 if (!iommu_init_table(&veth_iommu_table))
41 printk("Virtual Bus VETH TCE table failed.\n");
42 if (!iommu_init_table(&vio_iommu_table))
43 printk("Virtual Bus VIO TCE table failed.\n");
44}
45
46/**
47 * vio_register_device_iseries: - Register a new iSeries vio device.
48 * @voidev: The device to register.
49 */
50static struct vio_dev *__init vio_register_device_iseries(char *type,
51 uint32_t unit_num)
52{
53 struct vio_dev *viodev;
54
55 /* allocate a vio_dev for this device */
56 viodev = kmalloc(sizeof(struct vio_dev), GFP_KERNEL);
57 if (!viodev)
58 return NULL;
59 memset(viodev, 0, sizeof(struct vio_dev));
60
61 snprintf(viodev->dev.bus_id, BUS_ID_SIZE, "%s%d", type, unit_num);
62
63 viodev->name = viodev->dev.bus_id;
64 viodev->type = type;
65 viodev->unit_address = unit_num;
66 viodev->iommu_table = &vio_iommu_table;
67 if (vio_register_device(viodev) == NULL) {
68 kfree(viodev);
69 return NULL;
70 }
71 return viodev;
72}
73
74void __init probe_bus_iseries(void)
75{
76 HvLpIndexMap vlan_map;
77 struct vio_dev *viodev;
78 int i;
79
80 /* there is only one of each of these */
81 vio_register_device_iseries("viocons", 0);
82 vio_register_device_iseries("vscsi", 0);
83
84 vlan_map = HvLpConfig_getVirtualLanIndexMap();
85 for (i = 0; i < HVMAXARCHITECTEDVIRTUALLANS; i++) {
86 if ((vlan_map & (0x8000 >> i)) == 0)
87 continue;
88 viodev = vio_register_device_iseries("vlan", i);
89 /* veth is special and has it own iommu_table */
90 viodev->iommu_table = &veth_iommu_table;
91 }
92 for (i = 0; i < HVMAXARCHITECTEDVIRTUALDISKS; i++)
93 vio_register_device_iseries("viodasd", i);
94 for (i = 0; i < HVMAXARCHITECTEDVIRTUALCDROMS; i++)
95 vio_register_device_iseries("viocd", i);
96 for (i = 0; i < HVMAXARCHITECTEDVIRTUALTAPES; i++)
97 vio_register_device_iseries("viotape", i);
98}
99
100/**
101 * vio_match_device_iseries: - Tell if a iSeries VIO device matches a
102 * vio_device_id
103 */
104static int vio_match_device_iseries(const struct vio_device_id *id,
105 const struct vio_dev *dev)
106{
107 return strncmp(dev->type, id->type, strlen(id->type)) == 0;
108}
109
110static struct vio_bus_ops vio_bus_ops_iseries = {
111 .match = vio_match_device_iseries,
112};
113
114/**
115 * vio_bus_init_iseries: - Initialize the iSeries virtual IO bus
116 */
117static int __init vio_bus_init_iseries(void)
118{
119 int err;
120
121 err = vio_bus_init(&vio_bus_ops_iseries);
122 if (err == 0) {
123 iommu_vio_init();
124 vio_bus_device.iommu_table = &vio_iommu_table;
125 iSeries_vio_dev = &vio_bus_device.dev;
126 probe_bus_iseries();
127 }
128 return err;
129}
130
131__initcall(vio_bus_init_iseries);
diff --git a/arch/powerpc/platforms/maple/pci.c b/arch/powerpc/platforms/maple/pci.c
index 85d6c93659cc..9a4efc0c3b29 100644
--- a/arch/powerpc/platforms/maple/pci.c
+++ b/arch/powerpc/platforms/maple/pci.c
@@ -437,9 +437,6 @@ void __init maple_pci_init(void)
437 437
438 /* Tell pci.c to not change any resource allocations. */ 438 /* Tell pci.c to not change any resource allocations. */
439 pci_probe_only = 1; 439 pci_probe_only = 1;
440
441 /* Allow all IO */
442 io_page_mask = -1;
443} 440}
444 441
445int maple_pci_get_legacy_ide_irq(struct pci_dev *pdev, int channel) 442int maple_pci_get_legacy_ide_irq(struct pci_dev *pdev, int channel)
diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c
index 24c0aef4ea39..a0505ea48a86 100644
--- a/arch/powerpc/platforms/maple/setup.c
+++ b/arch/powerpc/platforms/maple/setup.c
@@ -189,7 +189,7 @@ void __init maple_setup_arch(void)
189 conswitchp = &dummy_con; 189 conswitchp = &dummy_con;
190#endif 190#endif
191 191
192 printk(KERN_INFO "Using native/NAP idle loop\n"); 192 printk(KERN_DEBUG "Using native/NAP idle loop\n");
193} 193}
194 194
195/* 195/*
diff --git a/arch/powerpc/platforms/powermac/feature.c b/arch/powerpc/platforms/powermac/feature.c
index a5063cd675c5..85e00cb0006e 100644
--- a/arch/powerpc/platforms/powermac/feature.c
+++ b/arch/powerpc/platforms/powermac/feature.c
@@ -2510,7 +2510,7 @@ found:
2510 if (get_property(np, "flush-on-lock", NULL)) 2510 if (get_property(np, "flush-on-lock", NULL))
2511 break; 2511 break;
2512 powersave_nap = 1; 2512 powersave_nap = 1;
2513 printk(KERN_INFO "Processor NAP mode on idle enabled.\n"); 2513 printk(KERN_DEBUG "Processor NAP mode on idle enabled.\n");
2514 break; 2514 break;
2515 } 2515 }
2516 2516
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index ea179afea632..80035853467b 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -1068,9 +1068,6 @@ void __init pmac_pci_init(void)
1068 /* Tell pci.c to not use the common resource allocation mechanism */ 1068 /* Tell pci.c to not use the common resource allocation mechanism */
1069 pci_probe_only = 1; 1069 pci_probe_only = 1;
1070 1070
1071 /* Allow all IO */
1072 io_page_mask = -1;
1073
1074#else /* CONFIG_PPC64 */ 1071#else /* CONFIG_PPC64 */
1075 init_p2pbridge(); 1072 init_p2pbridge();
1076 fixup_nec_usb2(); 1073 fixup_nec_usb2();
diff --git a/arch/powerpc/platforms/pseries/Makefile b/arch/powerpc/platforms/pseries/Makefile
index 930898635c9f..b46ce3b9bb3c 100644
--- a/arch/powerpc/platforms/pseries/Makefile
+++ b/arch/powerpc/platforms/pseries/Makefile
@@ -2,7 +2,6 @@ obj-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 3 firmware.o
4obj-$(CONFIG_SMP) += smp.o 4obj-$(CONFIG_SMP) += smp.o
5obj-$(CONFIG_IBMVIO) += vio.o
6obj-$(CONFIG_XICS) += xics.o 5obj-$(CONFIG_XICS) += xics.o
7obj-$(CONFIG_SCANLOG) += scanlog.o 6obj-$(CONFIG_SCANLOG) += scanlog.o
8obj-$(CONFIG_EEH) += eeh.o eeh_cache.o eeh_driver.o eeh_event.o 7obj-$(CONFIG_EEH) += eeh.o eeh_cache.o eeh_driver.o eeh_event.o
diff --git a/arch/powerpc/platforms/pseries/eeh_driver.c b/arch/powerpc/platforms/pseries/eeh_driver.c
index 1fba695e32e8..4d45347afabc 100644
--- a/arch/powerpc/platforms/pseries/eeh_driver.c
+++ b/arch/powerpc/platforms/pseries/eeh_driver.c
@@ -23,9 +23,8 @@
23 * 23 *
24 */ 24 */
25#include <linux/delay.h> 25#include <linux/delay.h>
26#include <linux/irq.h>
27#include <linux/interrupt.h> 26#include <linux/interrupt.h>
28#include <linux/notifier.h> 27#include <linux/irq.h>
29#include <linux/pci.h> 28#include <linux/pci.h>
30#include <asm/eeh.h> 29#include <asm/eeh.h>
31#include <asm/eeh_event.h> 30#include <asm/eeh_event.h>
@@ -202,7 +201,11 @@ static void eeh_report_failure(struct pci_dev *dev, void *userdata)
202 201
203static int eeh_reset_device (struct pci_dn *pe_dn, struct pci_bus *bus) 202static int eeh_reset_device (struct pci_dn *pe_dn, struct pci_bus *bus)
204{ 203{
205 int rc; 204 int cnt, rc;
205
206 /* pcibios will clear the counter; save the value */
207 cnt = pe_dn->eeh_freeze_count;
208
206 if (bus) 209 if (bus)
207 pcibios_remove_pci_devices(bus); 210 pcibios_remove_pci_devices(bus);
208 211
@@ -241,6 +244,7 @@ static int eeh_reset_device (struct pci_dn *pe_dn, struct pci_bus *bus)
241 ssleep (5); 244 ssleep (5);
242 pcibios_add_pci_devices(bus); 245 pcibios_add_pci_devices(bus);
243 } 246 }
247 pe_dn->eeh_freeze_count = cnt;
244 248
245 return 0; 249 return 0;
246} 250}
@@ -250,7 +254,7 @@ static int eeh_reset_device (struct pci_dn *pe_dn, struct pci_bus *bus)
250 */ 254 */
251#define MAX_WAIT_FOR_RECOVERY 15 255#define MAX_WAIT_FOR_RECOVERY 15
252 256
253void handle_eeh_events (struct eeh_event *event) 257struct pci_dn * handle_eeh_events (struct eeh_event *event)
254{ 258{
255 struct device_node *frozen_dn; 259 struct device_node *frozen_dn;
256 struct pci_dn *frozen_pdn; 260 struct pci_dn *frozen_pdn;
@@ -265,7 +269,7 @@ void handle_eeh_events (struct eeh_event *event)
265 if (!frozen_dn) { 269 if (!frozen_dn) {
266 printk(KERN_ERR "EEH: Error: Cannot find partition endpoint for %s\n", 270 printk(KERN_ERR "EEH: Error: Cannot find partition endpoint for %s\n",
267 pci_name(event->dev)); 271 pci_name(event->dev));
268 return; 272 return NULL;
269 } 273 }
270 274
271 /* There are two different styles for coming up with the PE. 275 /* There are two different styles for coming up with the PE.
@@ -280,7 +284,7 @@ void handle_eeh_events (struct eeh_event *event)
280 if (!frozen_bus) { 284 if (!frozen_bus) {
281 printk(KERN_ERR "EEH: Cannot find PCI bus for %s\n", 285 printk(KERN_ERR "EEH: Cannot find PCI bus for %s\n",
282 frozen_dn->full_name); 286 frozen_dn->full_name);
283 return; 287 return NULL;
284 } 288 }
285 289
286#if 0 290#if 0
@@ -355,7 +359,7 @@ void handle_eeh_events (struct eeh_event *event)
355 /* Tell all device drivers that they can resume operations */ 359 /* Tell all device drivers that they can resume operations */
356 pci_walk_bus(frozen_bus, eeh_report_resume, NULL); 360 pci_walk_bus(frozen_bus, eeh_report_resume, NULL);
357 361
358 return; 362 return frozen_pdn;
359 363
360excess_failures: 364excess_failures:
361 /* 365 /*
@@ -384,6 +388,8 @@ perm_error:
384 388
385 /* Shut down the device drivers for good. */ 389 /* Shut down the device drivers for good. */
386 pcibios_remove_pci_devices(frozen_bus); 390 pcibios_remove_pci_devices(frozen_bus);
391
392 return NULL;
387} 393}
388 394
389/* ---------- end of file ---------- */ 395/* ---------- end of file ---------- */
diff --git a/arch/powerpc/platforms/pseries/eeh_event.c b/arch/powerpc/platforms/pseries/eeh_event.c
index 40020c65c89e..8f2d12935b99 100644
--- a/arch/powerpc/platforms/pseries/eeh_event.c
+++ b/arch/powerpc/platforms/pseries/eeh_event.c
@@ -18,6 +18,7 @@
18 * Copyright (c) 2005 Linas Vepstas <linas@linas.org> 18 * Copyright (c) 2005 Linas Vepstas <linas@linas.org>
19 */ 19 */
20 20
21#include <linux/delay.h>
21#include <linux/list.h> 22#include <linux/list.h>
22#include <linux/mutex.h> 23#include <linux/mutex.h>
23#include <linux/pci.h> 24#include <linux/pci.h>
@@ -56,38 +57,43 @@ static int eeh_event_handler(void * dummy)
56{ 57{
57 unsigned long flags; 58 unsigned long flags;
58 struct eeh_event *event; 59 struct eeh_event *event;
60 struct pci_dn *pdn;
59 61
60 daemonize ("eehd"); 62 daemonize ("eehd");
63 set_current_state(TASK_INTERRUPTIBLE);
61 64
62 while (1) { 65 spin_lock_irqsave(&eeh_eventlist_lock, flags);
63 set_current_state(TASK_INTERRUPTIBLE); 66 event = NULL;
64 67
65 spin_lock_irqsave(&eeh_eventlist_lock, flags); 68 /* Unqueue the event, get ready to process. */
66 event = NULL; 69 if (!list_empty(&eeh_eventlist)) {
70 event = list_entry(eeh_eventlist.next, struct eeh_event, list);
71 list_del(&event->list);
72 }
73 spin_unlock_irqrestore(&eeh_eventlist_lock, flags);
67 74
68 /* Unqueue the event, get ready to process. */ 75 if (event == NULL)
69 if (!list_empty(&eeh_eventlist)) { 76 return 0;
70 event = list_entry(eeh_eventlist.next, struct eeh_event, list);
71 list_del(&event->list);
72 }
73 spin_unlock_irqrestore(&eeh_eventlist_lock, flags);
74 77
75 if (event == NULL) 78 /* Serialize processing of EEH events */
76 break; 79 mutex_lock(&eeh_event_mutex);
80 eeh_mark_slot(event->dn, EEH_MODE_RECOVERING);
77 81
78 /* Serialize processing of EEH events */ 82 printk(KERN_INFO "EEH: Detected PCI bus error on device %s\n",
79 mutex_lock(&eeh_event_mutex); 83 pci_name(event->dev));
80 eeh_mark_slot(event->dn, EEH_MODE_RECOVERING);
81 84
82 printk(KERN_INFO "EEH: Detected PCI bus error on device %s\n", 85 pdn = handle_eeh_events(event);
83 pci_name(event->dev));
84 86
85 handle_eeh_events(event); 87 eeh_clear_slot(event->dn, EEH_MODE_RECOVERING);
88 pci_dev_put(event->dev);
89 kfree(event);
90 mutex_unlock(&eeh_event_mutex);
86 91
87 eeh_clear_slot(event->dn, EEH_MODE_RECOVERING); 92 /* If there are no new errors after an hour, clear the counter. */
88 pci_dev_put(event->dev); 93 if (pdn && pdn->eeh_freeze_count>0) {
89 kfree(event); 94 msleep_interruptible (3600*1000);
90 mutex_unlock(&eeh_event_mutex); 95 if (pdn->eeh_freeze_count>0)
96 pdn->eeh_freeze_count--;
91 } 97 }
92 98
93 return 0; 99 return 0;
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index 2643078433f0..44a507e6fb34 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -1,23 +1,24 @@
1/* 1/*
2 * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen, IBM Corporation 2 * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen, IBM Corporation
3 * 3 *
4 * Rewrite, cleanup: 4 * Rewrite, cleanup:
5 * 5 *
6 * Copyright (C) 2004 Olof Johansson <olof@lixom.net>, IBM Corporation 6 * Copyright (C) 2004 Olof Johansson <olof@lixom.net>, IBM Corporation
7 * Copyright (C) 2006 Olof Johansson <olof@lixom.net>
7 * 8 *
8 * Dynamic DMA mapping support, pSeries-specific parts, both SMP and LPAR. 9 * Dynamic DMA mapping support, pSeries-specific parts, both SMP and LPAR.
9 * 10 *
10 * 11 *
11 * This program is free software; you can redistribute it and/or modify 12 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by 13 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or 14 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version. 15 * (at your option) any later version.
15 * 16 *
16 * This program is distributed in the hope that it will be useful, 17 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details. 20 * GNU General Public License for more details.
20 * 21 *
21 * You should have received a copy of the GNU General Public License 22 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software 23 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -49,52 +50,46 @@
49 50
50#define DBG(fmt...) 51#define DBG(fmt...)
51 52
52static void tce_build_pSeries(struct iommu_table *tbl, long index, 53static void tce_build_pSeries(struct iommu_table *tbl, long index,
53 long npages, unsigned long uaddr, 54 long npages, unsigned long uaddr,
54 enum dma_data_direction direction) 55 enum dma_data_direction direction)
55{ 56{
56 union tce_entry t; 57 u64 proto_tce;
57 union tce_entry *tp; 58 u64 *tcep;
59 u64 rpn;
58 60
59 index <<= TCE_PAGE_FACTOR; 61 index <<= TCE_PAGE_FACTOR;
60 npages <<= TCE_PAGE_FACTOR; 62 npages <<= TCE_PAGE_FACTOR;
61 63
62 t.te_word = 0; 64 proto_tce = TCE_PCI_READ; // Read allowed
63 t.te_rdwr = 1; // Read allowed
64 65
65 if (direction != DMA_TO_DEVICE) 66 if (direction != DMA_TO_DEVICE)
66 t.te_pciwr = 1; 67 proto_tce |= TCE_PCI_WRITE;
67 68
68 tp = ((union tce_entry *)tbl->it_base) + index; 69 tcep = ((u64 *)tbl->it_base) + index;
69 70
70 while (npages--) { 71 while (npages--) {
71 /* can't move this out since we might cross LMB boundary */ 72 /* can't move this out since we might cross LMB boundary */
72 t.te_rpn = (virt_to_abs(uaddr)) >> TCE_SHIFT; 73 rpn = (virt_to_abs(uaddr)) >> TCE_SHIFT;
73 74 *tcep = proto_tce | (rpn & TCE_RPN_MASK) << TCE_RPN_SHIFT;
74 tp->te_word = t.te_word;
75 75
76 uaddr += TCE_PAGE_SIZE; 76 uaddr += TCE_PAGE_SIZE;
77 tp++; 77 tcep++;
78 } 78 }
79} 79}
80 80
81 81
82static void tce_free_pSeries(struct iommu_table *tbl, long index, long npages) 82static void tce_free_pSeries(struct iommu_table *tbl, long index, long npages)
83{ 83{
84 union tce_entry t; 84 u64 *tcep;
85 union tce_entry *tp;
86 85
87 npages <<= TCE_PAGE_FACTOR; 86 npages <<= TCE_PAGE_FACTOR;
88 index <<= TCE_PAGE_FACTOR; 87 index <<= TCE_PAGE_FACTOR;
89 88
90 t.te_word = 0; 89 tcep = ((u64 *)tbl->it_base) + index;
91 tp = ((union tce_entry *)tbl->it_base) + index; 90
92 91 while (npages--)
93 while (npages--) { 92 *(tcep++) = 0;
94 tp->te_word = t.te_word;
95
96 tp++;
97 }
98} 93}
99 94
100 95
@@ -103,43 +98,44 @@ static void tce_build_pSeriesLP(struct iommu_table *tbl, long tcenum,
103 enum dma_data_direction direction) 98 enum dma_data_direction direction)
104{ 99{
105 u64 rc; 100 u64 rc;
106 union tce_entry tce; 101 u64 proto_tce, tce;
102 u64 rpn;
107 103
108 tcenum <<= TCE_PAGE_FACTOR; 104 tcenum <<= TCE_PAGE_FACTOR;
109 npages <<= TCE_PAGE_FACTOR; 105 npages <<= TCE_PAGE_FACTOR;
110 106
111 tce.te_word = 0; 107 rpn = (virt_to_abs(uaddr)) >> TCE_SHIFT;
112 tce.te_rpn = (virt_to_abs(uaddr)) >> TCE_SHIFT; 108 proto_tce = TCE_PCI_READ;
113 tce.te_rdwr = 1;
114 if (direction != DMA_TO_DEVICE) 109 if (direction != DMA_TO_DEVICE)
115 tce.te_pciwr = 1; 110 proto_tce |= TCE_PCI_WRITE;
116 111
117 while (npages--) { 112 while (npages--) {
118 rc = plpar_tce_put((u64)tbl->it_index, 113 tce = proto_tce | (rpn & TCE_RPN_MASK) << TCE_RPN_SHIFT;
119 (u64)tcenum << 12, 114 rc = plpar_tce_put((u64)tbl->it_index, (u64)tcenum << 12, tce);
120 tce.te_word ); 115
121
122 if (rc && printk_ratelimit()) { 116 if (rc && printk_ratelimit()) {
123 printk("tce_build_pSeriesLP: plpar_tce_put failed. rc=%ld\n", rc); 117 printk("tce_build_pSeriesLP: plpar_tce_put failed. rc=%ld\n", rc);
124 printk("\tindex = 0x%lx\n", (u64)tbl->it_index); 118 printk("\tindex = 0x%lx\n", (u64)tbl->it_index);
125 printk("\ttcenum = 0x%lx\n", (u64)tcenum); 119 printk("\ttcenum = 0x%lx\n", (u64)tcenum);
126 printk("\ttce val = 0x%lx\n", tce.te_word ); 120 printk("\ttce val = 0x%lx\n", tce );
127 show_stack(current, (unsigned long *)__get_SP()); 121 show_stack(current, (unsigned long *)__get_SP());
128 } 122 }
129 123
130 tcenum++; 124 tcenum++;
131 tce.te_rpn++; 125 rpn++;
132 } 126 }
133} 127}
134 128
135static DEFINE_PER_CPU(void *, tce_page) = NULL; 129static DEFINE_PER_CPU(u64 *, tce_page) = NULL;
136 130
137static void tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum, 131static void tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
138 long npages, unsigned long uaddr, 132 long npages, unsigned long uaddr,
139 enum dma_data_direction direction) 133 enum dma_data_direction direction)
140{ 134{
141 u64 rc; 135 u64 rc;
142 union tce_entry tce, *tcep; 136 u64 proto_tce;
137 u64 *tcep;
138 u64 rpn;
143 long l, limit; 139 long l, limit;
144 140
145 if (TCE_PAGE_FACTOR == 0 && npages == 1) 141 if (TCE_PAGE_FACTOR == 0 && npages == 1)
@@ -152,7 +148,7 @@ static void tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
152 * from iommu_alloc{,_sg}() 148 * from iommu_alloc{,_sg}()
153 */ 149 */
154 if (!tcep) { 150 if (!tcep) {
155 tcep = (void *)__get_free_page(GFP_ATOMIC); 151 tcep = (u64 *)__get_free_page(GFP_ATOMIC);
156 /* If allocation fails, fall back to the loop implementation */ 152 /* If allocation fails, fall back to the loop implementation */
157 if (!tcep) 153 if (!tcep)
158 return tce_build_pSeriesLP(tbl, tcenum, npages, 154 return tce_build_pSeriesLP(tbl, tcenum, npages,
@@ -163,11 +159,10 @@ static void tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
163 tcenum <<= TCE_PAGE_FACTOR; 159 tcenum <<= TCE_PAGE_FACTOR;
164 npages <<= TCE_PAGE_FACTOR; 160 npages <<= TCE_PAGE_FACTOR;
165 161
166 tce.te_word = 0; 162 rpn = (virt_to_abs(uaddr)) >> TCE_SHIFT;
167 tce.te_rpn = (virt_to_abs(uaddr)) >> TCE_SHIFT; 163 proto_tce = TCE_PCI_READ;
168 tce.te_rdwr = 1;
169 if (direction != DMA_TO_DEVICE) 164 if (direction != DMA_TO_DEVICE)
170 tce.te_pciwr = 1; 165 proto_tce |= TCE_PCI_WRITE;
171 166
172 /* We can map max one pageful of TCEs at a time */ 167 /* We can map max one pageful of TCEs at a time */
173 do { 168 do {
@@ -175,11 +170,11 @@ static void tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
175 * Set up the page with TCE data, looping through and setting 170 * Set up the page with TCE data, looping through and setting
176 * the values. 171 * the values.
177 */ 172 */
178 limit = min_t(long, npages, 4096/sizeof(union tce_entry)); 173 limit = min_t(long, npages, 4096/TCE_ENTRY_SIZE);
179 174
180 for (l = 0; l < limit; l++) { 175 for (l = 0; l < limit; l++) {
181 tcep[l] = tce; 176 tcep[l] = proto_tce | (rpn & TCE_RPN_MASK) << TCE_RPN_SHIFT;
182 tce.te_rpn++; 177 rpn++;
183 } 178 }
184 179
185 rc = plpar_tce_put_indirect((u64)tbl->it_index, 180 rc = plpar_tce_put_indirect((u64)tbl->it_index,
@@ -195,7 +190,7 @@ static void tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
195 printk("tce_buildmulti_pSeriesLP: plpar_tce_put failed. rc=%ld\n", rc); 190 printk("tce_buildmulti_pSeriesLP: plpar_tce_put failed. rc=%ld\n", rc);
196 printk("\tindex = 0x%lx\n", (u64)tbl->it_index); 191 printk("\tindex = 0x%lx\n", (u64)tbl->it_index);
197 printk("\tnpages = 0x%lx\n", (u64)npages); 192 printk("\tnpages = 0x%lx\n", (u64)npages);
198 printk("\ttce[0] val = 0x%lx\n", tcep[0].te_word); 193 printk("\ttce[0] val = 0x%lx\n", tcep[0]);
199 show_stack(current, (unsigned long *)__get_SP()); 194 show_stack(current, (unsigned long *)__get_SP());
200 } 195 }
201} 196}
@@ -203,23 +198,17 @@ static void tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
203static void tce_free_pSeriesLP(struct iommu_table *tbl, long tcenum, long npages) 198static void tce_free_pSeriesLP(struct iommu_table *tbl, long tcenum, long npages)
204{ 199{
205 u64 rc; 200 u64 rc;
206 union tce_entry tce;
207 201
208 tcenum <<= TCE_PAGE_FACTOR; 202 tcenum <<= TCE_PAGE_FACTOR;
209 npages <<= TCE_PAGE_FACTOR; 203 npages <<= TCE_PAGE_FACTOR;
210 204
211 tce.te_word = 0;
212
213 while (npages--) { 205 while (npages--) {
214 rc = plpar_tce_put((u64)tbl->it_index, 206 rc = plpar_tce_put((u64)tbl->it_index, (u64)tcenum << 12, 0);
215 (u64)tcenum << 12,
216 tce.te_word);
217 207
218 if (rc && printk_ratelimit()) { 208 if (rc && printk_ratelimit()) {
219 printk("tce_free_pSeriesLP: plpar_tce_put failed. rc=%ld\n", rc); 209 printk("tce_free_pSeriesLP: plpar_tce_put failed. rc=%ld\n", rc);
220 printk("\tindex = 0x%lx\n", (u64)tbl->it_index); 210 printk("\tindex = 0x%lx\n", (u64)tbl->it_index);
221 printk("\ttcenum = 0x%lx\n", (u64)tcenum); 211 printk("\ttcenum = 0x%lx\n", (u64)tcenum);
222 printk("\ttce val = 0x%lx\n", tce.te_word );
223 show_stack(current, (unsigned long *)__get_SP()); 212 show_stack(current, (unsigned long *)__get_SP());
224 } 213 }
225 214
@@ -231,31 +220,24 @@ static void tce_free_pSeriesLP(struct iommu_table *tbl, long tcenum, long npages
231static void tce_freemulti_pSeriesLP(struct iommu_table *tbl, long tcenum, long npages) 220static void tce_freemulti_pSeriesLP(struct iommu_table *tbl, long tcenum, long npages)
232{ 221{
233 u64 rc; 222 u64 rc;
234 union tce_entry tce;
235 223
236 tcenum <<= TCE_PAGE_FACTOR; 224 tcenum <<= TCE_PAGE_FACTOR;
237 npages <<= TCE_PAGE_FACTOR; 225 npages <<= TCE_PAGE_FACTOR;
238 226
239 tce.te_word = 0; 227 rc = plpar_tce_stuff((u64)tbl->it_index, (u64)tcenum << 12, 0, npages);
240
241 rc = plpar_tce_stuff((u64)tbl->it_index,
242 (u64)tcenum << 12,
243 tce.te_word,
244 npages);
245 228
246 if (rc && printk_ratelimit()) { 229 if (rc && printk_ratelimit()) {
247 printk("tce_freemulti_pSeriesLP: plpar_tce_stuff failed\n"); 230 printk("tce_freemulti_pSeriesLP: plpar_tce_stuff failed\n");
248 printk("\trc = %ld\n", rc); 231 printk("\trc = %ld\n", rc);
249 printk("\tindex = 0x%lx\n", (u64)tbl->it_index); 232 printk("\tindex = 0x%lx\n", (u64)tbl->it_index);
250 printk("\tnpages = 0x%lx\n", (u64)npages); 233 printk("\tnpages = 0x%lx\n", (u64)npages);
251 printk("\ttce val = 0x%lx\n", tce.te_word );
252 show_stack(current, (unsigned long *)__get_SP()); 234 show_stack(current, (unsigned long *)__get_SP());
253 } 235 }
254} 236}
255 237
256static void iommu_table_setparms(struct pci_controller *phb, 238static void iommu_table_setparms(struct pci_controller *phb,
257 struct device_node *dn, 239 struct device_node *dn,
258 struct iommu_table *tbl) 240 struct iommu_table *tbl)
259{ 241{
260 struct device_node *node; 242 struct device_node *node;
261 unsigned long *basep; 243 unsigned long *basep;
@@ -275,16 +257,16 @@ static void iommu_table_setparms(struct pci_controller *phb,
275 memset((void *)tbl->it_base, 0, *sizep); 257 memset((void *)tbl->it_base, 0, *sizep);
276 258
277 tbl->it_busno = phb->bus->number; 259 tbl->it_busno = phb->bus->number;
278 260
279 /* Units of tce entries */ 261 /* Units of tce entries */
280 tbl->it_offset = phb->dma_window_base_cur >> PAGE_SHIFT; 262 tbl->it_offset = phb->dma_window_base_cur >> PAGE_SHIFT;
281 263
282 /* Test if we are going over 2GB of DMA space */ 264 /* Test if we are going over 2GB of DMA space */
283 if (phb->dma_window_base_cur + phb->dma_window_size > 0x80000000ul) { 265 if (phb->dma_window_base_cur + phb->dma_window_size > 0x80000000ul) {
284 udbg_printf("PCI_DMA: Unexpected number of IOAs under this PHB.\n"); 266 udbg_printf("PCI_DMA: Unexpected number of IOAs under this PHB.\n");
285 panic("PCI_DMA: Unexpected number of IOAs under this PHB.\n"); 267 panic("PCI_DMA: Unexpected number of IOAs under this PHB.\n");
286 } 268 }
287 269
288 phb->dma_window_base_cur += phb->dma_window_size; 270 phb->dma_window_base_cur += phb->dma_window_size;
289 271
290 /* Set the tce table size - measured in entries */ 272 /* Set the tce table size - measured in entries */
@@ -299,30 +281,22 @@ static void iommu_table_setparms(struct pci_controller *phb,
299 * iommu_table_setparms_lpar 281 * iommu_table_setparms_lpar
300 * 282 *
301 * Function: On pSeries LPAR systems, return TCE table info, given a pci bus. 283 * Function: On pSeries LPAR systems, return TCE table info, given a pci bus.
302 *
303 * ToDo: properly interpret the ibm,dma-window property. The definition is:
304 * logical-bus-number (1 word)
305 * phys-address (#address-cells words)
306 * size (#cell-size words)
307 *
308 * Currently we hard code these sizes (more or less).
309 */ 284 */
310static void iommu_table_setparms_lpar(struct pci_controller *phb, 285static void iommu_table_setparms_lpar(struct pci_controller *phb,
311 struct device_node *dn, 286 struct device_node *dn,
312 struct iommu_table *tbl, 287 struct iommu_table *tbl,
313 unsigned int *dma_window) 288 unsigned char *dma_window)
314{ 289{
290 unsigned long offset, size;
291
315 tbl->it_busno = PCI_DN(dn)->bussubno; 292 tbl->it_busno = PCI_DN(dn)->bussubno;
293 of_parse_dma_window(dn, dma_window, &tbl->it_index, &offset, &size);
316 294
317 /* TODO: Parse field size properties properly. */
318 tbl->it_size = (((unsigned long)dma_window[4] << 32) |
319 (unsigned long)dma_window[5]) >> PAGE_SHIFT;
320 tbl->it_offset = (((unsigned long)dma_window[2] << 32) |
321 (unsigned long)dma_window[3]) >> PAGE_SHIFT;
322 tbl->it_base = 0; 295 tbl->it_base = 0;
323 tbl->it_index = dma_window[0];
324 tbl->it_blocksize = 16; 296 tbl->it_blocksize = 16;
325 tbl->it_type = TCE_PCI; 297 tbl->it_type = TCE_PCI;
298 tbl->it_offset = offset >> PAGE_SHIFT;
299 tbl->it_size = size >> PAGE_SHIFT;
326} 300}
327 301
328static void iommu_bus_setup_pSeries(struct pci_bus *bus) 302static void iommu_bus_setup_pSeries(struct pci_bus *bus)
@@ -414,7 +388,7 @@ static void iommu_bus_setup_pSeriesLP(struct pci_bus *bus)
414 struct iommu_table *tbl; 388 struct iommu_table *tbl;
415 struct device_node *dn, *pdn; 389 struct device_node *dn, *pdn;
416 struct pci_dn *ppci; 390 struct pci_dn *ppci;
417 unsigned int *dma_window = NULL; 391 unsigned char *dma_window = NULL;
418 392
419 DBG("iommu_bus_setup_pSeriesLP, bus %p, bus->self %p\n", bus, bus->self); 393 DBG("iommu_bus_setup_pSeriesLP, bus %p, bus->self %p\n", bus, bus->self);
420 394
@@ -422,7 +396,7 @@ static void iommu_bus_setup_pSeriesLP(struct pci_bus *bus)
422 396
423 /* Find nearest ibm,dma-window, walking up the device tree */ 397 /* Find nearest ibm,dma-window, walking up the device tree */
424 for (pdn = dn; pdn != NULL; pdn = pdn->parent) { 398 for (pdn = dn; pdn != NULL; pdn = pdn->parent) {
425 dma_window = (unsigned int *)get_property(pdn, "ibm,dma-window", NULL); 399 dma_window = get_property(pdn, "ibm,dma-window", NULL);
426 if (dma_window != NULL) 400 if (dma_window != NULL)
427 break; 401 break;
428 } 402 }
@@ -442,7 +416,7 @@ static void iommu_bus_setup_pSeriesLP(struct pci_bus *bus)
442 416
443 tbl = (struct iommu_table *)kmalloc(sizeof(struct iommu_table), 417 tbl = (struct iommu_table *)kmalloc(sizeof(struct iommu_table),
444 GFP_KERNEL); 418 GFP_KERNEL);
445 419
446 iommu_table_setparms_lpar(ppci->phb, pdn, tbl, dma_window); 420 iommu_table_setparms_lpar(ppci->phb, pdn, tbl, dma_window);
447 421
448 ppci->iommu_table = iommu_init_table(tbl); 422 ppci->iommu_table = iommu_init_table(tbl);
@@ -516,7 +490,7 @@ static void iommu_dev_setup_pSeriesLP(struct pci_dev *dev)
516{ 490{
517 struct device_node *pdn, *dn; 491 struct device_node *pdn, *dn;
518 struct iommu_table *tbl; 492 struct iommu_table *tbl;
519 int *dma_window = NULL; 493 unsigned char *dma_window = NULL;
520 struct pci_dn *pci; 494 struct pci_dn *pci;
521 495
522 DBG("iommu_dev_setup_pSeriesLP, dev %p (%s)\n", dev, pci_name(dev)); 496 DBG("iommu_dev_setup_pSeriesLP, dev %p (%s)\n", dev, pci_name(dev));
@@ -531,8 +505,7 @@ static void iommu_dev_setup_pSeriesLP(struct pci_dev *dev)
531 505
532 for (pdn = dn; pdn && PCI_DN(pdn) && !PCI_DN(pdn)->iommu_table; 506 for (pdn = dn; pdn && PCI_DN(pdn) && !PCI_DN(pdn)->iommu_table;
533 pdn = pdn->parent) { 507 pdn = pdn->parent) {
534 dma_window = (unsigned int *) 508 dma_window = get_property(pdn, "ibm,dma-window", NULL);
535 get_property(pdn, "ibm,dma-window", NULL);
536 if (dma_window) 509 if (dma_window)
537 break; 510 break;
538 } 511 }
diff --git a/arch/powerpc/platforms/pseries/rtasd.c b/arch/powerpc/platforms/pseries/rtasd.c
index e0000ce769e5..2e4e04042d85 100644
--- a/arch/powerpc/platforms/pseries/rtasd.c
+++ b/arch/powerpc/platforms/pseries/rtasd.c
@@ -348,7 +348,7 @@ static int enable_surveillance(int timeout)
348 return 0; 348 return 0;
349 349
350 if (error == -EINVAL) { 350 if (error == -EINVAL) {
351 printk(KERN_INFO "rtasd: surveillance not supported\n"); 351 printk(KERN_DEBUG "rtasd: surveillance not supported\n");
352 return 0; 352 return 0;
353 } 353 }
354 354
@@ -440,7 +440,7 @@ static int rtasd(void *unused)
440 goto error; 440 goto error;
441 } 441 }
442 442
443 printk(KERN_INFO "RTAS daemon started\n"); 443 printk(KERN_DEBUG "RTAS daemon started\n");
444 444
445 DEBUG("will sleep for %d milliseconds\n", (30000/rtas_event_scan_rate)); 445 DEBUG("will sleep for %d milliseconds\n", (30000/rtas_event_scan_rate));
446 446
@@ -487,7 +487,7 @@ static int __init rtas_init(void)
487 487
488 /* No RTAS */ 488 /* No RTAS */
489 if (rtas_token("event-scan") == RTAS_UNKNOWN_SERVICE) { 489 if (rtas_token("event-scan") == RTAS_UNKNOWN_SERVICE) {
490 printk(KERN_INFO "rtasd: no event-scan on system\n"); 490 printk(KERN_DEBUG "rtasd: no event-scan on system\n");
491 return -ENODEV; 491 return -ENODEV;
492 } 492 }
493 493
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 5f79f01c44f2..ee89d19c436a 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -235,14 +235,14 @@ static void __init pSeries_setup_arch(void)
235 if (firmware_has_feature(FW_FEATURE_SPLPAR)) { 235 if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
236 vpa_init(boot_cpuid); 236 vpa_init(boot_cpuid);
237 if (get_lppaca()->shared_proc) { 237 if (get_lppaca()->shared_proc) {
238 printk(KERN_INFO "Using shared processor idle loop\n"); 238 printk(KERN_DEBUG "Using shared processor idle loop\n");
239 ppc_md.power_save = pseries_shared_idle_sleep; 239 ppc_md.power_save = pseries_shared_idle_sleep;
240 } else { 240 } else {
241 printk(KERN_INFO "Using dedicated idle loop\n"); 241 printk(KERN_DEBUG "Using dedicated idle loop\n");
242 ppc_md.power_save = pseries_dedicated_idle_sleep; 242 ppc_md.power_save = pseries_dedicated_idle_sleep;
243 } 243 }
244 } else { 244 } else {
245 printk(KERN_INFO "Using default idle loop\n"); 245 printk(KERN_DEBUG "Using default idle loop\n");
246 } 246 }
247 247
248 if (firmware_has_feature(FW_FEATURE_LPAR)) 248 if (firmware_has_feature(FW_FEATURE_LPAR))
diff --git a/arch/powerpc/platforms/pseries/vio.c b/arch/powerpc/platforms/pseries/vio.c
deleted file mode 100644
index 8e53e04ada8b..000000000000
--- a/arch/powerpc/platforms/pseries/vio.c
+++ /dev/null
@@ -1,274 +0,0 @@
1/*
2 * IBM PowerPC pSeries Virtual I/O Infrastructure Support.
3 *
4 * Copyright (c) 2003-2005 IBM Corp.
5 * Dave Engebretsen engebret@us.ibm.com
6 * Santiago Leon santil@us.ibm.com
7 * Hollis Blanchard <hollisb@us.ibm.com>
8 * Stephen Rothwell
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
14 */
15
16#include <linux/init.h>
17#include <linux/module.h>
18#include <linux/mm.h>
19#include <linux/kobject.h>
20#include <asm/iommu.h>
21#include <asm/dma.h>
22#include <asm/prom.h>
23#include <asm/vio.h>
24#include <asm/hvcall.h>
25#include <asm/tce.h>
26
27extern struct subsystem devices_subsys; /* needed for vio_find_name() */
28
29static void probe_bus_pseries(void)
30{
31 struct device_node *node_vroot, *of_node;
32
33 node_vroot = find_devices("vdevice");
34 if ((node_vroot == NULL) || (node_vroot->child == NULL))
35 /* this machine doesn't do virtual IO, and that's ok */
36 return;
37
38 /*
39 * Create struct vio_devices for each virtual device in the device tree.
40 * Drivers will associate with them later.
41 */
42 for (of_node = node_vroot->child; of_node != NULL;
43 of_node = of_node->sibling) {
44 printk(KERN_DEBUG "%s: processing %p\n", __FUNCTION__, of_node);
45 vio_register_device_node(of_node);
46 }
47}
48
49/**
50 * vio_match_device_pseries: - Tell if a pSeries VIO device matches a
51 * vio_device_id
52 */
53static int vio_match_device_pseries(const struct vio_device_id *id,
54 const struct vio_dev *dev)
55{
56 return (strncmp(dev->type, id->type, strlen(id->type)) == 0) &&
57 device_is_compatible(dev->dev.platform_data, id->compat);
58}
59
60static void vio_release_device_pseries(struct device *dev)
61{
62 /* XXX free TCE table */
63 of_node_put(dev->platform_data);
64}
65
66static ssize_t viodev_show_devspec(struct device *dev,
67 struct device_attribute *attr, char *buf)
68{
69 struct device_node *of_node = dev->platform_data;
70
71 return sprintf(buf, "%s\n", of_node->full_name);
72}
73DEVICE_ATTR(devspec, S_IRUSR | S_IRGRP | S_IROTH, viodev_show_devspec, NULL);
74
75static void vio_unregister_device_pseries(struct vio_dev *viodev)
76{
77 device_remove_file(&viodev->dev, &dev_attr_devspec);
78}
79
80static struct vio_bus_ops vio_bus_ops_pseries = {
81 .match = vio_match_device_pseries,
82 .unregister_device = vio_unregister_device_pseries,
83 .release_device = vio_release_device_pseries,
84};
85
86/**
87 * vio_bus_init_pseries: - Initialize the pSeries virtual IO bus
88 */
89static int __init vio_bus_init_pseries(void)
90{
91 int err;
92
93 err = vio_bus_init(&vio_bus_ops_pseries);
94 if (err == 0)
95 probe_bus_pseries();
96 return err;
97}
98
99__initcall(vio_bus_init_pseries);
100
101/**
102 * vio_build_iommu_table: - gets the dma information from OF and
103 * builds the TCE tree.
104 * @dev: the virtual device.
105 *
106 * Returns a pointer to the built tce tree, or NULL if it can't
107 * find property.
108*/
109static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev)
110{
111 unsigned int *dma_window;
112 struct iommu_table *newTceTable;
113 unsigned long offset;
114 int dma_window_property_size;
115
116 dma_window = (unsigned int *) get_property(dev->dev.platform_data, "ibm,my-dma-window", &dma_window_property_size);
117 if(!dma_window) {
118 return NULL;
119 }
120
121 newTceTable = (struct iommu_table *) kmalloc(sizeof(struct iommu_table), GFP_KERNEL);
122
123 /* There should be some code to extract the phys-encoded offset
124 using prom_n_addr_cells(). However, according to a comment
125 on earlier versions, it's always zero, so we don't bother */
126 offset = dma_window[1] >> PAGE_SHIFT;
127
128 /* TCE table size - measured in tce entries */
129 newTceTable->it_size = dma_window[4] >> PAGE_SHIFT;
130 /* offset for VIO should always be 0 */
131 newTceTable->it_offset = offset;
132 newTceTable->it_busno = 0;
133 newTceTable->it_index = (unsigned long)dma_window[0];
134 newTceTable->it_type = TCE_VB;
135
136 return iommu_init_table(newTceTable);
137}
138
139/**
140 * vio_register_device_node: - Register a new vio device.
141 * @of_node: The OF node for this device.
142 *
143 * Creates and initializes a vio_dev structure from the data in
144 * of_node (dev.platform_data) and adds it to the list of virtual devices.
145 * Returns a pointer to the created vio_dev or NULL if node has
146 * NULL device_type or compatible fields.
147 */
148struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node)
149{
150 struct vio_dev *viodev;
151 unsigned int *unit_address;
152 unsigned int *irq_p;
153
154 /* we need the 'device_type' property, in order to match with drivers */
155 if ((NULL == of_node->type)) {
156 printk(KERN_WARNING
157 "%s: node %s missing 'device_type'\n", __FUNCTION__,
158 of_node->name ? of_node->name : "<unknown>");
159 return NULL;
160 }
161
162 unit_address = (unsigned int *)get_property(of_node, "reg", NULL);
163 if (!unit_address) {
164 printk(KERN_WARNING "%s: node %s missing 'reg'\n", __FUNCTION__,
165 of_node->name ? of_node->name : "<unknown>");
166 return NULL;
167 }
168
169 /* allocate a vio_dev for this node */
170 viodev = kmalloc(sizeof(struct vio_dev), GFP_KERNEL);
171 if (!viodev) {
172 return NULL;
173 }
174 memset(viodev, 0, sizeof(struct vio_dev));
175
176 viodev->dev.platform_data = of_node_get(of_node);
177
178 viodev->irq = NO_IRQ;
179 irq_p = (unsigned int *)get_property(of_node, "interrupts", NULL);
180 if (irq_p) {
181 int virq = virt_irq_create_mapping(*irq_p);
182 if (virq == NO_IRQ) {
183 printk(KERN_ERR "Unable to allocate interrupt "
184 "number for %s\n", of_node->full_name);
185 } else
186 viodev->irq = irq_offset_up(virq);
187 }
188
189 snprintf(viodev->dev.bus_id, BUS_ID_SIZE, "%x", *unit_address);
190 viodev->name = of_node->name;
191 viodev->type = of_node->type;
192 viodev->unit_address = *unit_address;
193 viodev->iommu_table = vio_build_iommu_table(viodev);
194
195 /* register with generic device framework */
196 if (vio_register_device(viodev) == NULL) {
197 /* XXX free TCE table */
198 kfree(viodev);
199 return NULL;
200 }
201 device_create_file(&viodev->dev, &dev_attr_devspec);
202
203 return viodev;
204}
205EXPORT_SYMBOL(vio_register_device_node);
206
207/**
208 * vio_get_attribute: - get attribute for virtual device
209 * @vdev: The vio device to get property.
210 * @which: The property/attribute to be extracted.
211 * @length: Pointer to length of returned data size (unused if NULL).
212 *
213 * Calls prom.c's get_property() to return the value of the
214 * attribute specified by the preprocessor constant @which
215*/
216const void * vio_get_attribute(struct vio_dev *vdev, void* which, int* length)
217{
218 return get_property(vdev->dev.platform_data, (char*)which, length);
219}
220EXPORT_SYMBOL(vio_get_attribute);
221
222/* vio_find_name() - internal because only vio.c knows how we formatted the
223 * kobject name
224 * XXX once vio_bus_type.devices is actually used as a kset in
225 * drivers/base/bus.c, this function should be removed in favor of
226 * "device_find(kobj_name, &vio_bus_type)"
227 */
228static struct vio_dev *vio_find_name(const char *kobj_name)
229{
230 struct kobject *found;
231
232 found = kset_find_obj(&devices_subsys.kset, kobj_name);
233 if (!found)
234 return NULL;
235
236 return to_vio_dev(container_of(found, struct device, kobj));
237}
238
239/**
240 * vio_find_node - find an already-registered vio_dev
241 * @vnode: device_node of the virtual device we're looking for
242 */
243struct vio_dev *vio_find_node(struct device_node *vnode)
244{
245 uint32_t *unit_address;
246 char kobj_name[BUS_ID_SIZE];
247
248 /* construct the kobject name from the device node */
249 unit_address = (uint32_t *)get_property(vnode, "reg", NULL);
250 if (!unit_address)
251 return NULL;
252 snprintf(kobj_name, BUS_ID_SIZE, "%x", *unit_address);
253
254 return vio_find_name(kobj_name);
255}
256EXPORT_SYMBOL(vio_find_node);
257
258int vio_enable_interrupts(struct vio_dev *dev)
259{
260 int rc = h_vio_signal(dev->unit_address, VIO_IRQ_ENABLE);
261 if (rc != H_SUCCESS)
262 printk(KERN_ERR "vio: Error 0x%x enabling interrupts\n", rc);
263 return rc;
264}
265EXPORT_SYMBOL(vio_enable_interrupts);
266
267int vio_disable_interrupts(struct vio_dev *dev)
268{
269 int rc = h_vio_signal(dev->unit_address, VIO_IRQ_DISABLE);
270 if (rc != H_SUCCESS)
271 printk(KERN_ERR "vio: Error 0x%x disabling interrupts\n", rc);
272 return rc;
273}
274EXPORT_SYMBOL(vio_disable_interrupts);
diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c
index 2d60ea30fed6..b14f9b5c114e 100644
--- a/arch/powerpc/platforms/pseries/xics.c
+++ b/arch/powerpc/platforms/pseries/xics.c
@@ -522,7 +522,7 @@ nextnode:
522 522
523 np = of_find_node_by_type(NULL, "interrupt-controller"); 523 np = of_find_node_by_type(NULL, "interrupt-controller");
524 if (!np) { 524 if (!np) {
525 printk(KERN_WARNING "xics: no ISA interrupt controller\n"); 525 printk(KERN_DEBUG "xics: no ISA interrupt controller\n");
526 xics_irq_8259_cascade_real = -1; 526 xics_irq_8259_cascade_real = -1;
527 xics_irq_8259_cascade = -1; 527 xics_irq_8259_cascade = -1;
528 } else { 528 } else {
@@ -641,23 +641,26 @@ void xics_teardown_cpu(int secondary)
641 ops->cppr_info(cpu, 0x00); 641 ops->cppr_info(cpu, 0x00);
642 iosync(); 642 iosync();
643 643
644 /* Clear IPI */
645 ops->qirr_info(cpu, 0xff);
646
647 /*
648 * we need to EOI the IPI if we got here from kexec down IPI
649 *
650 * probably need to check all the other interrupts too
651 * should we be flagging idle loop instead?
652 * or creating some task to be scheduled?
653 */
654 ops->xirr_info_set(cpu, XICS_IPI);
655
644 /* 656 /*
645 * Some machines need to have at least one cpu in the GIQ, 657 * Some machines need to have at least one cpu in the GIQ,
646 * so leave the master cpu in the group. 658 * so leave the master cpu in the group.
647 */ 659 */
648 if (secondary) { 660 if (secondary)
649 /*
650 * we need to EOI the IPI if we got here from kexec down IPI
651 *
652 * probably need to check all the other interrupts too
653 * should we be flagging idle loop instead?
654 * or creating some task to be scheduled?
655 */
656 ops->xirr_info_set(cpu, XICS_IPI);
657 rtas_set_indicator(GLOBAL_INTERRUPT_QUEUE, 661 rtas_set_indicator(GLOBAL_INTERRUPT_QUEUE,
658 (1UL << interrupt_server_size) - 1 - 662 (1UL << interrupt_server_size) - 1 -
659 default_distrib_server, 0); 663 default_distrib_server, 0);
660 }
661} 664}
662 665
663#ifdef CONFIG_HOTPLUG_CPU 666#ifdef CONFIG_HOTPLUG_CPU
diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig
index e9a8f5d1dfcd..b55de4f42aec 100644
--- a/arch/ppc/Kconfig
+++ b/arch/ppc/Kconfig
@@ -40,6 +40,10 @@ config GENERIC_NVRAM
40 bool 40 bool
41 default y 41 default y
42 42
43config GENERIC_FIND_NEXT_BIT
44 bool
45 default y
46
43config SCHED_NO_NO_OMIT_FRAME_POINTER 47config SCHED_NO_NO_OMIT_FRAME_POINTER
44 bool 48 bool
45 default y 49 default y