aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-10 16:32:24 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-10 16:32:24 -0400
commit62933d36ac98360da45f43df989277df002b034b (patch)
tree1164d4f10bb56b757f0507ed49d7aa4b17a9dc2b /arch
parent0ab598099c18affd73a21482274c00e8119236be (diff)
parentf64071200acc124bd0d641ef7d750f38fbf5f8b8 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc: (24 commits) [POWERPC] Fix compile error with kexec and CONFIG_SMP=n [POWERPC] Split initrd logic out of early_init_dt_scan_chosen() to fix warning [POWERPC] Fix warning in hpte_decode(), and generalize it [POWERPC] Minor pSeries IOMMU debug cleanup [POWERPC] PS3: Fix sys manager build error [POWERPC] Assorted janitorial EEH cleanups [POWERPC] We don't define CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID [POWERPC] pmu_sys_suspended is only defined for PPC32 [POWERPC] Fix incorrect calculation of I/O window addresses [POWERPC] celleb: Update celleb_defconfig [POWERPC] celleb: Fix parsing of machine type hack command line option [POWERPC] celleb: Fix PCI config space accesses to subordinate buses [POWERPC] celleb: Fix support for multiple PCI domains [POWERPC] Wire up sys_utimensat [POWERPC] CPM_UART: Removed __init from cpm_uart_init_portdesc to fix warning [POWERPC] User rheap from arch/powerpc/lib [POWERPC] 83xx: Fix the PCI ranges in the MPC834x_MDS device tree. [POWERPC] 83xx: Fix the PCI ranges in the MPC832x_MDS device tree. [POWERPC] CPM_UART: cpm_uart_set_termios should take ktermios, not termios [POWERPC] Change rheap functions to use ulongs instead of pointers ...
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/boot/dts/mpc832x_mds.dts2
-rw-r--r--arch/powerpc/boot/dts/mpc834x_mds.dts4
-rw-r--r--arch/powerpc/configs/celleb_defconfig129
-rw-r--r--arch/powerpc/kernel/pci_64.c37
-rw-r--r--arch/powerpc/kernel/prom.c47
-rw-r--r--arch/powerpc/lib/Makefile2
-rw-r--r--arch/powerpc/lib/rheap.c117
-rw-r--r--arch/powerpc/mm/hash_native_64.c37
-rw-r--r--arch/powerpc/platforms/83xx/mpc8313_rdb.c2
-rw-r--r--arch/powerpc/platforms/83xx/mpc832x_rdb.c2
-rw-r--r--arch/powerpc/platforms/83xx/mpc834x_itx.c2
-rw-r--r--arch/powerpc/platforms/83xx/mpc834x_mds.c2
-rw-r--r--arch/powerpc/platforms/86xx/mpc86xx_hpcn.c7
-rw-r--r--arch/powerpc/platforms/celleb/pci.c1
-rw-r--r--arch/powerpc/platforms/celleb/scc_epci.c8
-rw-r--r--arch/powerpc/platforms/celleb/setup.c2
-rw-r--r--arch/powerpc/platforms/pseries/eeh.c13
-rw-r--r--arch/powerpc/platforms/pseries/eeh_driver.c7
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c3
-rw-r--r--arch/powerpc/platforms/pseries/kexec.c1
-rw-r--r--arch/powerpc/sysdev/commproc.c20
-rw-r--r--arch/powerpc/sysdev/cpm2_common.c21
-rw-r--r--arch/powerpc/sysdev/qe_lib/qe.c29
-rw-r--r--arch/powerpc/sysdev/qe_lib/ucc_fast.c5
-rw-r--r--arch/powerpc/sysdev/qe_lib/ucc_slow.c7
-rw-r--r--arch/ppc/8xx_io/commproc.c22
-rw-r--r--arch/ppc/lib/Makefile3
-rw-r--r--arch/ppc/lib/rheap.c692
-rw-r--r--arch/ppc/syslib/cpm2_common.c23
29 files changed, 316 insertions, 931 deletions
diff --git a/arch/powerpc/boot/dts/mpc832x_mds.dts b/arch/powerpc/boot/dts/mpc832x_mds.dts
index 93b760696010..112dd5198fe2 100644
--- a/arch/powerpc/boot/dts/mpc832x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc832x_mds.dts
@@ -146,7 +146,7 @@
146 interrupt-parent = < &ipic >; 146 interrupt-parent = < &ipic >;
147 interrupts = <42 8>; 147 interrupts = <42 8>;
148 bus-range = <0 0>; 148 bus-range = <0 0>;
149 ranges = <02000000 0 a0000000 90000000 0 10000000 149 ranges = <02000000 0 90000000 90000000 0 10000000
150 42000000 0 80000000 80000000 0 10000000 150 42000000 0 80000000 80000000 0 10000000
151 01000000 0 00000000 d0000000 0 00100000>; 151 01000000 0 00000000 d0000000 0 00100000>;
152 clock-frequency = <0>; 152 clock-frequency = <0>;
diff --git a/arch/powerpc/boot/dts/mpc834x_mds.dts b/arch/powerpc/boot/dts/mpc834x_mds.dts
index 07bcc5194d2b..df773fafe9d1 100644
--- a/arch/powerpc/boot/dts/mpc834x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc834x_mds.dts
@@ -223,7 +223,7 @@
223 interrupt-parent = < &ipic >; 223 interrupt-parent = < &ipic >;
224 interrupts = <42 8>; 224 interrupts = <42 8>;
225 bus-range = <0 0>; 225 bus-range = <0 0>;
226 ranges = <02000000 0 a0000000 a0000000 0 10000000 226 ranges = <02000000 0 90000000 90000000 0 10000000
227 42000000 0 80000000 80000000 0 10000000 227 42000000 0 80000000 80000000 0 10000000
228 01000000 0 00000000 e2000000 0 00100000>; 228 01000000 0 00000000 e2000000 0 00100000>;
229 clock-frequency = <3f940aa>; 229 clock-frequency = <3f940aa>;
@@ -284,7 +284,7 @@
284 interrupts = <42 8>; 284 interrupts = <42 8>;
285 bus-range = <0 0>; 285 bus-range = <0 0>;
286 ranges = <02000000 0 b0000000 b0000000 0 10000000 286 ranges = <02000000 0 b0000000 b0000000 0 10000000
287 42000000 0 90000000 90000000 0 10000000 287 42000000 0 a0000000 a0000000 0 10000000
288 01000000 0 00000000 e2100000 0 00100000>; 288 01000000 0 00000000 e2100000 0 00100000>;
289 clock-frequency = <3f940aa>; 289 clock-frequency = <3f940aa>;
290 #interrupt-cells = <1>; 290 #interrupt-cells = <1>;
diff --git a/arch/powerpc/configs/celleb_defconfig b/arch/powerpc/configs/celleb_defconfig
index a1fe97197ead..91b657b339b4 100644
--- a/arch/powerpc/configs/celleb_defconfig
+++ b/arch/powerpc/configs/celleb_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20-rc4 3# Linux kernel version: 2.6.21
4# Thu Jan 11 20:55:33 2007 4# Tue May 8 12:32:16 2007
5# 5#
6CONFIG_PPC64=y 6CONFIG_PPC64=y
7CONFIG_64BIT=y 7CONFIG_64BIT=y
@@ -60,6 +60,7 @@ CONFIG_LOCALVERSION_AUTO=y
60CONFIG_SWAP=y 60CONFIG_SWAP=y
61CONFIG_SYSVIPC=y 61CONFIG_SYSVIPC=y
62# CONFIG_IPC_NS is not set 62# CONFIG_IPC_NS is not set
63CONFIG_SYSVIPC_SYSCTL=y
63# CONFIG_POSIX_MQUEUE is not set 64# CONFIG_POSIX_MQUEUE is not set
64# CONFIG_BSD_PROCESS_ACCT is not set 65# CONFIG_BSD_PROCESS_ACCT is not set
65# CONFIG_TASKSTATS is not set 66# CONFIG_TASKSTATS is not set
@@ -70,6 +71,7 @@ CONFIG_IKCONFIG_PROC=y
70# CONFIG_CPUSETS is not set 71# CONFIG_CPUSETS is not set
71CONFIG_SYSFS_DEPRECATED=y 72CONFIG_SYSFS_DEPRECATED=y
72# CONFIG_RELAY is not set 73# CONFIG_RELAY is not set
74CONFIG_BLK_DEV_INITRD=y
73CONFIG_INITRAMFS_SOURCE="" 75CONFIG_INITRAMFS_SOURCE=""
74CONFIG_CC_OPTIMIZE_FOR_SIZE=y 76CONFIG_CC_OPTIMIZE_FOR_SIZE=y
75CONFIG_SYSCTL=y 77CONFIG_SYSCTL=y
@@ -132,15 +134,26 @@ CONFIG_PPC_MULTIPLATFORM=y
132# CONFIG_PPC_PSERIES is not set 134# CONFIG_PPC_PSERIES is not set
133# CONFIG_PPC_ISERIES is not set 135# CONFIG_PPC_ISERIES is not set
134# CONFIG_PPC_MPC52xx is not set 136# CONFIG_PPC_MPC52xx is not set
137# CONFIG_PPC_MPC5200 is not set
135# CONFIG_PPC_PMAC is not set 138# CONFIG_PPC_PMAC is not set
136# CONFIG_PPC_MAPLE is not set 139# CONFIG_PPC_MAPLE is not set
137# CONFIG_PPC_PASEMI is not set 140# CONFIG_PPC_PASEMI is not set
141CONFIG_PPC_CELLEB=y
142# CONFIG_PPC_PS3 is not set
138CONFIG_PPC_CELL=y 143CONFIG_PPC_CELL=y
139# CONFIG_PPC_CELL_NATIVE is not set 144# CONFIG_PPC_CELL_NATIVE is not set
140# CONFIG_PPC_IBM_CELL_BLADE is not set 145# CONFIG_PPC_IBM_CELL_BLADE is not set
141# CONFIG_PPC_PS3 is not set 146
142CONFIG_PPC_CELLEB=y 147#
148# Cell Broadband Engine options
149#
150CONFIG_SPU_FS=y
151CONFIG_SPU_BASE=y
152# CONFIG_PQ2ADS is not set
143CONFIG_PPC_UDBG_BEAT=y 153CONFIG_PPC_UDBG_BEAT=y
154# CONFIG_MPIC is not set
155# CONFIG_MPIC_WEIRD is not set
156# CONFIG_PPC_I8259 is not set
144# CONFIG_U3_DART is not set 157# CONFIG_U3_DART is not set
145# CONFIG_PPC_RTAS is not set 158# CONFIG_PPC_RTAS is not set
146# CONFIG_MMIO_NVRAM is not set 159# CONFIG_MMIO_NVRAM is not set
@@ -149,15 +162,7 @@ CONFIG_PPC_UDBG_BEAT=y
149# CONFIG_PPC_INDIRECT_IO is not set 162# CONFIG_PPC_INDIRECT_IO is not set
150# CONFIG_GENERIC_IOMAP is not set 163# CONFIG_GENERIC_IOMAP is not set
151# CONFIG_CPU_FREQ is not set 164# CONFIG_CPU_FREQ is not set
152# CONFIG_WANT_EARLY_SERIAL is not set 165# CONFIG_CPM2 is not set
153# CONFIG_MPIC is not set
154
155#
156# Cell Broadband Engine options
157#
158CONFIG_SPU_FS=y
159CONFIG_SPU_BASE=y
160# CONFIG_CBE_RAS is not set
161 166
162# 167#
163# Kernel options 168# Kernel options
@@ -183,7 +188,6 @@ CONFIG_NUMA=y
183CONFIG_NODES_SHIFT=4 188CONFIG_NODES_SHIFT=4
184CONFIG_ARCH_SELECT_MEMORY_MODEL=y 189CONFIG_ARCH_SELECT_MEMORY_MODEL=y
185CONFIG_ARCH_SPARSEMEM_ENABLE=y 190CONFIG_ARCH_SPARSEMEM_ENABLE=y
186CONFIG_ARCH_SPARSEMEM_DEFAULT=y
187CONFIG_ARCH_POPULATES_NODE_MAP=y 191CONFIG_ARCH_POPULATES_NODE_MAP=y
188CONFIG_SELECT_MEMORY_MODEL=y 192CONFIG_SELECT_MEMORY_MODEL=y
189# CONFIG_FLATMEM_MANUAL is not set 193# CONFIG_FLATMEM_MANUAL is not set
@@ -199,6 +203,7 @@ CONFIG_MEMORY_HOTPLUG_SPARSE=y
199CONFIG_SPLIT_PTLOCK_CPUS=4 203CONFIG_SPLIT_PTLOCK_CPUS=4
200CONFIG_MIGRATION=y 204CONFIG_MIGRATION=y
201CONFIG_RESOURCES_64BIT=y 205CONFIG_RESOURCES_64BIT=y
206CONFIG_ZONE_DMA_FLAG=1
202CONFIG_ARCH_MEMORY_PROBE=y 207CONFIG_ARCH_MEMORY_PROBE=y
203CONFIG_NODES_SPAN_OTHER_NODES=y 208CONFIG_NODES_SPAN_OTHER_NODES=y
204# CONFIG_PPC_64K_PAGES is not set 209# CONFIG_PPC_64K_PAGES is not set
@@ -207,14 +212,14 @@ CONFIG_PROC_DEVICETREE=y
207# CONFIG_CMDLINE_BOOL is not set 212# CONFIG_CMDLINE_BOOL is not set
208# CONFIG_PM is not set 213# CONFIG_PM is not set
209CONFIG_SECCOMP=y 214CONFIG_SECCOMP=y
215# CONFIG_WANT_DEVICE_TREE is not set
210CONFIG_ISA_DMA_API=y 216CONFIG_ISA_DMA_API=y
211 217
212# 218#
213# Bus options 219# Bus options
214# 220#
221CONFIG_ZONE_DMA=y
215CONFIG_GENERIC_ISA_DMA=y 222CONFIG_GENERIC_ISA_DMA=y
216# CONFIG_MPIC_WEIRD is not set
217# CONFIG_PPC_I8259 is not set
218# CONFIG_PPC_INDIRECT_PCI is not set 223# CONFIG_PPC_INDIRECT_PCI is not set
219CONFIG_PCI=y 224CONFIG_PCI=y
220CONFIG_PCI_DOMAINS=y 225CONFIG_PCI_DOMAINS=y
@@ -240,13 +245,13 @@ CONFIG_NET=y
240# 245#
241# Networking options 246# Networking options
242# 247#
243# CONFIG_NETDEBUG is not set
244CONFIG_PACKET=y 248CONFIG_PACKET=y
245# CONFIG_PACKET_MMAP is not set 249# CONFIG_PACKET_MMAP is not set
246CONFIG_UNIX=y 250CONFIG_UNIX=y
247CONFIG_XFRM=y 251CONFIG_XFRM=y
248# CONFIG_XFRM_USER is not set 252# CONFIG_XFRM_USER is not set
249# CONFIG_XFRM_SUB_POLICY is not set 253# CONFIG_XFRM_SUB_POLICY is not set
254# CONFIG_XFRM_MIGRATE is not set
250# CONFIG_NET_KEY is not set 255# CONFIG_NET_KEY is not set
251CONFIG_INET=y 256CONFIG_INET=y
252CONFIG_IP_MULTICAST=y 257CONFIG_IP_MULTICAST=y
@@ -262,7 +267,7 @@ CONFIG_SYN_COOKIES=y
262# CONFIG_INET_ESP is not set 267# CONFIG_INET_ESP is not set
263# CONFIG_INET_IPCOMP is not set 268# CONFIG_INET_IPCOMP is not set
264# CONFIG_INET_XFRM_TUNNEL is not set 269# CONFIG_INET_XFRM_TUNNEL is not set
265# CONFIG_INET_TUNNEL is not set 270CONFIG_INET_TUNNEL=y
266CONFIG_INET_XFRM_MODE_TRANSPORT=y 271CONFIG_INET_XFRM_MODE_TRANSPORT=y
267CONFIG_INET_XFRM_MODE_TUNNEL=y 272CONFIG_INET_XFRM_MODE_TUNNEL=y
268CONFIG_INET_XFRM_MODE_BEET=y 273CONFIG_INET_XFRM_MODE_BEET=y
@@ -280,6 +285,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
280CONFIG_IPV6=y 285CONFIG_IPV6=y
281# CONFIG_IPV6_PRIVACY is not set 286# CONFIG_IPV6_PRIVACY is not set
282# CONFIG_IPV6_ROUTER_PREF is not set 287# CONFIG_IPV6_ROUTER_PREF is not set
288# CONFIG_IPV6_OPTIMISTIC_DAD is not set
283CONFIG_INET6_AH=m 289CONFIG_INET6_AH=m
284CONFIG_INET6_ESP=m 290CONFIG_INET6_ESP=m
285CONFIG_INET6_IPCOMP=m 291CONFIG_INET6_IPCOMP=m
@@ -302,17 +308,21 @@ CONFIG_NETFILTER=y
302# 308#
303# CONFIG_NETFILTER_NETLINK is not set 309# CONFIG_NETFILTER_NETLINK is not set
304# CONFIG_NF_CONNTRACK_ENABLED is not set 310# CONFIG_NF_CONNTRACK_ENABLED is not set
311# CONFIG_NF_CONNTRACK is not set
305# CONFIG_NETFILTER_XTABLES is not set 312# CONFIG_NETFILTER_XTABLES is not set
306 313
307# 314#
308# IP: Netfilter Configuration 315# IP: Netfilter Configuration
309# 316#
310CONFIG_IP_NF_QUEUE=m 317CONFIG_IP_NF_QUEUE=m
318# CONFIG_IP_NF_IPTABLES is not set
319# CONFIG_IP_NF_ARPTABLES is not set
311 320
312# 321#
313# IPv6: Netfilter Configuration (EXPERIMENTAL) 322# IPv6: Netfilter Configuration (EXPERIMENTAL)
314# 323#
315# CONFIG_IP6_NF_QUEUE is not set 324# CONFIG_IP6_NF_QUEUE is not set
325# CONFIG_IP6_NF_IPTABLES is not set
316 326
317# 327#
318# DCCP Configuration (EXPERIMENTAL) 328# DCCP Configuration (EXPERIMENTAL)
@@ -352,6 +362,13 @@ CONFIG_IP_NF_QUEUE=m
352# CONFIG_HAMRADIO is not set 362# CONFIG_HAMRADIO is not set
353# CONFIG_IRDA is not set 363# CONFIG_IRDA is not set
354# CONFIG_BT is not set 364# CONFIG_BT is not set
365# CONFIG_AF_RXRPC is not set
366
367#
368# Wireless
369#
370# CONFIG_CFG80211 is not set
371# CONFIG_WIRELESS_EXT is not set
355# CONFIG_IEEE80211 is not set 372# CONFIG_IEEE80211 is not set
356 373
357# 374#
@@ -365,16 +382,13 @@ CONFIG_STANDALONE=y
365CONFIG_PREVENT_FIRMWARE_BUILD=y 382CONFIG_PREVENT_FIRMWARE_BUILD=y
366CONFIG_FW_LOADER=y 383CONFIG_FW_LOADER=y
367# CONFIG_DEBUG_DRIVER is not set 384# CONFIG_DEBUG_DRIVER is not set
385# CONFIG_DEBUG_DEVRES is not set
368# CONFIG_SYS_HYPERVISOR is not set 386# CONFIG_SYS_HYPERVISOR is not set
369 387
370# 388#
371# Connector - unified userspace <-> kernelspace linker 389# Connector - unified userspace <-> kernelspace linker
372# 390#
373# CONFIG_CONNECTOR is not set 391# CONFIG_CONNECTOR is not set
374
375#
376# Memory Technology Devices (MTD)
377#
378# CONFIG_MTD is not set 392# CONFIG_MTD is not set
379 393
380# 394#
@@ -385,6 +399,7 @@ CONFIG_FW_LOADER=y
385# 399#
386# Plug and Play support 400# Plug and Play support
387# 401#
402# CONFIG_PNPACPI is not set
388 403
389# 404#
390# Block devices 405# Block devices
@@ -404,7 +419,6 @@ CONFIG_BLK_DEV_RAM=y
404CONFIG_BLK_DEV_RAM_COUNT=16 419CONFIG_BLK_DEV_RAM_COUNT=16
405CONFIG_BLK_DEV_RAM_SIZE=131072 420CONFIG_BLK_DEV_RAM_SIZE=131072
406CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 421CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
407CONFIG_BLK_DEV_INITRD=y
408# CONFIG_CDROM_PKTCDVD is not set 422# CONFIG_CDROM_PKTCDVD is not set
409# CONFIG_ATA_OVER_ETH is not set 423# CONFIG_ATA_OVER_ETH is not set
410 424
@@ -443,7 +457,6 @@ CONFIG_BLK_DEV_GENERIC=y
443# CONFIG_BLK_DEV_OPTI621 is not set 457# CONFIG_BLK_DEV_OPTI621 is not set
444CONFIG_BLK_DEV_IDEDMA_PCI=y 458CONFIG_BLK_DEV_IDEDMA_PCI=y
445# CONFIG_BLK_DEV_IDEDMA_FORCED is not set 459# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
446CONFIG_IDEDMA_PCI_AUTO=y
447# CONFIG_IDEDMA_ONLYDISK is not set 460# CONFIG_IDEDMA_ONLYDISK is not set
448# CONFIG_BLK_DEV_AEC62XX is not set 461# CONFIG_BLK_DEV_AEC62XX is not set
449# CONFIG_BLK_DEV_ALI15X3 is not set 462# CONFIG_BLK_DEV_ALI15X3 is not set
@@ -458,6 +471,7 @@ CONFIG_IDEDMA_PCI_AUTO=y
458# CONFIG_BLK_DEV_JMICRON is not set 471# CONFIG_BLK_DEV_JMICRON is not set
459# CONFIG_BLK_DEV_SC1200 is not set 472# CONFIG_BLK_DEV_SC1200 is not set
460# CONFIG_BLK_DEV_PIIX is not set 473# CONFIG_BLK_DEV_PIIX is not set
474# CONFIG_BLK_DEV_IT8213 is not set
461# CONFIG_BLK_DEV_IT821X is not set 475# CONFIG_BLK_DEV_IT821X is not set
462# CONFIG_BLK_DEV_NS87415 is not set 476# CONFIG_BLK_DEV_NS87415 is not set
463# CONFIG_BLK_DEV_PDC202XX_OLD is not set 477# CONFIG_BLK_DEV_PDC202XX_OLD is not set
@@ -468,11 +482,11 @@ CONFIG_IDEDMA_PCI_AUTO=y
468# CONFIG_BLK_DEV_SLC90E66 is not set 482# CONFIG_BLK_DEV_SLC90E66 is not set
469# CONFIG_BLK_DEV_TRM290 is not set 483# CONFIG_BLK_DEV_TRM290 is not set
470# CONFIG_BLK_DEV_VIA82CXXX is not set 484# CONFIG_BLK_DEV_VIA82CXXX is not set
471CONFIG_BLK_DEV_IDE_CELLEB=y 485# CONFIG_BLK_DEV_TC86C001 is not set
486CONFIG_BLK_DEV_CELLEB=y
472# CONFIG_IDE_ARM is not set 487# CONFIG_IDE_ARM is not set
473CONFIG_BLK_DEV_IDEDMA=y 488CONFIG_BLK_DEV_IDEDMA=y
474# CONFIG_IDEDMA_IVB is not set 489# CONFIG_IDEDMA_IVB is not set
475CONFIG_IDEDMA_AUTO=y
476# CONFIG_BLK_DEV_HD is not set 490# CONFIG_BLK_DEV_HD is not set
477 491
478# 492#
@@ -546,6 +560,7 @@ CONFIG_SCSI_MULTI_LUN=y
546# CONFIG_SCSI_DC395x is not set 560# CONFIG_SCSI_DC395x is not set
547# CONFIG_SCSI_DC390T is not set 561# CONFIG_SCSI_DC390T is not set
548# CONFIG_SCSI_DEBUG is not set 562# CONFIG_SCSI_DEBUG is not set
563# CONFIG_SCSI_ESP_CORE is not set
549# CONFIG_SCSI_SRP is not set 564# CONFIG_SCSI_SRP is not set
550 565
551# 566#
@@ -591,12 +606,7 @@ CONFIG_DM_MULTIPATH=m
591# I2O device support 606# I2O device support
592# 607#
593# CONFIG_I2O is not set 608# CONFIG_I2O is not set
594 609# CONFIG_MACINTOSH_DRIVERS is not set
595#
596# Macintosh device drivers
597#
598# CONFIG_MAC_EMUMOUSEBTN is not set
599# CONFIG_WINDFARM is not set
600 610
601# 611#
602# Network device support 612# Network device support
@@ -652,15 +662,18 @@ CONFIG_MII=y
652# CONFIG_BNX2 is not set 662# CONFIG_BNX2 is not set
653CONFIG_SPIDER_NET=y 663CONFIG_SPIDER_NET=y
654# CONFIG_QLA3XXX is not set 664# CONFIG_QLA3XXX is not set
665# CONFIG_ATL1 is not set
655 666
656# 667#
657# Ethernet (10000 Mbit) 668# Ethernet (10000 Mbit)
658# 669#
659# CONFIG_CHELSIO_T1 is not set 670# CONFIG_CHELSIO_T1 is not set
671# CONFIG_CHELSIO_T3 is not set
660# CONFIG_IXGB is not set 672# CONFIG_IXGB is not set
661# CONFIG_S2IO is not set 673# CONFIG_S2IO is not set
662# CONFIG_MYRI10GE is not set 674# CONFIG_MYRI10GE is not set
663# CONFIG_NETXEN_NIC is not set 675# CONFIG_NETXEN_NIC is not set
676# CONFIG_PASEMI_MAC is not set
664 677
665# 678#
666# Token Ring devices 679# Token Ring devices
@@ -668,9 +681,10 @@ CONFIG_SPIDER_NET=y
668# CONFIG_TR is not set 681# CONFIG_TR is not set
669 682
670# 683#
671# Wireless LAN (non-hamradio) 684# Wireless LAN
672# 685#
673# CONFIG_NET_RADIO is not set 686# CONFIG_WLAN_PRE80211 is not set
687# CONFIG_WLAN_80211 is not set
674 688
675# 689#
676# Wan interfaces 690# Wan interfaces
@@ -770,6 +784,7 @@ CONFIG_SERIAL_CORE=y
770CONFIG_SERIAL_CORE_CONSOLE=y 784CONFIG_SERIAL_CORE_CONSOLE=y
771CONFIG_SERIAL_TXX9=y 785CONFIG_SERIAL_TXX9=y
772CONFIG_HAS_TXX9_SERIAL=y 786CONFIG_HAS_TXX9_SERIAL=y
787CONFIG_SERIAL_TXX9_NR_UARTS=3
773CONFIG_SERIAL_TXX9_CONSOLE=y 788CONFIG_SERIAL_TXX9_CONSOLE=y
774# CONFIG_SERIAL_TXX9_STDSERIAL is not set 789# CONFIG_SERIAL_TXX9_STDSERIAL is not set
775# CONFIG_SERIAL_JSM is not set 790# CONFIG_SERIAL_JSM is not set
@@ -891,6 +906,11 @@ CONFIG_I2C_ALGOBIT=y
891# CONFIG_HWMON_VID is not set 906# CONFIG_HWMON_VID is not set
892 907
893# 908#
909# Multifunction device drivers
910#
911# CONFIG_MFD_SM501 is not set
912
913#
894# Multimedia devices 914# Multimedia devices
895# 915#
896# CONFIG_VIDEO_DEV is not set 916# CONFIG_VIDEO_DEV is not set
@@ -904,7 +924,7 @@ CONFIG_I2C_ALGOBIT=y
904# 924#
905# Graphics support 925# Graphics support
906# 926#
907# CONFIG_FIRMWARE_EDID is not set 927# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
908# CONFIG_FB is not set 928# CONFIG_FB is not set
909# CONFIG_FB_IBM_GXT4500 is not set 929# CONFIG_FB_IBM_GXT4500 is not set
910 930
@@ -913,7 +933,6 @@ CONFIG_I2C_ALGOBIT=y
913# 933#
914# CONFIG_VGA_CONSOLE is not set 934# CONFIG_VGA_CONSOLE is not set
915CONFIG_DUMMY_CONSOLE=y 935CONFIG_DUMMY_CONSOLE=y
916# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
917 936
918# 937#
919# Sound 938# Sound
@@ -924,6 +943,15 @@ CONFIG_DUMMY_CONSOLE=y
924# HID Devices 943# HID Devices
925# 944#
926CONFIG_HID=y 945CONFIG_HID=y
946# CONFIG_HID_DEBUG is not set
947
948#
949# USB Input Devices
950#
951CONFIG_USB_HID=y
952# CONFIG_USB_HIDINPUT_POWERBOOK is not set
953# CONFIG_HID_FF is not set
954CONFIG_USB_HIDDEV=y
927 955
928# 956#
929# USB support 957# USB support
@@ -938,9 +966,8 @@ CONFIG_USB=y
938# Miscellaneous USB options 966# Miscellaneous USB options
939# 967#
940CONFIG_USB_DEVICEFS=y 968CONFIG_USB_DEVICEFS=y
941# CONFIG_USB_BANDWIDTH is not set 969# CONFIG_USB_DEVICE_CLASS is not set
942# CONFIG_USB_DYNAMIC_MINORS is not set 970# CONFIG_USB_DYNAMIC_MINORS is not set
943# CONFIG_USB_MULTITHREAD_PROBE is not set
944# CONFIG_USB_OTG is not set 971# CONFIG_USB_OTG is not set
945 972
946# 973#
@@ -953,6 +980,7 @@ CONFIG_USB_EHCI_HCD=m
953CONFIG_USB_EHCI_BIG_ENDIAN_MMIO=y 980CONFIG_USB_EHCI_BIG_ENDIAN_MMIO=y
954# CONFIG_USB_ISP116X_HCD is not set 981# CONFIG_USB_ISP116X_HCD is not set
955CONFIG_USB_OHCI_HCD=m 982CONFIG_USB_OHCI_HCD=m
983# CONFIG_USB_OHCI_HCD_PPC_OF is not set
956# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set 984# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
957CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y 985CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y
958CONFIG_USB_OHCI_LITTLE_ENDIAN=y 986CONFIG_USB_OHCI_LITTLE_ENDIAN=y
@@ -989,10 +1017,6 @@ CONFIG_USB_STORAGE=m
989# 1017#
990# USB Input Devices 1018# USB Input Devices
991# 1019#
992CONFIG_USB_HID=y
993# CONFIG_USB_HIDINPUT_POWERBOOK is not set
994# CONFIG_HID_FF is not set
995CONFIG_USB_HIDDEV=y
996# CONFIG_USB_AIPTEK is not set 1020# CONFIG_USB_AIPTEK is not set
997# CONFIG_USB_WACOM is not set 1021# CONFIG_USB_WACOM is not set
998# CONFIG_USB_ACECAD is not set 1022# CONFIG_USB_ACECAD is not set
@@ -1005,6 +1029,7 @@ CONFIG_USB_HIDDEV=y
1005# CONFIG_USB_ATI_REMOTE2 is not set 1029# CONFIG_USB_ATI_REMOTE2 is not set
1006# CONFIG_USB_KEYSPAN_REMOTE is not set 1030# CONFIG_USB_KEYSPAN_REMOTE is not set
1007# CONFIG_USB_APPLETOUCH is not set 1031# CONFIG_USB_APPLETOUCH is not set
1032# CONFIG_USB_GTCO is not set
1008 1033
1009# 1034#
1010# USB Imaging devices 1035# USB Imaging devices
@@ -1042,6 +1067,7 @@ CONFIG_USB_MON=y
1042# CONFIG_USB_RIO500 is not set 1067# CONFIG_USB_RIO500 is not set
1043# CONFIG_USB_LEGOTOWER is not set 1068# CONFIG_USB_LEGOTOWER is not set
1044# CONFIG_USB_LCD is not set 1069# CONFIG_USB_LCD is not set
1070# CONFIG_USB_BERRY_CHARGE is not set
1045# CONFIG_USB_LED is not set 1071# CONFIG_USB_LED is not set
1046# CONFIG_USB_CYPRESS_CY7C63 is not set 1072# CONFIG_USB_CYPRESS_CY7C63 is not set
1047# CONFIG_USB_CYTHERM is not set 1073# CONFIG_USB_CYTHERM is not set
@@ -1052,6 +1078,7 @@ CONFIG_USB_MON=y
1052# CONFIG_USB_SISUSBVGA is not set 1078# CONFIG_USB_SISUSBVGA is not set
1053# CONFIG_USB_LD is not set 1079# CONFIG_USB_LD is not set
1054# CONFIG_USB_TRANCEVIBRATOR is not set 1080# CONFIG_USB_TRANCEVIBRATOR is not set
1081# CONFIG_USB_IOWARRIOR is not set
1055# CONFIG_USB_TEST is not set 1082# CONFIG_USB_TEST is not set
1056 1083
1057# 1084#
@@ -1109,6 +1136,10 @@ CONFIG_USB_MON=y
1109# 1136#
1110 1137
1111# 1138#
1139# Auxiliary Display support
1140#
1141
1142#
1112# Virtualization 1143# Virtualization
1113# 1144#
1114 1145
@@ -1293,6 +1324,8 @@ CONFIG_NLS_ISO8859_15=m
1293# Distributed Lock Manager 1324# Distributed Lock Manager
1294# 1325#
1295# CONFIG_DLM is not set 1326# CONFIG_DLM is not set
1327# CONFIG_UCC_SLOW is not set
1328# CONFIG_UCC_FAST is not set
1296 1329
1297# 1330#
1298# Library routines 1331# Library routines
@@ -1305,7 +1338,8 @@ CONFIG_LIBCRC32C=m
1305CONFIG_ZLIB_INFLATE=m 1338CONFIG_ZLIB_INFLATE=m
1306CONFIG_ZLIB_DEFLATE=m 1339CONFIG_ZLIB_DEFLATE=m
1307CONFIG_PLIST=y 1340CONFIG_PLIST=y
1308CONFIG_IOMAP_COPY=y 1341CONFIG_HAS_IOMEM=y
1342CONFIG_HAS_IOPORT=y
1309 1343
1310# 1344#
1311# Instrumentation Support 1345# Instrumentation Support
@@ -1323,15 +1357,16 @@ CONFIG_MAGIC_SYSRQ=y
1323CONFIG_DEBUG_FS=y 1357CONFIG_DEBUG_FS=y
1324# CONFIG_HEADERS_CHECK is not set 1358# CONFIG_HEADERS_CHECK is not set
1325CONFIG_DEBUG_KERNEL=y 1359CONFIG_DEBUG_KERNEL=y
1360# CONFIG_DEBUG_SHIRQ is not set
1326CONFIG_LOG_BUF_SHIFT=15 1361CONFIG_LOG_BUF_SHIFT=15
1327CONFIG_DETECT_SOFTLOCKUP=y 1362CONFIG_DETECT_SOFTLOCKUP=y
1328# CONFIG_SCHEDSTATS is not set 1363# CONFIG_SCHEDSTATS is not set
1364# CONFIG_TIMER_STATS is not set
1329# CONFIG_DEBUG_SLAB is not set 1365# CONFIG_DEBUG_SLAB is not set
1330# CONFIG_DEBUG_RT_MUTEXES is not set 1366# CONFIG_DEBUG_RT_MUTEXES is not set
1331# CONFIG_RT_MUTEX_TESTER is not set 1367# CONFIG_RT_MUTEX_TESTER is not set
1332# CONFIG_DEBUG_SPINLOCK is not set 1368# CONFIG_DEBUG_SPINLOCK is not set
1333CONFIG_DEBUG_MUTEXES=y 1369CONFIG_DEBUG_MUTEXES=y
1334# CONFIG_DEBUG_RWSEMS is not set
1335CONFIG_DEBUG_SPINLOCK_SLEEP=y 1370CONFIG_DEBUG_SPINLOCK_SLEEP=y
1336# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 1371# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1337# CONFIG_DEBUG_KOBJECT is not set 1372# CONFIG_DEBUG_KOBJECT is not set
@@ -1341,8 +1376,10 @@ CONFIG_DEBUG_BUGVERBOSE=y
1341# CONFIG_DEBUG_LIST is not set 1376# CONFIG_DEBUG_LIST is not set
1342# CONFIG_FORCED_INLINING is not set 1377# CONFIG_FORCED_INLINING is not set
1343# CONFIG_RCU_TORTURE_TEST is not set 1378# CONFIG_RCU_TORTURE_TEST is not set
1379# CONFIG_FAULT_INJECTION is not set
1344# CONFIG_DEBUG_STACKOVERFLOW is not set 1380# CONFIG_DEBUG_STACKOVERFLOW is not set
1345# CONFIG_DEBUG_STACK_USAGE is not set 1381# CONFIG_DEBUG_STACK_USAGE is not set
1382# CONFIG_DEBUG_PAGEALLOC is not set
1346CONFIG_DEBUGGER=y 1383CONFIG_DEBUGGER=y
1347CONFIG_XMON=y 1384CONFIG_XMON=y
1348CONFIG_XMON_DEFAULT=y 1385CONFIG_XMON_DEFAULT=y
@@ -1356,6 +1393,7 @@ CONFIG_PPC_EARLY_DEBUG=y
1356# CONFIG_PPC_EARLY_DEBUG_RTAS_CONSOLE is not set 1393# CONFIG_PPC_EARLY_DEBUG_RTAS_CONSOLE is not set
1357# CONFIG_PPC_EARLY_DEBUG_MAPLE is not set 1394# CONFIG_PPC_EARLY_DEBUG_MAPLE is not set
1358# CONFIG_PPC_EARLY_DEBUG_ISERIES is not set 1395# CONFIG_PPC_EARLY_DEBUG_ISERIES is not set
1396# CONFIG_PPC_EARLY_DEBUG_PAS_REALMODE is not set
1359CONFIG_PPC_EARLY_DEBUG_BEAT=y 1397CONFIG_PPC_EARLY_DEBUG_BEAT=y
1360 1398
1361# 1399#
@@ -1385,8 +1423,10 @@ CONFIG_CRYPTO_TGR192=m
1385# CONFIG_CRYPTO_GF128MUL is not set 1423# CONFIG_CRYPTO_GF128MUL is not set
1386CONFIG_CRYPTO_ECB=m 1424CONFIG_CRYPTO_ECB=m
1387CONFIG_CRYPTO_CBC=m 1425CONFIG_CRYPTO_CBC=m
1426CONFIG_CRYPTO_PCBC=m
1388# CONFIG_CRYPTO_LRW is not set 1427# CONFIG_CRYPTO_LRW is not set
1389CONFIG_CRYPTO_DES=m 1428CONFIG_CRYPTO_DES=m
1429# CONFIG_CRYPTO_FCRYPT is not set
1390CONFIG_CRYPTO_BLOWFISH=m 1430CONFIG_CRYPTO_BLOWFISH=m
1391CONFIG_CRYPTO_TWOFISH=m 1431CONFIG_CRYPTO_TWOFISH=m
1392CONFIG_CRYPTO_TWOFISH_COMMON=m 1432CONFIG_CRYPTO_TWOFISH_COMMON=m
@@ -1401,6 +1441,7 @@ CONFIG_CRYPTO_ANUBIS=m
1401CONFIG_CRYPTO_DEFLATE=m 1441CONFIG_CRYPTO_DEFLATE=m
1402CONFIG_CRYPTO_MICHAEL_MIC=m 1442CONFIG_CRYPTO_MICHAEL_MIC=m
1403CONFIG_CRYPTO_CRC32C=m 1443CONFIG_CRYPTO_CRC32C=m
1444# CONFIG_CRYPTO_CAMELLIA is not set
1404CONFIG_CRYPTO_TEST=m 1445CONFIG_CRYPTO_TEST=m
1405 1446
1406# 1447#
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 6d05a1f377b5..b0409e19b1c1 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -1098,35 +1098,24 @@ static int get_bus_io_range(struct pci_bus *bus, unsigned long *start_phys,
1098 unsigned long *start_virt, unsigned long *size) 1098 unsigned long *start_virt, unsigned long *size)
1099{ 1099{
1100 struct pci_controller *hose = pci_bus_to_host(bus); 1100 struct pci_controller *hose = pci_bus_to_host(bus);
1101 struct pci_bus_region region;
1102 struct resource *res; 1101 struct resource *res;
1103 1102
1104 if (bus->self) { 1103 if (bus->self)
1105 res = bus->resource[0]; 1104 res = bus->resource[0];
1106 pcibios_resource_to_bus(bus->self, &region, res); 1105 else
1107 *start_phys = hose->io_base_phys + region.start;
1108 *start_virt = (unsigned long) hose->io_base_virt +
1109 region.start;
1110 if (region.end > region.start)
1111 *size = region.end - region.start + 1;
1112 else {
1113 printk("%s(): unexpected region 0x%lx->0x%lx\n",
1114 __FUNCTION__, region.start, region.end);
1115 return 1;
1116 }
1117
1118 } else {
1119 /* Root Bus */ 1106 /* Root Bus */
1120 res = &hose->io_resource; 1107 res = &hose->io_resource;
1121 *start_phys = hose->io_base_phys + res->start; 1108
1122 *start_virt = (unsigned long) hose->io_base_virt + res->start; 1109 *start_virt = pci_io_base + res->start;
1123 if (res->end > res->start) 1110 *start_phys = *start_virt + hose->io_base_phys
1124 *size = res->end - res->start + 1; 1111 - (unsigned long) hose->io_base_virt;
1125 else { 1112
1126 printk("%s(): unexpected region 0x%lx->0x%lx\n", 1113 if (res->end > res->start)
1127 __FUNCTION__, res->start, res->end); 1114 *size = res->end - res->start + 1;
1128 return 1; 1115 else {
1129 } 1116 printk("%s(): unexpected region 0x%lx->0x%lx\n",
1117 __FUNCTION__, res->start, res->end);
1118 return 1;
1130 } 1119 }
1131 1120
1132 return 0; 1121 return 0;
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index caef555f2dc0..c065b5550368 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -716,11 +716,40 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
716 return 0; 716 return 0;
717} 717}
718 718
719#ifdef CONFIG_BLK_DEV_INITRD
720static void __init early_init_dt_check_for_initrd(unsigned long node)
721{
722 unsigned long l;
723 u32 *prop;
724
725 DBG("Looking for initrd properties... ");
726
727 prop = of_get_flat_dt_prop(node, "linux,initrd-start", &l);
728 if (prop) {
729 initrd_start = (unsigned long)__va(of_read_ulong(prop, l/4));
730
731 prop = of_get_flat_dt_prop(node, "linux,initrd-end", &l);
732 if (prop) {
733 initrd_end = (unsigned long)
734 __va(of_read_ulong(prop, l/4));
735 initrd_below_start_ok = 1;
736 } else {
737 initrd_start = 0;
738 }
739 }
740
741 DBG("initrd_start=0x%lx initrd_end=0x%lx\n", initrd_start, initrd_end);
742}
743#else
744static inline void early_init_dt_check_for_initrd(unsigned long node)
745{
746}
747#endif /* CONFIG_BLK_DEV_INITRD */
748
719static int __init early_init_dt_scan_chosen(unsigned long node, 749static int __init early_init_dt_scan_chosen(unsigned long node,
720 const char *uname, int depth, void *data) 750 const char *uname, int depth, void *data)
721{ 751{
722 unsigned long *lprop; 752 unsigned long *lprop;
723 u32 *prop;
724 unsigned long l; 753 unsigned long l;
725 char *p; 754 char *p;
726 755
@@ -762,21 +791,7 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
762 crashk_res.end = crashk_res.start + *lprop - 1; 791 crashk_res.end = crashk_res.start + *lprop - 1;
763#endif 792#endif
764 793
765#ifdef CONFIG_BLK_DEV_INITRD 794 early_init_dt_check_for_initrd(node);
766 DBG("Looking for initrd properties... ");
767 prop = of_get_flat_dt_prop(node, "linux,initrd-start", &l);
768 if (prop) {
769 initrd_start = (unsigned long)__va(of_read_ulong(prop, l/4));
770 prop = of_get_flat_dt_prop(node, "linux,initrd-end", &l);
771 if (prop) {
772 initrd_end = (unsigned long)__va(of_read_ulong(prop, l/4));
773 initrd_below_start_ok = 1;
774 } else {
775 initrd_start = 0;
776 }
777 }
778 DBG("initrd_start=0x%lx initrd_end=0x%lx\n", initrd_start, initrd_end);
779#endif /* CONFIG_BLK_DEV_INITRD */
780 795
781 /* Retreive command line */ 796 /* Retreive command line */
782 p = of_get_flat_dt_prop(node, "bootargs", &l); 797 p = of_get_flat_dt_prop(node, "bootargs", &l);
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index 450258de7ca1..0a486d4b2547 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -23,7 +23,5 @@ obj-$(CONFIG_SMP) += locks.o
23endif 23endif
24 24
25# Temporary hack until we have migrated to asm-powerpc 25# Temporary hack until we have migrated to asm-powerpc
26ifeq ($(CONFIG_PPC_MERGE),y)
27obj-$(CONFIG_8xx) += rheap.o 26obj-$(CONFIG_8xx) += rheap.o
28obj-$(CONFIG_CPM2) += rheap.o 27obj-$(CONFIG_CPM2) += rheap.o
29endif
diff --git a/arch/powerpc/lib/rheap.c b/arch/powerpc/lib/rheap.c
index 6c5c5dd183ee..b2f6dcc59600 100644
--- a/arch/powerpc/lib/rheap.c
+++ b/arch/powerpc/lib/rheap.c
@@ -133,7 +133,7 @@ static rh_block_t *get_slot(rh_info_t * info)
133 info->empty_slots--; 133 info->empty_slots--;
134 134
135 /* Initialize */ 135 /* Initialize */
136 blk->start = NULL; 136 blk->start = 0;
137 blk->size = 0; 137 blk->size = 0;
138 blk->owner = NULL; 138 blk->owner = NULL;
139 139
@@ -158,7 +158,7 @@ static void attach_free_block(rh_info_t * info, rh_block_t * blkn)
158 158
159 /* We assume that they are aligned properly */ 159 /* We assume that they are aligned properly */
160 size = blkn->size; 160 size = blkn->size;
161 s = (unsigned long)blkn->start; 161 s = blkn->start;
162 e = s + size; 162 e = s + size;
163 163
164 /* Find the blocks immediately before and after the given one 164 /* Find the blocks immediately before and after the given one
@@ -170,7 +170,7 @@ static void attach_free_block(rh_info_t * info, rh_block_t * blkn)
170 list_for_each(l, &info->free_list) { 170 list_for_each(l, &info->free_list) {
171 blk = list_entry(l, rh_block_t, list); 171 blk = list_entry(l, rh_block_t, list);
172 172
173 bs = (unsigned long)blk->start; 173 bs = blk->start;
174 be = bs + blk->size; 174 be = bs + blk->size;
175 175
176 if (next == NULL && s >= bs) 176 if (next == NULL && s >= bs)
@@ -188,10 +188,10 @@ static void attach_free_block(rh_info_t * info, rh_block_t * blkn)
188 } 188 }
189 189
190 /* Now check if they are really adjacent */ 190 /* Now check if they are really adjacent */
191 if (before != NULL && s != (unsigned long)before->start + before->size) 191 if (before && s != (before->start + before->size))
192 before = NULL; 192 before = NULL;
193 193
194 if (after != NULL && e != (unsigned long)after->start) 194 if (after && e != after->start)
195 after = NULL; 195 after = NULL;
196 196
197 /* No coalescing; list insert and return */ 197 /* No coalescing; list insert and return */
@@ -216,7 +216,7 @@ static void attach_free_block(rh_info_t * info, rh_block_t * blkn)
216 216
217 /* Grow the after block backwards */ 217 /* Grow the after block backwards */
218 if (before == NULL && after != NULL) { 218 if (before == NULL && after != NULL) {
219 after->start = (int8_t *)after->start - size; 219 after->start -= size;
220 after->size += size; 220 after->size += size;
221 return; 221 return;
222 } 222 }
@@ -321,14 +321,14 @@ void rh_init(rh_info_t * info, unsigned int alignment, int max_blocks,
321} 321}
322 322
323/* Attach a free memory region, coalesces regions if adjuscent */ 323/* Attach a free memory region, coalesces regions if adjuscent */
324int rh_attach_region(rh_info_t * info, void *start, int size) 324int rh_attach_region(rh_info_t * info, unsigned long start, int size)
325{ 325{
326 rh_block_t *blk; 326 rh_block_t *blk;
327 unsigned long s, e, m; 327 unsigned long s, e, m;
328 int r; 328 int r;
329 329
330 /* The region must be aligned */ 330 /* The region must be aligned */
331 s = (unsigned long)start; 331 s = start;
332 e = s + size; 332 e = s + size;
333 m = info->alignment - 1; 333 m = info->alignment - 1;
334 334
@@ -338,9 +338,12 @@ int rh_attach_region(rh_info_t * info, void *start, int size)
338 /* Round end down */ 338 /* Round end down */
339 e = e & ~m; 339 e = e & ~m;
340 340
341 if (IS_ERR_VALUE(e) || (e < s))
342 return -ERANGE;
343
341 /* Take final values */ 344 /* Take final values */
342 start = (void *)s; 345 start = s;
343 size = (int)(e - s); 346 size = e - s;
344 347
345 /* Grow the blocks, if needed */ 348 /* Grow the blocks, if needed */
346 r = assure_empty(info, 1); 349 r = assure_empty(info, 1);
@@ -358,7 +361,7 @@ int rh_attach_region(rh_info_t * info, void *start, int size)
358} 361}
359 362
360/* Detatch given address range, splits free block if needed. */ 363/* Detatch given address range, splits free block if needed. */
361void *rh_detach_region(rh_info_t * info, void *start, int size) 364unsigned long rh_detach_region(rh_info_t * info, unsigned long start, int size)
362{ 365{
363 struct list_head *l; 366 struct list_head *l;
364 rh_block_t *blk, *newblk; 367 rh_block_t *blk, *newblk;
@@ -366,10 +369,10 @@ void *rh_detach_region(rh_info_t * info, void *start, int size)
366 369
367 /* Validate size */ 370 /* Validate size */
368 if (size <= 0) 371 if (size <= 0)
369 return ERR_PTR(-EINVAL); 372 return (unsigned long) -EINVAL;
370 373
371 /* The region must be aligned */ 374 /* The region must be aligned */
372 s = (unsigned long)start; 375 s = start;
373 e = s + size; 376 e = s + size;
374 m = info->alignment - 1; 377 m = info->alignment - 1;
375 378
@@ -380,34 +383,34 @@ void *rh_detach_region(rh_info_t * info, void *start, int size)
380 e = e & ~m; 383 e = e & ~m;
381 384
382 if (assure_empty(info, 1) < 0) 385 if (assure_empty(info, 1) < 0)
383 return ERR_PTR(-ENOMEM); 386 return (unsigned long) -ENOMEM;
384 387
385 blk = NULL; 388 blk = NULL;
386 list_for_each(l, &info->free_list) { 389 list_for_each(l, &info->free_list) {
387 blk = list_entry(l, rh_block_t, list); 390 blk = list_entry(l, rh_block_t, list);
388 /* The range must lie entirely inside one free block */ 391 /* The range must lie entirely inside one free block */
389 bs = (unsigned long)blk->start; 392 bs = blk->start;
390 be = (unsigned long)blk->start + blk->size; 393 be = blk->start + blk->size;
391 if (s >= bs && e <= be) 394 if (s >= bs && e <= be)
392 break; 395 break;
393 blk = NULL; 396 blk = NULL;
394 } 397 }
395 398
396 if (blk == NULL) 399 if (blk == NULL)
397 return ERR_PTR(-ENOMEM); 400 return (unsigned long) -ENOMEM;
398 401
399 /* Perfect fit */ 402 /* Perfect fit */
400 if (bs == s && be == e) { 403 if (bs == s && be == e) {
401 /* Delete from free list, release slot */ 404 /* Delete from free list, release slot */
402 list_del(&blk->list); 405 list_del(&blk->list);
403 release_slot(info, blk); 406 release_slot(info, blk);
404 return (void *)s; 407 return s;
405 } 408 }
406 409
407 /* blk still in free list, with updated start and/or size */ 410 /* blk still in free list, with updated start and/or size */
408 if (bs == s || be == e) { 411 if (bs == s || be == e) {
409 if (bs == s) 412 if (bs == s)
410 blk->start = (int8_t *)blk->start + size; 413 blk->start += size;
411 blk->size -= size; 414 blk->size -= size;
412 415
413 } else { 416 } else {
@@ -416,25 +419,29 @@ void *rh_detach_region(rh_info_t * info, void *start, int size)
416 419
417 /* the back free fragment */ 420 /* the back free fragment */
418 newblk = get_slot(info); 421 newblk = get_slot(info);
419 newblk->start = (void *)e; 422 newblk->start = e;
420 newblk->size = be - e; 423 newblk->size = be - e;
421 424
422 list_add(&newblk->list, &blk->list); 425 list_add(&newblk->list, &blk->list);
423 } 426 }
424 427
425 return (void *)s; 428 return s;
426} 429}
427 430
428void *rh_alloc_align(rh_info_t * info, int size, int alignment, const char *owner) 431/* Allocate a block of memory at the specified alignment. The value returned
432 * is an offset into the buffer initialized by rh_init(), or a negative number
433 * if there is an error.
434 */
435unsigned long rh_alloc_align(rh_info_t * info, int size, int alignment, const char *owner)
429{ 436{
430 struct list_head *l; 437 struct list_head *l;
431 rh_block_t *blk; 438 rh_block_t *blk;
432 rh_block_t *newblk; 439 rh_block_t *newblk;
433 void *start; 440 unsigned long start;
434 441
435 /* Validate size, (must be power of two) */ 442 /* Validate size, and alignment must be power of two */
436 if (size <= 0 || (alignment & (alignment - 1)) != 0) 443 if (size <= 0 || (alignment & (alignment - 1)) != 0)
437 return ERR_PTR(-EINVAL); 444 return (unsigned long) -EINVAL;
438 445
439 /* given alignment larger that default rheap alignment */ 446 /* given alignment larger that default rheap alignment */
440 if (alignment > info->alignment) 447 if (alignment > info->alignment)
@@ -444,7 +451,7 @@ void *rh_alloc_align(rh_info_t * info, int size, int alignment, const char *owne
444 size = (size + (info->alignment - 1)) & ~(info->alignment - 1); 451 size = (size + (info->alignment - 1)) & ~(info->alignment - 1);
445 452
446 if (assure_empty(info, 1) < 0) 453 if (assure_empty(info, 1) < 0)
447 return ERR_PTR(-ENOMEM); 454 return (unsigned long) -ENOMEM;
448 455
449 blk = NULL; 456 blk = NULL;
450 list_for_each(l, &info->free_list) { 457 list_for_each(l, &info->free_list) {
@@ -455,7 +462,7 @@ void *rh_alloc_align(rh_info_t * info, int size, int alignment, const char *owne
455 } 462 }
456 463
457 if (blk == NULL) 464 if (blk == NULL)
458 return ERR_PTR(-ENOMEM); 465 return (unsigned long) -ENOMEM;
459 466
460 /* Just fits */ 467 /* Just fits */
461 if (blk->size == size) { 468 if (blk->size == size) {
@@ -475,7 +482,7 @@ void *rh_alloc_align(rh_info_t * info, int size, int alignment, const char *owne
475 newblk->owner = owner; 482 newblk->owner = owner;
476 483
477 /* blk still in free list, with updated start, size */ 484 /* blk still in free list, with updated start, size */
478 blk->start = (int8_t *)blk->start + size; 485 blk->start += size;
479 blk->size -= size; 486 blk->size -= size;
480 487
481 start = newblk->start; 488 start = newblk->start;
@@ -486,19 +493,25 @@ void *rh_alloc_align(rh_info_t * info, int size, int alignment, const char *owne
486 /* this is no problem with the deallocator since */ 493 /* this is no problem with the deallocator since */
487 /* we scan for pointers that lie in the blocks */ 494 /* we scan for pointers that lie in the blocks */
488 if (alignment > info->alignment) 495 if (alignment > info->alignment)
489 start = (void *)(((unsigned long)start + alignment - 1) & 496 start = (start + alignment - 1) & ~(alignment - 1);
490 ~(alignment - 1));
491 497
492 return start; 498 return start;
493} 499}
494 500
495void *rh_alloc(rh_info_t * info, int size, const char *owner) 501/* Allocate a block of memory at the default alignment. The value returned is
502 * an offset into the buffer initialized by rh_init(), or a negative number if
503 * there is an error.
504 */
505unsigned long rh_alloc(rh_info_t * info, int size, const char *owner)
496{ 506{
497 return rh_alloc_align(info, size, info->alignment, owner); 507 return rh_alloc_align(info, size, info->alignment, owner);
498} 508}
499 509
500/* allocate at precisely the given address */ 510/* Allocate a block of memory at the given offset, rounded up to the default
501void *rh_alloc_fixed(rh_info_t * info, void *start, int size, const char *owner) 511 * alignment. The value returned is an offset into the buffer initialized by
512 * rh_init(), or a negative number if there is an error.
513 */
514unsigned long rh_alloc_fixed(rh_info_t * info, unsigned long start, int size, const char *owner)
502{ 515{
503 struct list_head *l; 516 struct list_head *l;
504 rh_block_t *blk, *newblk1, *newblk2; 517 rh_block_t *blk, *newblk1, *newblk2;
@@ -506,10 +519,10 @@ void *rh_alloc_fixed(rh_info_t * info, void *start, int size, const char *owner)
506 519
507 /* Validate size */ 520 /* Validate size */
508 if (size <= 0) 521 if (size <= 0)
509 return ERR_PTR(-EINVAL); 522 return (unsigned long) -EINVAL;
510 523
511 /* The region must be aligned */ 524 /* The region must be aligned */
512 s = (unsigned long)start; 525 s = start;
513 e = s + size; 526 e = s + size;
514 m = info->alignment - 1; 527 m = info->alignment - 1;
515 528
@@ -520,20 +533,20 @@ void *rh_alloc_fixed(rh_info_t * info, void *start, int size, const char *owner)
520 e = e & ~m; 533 e = e & ~m;
521 534
522 if (assure_empty(info, 2) < 0) 535 if (assure_empty(info, 2) < 0)
523 return ERR_PTR(-ENOMEM); 536 return (unsigned long) -ENOMEM;
524 537
525 blk = NULL; 538 blk = NULL;
526 list_for_each(l, &info->free_list) { 539 list_for_each(l, &info->free_list) {
527 blk = list_entry(l, rh_block_t, list); 540 blk = list_entry(l, rh_block_t, list);
528 /* The range must lie entirely inside one free block */ 541 /* The range must lie entirely inside one free block */
529 bs = (unsigned long)blk->start; 542 bs = blk->start;
530 be = (unsigned long)blk->start + blk->size; 543 be = blk->start + blk->size;
531 if (s >= bs && e <= be) 544 if (s >= bs && e <= be)
532 break; 545 break;
533 } 546 }
534 547
535 if (blk == NULL) 548 if (blk == NULL)
536 return ERR_PTR(-ENOMEM); 549 return (unsigned long) -ENOMEM;
537 550
538 /* Perfect fit */ 551 /* Perfect fit */
539 if (bs == s && be == e) { 552 if (bs == s && be == e) {
@@ -551,7 +564,7 @@ void *rh_alloc_fixed(rh_info_t * info, void *start, int size, const char *owner)
551 /* blk still in free list, with updated start and/or size */ 564 /* blk still in free list, with updated start and/or size */
552 if (bs == s || be == e) { 565 if (bs == s || be == e) {
553 if (bs == s) 566 if (bs == s)
554 blk->start = (int8_t *)blk->start + size; 567 blk->start += size;
555 blk->size -= size; 568 blk->size -= size;
556 569
557 } else { 570 } else {
@@ -560,14 +573,14 @@ void *rh_alloc_fixed(rh_info_t * info, void *start, int size, const char *owner)
560 573
561 /* The back free fragment */ 574 /* The back free fragment */
562 newblk2 = get_slot(info); 575 newblk2 = get_slot(info);
563 newblk2->start = (void *)e; 576 newblk2->start = e;
564 newblk2->size = be - e; 577 newblk2->size = be - e;
565 578
566 list_add(&newblk2->list, &blk->list); 579 list_add(&newblk2->list, &blk->list);
567 } 580 }
568 581
569 newblk1 = get_slot(info); 582 newblk1 = get_slot(info);
570 newblk1->start = (void *)s; 583 newblk1->start = s;
571 newblk1->size = e - s; 584 newblk1->size = e - s;
572 newblk1->owner = owner; 585 newblk1->owner = owner;
573 586
@@ -577,7 +590,11 @@ void *rh_alloc_fixed(rh_info_t * info, void *start, int size, const char *owner)
577 return start; 590 return start;
578} 591}
579 592
580int rh_free(rh_info_t * info, void *start) 593/* Deallocate the memory previously allocated by one of the rh_alloc functions.
594 * The return value is the size of the deallocated block, or a negative number
595 * if there is an error.
596 */
597int rh_free(rh_info_t * info, unsigned long start)
581{ 598{
582 rh_block_t *blk, *blk2; 599 rh_block_t *blk, *blk2;
583 struct list_head *l; 600 struct list_head *l;
@@ -642,7 +659,7 @@ int rh_get_stats(rh_info_t * info, int what, int max_stats, rh_stats_t * stats)
642 return nr; 659 return nr;
643} 660}
644 661
645int rh_set_owner(rh_info_t * info, void *start, const char *owner) 662int rh_set_owner(rh_info_t * info, unsigned long start, const char *owner)
646{ 663{
647 rh_block_t *blk, *blk2; 664 rh_block_t *blk, *blk2;
648 struct list_head *l; 665 struct list_head *l;
@@ -684,8 +701,8 @@ void rh_dump(rh_info_t * info)
684 nr = maxnr; 701 nr = maxnr;
685 for (i = 0; i < nr; i++) 702 for (i = 0; i < nr; i++)
686 printk(KERN_INFO 703 printk(KERN_INFO
687 " 0x%p-0x%p (%u)\n", 704 " 0x%lx-0x%lx (%u)\n",
688 st[i].start, (int8_t *) st[i].start + st[i].size, 705 st[i].start, st[i].start + st[i].size,
689 st[i].size); 706 st[i].size);
690 printk(KERN_INFO "\n"); 707 printk(KERN_INFO "\n");
691 708
@@ -695,8 +712,8 @@ void rh_dump(rh_info_t * info)
695 nr = maxnr; 712 nr = maxnr;
696 for (i = 0; i < nr; i++) 713 for (i = 0; i < nr; i++)
697 printk(KERN_INFO 714 printk(KERN_INFO
698 " 0x%p-0x%p (%u) %s\n", 715 " 0x%lx-0x%lx (%u) %s\n",
699 st[i].start, (int8_t *) st[i].start + st[i].size, 716 st[i].start, st[i].start + st[i].size,
700 st[i].size, st[i].owner != NULL ? st[i].owner : ""); 717 st[i].size, st[i].owner != NULL ? st[i].owner : "");
701 printk(KERN_INFO "\n"); 718 printk(KERN_INFO "\n");
702} 719}
@@ -704,6 +721,6 @@ void rh_dump(rh_info_t * info)
704void rh_dump_blk(rh_info_t * info, rh_block_t * blk) 721void rh_dump_blk(rh_info_t * info, rh_block_t * blk)
705{ 722{
706 printk(KERN_INFO 723 printk(KERN_INFO
707 "blk @0x%p: 0x%p-0x%p (%u)\n", 724 "blk @0x%p: 0x%lx-0x%lx (%u)\n",
708 blk, blk->start, (int8_t *) blk->start + blk->size, blk->size); 725 blk, blk->start, blk->start + blk->size, blk->size);
709} 726}
diff --git a/arch/powerpc/mm/hash_native_64.c b/arch/powerpc/mm/hash_native_64.c
index 7b7fe2d7b9dc..7d722eea4ea8 100644
--- a/arch/powerpc/mm/hash_native_64.c
+++ b/arch/powerpc/mm/hash_native_64.c
@@ -376,31 +376,28 @@ static void hpte_decode(hpte_t *hpte, unsigned long slot,
376 } 376 }
377 } 377 }
378 378
379 /* 379 /* This works for all page sizes, and for 256M and 1T segments */
380 * FIXME, the code below works for 16M, 64K, and 4K pages as these
381 * fall under the p<=23 rules for calculating the virtual address.
382 * In the case of 16M pages, an extra bit is stolen from the AVPN
383 * field to achieve the requisite 24 bits.
384 *
385 * Does not work for 16G pages or 1 TB segments.
386 */
387 shift = mmu_psize_defs[size].shift; 380 shift = mmu_psize_defs[size].shift;
388 if (mmu_psize_defs[size].avpnm) 381 avpn = (HPTE_V_AVPN_VAL(hpte_v) & ~mmu_psize_defs[size].avpnm) << 23;
389 avpnm_bits = __ilog2_u64(mmu_psize_defs[size].avpnm) + 1;
390 else
391 avpnm_bits = 0;
392 if (shift - avpnm_bits <= 23) {
393 avpn = HPTE_V_AVPN_VAL(hpte_v) << 23;
394 382
395 if (shift < 23) { 383 if (shift < 23) {
396 unsigned long vpi, pteg; 384 unsigned long vpi, vsid, pteg;
397 385
398 pteg = slot / HPTES_PER_GROUP; 386 pteg = slot / HPTES_PER_GROUP;
399 if (hpte_v & HPTE_V_SECONDARY) 387 if (hpte_v & HPTE_V_SECONDARY)
400 pteg = ~pteg; 388 pteg = ~pteg;
389 switch (hpte_v >> HPTE_V_SSIZE_SHIFT) {
390 case MMU_SEGSIZE_256M:
401 vpi = ((avpn >> 28) ^ pteg) & htab_hash_mask; 391 vpi = ((avpn >> 28) ^ pteg) & htab_hash_mask;
402 avpn |= (vpi << mmu_psize_defs[size].shift); 392 break;
393 case MMU_SEGSIZE_1T:
394 vsid = avpn >> 40;
395 vpi = (vsid ^ (vsid << 25) ^ pteg) & htab_hash_mask;
396 break;
397 default:
398 avpn = vpi = psize = 0;
403 } 399 }
400 avpn |= (vpi << mmu_psize_defs[size].shift);
404 } 401 }
405 402
406 *va = avpn; 403 *va = avpn;
diff --git a/arch/powerpc/platforms/83xx/mpc8313_rdb.c b/arch/powerpc/platforms/83xx/mpc8313_rdb.c
index 32e9e9492841..96970ac887ee 100644
--- a/arch/powerpc/platforms/83xx/mpc8313_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc8313_rdb.c
@@ -40,7 +40,9 @@ unsigned long isa_mem_base = 0;
40 */ 40 */
41static void __init mpc8313_rdb_setup_arch(void) 41static void __init mpc8313_rdb_setup_arch(void)
42{ 42{
43#ifdef CONFIG_PCI
43 struct device_node *np; 44 struct device_node *np;
45#endif
44 46
45 if (ppc_md.progress) 47 if (ppc_md.progress)
46 ppc_md.progress("mpc8313_rdb_setup_arch()", 0); 48 ppc_md.progress("mpc8313_rdb_setup_arch()", 0);
diff --git a/arch/powerpc/platforms/83xx/mpc832x_rdb.c b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
index b0b22bb29de7..3db68b73fc32 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
@@ -44,7 +44,9 @@ unsigned long isa_mem_base = 0;
44 */ 44 */
45static void __init mpc832x_rdb_setup_arch(void) 45static void __init mpc832x_rdb_setup_arch(void)
46{ 46{
47#if defined(CONFIG_PCI) || defined(CONFIG_QUICC_ENGINE)
47 struct device_node *np; 48 struct device_node *np;
49#endif
48 50
49 if (ppc_md.progress) 51 if (ppc_md.progress)
50 ppc_md.progress("mpc832x_rdb_setup_arch()", 0); 52 ppc_md.progress("mpc832x_rdb_setup_arch()", 0);
diff --git a/arch/powerpc/platforms/83xx/mpc834x_itx.c b/arch/powerpc/platforms/83xx/mpc834x_itx.c
index 3c009f6d4a4f..40a01947d684 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_itx.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_itx.c
@@ -50,7 +50,9 @@ unsigned long isa_mem_base = 0;
50 */ 50 */
51static void __init mpc834x_itx_setup_arch(void) 51static void __init mpc834x_itx_setup_arch(void)
52{ 52{
53#ifdef CONFIG_PCI
53 struct device_node *np; 54 struct device_node *np;
55#endif
54 56
55 if (ppc_md.progress) 57 if (ppc_md.progress)
56 ppc_md.progress("mpc834x_itx_setup_arch()", 0); 58 ppc_md.progress("mpc834x_itx_setup_arch()", 0);
diff --git a/arch/powerpc/platforms/83xx/mpc834x_mds.c b/arch/powerpc/platforms/83xx/mpc834x_mds.c
index 8aa9a93e2aa2..10394b2d7e7a 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_mds.c
@@ -120,7 +120,9 @@ static int mpc834x_usb_cfg(void)
120 */ 120 */
121static void __init mpc834x_mds_setup_arch(void) 121static void __init mpc834x_mds_setup_arch(void)
122{ 122{
123#ifdef CONFIG_PCI
123 struct device_node *np; 124 struct device_node *np;
125#endif
124 126
125 if (ppc_md.progress) 127 if (ppc_md.progress)
126 ppc_md.progress("mpc834x_mds_setup_arch()", 0); 128 ppc_md.progress("mpc834x_mds_setup_arch()", 0);
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index 90877565caa3..1051702c8d4f 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -168,7 +168,7 @@ static void __devinit quirk_uli1575(struct pci_dev *dev)
168{ 168{
169 unsigned short temp; 169 unsigned short temp;
170 struct pci_controller *hose = pci_bus_to_host(dev->bus); 170 struct pci_controller *hose = pci_bus_to_host(dev->bus);
171 unsigned char irq2pin[16]; 171 unsigned char irq2pin[16], c;
172 unsigned long pirq_map_word = 0; 172 unsigned long pirq_map_word = 0;
173 u32 irq; 173 u32 irq;
174 int i; 174 int i;
@@ -288,6 +288,11 @@ static void __devinit quirk_uli1575(struct pci_dev *dev)
288 outb(0x1e, 0x4d1); 288 outb(0x1e, 0x4d1);
289 289
290#undef ULI1575_SET_DEV_IRQ 290#undef ULI1575_SET_DEV_IRQ
291
292 /* Disable the HD interface and enable the AC97 interface. */
293 pci_read_config_byte(dev, 0xb8, &c);
294 c &= 0x7f;
295 pci_write_config_byte(dev, 0xb8, c);
291} 296}
292 297
293static void __devinit quirk_uli5288(struct pci_dev *dev) 298static void __devinit quirk_uli5288(struct pci_dev *dev)
diff --git a/arch/powerpc/platforms/celleb/pci.c b/arch/powerpc/platforms/celleb/pci.c
index d1adf34cd5e8..e9ac19c4bba4 100644
--- a/arch/powerpc/platforms/celleb/pci.c
+++ b/arch/powerpc/platforms/celleb/pci.c
@@ -457,6 +457,7 @@ int __devinit celleb_setup_phb(struct pci_controller *phb)
457 457
458 pr_debug("PCI: celleb_setup_phb() %s\n", name); 458 pr_debug("PCI: celleb_setup_phb() %s\n", name);
459 phb_set_bus_ranges(dev, phb); 459 phb_set_bus_ranges(dev, phb);
460 phb->buid = 1;
460 461
461 if (strcmp(name, "epci") == 0) { 462 if (strcmp(name, "epci") == 0) {
462 phb->ops = &celleb_epci_ops; 463 phb->ops = &celleb_epci_ops;
diff --git a/arch/powerpc/platforms/celleb/scc_epci.c b/arch/powerpc/platforms/celleb/scc_epci.c
index fb23d53eb09c..c4b011094bd6 100644
--- a/arch/powerpc/platforms/celleb/scc_epci.c
+++ b/arch/powerpc/platforms/celleb/scc_epci.c
@@ -133,13 +133,13 @@ static int celleb_epci_check_abort(struct pci_controller *hose,
133} 133}
134 134
135static volatile void __iomem *celleb_epci_make_config_addr( 135static volatile void __iomem *celleb_epci_make_config_addr(
136 struct pci_bus *bus,
136 struct pci_controller *hose, 137 struct pci_controller *hose,
137 unsigned int devfn, int where) 138 unsigned int devfn, int where)
138{ 139{
139 volatile void __iomem *addr; 140 volatile void __iomem *addr;
140 struct pci_bus *bus = hose->bus;
141 141
142 if (bus->self) 142 if (bus != hose->bus)
143 addr = celleb_epci_get_epci_cfg(hose) + 143 addr = celleb_epci_get_epci_cfg(hose) +
144 (((bus->number & 0xff) << 16) 144 (((bus->number & 0xff) << 16)
145 | ((devfn & 0xff) << 8) 145 | ((devfn & 0xff) << 8)
@@ -193,7 +193,7 @@ static int celleb_epci_read_config(struct pci_bus *bus,
193 } else { 193 } else {
194 194
195 clear_and_disable_master_abort_interrupt(hose); 195 clear_and_disable_master_abort_interrupt(hose);
196 addr = celleb_epci_make_config_addr(hose, devfn, where); 196 addr = celleb_epci_make_config_addr(bus, hose, devfn, where);
197 197
198 switch (size) { 198 switch (size) {
199 case 1: 199 case 1:
@@ -257,7 +257,7 @@ static int celleb_epci_write_config(struct pci_bus *bus,
257 } else { 257 } else {
258 258
259 clear_and_disable_master_abort_interrupt(hose); 259 clear_and_disable_master_abort_interrupt(hose);
260 addr = celleb_epci_make_config_addr(hose, devfn, where); 260 addr = celleb_epci_make_config_addr(bus, hose, devfn, where);
261 261
262 switch (size) { 262 switch (size) {
263 case 1: 263 case 1:
diff --git a/arch/powerpc/platforms/celleb/setup.c b/arch/powerpc/platforms/celleb/setup.c
index 596ab2a788d4..5e9f7f163571 100644
--- a/arch/powerpc/platforms/celleb/setup.c
+++ b/arch/powerpc/platforms/celleb/setup.c
@@ -80,7 +80,7 @@ static int celleb_machine_type_hack(char *ptr)
80 return 0; 80 return 0;
81} 81}
82 82
83__setup("celleb_machine_type_hack", celleb_machine_type_hack); 83__setup("celleb_machine_type_hack=", celleb_machine_type_hack);
84 84
85static void celleb_progress(char *s, unsigned short hex) 85static void celleb_progress(char *s, unsigned short hex)
86{ 86{
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c
index 093438b93bd9..5f3e6d8659fe 100644
--- a/arch/powerpc/platforms/pseries/eeh.c
+++ b/arch/powerpc/platforms/pseries/eeh.c
@@ -76,7 +76,7 @@
76 */ 76 */
77#define EEH_MAX_FAILS 2100000 77#define EEH_MAX_FAILS 2100000
78 78
79/* Time to wait for a PCI slot to retport status, in milliseconds */ 79/* Time to wait for a PCI slot to report status, in milliseconds */
80#define PCI_BUS_RESET_WAIT_MSEC (60*1000) 80#define PCI_BUS_RESET_WAIT_MSEC (60*1000)
81 81
82/* RTAS tokens */ 82/* RTAS tokens */
@@ -95,11 +95,18 @@ EXPORT_SYMBOL(eeh_subsystem_enabled);
95/* Lock to avoid races due to multiple reports of an error */ 95/* Lock to avoid races due to multiple reports of an error */
96static DEFINE_SPINLOCK(confirm_error_lock); 96static DEFINE_SPINLOCK(confirm_error_lock);
97 97
98/* Buffer for reporting slot-error-detail rtas calls */ 98/* Buffer for reporting slot-error-detail rtas calls. Its here
99 * in BSS, and not dynamically alloced, so that it ends up in
100 * RMO where RTAS can access it.
101 */
99static unsigned char slot_errbuf[RTAS_ERROR_LOG_MAX]; 102static unsigned char slot_errbuf[RTAS_ERROR_LOG_MAX];
100static DEFINE_SPINLOCK(slot_errbuf_lock); 103static DEFINE_SPINLOCK(slot_errbuf_lock);
101static int eeh_error_buf_size; 104static int eeh_error_buf_size;
102 105
106/* Buffer for reporting pci register dumps. Its here in BSS, and
107 * not dynamically alloced, so that it ends up in RMO where RTAS
108 * can access it.
109 */
103#define EEH_PCI_REGS_LOG_LEN 4096 110#define EEH_PCI_REGS_LOG_LEN 4096
104static unsigned char pci_regs_buf[EEH_PCI_REGS_LOG_LEN]; 111static unsigned char pci_regs_buf[EEH_PCI_REGS_LOG_LEN];
105 112
@@ -218,7 +225,7 @@ static size_t gather_pci_data(struct pci_dn *pdn, char * buf, size_t len)
218void eeh_slot_error_detail(struct pci_dn *pdn, int severity) 225void eeh_slot_error_detail(struct pci_dn *pdn, int severity)
219{ 226{
220 size_t loglen = 0; 227 size_t loglen = 0;
221 memset(pci_regs_buf, 0, EEH_PCI_REGS_LOG_LEN); 228 pci_regs_buf[0] = 0;
222 229
223 rtas_pci_enable(pdn, EEH_THAW_MMIO); 230 rtas_pci_enable(pdn, EEH_THAW_MMIO);
224 loglen = gather_pci_data(pdn, pci_regs_buf, EEH_PCI_REGS_LOG_LEN); 231 loglen = gather_pci_data(pdn, pci_regs_buf, EEH_PCI_REGS_LOG_LEN);
diff --git a/arch/powerpc/platforms/pseries/eeh_driver.c b/arch/powerpc/platforms/pseries/eeh_driver.c
index f07d849cfc84..161a5844ab6c 100644
--- a/arch/powerpc/platforms/pseries/eeh_driver.c
+++ b/arch/powerpc/platforms/pseries/eeh_driver.c
@@ -378,8 +378,9 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event)
378 378
379 /* Since rtas may enable MMIO when posting the error log, 379 /* Since rtas may enable MMIO when posting the error log,
380 * don't post the error log until after all dev drivers 380 * don't post the error log until after all dev drivers
381 * have been informed. */ 381 * have been informed.
382 eeh_slot_error_detail(frozen_pdn, 1 /* Temporary Error */); 382 */
383 eeh_slot_error_detail(frozen_pdn, EEH_LOG_TEMP_FAILURE);
383 384
384 /* If all device drivers were EEH-unaware, then shut 385 /* If all device drivers were EEH-unaware, then shut
385 * down all of the device drivers, and hope they 386 * down all of the device drivers, and hope they
@@ -470,7 +471,7 @@ hard_fail:
470 location, drv_str, pci_str); 471 location, drv_str, pci_str);
471 472
472perm_error: 473perm_error:
473 eeh_slot_error_detail(frozen_pdn, 2 /* Permanent Error */); 474 eeh_slot_error_detail(frozen_pdn, EEH_LOG_PERM_FAILURE);
474 475
475 /* Notify all devices that they're about to go down. */ 476 /* Notify all devices that they're about to go down. */
476 pci_walk_bus(frozen_bus, eeh_report_failure, NULL); 477 pci_walk_bus(frozen_bus, eeh_report_failure, NULL);
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index eec684a8e44e..be17d2395072 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -520,7 +520,6 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev)
520 dev->dev.archdata.dma_data = PCI_DN(pdn)->iommu_table; 520 dev->dev.archdata.dma_data = PCI_DN(pdn)->iommu_table;
521 return; 521 return;
522 } 522 }
523 DBG(" found DMA window, table: %p\n", pci->iommu_table);
524 523
525 pci = PCI_DN(pdn); 524 pci = PCI_DN(pdn);
526 if (!pci->iommu_table) { 525 if (!pci->iommu_table) {
@@ -534,6 +533,8 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev)
534 533
535 pci->iommu_table = iommu_init_table(tbl, pci->phb->node); 534 pci->iommu_table = iommu_init_table(tbl, pci->phb->node);
536 DBG(" created table: %p\n", pci->iommu_table); 535 DBG(" created table: %p\n", pci->iommu_table);
536 } else {
537 DBG(" found DMA window, table: %p\n", pci->iommu_table);
537 } 538 }
538 539
539 dev->dev.archdata.dma_data = pci->iommu_table; 540 dev->dev.archdata.dma_data = pci->iommu_table;
diff --git a/arch/powerpc/platforms/pseries/kexec.c b/arch/powerpc/platforms/pseries/kexec.c
index af2685607458..412a5e7aff2d 100644
--- a/arch/powerpc/platforms/pseries/kexec.c
+++ b/arch/powerpc/platforms/pseries/kexec.c
@@ -12,6 +12,7 @@
12#include <asm/firmware.h> 12#include <asm/firmware.h>
13#include <asm/kexec.h> 13#include <asm/kexec.h>
14#include <asm/mpic.h> 14#include <asm/mpic.h>
15#include <asm/smp.h>
15 16
16#include "pseries.h" 17#include "pseries.h"
17#include "xics.h" 18#include "xics.h"
diff --git a/arch/powerpc/sysdev/commproc.c b/arch/powerpc/sysdev/commproc.c
index 9b4fafd9a840..4f67b89ba1d0 100644
--- a/arch/powerpc/sysdev/commproc.c
+++ b/arch/powerpc/sysdev/commproc.c
@@ -330,7 +330,7 @@ void m8xx_cpm_dpinit(void)
330 * with the processor and the microcode patches applied / activated. 330 * with the processor and the microcode patches applied / activated.
331 * But the following should be at least safe. 331 * But the following should be at least safe.
332 */ 332 */
333 rh_attach_region(&cpm_dpmem_info, (void *)CPM_DATAONLY_BASE, CPM_DATAONLY_SIZE); 333 rh_attach_region(&cpm_dpmem_info, CPM_DATAONLY_BASE, CPM_DATAONLY_SIZE);
334} 334}
335 335
336/* 336/*
@@ -338,9 +338,9 @@ void m8xx_cpm_dpinit(void)
338 * This function returns an offset into the DPRAM area. 338 * This function returns an offset into the DPRAM area.
339 * Use cpm_dpram_addr() to get the virtual address of the area. 339 * Use cpm_dpram_addr() to get the virtual address of the area.
340 */ 340 */
341uint cpm_dpalloc(uint size, uint align) 341unsigned long cpm_dpalloc(uint size, uint align)
342{ 342{
343 void *start; 343 unsigned long start;
344 unsigned long flags; 344 unsigned long flags;
345 345
346 spin_lock_irqsave(&cpm_dpmem_lock, flags); 346 spin_lock_irqsave(&cpm_dpmem_lock, flags);
@@ -352,30 +352,30 @@ uint cpm_dpalloc(uint size, uint align)
352} 352}
353EXPORT_SYMBOL(cpm_dpalloc); 353EXPORT_SYMBOL(cpm_dpalloc);
354 354
355int cpm_dpfree(uint offset) 355int cpm_dpfree(unsigned long offset)
356{ 356{
357 int ret; 357 int ret;
358 unsigned long flags; 358 unsigned long flags;
359 359
360 spin_lock_irqsave(&cpm_dpmem_lock, flags); 360 spin_lock_irqsave(&cpm_dpmem_lock, flags);
361 ret = rh_free(&cpm_dpmem_info, (void *)offset); 361 ret = rh_free(&cpm_dpmem_info, offset);
362 spin_unlock_irqrestore(&cpm_dpmem_lock, flags); 362 spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
363 363
364 return ret; 364 return ret;
365} 365}
366EXPORT_SYMBOL(cpm_dpfree); 366EXPORT_SYMBOL(cpm_dpfree);
367 367
368uint cpm_dpalloc_fixed(uint offset, uint size, uint align) 368unsigned long cpm_dpalloc_fixed(unsigned long offset, uint size, uint align)
369{ 369{
370 void *start; 370 unsigned long start;
371 unsigned long flags; 371 unsigned long flags;
372 372
373 spin_lock_irqsave(&cpm_dpmem_lock, flags); 373 spin_lock_irqsave(&cpm_dpmem_lock, flags);
374 cpm_dpmem_info.alignment = align; 374 cpm_dpmem_info.alignment = align;
375 start = rh_alloc_fixed(&cpm_dpmem_info, (void *)offset, size, "commproc"); 375 start = rh_alloc_fixed(&cpm_dpmem_info, offset, size, "commproc");
376 spin_unlock_irqrestore(&cpm_dpmem_lock, flags); 376 spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
377 377
378 return (uint)start; 378 return start;
379} 379}
380EXPORT_SYMBOL(cpm_dpalloc_fixed); 380EXPORT_SYMBOL(cpm_dpalloc_fixed);
381 381
@@ -385,7 +385,7 @@ void cpm_dpdump(void)
385} 385}
386EXPORT_SYMBOL(cpm_dpdump); 386EXPORT_SYMBOL(cpm_dpdump);
387 387
388void *cpm_dpram_addr(uint offset) 388void *cpm_dpram_addr(unsigned long offset)
389{ 389{
390 return (void *)(dpram_vbase + offset); 390 return (void *)(dpram_vbase + offset);
391} 391}
diff --git a/arch/powerpc/sysdev/cpm2_common.c b/arch/powerpc/sysdev/cpm2_common.c
index ec265995d5d8..924412974795 100644
--- a/arch/powerpc/sysdev/cpm2_common.c
+++ b/arch/powerpc/sysdev/cpm2_common.c
@@ -248,15 +248,14 @@ static void cpm2_dpinit(void)
248 * varies with the processor and the microcode patches activated. 248 * varies with the processor and the microcode patches activated.
249 * But the following should be at least safe. 249 * But the following should be at least safe.
250 */ 250 */
251 rh_attach_region(&cpm_dpmem_info, (void *)CPM_DATAONLY_BASE, 251 rh_attach_region(&cpm_dpmem_info, CPM_DATAONLY_BASE, CPM_DATAONLY_SIZE);
252 CPM_DATAONLY_SIZE);
253} 252}
254 253
255/* This function returns an index into the DPRAM area. 254/* This function returns an index into the DPRAM area.
256 */ 255 */
257uint cpm_dpalloc(uint size, uint align) 256unsigned long cpm_dpalloc(uint size, uint align)
258{ 257{
259 void *start; 258 unsigned long start;
260 unsigned long flags; 259 unsigned long flags;
261 260
262 spin_lock_irqsave(&cpm_dpmem_lock, flags); 261 spin_lock_irqsave(&cpm_dpmem_lock, flags);
@@ -268,13 +267,13 @@ uint cpm_dpalloc(uint size, uint align)
268} 267}
269EXPORT_SYMBOL(cpm_dpalloc); 268EXPORT_SYMBOL(cpm_dpalloc);
270 269
271int cpm_dpfree(uint offset) 270int cpm_dpfree(unsigned long offset)
272{ 271{
273 int ret; 272 int ret;
274 unsigned long flags; 273 unsigned long flags;
275 274
276 spin_lock_irqsave(&cpm_dpmem_lock, flags); 275 spin_lock_irqsave(&cpm_dpmem_lock, flags);
277 ret = rh_free(&cpm_dpmem_info, (void *)offset); 276 ret = rh_free(&cpm_dpmem_info, offset);
278 spin_unlock_irqrestore(&cpm_dpmem_lock, flags); 277 spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
279 278
280 return ret; 279 return ret;
@@ -282,17 +281,17 @@ int cpm_dpfree(uint offset)
282EXPORT_SYMBOL(cpm_dpfree); 281EXPORT_SYMBOL(cpm_dpfree);
283 282
284/* not sure if this is ever needed */ 283/* not sure if this is ever needed */
285uint cpm_dpalloc_fixed(uint offset, uint size, uint align) 284unsigned long cpm_dpalloc_fixed(unsigned long offset, uint size, uint align)
286{ 285{
287 void *start; 286 unsigned long start;
288 unsigned long flags; 287 unsigned long flags;
289 288
290 spin_lock_irqsave(&cpm_dpmem_lock, flags); 289 spin_lock_irqsave(&cpm_dpmem_lock, flags);
291 cpm_dpmem_info.alignment = align; 290 cpm_dpmem_info.alignment = align;
292 start = rh_alloc_fixed(&cpm_dpmem_info, (void *)offset, size, "commproc"); 291 start = rh_alloc_fixed(&cpm_dpmem_info, offset, size, "commproc");
293 spin_unlock_irqrestore(&cpm_dpmem_lock, flags); 292 spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
294 293
295 return (uint)start; 294 return start;
296} 295}
297EXPORT_SYMBOL(cpm_dpalloc_fixed); 296EXPORT_SYMBOL(cpm_dpalloc_fixed);
298 297
@@ -302,7 +301,7 @@ void cpm_dpdump(void)
302} 301}
303EXPORT_SYMBOL(cpm_dpdump); 302EXPORT_SYMBOL(cpm_dpdump);
304 303
305void *cpm_dpram_addr(uint offset) 304void *cpm_dpram_addr(unsigned long offset)
306{ 305{
307 return (void *)(im_dprambase + offset); 306 return (void *)(im_dprambase + offset);
308} 307}
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index 7f4c07543961..90f87408b5d5 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -244,7 +244,7 @@ EXPORT_SYMBOL(qe_put_snum);
244static int qe_sdma_init(void) 244static int qe_sdma_init(void)
245{ 245{
246 struct sdma *sdma = &qe_immr->sdma; 246 struct sdma *sdma = &qe_immr->sdma;
247 u32 sdma_buf_offset; 247 unsigned long sdma_buf_offset;
248 248
249 if (!sdma) 249 if (!sdma)
250 return -ENODEV; 250 return -ENODEV;
@@ -252,10 +252,10 @@ static int qe_sdma_init(void)
252 /* allocate 2 internal temporary buffers (512 bytes size each) for 252 /* allocate 2 internal temporary buffers (512 bytes size each) for
253 * the SDMA */ 253 * the SDMA */
254 sdma_buf_offset = qe_muram_alloc(512 * 2, 4096); 254 sdma_buf_offset = qe_muram_alloc(512 * 2, 4096);
255 if (IS_MURAM_ERR(sdma_buf_offset)) 255 if (IS_ERR_VALUE(sdma_buf_offset))
256 return -ENOMEM; 256 return -ENOMEM;
257 257
258 out_be32(&sdma->sdebcr, sdma_buf_offset & QE_SDEBCR_BA_MASK); 258 out_be32(&sdma->sdebcr, (u32) sdma_buf_offset & QE_SDEBCR_BA_MASK);
259 out_be32(&sdma->sdmr, (QE_SDMR_GLB_1_MSK | 259 out_be32(&sdma->sdmr, (QE_SDMR_GLB_1_MSK |
260 (0x1 << QE_SDMR_CEN_SHIFT))); 260 (0x1 << QE_SDMR_CEN_SHIFT)));
261 261
@@ -291,33 +291,32 @@ static void qe_muram_init(void)
291 if ((np = of_find_node_by_name(NULL, "data-only")) != NULL) { 291 if ((np = of_find_node_by_name(NULL, "data-only")) != NULL) {
292 address = *of_get_address(np, 0, &size, &flags); 292 address = *of_get_address(np, 0, &size, &flags);
293 of_node_put(np); 293 of_node_put(np);
294 rh_attach_region(&qe_muram_info, 294 rh_attach_region(&qe_muram_info, address, (int) size);
295 (void *)address, (int)size);
296 } 295 }
297} 296}
298 297
299/* This function returns an index into the MURAM area. 298/* This function returns an index into the MURAM area.
300 */ 299 */
301u32 qe_muram_alloc(u32 size, u32 align) 300unsigned long qe_muram_alloc(int size, int align)
302{ 301{
303 void *start; 302 unsigned long start;
304 unsigned long flags; 303 unsigned long flags;
305 304
306 spin_lock_irqsave(&qe_muram_lock, flags); 305 spin_lock_irqsave(&qe_muram_lock, flags);
307 start = rh_alloc_align(&qe_muram_info, size, align, "QE"); 306 start = rh_alloc_align(&qe_muram_info, size, align, "QE");
308 spin_unlock_irqrestore(&qe_muram_lock, flags); 307 spin_unlock_irqrestore(&qe_muram_lock, flags);
309 308
310 return (u32) start; 309 return start;
311} 310}
312EXPORT_SYMBOL(qe_muram_alloc); 311EXPORT_SYMBOL(qe_muram_alloc);
313 312
314int qe_muram_free(u32 offset) 313int qe_muram_free(unsigned long offset)
315{ 314{
316 int ret; 315 int ret;
317 unsigned long flags; 316 unsigned long flags;
318 317
319 spin_lock_irqsave(&qe_muram_lock, flags); 318 spin_lock_irqsave(&qe_muram_lock, flags);
320 ret = rh_free(&qe_muram_info, (void *)offset); 319 ret = rh_free(&qe_muram_info, offset);
321 spin_unlock_irqrestore(&qe_muram_lock, flags); 320 spin_unlock_irqrestore(&qe_muram_lock, flags);
322 321
323 return ret; 322 return ret;
@@ -325,16 +324,16 @@ int qe_muram_free(u32 offset)
325EXPORT_SYMBOL(qe_muram_free); 324EXPORT_SYMBOL(qe_muram_free);
326 325
327/* not sure if this is ever needed */ 326/* not sure if this is ever needed */
328u32 qe_muram_alloc_fixed(u32 offset, u32 size) 327unsigned long qe_muram_alloc_fixed(unsigned long offset, int size)
329{ 328{
330 void *start; 329 unsigned long start;
331 unsigned long flags; 330 unsigned long flags;
332 331
333 spin_lock_irqsave(&qe_muram_lock, flags); 332 spin_lock_irqsave(&qe_muram_lock, flags);
334 start = rh_alloc_fixed(&qe_muram_info, (void *)offset, size, "commproc"); 333 start = rh_alloc_fixed(&qe_muram_info, offset, size, "commproc");
335 spin_unlock_irqrestore(&qe_muram_lock, flags); 334 spin_unlock_irqrestore(&qe_muram_lock, flags);
336 335
337 return (u32) start; 336 return start;
338} 337}
339EXPORT_SYMBOL(qe_muram_alloc_fixed); 338EXPORT_SYMBOL(qe_muram_alloc_fixed);
340 339
@@ -344,7 +343,7 @@ void qe_muram_dump(void)
344} 343}
345EXPORT_SYMBOL(qe_muram_dump); 344EXPORT_SYMBOL(qe_muram_dump);
346 345
347void *qe_muram_addr(u32 offset) 346void *qe_muram_addr(unsigned long offset)
348{ 347{
349 return (void *)&qe_immr->muram[offset]; 348 return (void *)&qe_immr->muram[offset];
350} 349}
diff --git a/arch/powerpc/sysdev/qe_lib/ucc_fast.c b/arch/powerpc/sysdev/qe_lib/ucc_fast.c
index 66137bf2dfb0..9143236853fc 100644
--- a/arch/powerpc/sysdev/qe_lib/ucc_fast.c
+++ b/arch/powerpc/sysdev/qe_lib/ucc_fast.c
@@ -18,6 +18,7 @@
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <linux/stddef.h> 19#include <linux/stddef.h>
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/err.h>
21 22
22#include <asm/io.h> 23#include <asm/io.h>
23#include <asm/immap_qe.h> 24#include <asm/immap_qe.h>
@@ -268,7 +269,7 @@ int ucc_fast_init(struct ucc_fast_info * uf_info, struct ucc_fast_private ** ucc
268 /* Allocate memory for Tx Virtual Fifo */ 269 /* Allocate memory for Tx Virtual Fifo */
269 uccf->ucc_fast_tx_virtual_fifo_base_offset = 270 uccf->ucc_fast_tx_virtual_fifo_base_offset =
270 qe_muram_alloc(uf_info->utfs, UCC_FAST_VIRT_FIFO_REGS_ALIGNMENT); 271 qe_muram_alloc(uf_info->utfs, UCC_FAST_VIRT_FIFO_REGS_ALIGNMENT);
271 if (IS_MURAM_ERR(uccf->ucc_fast_tx_virtual_fifo_base_offset)) { 272 if (IS_ERR_VALUE(uccf->ucc_fast_tx_virtual_fifo_base_offset)) {
272 printk(KERN_ERR "%s: cannot allocate MURAM for TX FIFO", __FUNCTION__); 273 printk(KERN_ERR "%s: cannot allocate MURAM for TX FIFO", __FUNCTION__);
273 uccf->ucc_fast_tx_virtual_fifo_base_offset = 0; 274 uccf->ucc_fast_tx_virtual_fifo_base_offset = 0;
274 ucc_fast_free(uccf); 275 ucc_fast_free(uccf);
@@ -280,7 +281,7 @@ int ucc_fast_init(struct ucc_fast_info * uf_info, struct ucc_fast_private ** ucc
280 qe_muram_alloc(uf_info->urfs + 281 qe_muram_alloc(uf_info->urfs +
281 UCC_FAST_RECEIVE_VIRTUAL_FIFO_SIZE_FUDGE_FACTOR, 282 UCC_FAST_RECEIVE_VIRTUAL_FIFO_SIZE_FUDGE_FACTOR,
282 UCC_FAST_VIRT_FIFO_REGS_ALIGNMENT); 283 UCC_FAST_VIRT_FIFO_REGS_ALIGNMENT);
283 if (IS_MURAM_ERR(uccf->ucc_fast_rx_virtual_fifo_base_offset)) { 284 if (IS_ERR_VALUE(uccf->ucc_fast_rx_virtual_fifo_base_offset)) {
284 printk(KERN_ERR "%s: cannot allocate MURAM for RX FIFO", __FUNCTION__); 285 printk(KERN_ERR "%s: cannot allocate MURAM for RX FIFO", __FUNCTION__);
285 uccf->ucc_fast_rx_virtual_fifo_base_offset = 0; 286 uccf->ucc_fast_rx_virtual_fifo_base_offset = 0;
286 ucc_fast_free(uccf); 287 ucc_fast_free(uccf);
diff --git a/arch/powerpc/sysdev/qe_lib/ucc_slow.c b/arch/powerpc/sysdev/qe_lib/ucc_slow.c
index b930d686a4d1..1f65c26ce63f 100644
--- a/arch/powerpc/sysdev/qe_lib/ucc_slow.c
+++ b/arch/powerpc/sysdev/qe_lib/ucc_slow.c
@@ -18,6 +18,7 @@
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <linux/stddef.h> 19#include <linux/stddef.h>
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/err.h>
21 22
22#include <asm/io.h> 23#include <asm/io.h>
23#include <asm/immap_qe.h> 24#include <asm/immap_qe.h>
@@ -175,7 +176,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc
175 /* Get PRAM base */ 176 /* Get PRAM base */
176 uccs->us_pram_offset = 177 uccs->us_pram_offset =
177 qe_muram_alloc(UCC_SLOW_PRAM_SIZE, ALIGNMENT_OF_UCC_SLOW_PRAM); 178 qe_muram_alloc(UCC_SLOW_PRAM_SIZE, ALIGNMENT_OF_UCC_SLOW_PRAM);
178 if (IS_MURAM_ERR(uccs->us_pram_offset)) { 179 if (IS_ERR_VALUE(uccs->us_pram_offset)) {
179 printk(KERN_ERR "%s: cannot allocate MURAM for PRAM", __FUNCTION__); 180 printk(KERN_ERR "%s: cannot allocate MURAM for PRAM", __FUNCTION__);
180 ucc_slow_free(uccs); 181 ucc_slow_free(uccs);
181 return -ENOMEM; 182 return -ENOMEM;
@@ -210,7 +211,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc
210 uccs->rx_base_offset = 211 uccs->rx_base_offset =
211 qe_muram_alloc(us_info->rx_bd_ring_len * sizeof(struct qe_bd), 212 qe_muram_alloc(us_info->rx_bd_ring_len * sizeof(struct qe_bd),
212 QE_ALIGNMENT_OF_BD); 213 QE_ALIGNMENT_OF_BD);
213 if (IS_MURAM_ERR(uccs->rx_base_offset)) { 214 if (IS_ERR_VALUE(uccs->rx_base_offset)) {
214 printk(KERN_ERR "%s: cannot allocate RX BDs", __FUNCTION__); 215 printk(KERN_ERR "%s: cannot allocate RX BDs", __FUNCTION__);
215 uccs->rx_base_offset = 0; 216 uccs->rx_base_offset = 0;
216 ucc_slow_free(uccs); 217 ucc_slow_free(uccs);
@@ -220,7 +221,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc
220 uccs->tx_base_offset = 221 uccs->tx_base_offset =
221 qe_muram_alloc(us_info->tx_bd_ring_len * sizeof(struct qe_bd), 222 qe_muram_alloc(us_info->tx_bd_ring_len * sizeof(struct qe_bd),
222 QE_ALIGNMENT_OF_BD); 223 QE_ALIGNMENT_OF_BD);
223 if (IS_MURAM_ERR(uccs->tx_base_offset)) { 224 if (IS_ERR_VALUE(uccs->tx_base_offset)) {
224 printk(KERN_ERR "%s: cannot allocate TX BDs", __FUNCTION__); 225 printk(KERN_ERR "%s: cannot allocate TX BDs", __FUNCTION__);
225 uccs->tx_base_offset = 0; 226 uccs->tx_base_offset = 0;
226 ucc_slow_free(uccs); 227 ucc_slow_free(uccs);
diff --git a/arch/ppc/8xx_io/commproc.c b/arch/ppc/8xx_io/commproc.c
index 7a8722beac12..e2c6210f234b 100644
--- a/arch/ppc/8xx_io/commproc.c
+++ b/arch/ppc/8xx_io/commproc.c
@@ -402,7 +402,7 @@ void m8xx_cpm_dpinit(void)
402 * with the processor and the microcode patches applied / activated. 402 * with the processor and the microcode patches applied / activated.
403 * But the following should be at least safe. 403 * But the following should be at least safe.
404 */ 404 */
405 rh_attach_region(&cpm_dpmem_info, (void *)CPM_DATAONLY_BASE, CPM_DATAONLY_SIZE); 405 rh_attach_region(&cpm_dpmem_info, CPM_DATAONLY_BASE, CPM_DATAONLY_SIZE);
406} 406}
407 407
408/* 408/*
@@ -410,9 +410,9 @@ void m8xx_cpm_dpinit(void)
410 * This function returns an offset into the DPRAM area. 410 * This function returns an offset into the DPRAM area.
411 * Use cpm_dpram_addr() to get the virtual address of the area. 411 * Use cpm_dpram_addr() to get the virtual address of the area.
412 */ 412 */
413uint cpm_dpalloc(uint size, uint align) 413unsigned long cpm_dpalloc(uint size, uint align)
414{ 414{
415 void *start; 415 unsigned long start;
416 unsigned long flags; 416 unsigned long flags;
417 417
418 spin_lock_irqsave(&cpm_dpmem_lock, flags); 418 spin_lock_irqsave(&cpm_dpmem_lock, flags);
@@ -420,34 +420,34 @@ uint cpm_dpalloc(uint size, uint align)
420 start = rh_alloc(&cpm_dpmem_info, size, "commproc"); 420 start = rh_alloc(&cpm_dpmem_info, size, "commproc");
421 spin_unlock_irqrestore(&cpm_dpmem_lock, flags); 421 spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
422 422
423 return (uint)start; 423 return start;
424} 424}
425EXPORT_SYMBOL(cpm_dpalloc); 425EXPORT_SYMBOL(cpm_dpalloc);
426 426
427int cpm_dpfree(uint offset) 427int cpm_dpfree(unsigned long offset)
428{ 428{
429 int ret; 429 int ret;
430 unsigned long flags; 430 unsigned long flags;
431 431
432 spin_lock_irqsave(&cpm_dpmem_lock, flags); 432 spin_lock_irqsave(&cpm_dpmem_lock, flags);
433 ret = rh_free(&cpm_dpmem_info, (void *)offset); 433 ret = rh_free(&cpm_dpmem_info, offset);
434 spin_unlock_irqrestore(&cpm_dpmem_lock, flags); 434 spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
435 435
436 return ret; 436 return ret;
437} 437}
438EXPORT_SYMBOL(cpm_dpfree); 438EXPORT_SYMBOL(cpm_dpfree);
439 439
440uint cpm_dpalloc_fixed(uint offset, uint size, uint align) 440unsigned long cpm_dpalloc_fixed(unsigned long offset, uint size, uint align)
441{ 441{
442 void *start; 442 unsigned long start;
443 unsigned long flags; 443 unsigned long flags;
444 444
445 spin_lock_irqsave(&cpm_dpmem_lock, flags); 445 spin_lock_irqsave(&cpm_dpmem_lock, flags);
446 cpm_dpmem_info.alignment = align; 446 cpm_dpmem_info.alignment = align;
447 start = rh_alloc_fixed(&cpm_dpmem_info, (void *)offset, size, "commproc"); 447 start = rh_alloc_fixed(&cpm_dpmem_info, offset, size, "commproc");
448 spin_unlock_irqrestore(&cpm_dpmem_lock, flags); 448 spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
449 449
450 return (uint)start; 450 return start;
451} 451}
452EXPORT_SYMBOL(cpm_dpalloc_fixed); 452EXPORT_SYMBOL(cpm_dpalloc_fixed);
453 453
@@ -457,7 +457,7 @@ void cpm_dpdump(void)
457} 457}
458EXPORT_SYMBOL(cpm_dpdump); 458EXPORT_SYMBOL(cpm_dpdump);
459 459
460void *cpm_dpram_addr(uint offset) 460void *cpm_dpram_addr(unsigned long offset)
461{ 461{
462 return ((immap_t *)IMAP_ADDR)->im_cpm.cp_dpmem + offset; 462 return ((immap_t *)IMAP_ADDR)->im_cpm.cp_dpmem + offset;
463} 463}
diff --git a/arch/ppc/lib/Makefile b/arch/ppc/lib/Makefile
index 422bef9bae7b..095e661e79dd 100644
--- a/arch/ppc/lib/Makefile
+++ b/arch/ppc/lib/Makefile
@@ -3,6 +3,3 @@
3# 3#
4 4
5obj-y := checksum.o string.o div64.o 5obj-y := checksum.o string.o div64.o
6
7obj-$(CONFIG_8xx) += rheap.o
8obj-$(CONFIG_CPM2) += rheap.o
diff --git a/arch/ppc/lib/rheap.c b/arch/ppc/lib/rheap.c
deleted file mode 100644
index d40700795a9c..000000000000
--- a/arch/ppc/lib/rheap.c
+++ /dev/null
@@ -1,692 +0,0 @@
1/*
2 * A Remote Heap. Remote means that we don't touch the memory that the
3 * heap points to. Normal heap implementations use the memory they manage
4 * to place their list. We cannot do that because the memory we manage may
5 * have special properties, for example it is uncachable or of different
6 * endianess.
7 *
8 * Author: Pantelis Antoniou <panto@intracom.gr>
9 *
10 * 2004 (c) INTRACOM S.A. Greece. This file is licensed under
11 * the terms of the GNU General Public License version 2. This program
12 * is licensed "as is" without any warranty of any kind, whether express
13 * or implied.
14 */
15#include <linux/types.h>
16#include <linux/errno.h>
17#include <linux/kernel.h>
18#include <linux/mm.h>
19#include <linux/slab.h>
20
21#include <asm/rheap.h>
22
23/*
24 * Fixup a list_head, needed when copying lists. If the pointers fall
25 * between s and e, apply the delta. This assumes that
26 * sizeof(struct list_head *) == sizeof(unsigned long *).
27 */
28static inline void fixup(unsigned long s, unsigned long e, int d,
29 struct list_head *l)
30{
31 unsigned long *pp;
32
33 pp = (unsigned long *)&l->next;
34 if (*pp >= s && *pp < e)
35 *pp += d;
36
37 pp = (unsigned long *)&l->prev;
38 if (*pp >= s && *pp < e)
39 *pp += d;
40}
41
42/* Grow the allocated blocks */
43static int grow(rh_info_t * info, int max_blocks)
44{
45 rh_block_t *block, *blk;
46 int i, new_blocks;
47 int delta;
48 unsigned long blks, blke;
49
50 if (max_blocks <= info->max_blocks)
51 return -EINVAL;
52
53 new_blocks = max_blocks - info->max_blocks;
54
55 block = kmalloc(sizeof(rh_block_t) * max_blocks, GFP_KERNEL);
56 if (block == NULL)
57 return -ENOMEM;
58
59 if (info->max_blocks > 0) {
60
61 /* copy old block area */
62 memcpy(block, info->block,
63 sizeof(rh_block_t) * info->max_blocks);
64
65 delta = (char *)block - (char *)info->block;
66
67 /* and fixup list pointers */
68 blks = (unsigned long)info->block;
69 blke = (unsigned long)(info->block + info->max_blocks);
70
71 for (i = 0, blk = block; i < info->max_blocks; i++, blk++)
72 fixup(blks, blke, delta, &blk->list);
73
74 fixup(blks, blke, delta, &info->empty_list);
75 fixup(blks, blke, delta, &info->free_list);
76 fixup(blks, blke, delta, &info->taken_list);
77
78 /* free the old allocated memory */
79 if ((info->flags & RHIF_STATIC_BLOCK) == 0)
80 kfree(info->block);
81 }
82
83 info->block = block;
84 info->empty_slots += new_blocks;
85 info->max_blocks = max_blocks;
86 info->flags &= ~RHIF_STATIC_BLOCK;
87
88 /* add all new blocks to the free list */
89 for (i = 0, blk = block + info->max_blocks; i < new_blocks; i++, blk++)
90 list_add(&blk->list, &info->empty_list);
91
92 return 0;
93}
94
95/*
96 * Assure at least the required amount of empty slots. If this function
97 * causes a grow in the block area then all pointers kept to the block
98 * area are invalid!
99 */
100static int assure_empty(rh_info_t * info, int slots)
101{
102 int max_blocks;
103
104 /* This function is not meant to be used to grow uncontrollably */
105 if (slots >= 4)
106 return -EINVAL;
107
108 /* Enough space */
109 if (info->empty_slots >= slots)
110 return 0;
111
112 /* Next 16 sized block */
113 max_blocks = ((info->max_blocks + slots) + 15) & ~15;
114
115 return grow(info, max_blocks);
116}
117
118static rh_block_t *get_slot(rh_info_t * info)
119{
120 rh_block_t *blk;
121
122 /* If no more free slots, and failure to extend. */
123 /* XXX: You should have called assure_empty before */
124 if (info->empty_slots == 0) {
125 printk(KERN_ERR "rh: out of slots; crash is imminent.\n");
126 return NULL;
127 }
128
129 /* Get empty slot to use */
130 blk = list_entry(info->empty_list.next, rh_block_t, list);
131 list_del_init(&blk->list);
132 info->empty_slots--;
133
134 /* Initialize */
135 blk->start = NULL;
136 blk->size = 0;
137 blk->owner = NULL;
138
139 return blk;
140}
141
142static inline void release_slot(rh_info_t * info, rh_block_t * blk)
143{
144 list_add(&blk->list, &info->empty_list);
145 info->empty_slots++;
146}
147
148static void attach_free_block(rh_info_t * info, rh_block_t * blkn)
149{
150 rh_block_t *blk;
151 rh_block_t *before;
152 rh_block_t *after;
153 rh_block_t *next;
154 int size;
155 unsigned long s, e, bs, be;
156 struct list_head *l;
157
158 /* We assume that they are aligned properly */
159 size = blkn->size;
160 s = (unsigned long)blkn->start;
161 e = s + size;
162
163 /* Find the blocks immediately before and after the given one
164 * (if any) */
165 before = NULL;
166 after = NULL;
167 next = NULL;
168
169 list_for_each(l, &info->free_list) {
170 blk = list_entry(l, rh_block_t, list);
171
172 bs = (unsigned long)blk->start;
173 be = bs + blk->size;
174
175 if (next == NULL && s >= bs)
176 next = blk;
177
178 if (be == s)
179 before = blk;
180
181 if (e == bs)
182 after = blk;
183
184 /* If both are not null, break now */
185 if (before != NULL && after != NULL)
186 break;
187 }
188
189 /* Now check if they are really adjacent */
190 if (before != NULL && s != (unsigned long)before->start + before->size)
191 before = NULL;
192
193 if (after != NULL && e != (unsigned long)after->start)
194 after = NULL;
195
196 /* No coalescing; list insert and return */
197 if (before == NULL && after == NULL) {
198
199 if (next != NULL)
200 list_add(&blkn->list, &next->list);
201 else
202 list_add(&blkn->list, &info->free_list);
203
204 return;
205 }
206
207 /* We don't need it anymore */
208 release_slot(info, blkn);
209
210 /* Grow the before block */
211 if (before != NULL && after == NULL) {
212 before->size += size;
213 return;
214 }
215
216 /* Grow the after block backwards */
217 if (before == NULL && after != NULL) {
218 after->start = (int8_t *)after->start - size;
219 after->size += size;
220 return;
221 }
222
223 /* Grow the before block, and release the after block */
224 before->size += size + after->size;
225 list_del(&after->list);
226 release_slot(info, after);
227}
228
229static void attach_taken_block(rh_info_t * info, rh_block_t * blkn)
230{
231 rh_block_t *blk;
232 struct list_head *l;
233
234 /* Find the block immediately before the given one (if any) */
235 list_for_each(l, &info->taken_list) {
236 blk = list_entry(l, rh_block_t, list);
237 if (blk->start > blkn->start) {
238 list_add_tail(&blkn->list, &blk->list);
239 return;
240 }
241 }
242
243 list_add_tail(&blkn->list, &info->taken_list);
244}
245
246/*
247 * Create a remote heap dynamically. Note that no memory for the blocks
248 * are allocated. It will upon the first allocation
249 */
250rh_info_t *rh_create(unsigned int alignment)
251{
252 rh_info_t *info;
253
254 /* Alignment must be a power of two */
255 if ((alignment & (alignment - 1)) != 0)
256 return ERR_PTR(-EINVAL);
257
258 info = kmalloc(sizeof(*info), GFP_KERNEL);
259 if (info == NULL)
260 return ERR_PTR(-ENOMEM);
261
262 info->alignment = alignment;
263
264 /* Initially everything as empty */
265 info->block = NULL;
266 info->max_blocks = 0;
267 info->empty_slots = 0;
268 info->flags = 0;
269
270 INIT_LIST_HEAD(&info->empty_list);
271 INIT_LIST_HEAD(&info->free_list);
272 INIT_LIST_HEAD(&info->taken_list);
273
274 return info;
275}
276
277/*
278 * Destroy a dynamically created remote heap. Deallocate only if the areas
279 * are not static
280 */
281void rh_destroy(rh_info_t * info)
282{
283 if ((info->flags & RHIF_STATIC_BLOCK) == 0 && info->block != NULL)
284 kfree(info->block);
285
286 if ((info->flags & RHIF_STATIC_INFO) == 0)
287 kfree(info);
288}
289
290/*
291 * Initialize in place a remote heap info block. This is needed to support
292 * operation very early in the startup of the kernel, when it is not yet safe
293 * to call kmalloc.
294 */
295void rh_init(rh_info_t * info, unsigned int alignment, int max_blocks,
296 rh_block_t * block)
297{
298 int i;
299 rh_block_t *blk;
300
301 /* Alignment must be a power of two */
302 if ((alignment & (alignment - 1)) != 0)
303 return;
304
305 info->alignment = alignment;
306
307 /* Initially everything as empty */
308 info->block = block;
309 info->max_blocks = max_blocks;
310 info->empty_slots = max_blocks;
311 info->flags = RHIF_STATIC_INFO | RHIF_STATIC_BLOCK;
312
313 INIT_LIST_HEAD(&info->empty_list);
314 INIT_LIST_HEAD(&info->free_list);
315 INIT_LIST_HEAD(&info->taken_list);
316
317 /* Add all new blocks to the free list */
318 for (i = 0, blk = block; i < max_blocks; i++, blk++)
319 list_add(&blk->list, &info->empty_list);
320}
321
322/* Attach a free memory region, coalesces regions if adjuscent */
323int rh_attach_region(rh_info_t * info, void *start, int size)
324{
325 rh_block_t *blk;
326 unsigned long s, e, m;
327 int r;
328
329 /* The region must be aligned */
330 s = (unsigned long)start;
331 e = s + size;
332 m = info->alignment - 1;
333
334 /* Round start up */
335 s = (s + m) & ~m;
336
337 /* Round end down */
338 e = e & ~m;
339
340 /* Take final values */
341 start = (void *)s;
342 size = (int)(e - s);
343
344 /* Grow the blocks, if needed */
345 r = assure_empty(info, 1);
346 if (r < 0)
347 return r;
348
349 blk = get_slot(info);
350 blk->start = start;
351 blk->size = size;
352 blk->owner = NULL;
353
354 attach_free_block(info, blk);
355
356 return 0;
357}
358
359/* Detatch given address range, splits free block if needed. */
360void *rh_detach_region(rh_info_t * info, void *start, int size)
361{
362 struct list_head *l;
363 rh_block_t *blk, *newblk;
364 unsigned long s, e, m, bs, be;
365
366 /* Validate size */
367 if (size <= 0)
368 return ERR_PTR(-EINVAL);
369
370 /* The region must be aligned */
371 s = (unsigned long)start;
372 e = s + size;
373 m = info->alignment - 1;
374
375 /* Round start up */
376 s = (s + m) & ~m;
377
378 /* Round end down */
379 e = e & ~m;
380
381 if (assure_empty(info, 1) < 0)
382 return ERR_PTR(-ENOMEM);
383
384 blk = NULL;
385 list_for_each(l, &info->free_list) {
386 blk = list_entry(l, rh_block_t, list);
387 /* The range must lie entirely inside one free block */
388 bs = (unsigned long)blk->start;
389 be = (unsigned long)blk->start + blk->size;
390 if (s >= bs && e <= be)
391 break;
392 blk = NULL;
393 }
394
395 if (blk == NULL)
396 return ERR_PTR(-ENOMEM);
397
398 /* Perfect fit */
399 if (bs == s && be == e) {
400 /* Delete from free list, release slot */
401 list_del(&blk->list);
402 release_slot(info, blk);
403 return (void *)s;
404 }
405
406 /* blk still in free list, with updated start and/or size */
407 if (bs == s || be == e) {
408 if (bs == s)
409 blk->start = (int8_t *)blk->start + size;
410 blk->size -= size;
411
412 } else {
413 /* The front free fragment */
414 blk->size = s - bs;
415
416 /* the back free fragment */
417 newblk = get_slot(info);
418 newblk->start = (void *)e;
419 newblk->size = be - e;
420
421 list_add(&newblk->list, &blk->list);
422 }
423
424 return (void *)s;
425}
426
427void *rh_alloc(rh_info_t * info, int size, const char *owner)
428{
429 struct list_head *l;
430 rh_block_t *blk;
431 rh_block_t *newblk;
432 void *start;
433
434 /* Validate size */
435 if (size <= 0)
436 return ERR_PTR(-EINVAL);
437
438 /* Align to configured alignment */
439 size = (size + (info->alignment - 1)) & ~(info->alignment - 1);
440
441 if (assure_empty(info, 1) < 0)
442 return ERR_PTR(-ENOMEM);
443
444 blk = NULL;
445 list_for_each(l, &info->free_list) {
446 blk = list_entry(l, rh_block_t, list);
447 if (size <= blk->size)
448 break;
449 blk = NULL;
450 }
451
452 if (blk == NULL)
453 return ERR_PTR(-ENOMEM);
454
455 /* Just fits */
456 if (blk->size == size) {
457 /* Move from free list to taken list */
458 list_del(&blk->list);
459 blk->owner = owner;
460 start = blk->start;
461
462 attach_taken_block(info, blk);
463
464 return start;
465 }
466
467 newblk = get_slot(info);
468 newblk->start = blk->start;
469 newblk->size = size;
470 newblk->owner = owner;
471
472 /* blk still in free list, with updated start, size */
473 blk->start = (int8_t *)blk->start + size;
474 blk->size -= size;
475
476 start = newblk->start;
477
478 attach_taken_block(info, newblk);
479
480 return start;
481}
482
483/* allocate at precisely the given address */
484void *rh_alloc_fixed(rh_info_t * info, void *start, int size, const char *owner)
485{
486 struct list_head *l;
487 rh_block_t *blk, *newblk1, *newblk2;
488 unsigned long s, e, m, bs, be;
489
490 /* Validate size */
491 if (size <= 0)
492 return ERR_PTR(-EINVAL);
493
494 /* The region must be aligned */
495 s = (unsigned long)start;
496 e = s + size;
497 m = info->alignment - 1;
498
499 /* Round start up */
500 s = (s + m) & ~m;
501
502 /* Round end down */
503 e = e & ~m;
504
505 if (assure_empty(info, 2) < 0)
506 return ERR_PTR(-ENOMEM);
507
508 blk = NULL;
509 list_for_each(l, &info->free_list) {
510 blk = list_entry(l, rh_block_t, list);
511 /* The range must lie entirely inside one free block */
512 bs = (unsigned long)blk->start;
513 be = (unsigned long)blk->start + blk->size;
514 if (s >= bs && e <= be)
515 break;
516 }
517
518 if (blk == NULL)
519 return ERR_PTR(-ENOMEM);
520
521 /* Perfect fit */
522 if (bs == s && be == e) {
523 /* Move from free list to taken list */
524 list_del(&blk->list);
525 blk->owner = owner;
526
527 start = blk->start;
528 attach_taken_block(info, blk);
529
530 return start;
531
532 }
533
534 /* blk still in free list, with updated start and/or size */
535 if (bs == s || be == e) {
536 if (bs == s)
537 blk->start = (int8_t *)blk->start + size;
538 blk->size -= size;
539
540 } else {
541 /* The front free fragment */
542 blk->size = s - bs;
543
544 /* The back free fragment */
545 newblk2 = get_slot(info);
546 newblk2->start = (void *)e;
547 newblk2->size = be - e;
548
549 list_add(&newblk2->list, &blk->list);
550 }
551
552 newblk1 = get_slot(info);
553 newblk1->start = (void *)s;
554 newblk1->size = e - s;
555 newblk1->owner = owner;
556
557 start = newblk1->start;
558 attach_taken_block(info, newblk1);
559
560 return start;
561}
562
563int rh_free(rh_info_t * info, void *start)
564{
565 rh_block_t *blk, *blk2;
566 struct list_head *l;
567 int size;
568
569 /* Linear search for block */
570 blk = NULL;
571 list_for_each(l, &info->taken_list) {
572 blk2 = list_entry(l, rh_block_t, list);
573 if (start < blk2->start)
574 break;
575 blk = blk2;
576 }
577
578 if (blk == NULL || start > (blk->start + blk->size))
579 return -EINVAL;
580
581 /* Remove from taken list */
582 list_del(&blk->list);
583
584 /* Get size of freed block */
585 size = blk->size;
586 attach_free_block(info, blk);
587
588 return size;
589}
590
591int rh_get_stats(rh_info_t * info, int what, int max_stats, rh_stats_t * stats)
592{
593 rh_block_t *blk;
594 struct list_head *l;
595 struct list_head *h;
596 int nr;
597
598 switch (what) {
599
600 case RHGS_FREE:
601 h = &info->free_list;
602 break;
603
604 case RHGS_TAKEN:
605 h = &info->taken_list;
606 break;
607
608 default:
609 return -EINVAL;
610 }
611
612 /* Linear search for block */
613 nr = 0;
614 list_for_each(l, h) {
615 blk = list_entry(l, rh_block_t, list);
616 if (stats != NULL && nr < max_stats) {
617 stats->start = blk->start;
618 stats->size = blk->size;
619 stats->owner = blk->owner;
620 stats++;
621 }
622 nr++;
623 }
624
625 return nr;
626}
627
628int rh_set_owner(rh_info_t * info, void *start, const char *owner)
629{
630 rh_block_t *blk, *blk2;
631 struct list_head *l;
632 int size;
633
634 /* Linear search for block */
635 blk = NULL;
636 list_for_each(l, &info->taken_list) {
637 blk2 = list_entry(l, rh_block_t, list);
638 if (start < blk2->start)
639 break;
640 blk = blk2;
641 }
642
643 if (blk == NULL || start > (blk->start + blk->size))
644 return -EINVAL;
645
646 blk->owner = owner;
647 size = blk->size;
648
649 return size;
650}
651
652void rh_dump(rh_info_t * info)
653{
654 static rh_stats_t st[32]; /* XXX maximum 32 blocks */
655 int maxnr;
656 int i, nr;
657
658 maxnr = ARRAY_SIZE(st);
659
660 printk(KERN_INFO
661 "info @0x%p (%d slots empty / %d max)\n",
662 info, info->empty_slots, info->max_blocks);
663
664 printk(KERN_INFO " Free:\n");
665 nr = rh_get_stats(info, RHGS_FREE, maxnr, st);
666 if (nr > maxnr)
667 nr = maxnr;
668 for (i = 0; i < nr; i++)
669 printk(KERN_INFO
670 " 0x%p-0x%p (%u)\n",
671 st[i].start, (int8_t *) st[i].start + st[i].size,
672 st[i].size);
673 printk(KERN_INFO "\n");
674
675 printk(KERN_INFO " Taken:\n");
676 nr = rh_get_stats(info, RHGS_TAKEN, maxnr, st);
677 if (nr > maxnr)
678 nr = maxnr;
679 for (i = 0; i < nr; i++)
680 printk(KERN_INFO
681 " 0x%p-0x%p (%u) %s\n",
682 st[i].start, (int8_t *) st[i].start + st[i].size,
683 st[i].size, st[i].owner != NULL ? st[i].owner : "");
684 printk(KERN_INFO "\n");
685}
686
687void rh_dump_blk(rh_info_t * info, rh_block_t * blk)
688{
689 printk(KERN_INFO
690 "blk @0x%p: 0x%p-0x%p (%u)\n",
691 blk, blk->start, (int8_t *) blk->start + blk->size, blk->size);
692}
diff --git a/arch/ppc/syslib/cpm2_common.c b/arch/ppc/syslib/cpm2_common.c
index cbac44b1620c..6cd859d7721f 100644
--- a/arch/ppc/syslib/cpm2_common.c
+++ b/arch/ppc/syslib/cpm2_common.c
@@ -136,15 +136,14 @@ static void cpm2_dpinit(void)
136 * varies with the processor and the microcode patches activated. 136 * varies with the processor and the microcode patches activated.
137 * But the following should be at least safe. 137 * But the following should be at least safe.
138 */ 138 */
139 rh_attach_region(&cpm_dpmem_info, (void *)CPM_DATAONLY_BASE, 139 rh_attach_region(&cpm_dpmem_info, CPM_DATAONLY_BASE, CPM_DATAONLY_SIZE);
140 CPM_DATAONLY_SIZE);
141} 140}
142 141
143/* This function returns an index into the DPRAM area. 142/* This function returns an index into the DPRAM area.
144 */ 143 */
145uint cpm_dpalloc(uint size, uint align) 144unsigned long cpm_dpalloc(uint size, uint align)
146{ 145{
147 void *start; 146 unsigned long start;
148 unsigned long flags; 147 unsigned long flags;
149 148
150 spin_lock_irqsave(&cpm_dpmem_lock, flags); 149 spin_lock_irqsave(&cpm_dpmem_lock, flags);
@@ -152,17 +151,17 @@ uint cpm_dpalloc(uint size, uint align)
152 start = rh_alloc(&cpm_dpmem_info, size, "commproc"); 151 start = rh_alloc(&cpm_dpmem_info, size, "commproc");
153 spin_unlock_irqrestore(&cpm_dpmem_lock, flags); 152 spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
154 153
155 return (uint)start; 154 return start;
156} 155}
157EXPORT_SYMBOL(cpm_dpalloc); 156EXPORT_SYMBOL(cpm_dpalloc);
158 157
159int cpm_dpfree(uint offset) 158int cpm_dpfree(unsigned long offset)
160{ 159{
161 int ret; 160 int ret;
162 unsigned long flags; 161 unsigned long flags;
163 162
164 spin_lock_irqsave(&cpm_dpmem_lock, flags); 163 spin_lock_irqsave(&cpm_dpmem_lock, flags);
165 ret = rh_free(&cpm_dpmem_info, (void *)offset); 164 ret = rh_free(&cpm_dpmem_info, offset);
166 spin_unlock_irqrestore(&cpm_dpmem_lock, flags); 165 spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
167 166
168 return ret; 167 return ret;
@@ -170,17 +169,17 @@ int cpm_dpfree(uint offset)
170EXPORT_SYMBOL(cpm_dpfree); 169EXPORT_SYMBOL(cpm_dpfree);
171 170
172/* not sure if this is ever needed */ 171/* not sure if this is ever needed */
173uint cpm_dpalloc_fixed(uint offset, uint size, uint align) 172unsigned long cpm_dpalloc_fixed(unsigned long offset, uint size, uint align)
174{ 173{
175 void *start; 174 unsigned long start;
176 unsigned long flags; 175 unsigned long flags;
177 176
178 spin_lock_irqsave(&cpm_dpmem_lock, flags); 177 spin_lock_irqsave(&cpm_dpmem_lock, flags);
179 cpm_dpmem_info.alignment = align; 178 cpm_dpmem_info.alignment = align;
180 start = rh_alloc_fixed(&cpm_dpmem_info, (void *)offset, size, "commproc"); 179 start = rh_alloc_fixed(&cpm_dpmem_info, offset, size, "commproc");
181 spin_unlock_irqrestore(&cpm_dpmem_lock, flags); 180 spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
182 181
183 return (uint)start; 182 return start;
184} 183}
185EXPORT_SYMBOL(cpm_dpalloc_fixed); 184EXPORT_SYMBOL(cpm_dpalloc_fixed);
186 185
@@ -190,7 +189,7 @@ void cpm_dpdump(void)
190} 189}
191EXPORT_SYMBOL(cpm_dpdump); 190EXPORT_SYMBOL(cpm_dpdump);
192 191
193void *cpm_dpram_addr(uint offset) 192void *cpm_dpram_addr(unsigned long offset)
194{ 193{
195 return (void *)&cpm2_immr->im_dprambase[offset]; 194 return (void *)&cpm2_immr->im_dprambase[offset];
196} 195}