History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc

* git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc: (114 commits) [POWERPC] Fix ohare IDE irq workaround on old powermacs [POWERPC] EEH: Power4 systems sometimes need multiple resets. [POWERPC] Include <asm/mmu.h> in arch/powerpc/sysdev/fsl_soc.h for phys_addr_t. [POWERPC] Demacrofy arch/powerpc/platforms/maple/pci.c [POWERPC] Maple U3 HT - reject inappropriate config space access [POWERPC] Fix IPIC pending register assignments [POWERPC] powerpc: fix building gdb against asm/ptrace.h [POWERPC] Remove DISCONTIGMEM cruft from page.h [POWERPC] Merge iSeries i/o operations with the rest [POWERPC] 40x: Fix debug status register defines [POWERPC] Fix compile error in sbc8560 [POWERPC] EEH: support MMIO enable recovery step [POWERPC] EEH: enable MMIO/DMA on frozen slot [POWERPC] EEH: code comment cleanup [POWERPC] EEH: balance pcidev_get/put calls [POWERPC] PPC: Fix xmon stack frame address in backtrace [POWERPC] Add AT_PLATFORM value for Xilinx Virtex-4 FX [POWERPC] Start arch/powerpc/boot code reorganization [POWERPC] Define of_read_ulong helper [POWERPC] iseries: eliminate a couple of warnings ...

Linus Torvalds committed 20 years ago

Commit 14d1adf2 parents e478bec 69917c2219 files · +4351 −2459Browse files

Unified · Split

219 files
  1. MAINTAINERS +7 −0
  2. arch/powerpc/Kconfig +13 −1
  3. arch/powerpc/Kconfig.debug +16 −0
  4. arch/powerpc/boot/Makefile +6 −1
  5. arch/powerpc/boot/dts/mpc8349emds.dts +8 −8
  6. arch/powerpc/boot/flatdevtree.h +46 −0
  7. arch/powerpc/boot/main.c +129 −121
  8. arch/powerpc/boot/of.c +131 −13
  9. arch/powerpc/boot/ops.h +100 −0
  10. arch/powerpc/boot/prom.h +0 −41
  11. arch/powerpc/boot/stdio.c +2 −2
  12. arch/powerpc/boot/stdio.h +8 −0
  13. arch/powerpc/boot/types.h +23 −0
  14. arch/powerpc/configs/maple_defconfig +1 −1
  15. arch/powerpc/kernel/Makefile +2 −2
  16. arch/powerpc/kernel/asm-offsets.c +16 −1
  17. arch/powerpc/kernel/btext.c +12 −12
  18. arch/powerpc/kernel/cpu_setup_ppc970.S +26 −77
  19. arch/powerpc/kernel/cputable.c +21 −0
  20. arch/powerpc/kernel/crash_dump.c +1 −1
  21. arch/powerpc/kernel/dma_64.c +28 −37
  22. arch/powerpc/kernel/entry_64.S +8 −0
  23. arch/powerpc/kernel/head_64.S +34 −20
  24. arch/powerpc/kernel/ibmebus.c +3 −3
  25. arch/powerpc/kernel/io.c +131 −0
  26. arch/powerpc/kernel/irq.c +5 −0
  27. arch/powerpc/kernel/legacy_serial.c +18 −17
  28. arch/powerpc/kernel/lparcfg.c +19 −11
  29. arch/powerpc/kernel/machine_kexec_64.c +4 −6
  30. arch/powerpc/kernel/misc.S +0 −159
  31. arch/powerpc/kernel/of_device.c +0 −24
  32. arch/powerpc/kernel/paca.c +14 −1
  33. arch/powerpc/kernel/pci_32.c +21 −18
  34. arch/powerpc/kernel/pci_64.c +16 −51
  35. arch/powerpc/kernel/pci_dn.c +7 −6
  36. arch/powerpc/kernel/ppc_ksyms.c +2 −17
  37. arch/powerpc/kernel/prom.c +14 −30
  38. arch/powerpc/kernel/prom_init.c +8 −2
  39. arch/powerpc/kernel/prom_parse.c +47 −43
  40. arch/powerpc/kernel/rtas-proc.c +13 −12
  41. arch/powerpc/kernel/rtas.c +28 −19
  42. arch/powerpc/kernel/rtas_pci.c +13 −15
  43. arch/powerpc/kernel/setup-common.c +18 −14
  44. arch/powerpc/kernel/setup_64.c +11 −12
  45. arch/powerpc/kernel/sysfs.c +4 −5
  46. arch/powerpc/kernel/time.c +3 −5
  47. arch/powerpc/kernel/traps.c +25 −0
  48. arch/powerpc/kernel/vio.c +8 −8
  49. arch/powerpc/lib/Makefile +0 −1
  50. arch/powerpc/lib/e2a.c +0 −116
  51. arch/powerpc/lib/locks.c +13 −14
  52. arch/powerpc/mm/numa.c +14 −17
  53. arch/powerpc/mm/slb.c +33 −4
  54. arch/powerpc/mm/tlb_64.c +1 −0
  55. arch/powerpc/platforms/83xx/mpc834x_itx.c +2 −2
  56. arch/powerpc/platforms/83xx/mpc834x_sys.c +2 −2
  57. arch/powerpc/platforms/83xx/pci.c +2 −2
  58. arch/powerpc/platforms/85xx/mpc85xx_ads.c +2 −2
  59. arch/powerpc/platforms/85xx/mpc85xx_cds.c +2 −2
  60. arch/powerpc/platforms/85xx/pci.c +2 −2
  61. arch/powerpc/platforms/86xx/mpc86xx_hpcn.c +2 −2
  62. arch/powerpc/platforms/86xx/pci.c +2 −2
  63. arch/powerpc/platforms/Makefile +1 −0
  64. arch/powerpc/platforms/cell/cbe_regs.c +3 −5
  65. arch/powerpc/platforms/cell/interrupt.c +12 −13
  66. arch/powerpc/platforms/cell/iommu.c +12 −10
  67. arch/powerpc/platforms/cell/setup.c +0 −4
  68. arch/powerpc/platforms/cell/smp.c +2 −2
  69. arch/powerpc/platforms/cell/spider-pic.c +5 −5
  70. arch/powerpc/platforms/cell/spu_base.c +9 −9
  71. arch/powerpc/platforms/chrp/nvram.c +3 −2
  72. arch/powerpc/platforms/chrp/pci.c +43 −10
  73. arch/powerpc/platforms/chrp/setup.c +35 −13
  74. arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c +4 −4
  75. arch/powerpc/platforms/iseries/Kconfig +6 −2
  76. arch/powerpc/platforms/iseries/dt.c +42 −3
  77. arch/powerpc/platforms/iseries/hvlpconfig.c +13 −0
  78. arch/powerpc/platforms/iseries/iommu.c +18 −1
  79. arch/powerpc/platforms/iseries/it_exp_vpd_panel.h +3 −3
  80. arch/powerpc/platforms/iseries/it_lp_naca.h +3 −3
  81. arch/powerpc/platforms/iseries/lpardata.c +2 −4
  82. arch/powerpc/platforms/iseries/lpevents.c +1 −1
  83. arch/powerpc/platforms/iseries/main_store.h +63 −63
  84. arch/powerpc/platforms/iseries/pci.c +232 −57
  85. arch/powerpc/platforms/iseries/setup.c +1 −0
  86. arch/powerpc/platforms/iseries/viopath.c +18 −10
  87. arch/powerpc/platforms/iseries/vpdinfo.c +13 −9
  88. arch/powerpc/platforms/maple/pci.c +42 −28
  89. arch/powerpc/platforms/maple/setup.c +10 −17
  90. arch/powerpc/platforms/pasemi/Makefile +1 −0
  91. arch/powerpc/platforms/pasemi/pasemi.h +8 −0
  92. arch/powerpc/platforms/pasemi/pci.c +198 −0
  93. arch/powerpc/platforms/pasemi/setup.c +188 −0
  94. arch/powerpc/platforms/pasemi/time.c +29 −0
  95. arch/powerpc/platforms/powermac/backlight.c +2 −1
  96. arch/powerpc/platforms/powermac/cpufreq_32.c +12 −11
  97. arch/powerpc/platforms/powermac/cpufreq_64.c +14 −13
  98. arch/powerpc/platforms/powermac/feature.c +15 −15
  99. arch/powerpc/platforms/powermac/low_i2c.c +12 −12
  100. arch/powerpc/platforms/powermac/pci.c +20 −17
  101. arch/powerpc/platforms/powermac/pfunc_base.c +1 −1
  102. arch/powerpc/platforms/powermac/pfunc_core.c +3 −2
  103. arch/powerpc/platforms/powermac/setup.c +8 −10
  104. arch/powerpc/platforms/powermac/smp.c +3 −4
  105. arch/powerpc/platforms/powermac/udbg_scc.c +5 −5
  106. arch/powerpc/platforms/pseries/Makefile +1 −0
  107. arch/powerpc/platforms/pseries/eeh.c +73 −23
  108. arch/powerpc/platforms/pseries/eeh_cache.c +2 −15
  109. arch/powerpc/platforms/pseries/eeh_driver.c +87 −25
  110. arch/powerpc/platforms/pseries/eeh_event.c +2 −2
  111. arch/powerpc/platforms/pseries/firmware.c +1 −1
  112. arch/powerpc/platforms/pseries/hvCall.S +104 −169
  113. arch/powerpc/platforms/pseries/hvCall_inst.c +129 −0
  114. arch/powerpc/platforms/pseries/hvconsole.c +3 −2
  115. arch/powerpc/platforms/pseries/iommu.c +6 −7
  116. arch/powerpc/platforms/pseries/lpar.c +29 −17
  117. arch/powerpc/platforms/pseries/nvram.c +3 −2
  118. arch/powerpc/platforms/pseries/pci.c +1 −1
  119. arch/powerpc/platforms/pseries/plpar_wrappers.h +90 −17
  120. arch/powerpc/platforms/pseries/ras.c +2 −2
  121. arch/powerpc/platforms/pseries/rtasd.c +2 −2
  122. arch/powerpc/platforms/pseries/setup.c +28 −14
  123. arch/powerpc/platforms/pseries/smp.c +6 −6
  124. arch/powerpc/platforms/pseries/xics.c +12 −32
  125. arch/powerpc/sysdev/fsl_soc.c +14 −14
  126. arch/powerpc/sysdev/fsl_soc.h +2 −0
  127. arch/powerpc/sysdev/i8259.c +1 −1
  128. arch/powerpc/sysdev/ipic.c +21 −21
  129. arch/powerpc/sysdev/mmio_nvram.c +2 −2
  130. arch/powerpc/sysdev/tsi108_pci.c +2 −2
  131. arch/powerpc/xmon/xmon.c +10 −0
  132. arch/ppc/Kconfig +3 −3
  133. arch/ppc/kernel/misc.S +0 −88
  134. arch/ppc/kernel/ppc_ksyms.c +0 −9
  135. arch/ppc/kernel/setup.c +12 −5
  136. arch/ppc/platforms/85xx/sbc8560.h +1 −0
  137. arch/ppc/platforms/85xx/sbc85xx.h +18 −0
  138. arch/ppc/syslib/m8260_pci_erratum9.c +0 −16
  139. arch/ppc/xmon/start.c +18 −10
  140. arch/ppc/xmon/xmon.c +21 −7
  141. drivers/char/Kconfig +22 −0
  142. drivers/char/Makefile +2 −0
  143. drivers/char/agp/uninorth-agp.c +2 −2
  144. drivers/char/briq_panel.c +268 −0
  145. drivers/char/hvc_console.c +10 −8
  146. drivers/char/hvc_console.h +1 −1
  147. drivers/char/hvc_iseries.c +594 −0
  148. drivers/char/hvc_rtas.c +1 −1
  149. drivers/char/hvc_vio.c +4 −3
  150. drivers/char/hvsi.c +3 −4
  151. drivers/char/tpm/tpm_atmel.h +2 −2
  152. drivers/char/viocons.c +1 −30
  153. drivers/char/viotape.c +2 −4
  154. drivers/i2c/busses/i2c-powermac.c +2 −1
  155. drivers/ide/ppc/pmac.c +4 −4
  156. drivers/macintosh/macio_asic.c +6 −4
  157. drivers/macintosh/macio_sysfs.c +4 −4
  158. drivers/macintosh/smu.c +9 −10
  159. drivers/macintosh/therm_adt746x.c +4 −4
  160. drivers/macintosh/therm_pm72.c +7 −7
  161. drivers/macintosh/therm_windtunnel.c +2 −2
  162. drivers/macintosh/via-cuda.c +2 −2
  163. drivers/macintosh/via-pmu-led.c +1 −1
  164. drivers/macintosh/via-pmu.c +5 −5
  165. drivers/macintosh/windfarm_pm81.c +2 −2
  166. drivers/macintosh/windfarm_pm91.c +1 −1
  167. drivers/macintosh/windfarm_smu_controls.c +7 −6
  168. drivers/macintosh/windfarm_smu_sat.c +4 −4
  169. drivers/macintosh/windfarm_smu_sensors.c +6 −6
  170. drivers/net/bmac.c +8 −5
  171. drivers/net/ibmveth.c +2 −1
  172. drivers/net/ibmveth.h +15 −12
  173. drivers/net/mace.c +1 −1
  174. drivers/net/spider_net.c +6 −6
  175. drivers/net/sungem.c +1 −1
  176. drivers/pci/hotplug/rpaphp_core.c +16 −16
  177. drivers/scsi/ibmvscsi/rpa_vscsi.c +4 −7
  178. drivers/scsi/mac53c94.c +1 −1
  179. drivers/scsi/mesh.c +3 −2
  180. drivers/scsi/sata_svw.c +1 −1
  181. drivers/serial/pmac_zilog.c +5 −4
  182. drivers/video/S3triofb.c +6 −6
  183. drivers/video/aty/radeon_base.c +4 −4
  184. drivers/video/aty/radeon_monitor.c +6 −6
  185. drivers/video/aty/radeon_pm.c +2 −2
  186. drivers/video/nvidia/nv_of.c +5 −7
  187. drivers/video/offb.c +11 −11
  188. drivers/video/riva/fbdev.c +2 −3
  189. include/asm-powerpc/cputable.h +18 −9
  190. include/asm-powerpc/hvcall.h +42 −79
  191. include/asm-powerpc/ibmebus.h +1 −1
  192. include/asm-powerpc/ide.h +6 −6
  193. include/asm-powerpc/io.h +84 −99
  194. include/asm-powerpc/irq.h +12 −12
  195. include/asm-powerpc/iseries/hv_call_xm.h +0 −17
  196. include/asm-powerpc/iseries/hv_lp_config.h +2 −11
  197. include/asm-powerpc/iseries/iseries_io.h +0 −60
  198. include/asm-powerpc/iseries/it_lp_queue.h +0 −2
  199. include/asm-powerpc/iseries/vio.h +28 −0
  200. include/asm-powerpc/lppaca.h +21 −2
  201. include/asm-powerpc/paca.h +3 −0
  202. include/asm-powerpc/page.h +0 −6
  203. include/asm-powerpc/ppc-pci.h +11 −0
  204. include/asm-powerpc/processor.h +1 −0
  205. include/asm-powerpc/prom.h +25 −15
  206. include/asm-powerpc/ptrace.h +0 −4
  207. include/asm-powerpc/reg.h +1 −0
  208. include/asm-powerpc/rtas.h +16 −0
  209. include/asm-powerpc/smu.h +1 −1
  210. include/asm-powerpc/spu.h +1 −1
  211. include/asm-powerpc/system.h +0 −5
  212. include/asm-powerpc/vio.h +2 −2
  213. include/asm-ppc/io.h +6 −20
  214. include/asm-ppc/mpc8260_pci9.h +0 −4
  215. include/asm-ppc/reg_booke.h +8 −8
  216. scripts/checkstack.pl +2 −0
  217. sound/aoa/core/snd-aoa-gpio-feature.c +1 −1
  218. sound/oss/dmasound/dmasound_awacs.c +6 −5
  219. sound/ppc/tumbler.c +8 −7
MAINTAINERS+7−0
@@ -1783,6 +1783,13 @@ W: http://www.penguinppc.org/ · 1782 unmodified lines
17831783 L: linuxppc-embedded@ozlabs.org
17841784 S: Maintained
17851785
1786+LINUX FOR POWERPC PA SEMI PWRFICIENT
1787+P: Olof Johansson
1788+M: olof@lixom.net
1789+W: http://www.pasemi.com/
1790+L: linuxppc-dev@ozlabs.org
1791+S: Supported
1792+
17861793 LLC (802.2)
17871794 P: Arnaldo Carvalho de Melo
17881795 M: acme@conectiva.com.br
arch/powerpc/Kconfig+13−1
@@ -417,6 +417,17 @@ config PPC_MAPLE · 416 unmodified lines
417417 This option enables support for the Maple 970FX Evaluation Board.
418418 For more informations, refer to <http://www.970eval.com>
419419
420+config PPC_PASEMI
421+ depends on PPC_MULTIPLATFORM && PPC64
422+ bool "PA Semi SoC-based platforms"
423+ default n
424+ select MPIC
425+ select PPC_UDBG_16550
426+ select GENERIC_TBSYNC
427+ help
428+ This option enables support for PA Semi's PWRficient line
429+ of SoC processors, including PA6T-1682M
430+
420431 config PPC_CELL
421432 bool
422433 default n
@@ -436,7 +447,8 @@ config PPC_IBM_CELL_BLADE · 13 unmodified lines
436447 select UDBG_RTAS_CONSOLE
437448
438449 config UDBG_RTAS_CONSOLE
439− bool
450+ bool "RTAS based debug console"
451+ depends on PPC_RTAS
440452 default n
441453
442454 config XICS
arch/powerpc/Kconfig.debug+16−0
@@ -18,6 +18,20 @@ config DEBUG_STACK_USAGE · 17 unmodified lines
1818
1919 This option will slow down process creation somewhat.
2020
21+config HCALL_STATS
22+ bool "Hypervisor call instrumentation"
23+ depends on PPC_PSERIES && DEBUG_FS
24+ help
25+ Adds code to keep track of the number of hypervisor calls made and
26+ the amount of time spent in hypervisor callsr. Wall time spent in
27+ each call is always calculated, and if available CPU cycles spent
28+ are also calculated. A directory named hcall_inst is added at the
29+ root of the debugfs filesystem. Within the hcall_inst directory
30+ are files that contain CPU specific call statistics.
31+
32+ This option will add a small amount of overhead to all hypervisor
33+ calls.
34+
2135 config DEBUGGER
2236 bool "Enable debugger hooks"
2337 depends on DEBUG_KERNEL
@@ -74,6 +88,8 @@ config XMON · 50 unmodified lines
7488 very early during boot. 'xmon=on' will just enable the xmon
7589 debugger hooks. 'xmon=off' will disable the debugger hooks
7690 if CONFIG_XMON_DEFAULT is set.
91+ xmon will print a backtrace on the very first invocation.
92+ 'xmon=nobt' will disable this autobacktrace.
7793
7894 config XMON_DEFAULT
7995 bool "Enable xmon by default"
arch/powerpc/boot/Makefile+6−1
@@ -36,11 +36,16 @@ zliblinuxheader := zlib.h zconf.h zutil.h · 35 unmodified lines
3636 $(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader))
3737 #$(addprefix $(obj)/,main.o): $(addprefix $(obj)/,zlib.h)
3838
39−src-boot := crt0.S string.S prom.c stdio.c main.c div64.S
39+src-boot-$(CONFIG_PPC_MULTIPLATFORM) := of.c
40+src-boot := crt0.S string.S stdio.c main.c div64.S $(src-boot-y)
4041 src-boot += $(zlib)
4142 src-boot := $(addprefix $(obj)/, $(src-boot))
4243 obj-boot := $(addsuffix .o, $(basename $(src-boot)))
4344
45+ifeq ($(call cc-option-yn, -fstack-protector),y)
46+BOOTCFLAGS += -fno-stack-protector
47+endif
48+
4449 BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj)
4550
4651 quiet_cmd_copy_zlib = COPY $@
arch/powerpc/boot/dts/mpc8349emds.dts+8−8
@@ -214,10 +214,10 @@ · 213 unmodified lines
214214 b800 0 0 4 700 15 8
215215
216216 /* IDSEL 0x18 */
217− b000 0 0 1 700 15 8
218− b000 0 0 2 700 16 8
219− b000 0 0 3 700 17 8
220− b000 0 0 4 700 14 8>;
217+ c000 0 0 1 700 15 8
218+ c000 0 0 2 700 16 8
219+ c000 0 0 3 700 17 8
220+ c000 0 0 4 700 14 8>;
221221 interrupt-parent = <700>;
222222 interrupts = <42 8>;
223223 bus-range = <0 0>;
@@ -274,10 +274,10 @@ · 50 unmodified lines
274274 b800 0 0 4 700 15 8
275275
276276 /* IDSEL 0x18 */
277− b000 0 0 1 700 15 8
278− b000 0 0 2 700 16 8
279− b000 0 0 3 700 17 8
280− b000 0 0 4 700 14 8>;
277+ c000 0 0 1 700 15 8
278+ c000 0 0 2 700 16 8
279+ c000 0 0 3 700 17 8
280+ c000 0 0 4 700 14 8>;
281281 interrupt-parent = <700>;
282282 interrupts = <42 8>;
283283 bus-range = <0 0>;
arch/powerpc/boot/flatdevtree.h+46−0
@@ -0,0 +1,46 @@
1+/*
2+ * This program is free software; you can redistribute it and/or modify
3+ * it under the terms of the GNU General Public License as published by
4+ * the Free Software Foundation; either version 2 of the License, or
5+ * (at your option) any later version.
6+ *
7+ * This program is distributed in the hope that it will be useful,
8+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
9+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10+ * GNU General Public License for more details.
11+ *
12+ * You should have received a copy of the GNU General Public License
13+ * along with this program; if not, write to the Free Software
14+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15+ */
16+
17+#ifndef FLATDEVTREE_H
18+#define FLATDEVTREE_H
19+
20+#include "types.h"
21+
22+/* Definitions used by the flattened device tree */
23+#define OF_DT_HEADER 0xd00dfeed /* marker */
24+#define OF_DT_BEGIN_NODE 0x1 /* Start of node, full name */
25+#define OF_DT_END_NODE 0x2 /* End node */
26+#define OF_DT_PROP 0x3 /* Property: name off, size, content */
27+#define OF_DT_NOP 0x4 /* nop */
28+#define OF_DT_END 0x9
29+
30+#define OF_DT_VERSION 0x10
31+
32+struct boot_param_header {
33+ u32 magic; /* magic word OF_DT_HEADER */
34+ u32 totalsize; /* total size of DT block */
35+ u32 off_dt_struct; /* offset to structure */
36+ u32 off_dt_strings; /* offset to strings */
37+ u32 off_mem_rsvmap; /* offset to memory reserve map */
38+ u32 version; /* format version */
39+ u32 last_comp_version; /* last compatible version */
40+ /* version 2 fields below */
41+ u32 boot_cpuid_phys; /* Physical CPU id we're booting on */
42+ /* version 3 fields below */
43+ u32 dt_strings_size; /* size of the DT strings block */
44+};
45+
46+#endif /* FLATDEVTREE_H */
arch/powerpc/boot/main.c+129−121
@@ -14,17 +14,12 @@ · 13 unmodified lines
1414 #include "page.h"
1515 #include "string.h"
1616 #include "stdio.h"
17−#include "prom.h"
1817 #include "zlib.h"
18+#include "ops.h"
19+#include "flatdevtree.h"
1920
2021 extern void flush_cache(void *, unsigned long);
2122
22−
23−/* Value picked to match that used by yaboot */
24−#define PROG_START 0x01400000 /* only used on 64-bit systems */
25−#define RAM_END (512<<20) /* Fixme: use OF */
26−#define ONE_MB 0x100000
27−
2823 extern char _start[];
2924 extern char __bss_start[];
3025 extern char _end[];
@@ -33,14 +28,6 @@ extern char _vmlinux_end[]; · 2 unmodified lines
3328 extern char _initrd_start[];
3429 extern char _initrd_end[];
3530
36−/* A buffer that may be edited by tools operating on a zImage binary so as to
37− * edit the command line passed to vmlinux (by setting /chosen/bootargs).
38− * The buffer is put in it's own section so that tools may locate it easier.
39− */
40−static char builtin_cmdline[512]
41− __attribute__((section("__builtin_cmdline")));
42−
43−
4431 struct addr_range {
4532 unsigned long addr;
4633 unsigned long size;
@@ -51,21 +38,16 @@ static struct addr_range vmlinuz; · 4 unmodified lines
5138 static struct addr_range initrd;
5239
5340 static unsigned long elfoffset;
41+static int is_64bit;
5442
55−static char scratch[46912]; /* scratch space for gunzip, from zlib_inflate_workspacesize() */
43+/* scratch space for gunzip; 46912 is from zlib_inflate_workspacesize() */
44+static char scratch[46912];
5645 static char elfheader[256];
5746
58−
59−typedef void (*kernel_entry_t)( unsigned long,
60− unsigned long,
61− void *,
62− void *);
63−
47+typedef void (*kernel_entry_t)(unsigned long, unsigned long, void *);
6448
6549 #undef DEBUG
6650
67−static unsigned long claim_base;
68−
6951 #define HEAD_CRC 2
7052 #define EXTRA_FIELD 4
7153 #define ORIG_NAME 8
@@ -123,24 +105,6 @@ static void gunzip(void *dst, int dstlen, unsigned char *src, int *lenp) · 51 unmodified lines
123105 zlib_inflateEnd(&s);
124106 }
125107
126−static unsigned long try_claim(unsigned long size)
127−{
128− unsigned long addr = 0;
129−
130− for(; claim_base < RAM_END; claim_base += ONE_MB) {
131−#ifdef DEBUG
132− printf(" trying: 0x%08lx\n\r", claim_base);
133−#endif
134− addr = (unsigned long)claim(claim_base, size, 0);
135− if ((void *)addr != (void *)-1)
136− break;
137− }
138− if (addr == 0)
139− return 0;
140− claim_base = PAGE_ALIGN(claim_base + size);
141− return addr;
142−}
143−
144108 static int is_elf64(void *hdr)
145109 {
146110 Elf64_Ehdr *elf64 = hdr;
@@ -169,16 +133,7 @@ static int is_elf64(void *hdr) · 22 unmodified lines
169133 vmlinux.size = (unsigned long)elf64ph->p_filesz + elfoffset;
170134 vmlinux.memsize = (unsigned long)elf64ph->p_memsz + elfoffset;
171135
172−#if defined(PROG_START)
173− /*
174− * Maintain a "magic" minimum address. This keeps some older
175− * firmware platforms running.
176− */
177−
178− if (claim_base < PROG_START)
179− claim_base = PROG_START;
180−#endif
181−
136+ is_64bit = 1;
182137 return 1;
183138 }
184139
@@ -212,47 +167,9 @@ static int is_elf32(void *hdr) · 27 unmodified lines
212167 return 1;
213168 }
214169
215−void export_cmdline(void* chosen_handle)
216−{
217− int len;
218− char cmdline[2] = { 0, 0 };
219−
220− if (builtin_cmdline[0] == 0)
221− return;
222−
223− len = getprop(chosen_handle, "bootargs", cmdline, sizeof(cmdline));
224− if (len > 0 && cmdline[0] != 0)
225− return;
226−
227− setprop(chosen_handle, "bootargs", builtin_cmdline,
228− strlen(builtin_cmdline) + 1);
229−}
230−
231−
232−void start(unsigned long a1, unsigned long a2, void *promptr, void *sp)
170+static void prep_kernel(unsigned long *a1, unsigned long *a2)
233171 {
234172 int len;
235− kernel_entry_t kernel_entry;
236−
237− memset(__bss_start, 0, _end - __bss_start);
238−
239− prom = (int (*)(void *)) promptr;
240− chosen_handle = finddevice("/chosen");
241− if (chosen_handle == (void *) -1)
242− exit();
243− if (getprop(chosen_handle, "stdout", &stdout, sizeof(stdout)) != 4)
244− exit();
245−
246− printf("\n\rzImage starting: loaded at 0x%p (sp: 0x%p)\n\r", _start, sp);
247−
248− /*
249− * The first available claim_base must be above the end of the
250− * the loaded kernel wrapper file (_start to _end includes the
251− * initrd image if it is present) and rounded up to a nice
252− * 1 MB boundary for good measure.
253− */
254−
255− claim_base = _ALIGN_UP((unsigned long)_end, ONE_MB);
256173
257174 vmlinuz.addr = (unsigned long)_vmlinux_start;
258175 vmlinuz.size = (unsigned long)(_vmlinux_end - _vmlinux_start);
@@ -263,43 +180,51 @@ void start(unsigned long a1, unsigned long a2, void *promptr, void *sp) · 4 unmodified lines
263180 gunzip(elfheader, sizeof(elfheader),
264181 (unsigned char *)vmlinuz.addr, &len);
265182 } else
266− memcpy(elfheader, (const void *)vmlinuz.addr, sizeof(elfheader));
183+ memcpy(elfheader, (const void *)vmlinuz.addr,
184+ sizeof(elfheader));
267185
268186 if (!is_elf64(elfheader) && !is_elf32(elfheader)) {
269187 printf("Error: not a valid PPC32 or PPC64 ELF file!\n\r");
270188 exit();
271189 }
190+ if (platform_ops.image_hdr)
191+ platform_ops.image_hdr(elfheader);
272192
273− /* We need to claim the memsize plus the file offset since gzip
193+ /* We need to alloc the memsize plus the file offset since gzip
274194 * will expand the header (file offset), then the kernel, then
275195 * possible rubbish we don't care about. But the kernel bss must
276196 * be claimed (it will be zero'd by the kernel itself)
277197 */
278198 printf("Allocating 0x%lx bytes for kernel ...\n\r", vmlinux.memsize);
279− vmlinux.addr = try_claim(vmlinux.memsize);
199+ vmlinux.addr = (unsigned long)malloc(vmlinux.memsize);
280200 if (vmlinux.addr == 0) {
281201 printf("Can't allocate memory for kernel image !\n\r");
282202 exit();
283203 }
284204
285205 /*
286− * Now we try to claim memory for the initrd (and copy it there)
206+ * Now we try to alloc memory for the initrd (and copy it there)
287207 */
288208 initrd.size = (unsigned long)(_initrd_end - _initrd_start);
289209 initrd.memsize = initrd.size;
290210 if ( initrd.size > 0 ) {
291− printf("Allocating 0x%lx bytes for initrd ...\n\r", initrd.size);
292− initrd.addr = try_claim(initrd.size);
211+ printf("Allocating 0x%lx bytes for initrd ...\n\r",
212+ initrd.size);
213+ initrd.addr = (unsigned long)malloc((u32)initrd.size);
293214 if (initrd.addr == 0) {
294− printf("Can't allocate memory for initial ramdisk !\n\r");
215+ printf("Can't allocate memory for initial "
216+ "ramdisk !\n\r");
295217 exit();
296218 }
297− a1 = initrd.addr;
298− a2 = initrd.size;
299− printf("initial ramdisk moving 0x%lx <- 0x%lx (0x%lx bytes)\n\r",
300− initrd.addr, (unsigned long)_initrd_start, initrd.size);
301− memmove((void *)initrd.addr, (void *)_initrd_start, initrd.size);
302− printf("initrd head: 0x%lx\n\r", *((unsigned long *)initrd.addr));
219+ *a1 = initrd.addr;
220+ *a2 = initrd.size;
221+ printf("initial ramdisk moving 0x%lx <- 0x%lx "
222+ "(0x%lx bytes)\n\r", initrd.addr,
223+ (unsigned long)_initrd_start, initrd.size);
224+ memmove((void *)initrd.addr, (void *)_initrd_start,
225+ initrd.size);
226+ printf("initrd head: 0x%lx\n\r",
227+ *((unsigned long *)initrd.addr));
303228 }
304229
305230 /* Eventually gunzip the kernel */
@@ -311,11 +236,10 @@ void start(unsigned long a1, unsigned long a2, void *promptr, void *sp) · 5 unmodified lines
311236 (unsigned char *)vmlinuz.addr, &len);
312237 printf("done 0x%lx bytes\n\r", len);
313238 } else {
314− memmove((void *)vmlinux.addr,(void *)vmlinuz.addr,vmlinuz.size);
239+ memmove((void *)vmlinux.addr,(void *)vmlinuz.addr,
240+ vmlinuz.size);
315241 }
316242
317− export_cmdline(chosen_handle);
318−
319243 /* Skip over the ELF header */
320244 #ifdef DEBUG
321245 printf("... skipping 0x%lx bytes of ELF header\n\r",
@@ -324,23 +248,107 @@ void start(unsigned long a1, unsigned long a2, void *promptr, void *sp) · 2 unmodified lines
324248 vmlinux.addr += elfoffset;
325249
326250 flush_cache((void *)vmlinux.addr, vmlinux.size);
251+}
327252
328− kernel_entry = (kernel_entry_t)vmlinux.addr;
329−#ifdef DEBUG
330− printf( "kernel:\n\r"
331− " entry addr = 0x%lx\n\r"
332− " a1 = 0x%lx,\n\r"
333− " a2 = 0x%lx,\n\r"
334− " prom = 0x%lx,\n\r"
335− " bi_recs = 0x%lx,\n\r",
336− (unsigned long)kernel_entry, a1, a2,
337− (unsigned long)prom, NULL);
338−#endif
253+void __attribute__ ((weak)) ft_init(void *dt_blob)
254+{
255+}
339256
340− kernel_entry(a1, a2, prom, NULL);
257+/* A buffer that may be edited by tools operating on a zImage binary so as to
258+ * edit the command line passed to vmlinux (by setting /chosen/bootargs).
259+ * The buffer is put in it's own section so that tools may locate it easier.
260+ */
261+static char builtin_cmdline[COMMAND_LINE_SIZE]
262+ __attribute__((__section__("__builtin_cmdline")));
341263
342− printf("Error: Linux kernel returned to zImage bootloader!\n\r");
264+static void get_cmdline(char *buf, int size)
265+{
266+ void *devp;
267+ int len = strlen(builtin_cmdline);
343268
344− exit();
269+ buf[0] = '\0';
270+
271+ if (len > 0) { /* builtin_cmdline overrides dt's /chosen/bootargs */
272+ len = min(len, size-1);
273+ strncpy(buf, builtin_cmdline, len);
274+ buf[len] = '\0';
275+ }
276+ else if ((devp = finddevice("/chosen")))
277+ getprop(devp, "bootargs", buf, size);
278+}
279+
280+static void set_cmdline(char *buf)
281+{
282+ void *devp;
283+
284+ if ((devp = finddevice("/chosen")))
285+ setprop(devp, "bootargs", buf, strlen(buf) + 1);
345286 }
346287
288+/* Section where ft can be tacked on after zImage is built */
289+union blobspace {
290+ struct boot_param_header hdr;
291+ char space[8*1024];
292+} dt_blob __attribute__((__section__("__builtin_ft")));
293+
294+struct platform_ops platform_ops;
295+struct dt_ops dt_ops;
296+struct console_ops console_ops;
297+
298+void start(unsigned long a1, unsigned long a2, void *promptr, void *sp)
299+{
300+ int have_dt = 0;
301+ kernel_entry_t kentry;
302+ char cmdline[COMMAND_LINE_SIZE];
303+
304+ memset(__bss_start, 0, _end - __bss_start);
305+ memset(&platform_ops, 0, sizeof(platform_ops));
306+ memset(&dt_ops, 0, sizeof(dt_ops));
307+ memset(&console_ops, 0, sizeof(console_ops));
308+
309+ /* Override the dt_ops and device tree if there was an flat dev
310+ * tree attached to the zImage.
311+ */
312+ if (dt_blob.hdr.magic == OF_DT_HEADER) {
313+ have_dt = 1;
314+ ft_init(&dt_blob);
315+ }
316+
317+ if (platform_init(promptr))
318+ exit();
319+ if (console_ops.open && (console_ops.open() < 0))
320+ exit();
321+ if (platform_ops.fixups)
322+ platform_ops.fixups();
323+
324+ printf("\n\rzImage starting: loaded at 0x%p (sp: 0x%p)\n\r",
325+ _start, sp);
326+
327+ prep_kernel(&a1, &a2);
328+
329+ /* If cmdline came from zimage wrapper or if we can edit the one
330+ * in the dt, print it out and edit it, if possible.
331+ */
332+ if ((strlen(builtin_cmdline) > 0) || console_ops.edit_cmdline) {
333+ get_cmdline(cmdline, COMMAND_LINE_SIZE);
334+ printf("\n\rLinux/PowerPC load: %s", cmdline);
335+ if (console_ops.edit_cmdline)
336+ console_ops.edit_cmdline(cmdline, COMMAND_LINE_SIZE);
337+ printf("\n\r");
338+ set_cmdline(cmdline);
339+ }
340+
341+ if (console_ops.close)
342+ console_ops.close();
343+
344+ kentry = (kernel_entry_t) vmlinux.addr;
345+ if (have_dt)
346+ kentry(dt_ops.ft_addr(), 0, NULL);
347+ else
348+ /* XXX initrd addr/size should be passed in properties */
349+ kentry(a1, a2, promptr);
350+
351+ /* console closed so printf below may not work */
352+ printf("Error: Linux kernel returned to zImage boot wrapper!\n\r");
353+ exit();
354+}
arch/powerpc/boot/of.crenamed from arch/powerpc/boot/prom.c+131−13
@@ -8,15 +8,29 @@ · 7 unmodified lines
88 */
99 #include <stdarg.h>
1010 #include <stddef.h>
11+#include "types.h"
12+#include "elf.h"
1113 #include "string.h"
1214 #include "stdio.h"
13−#include "prom.h"
15+#include "page.h"
16+#include "ops.h"
1417
15−int (*prom)(void *);
16−phandle chosen_handle;
17−ihandle stdout;
18+typedef void *ihandle;
19+typedef void *phandle;
1820
19−int call_prom(const char *service, int nargs, int nret, ...)
21+extern char _end[];
22+
23+/* Value picked to match that used by yaboot */
24+#define PROG_START 0x01400000 /* only used on 64-bit systems */
25+#define RAM_END (512<<20) /* Fixme: use OF */
26+#define ONE_MB 0x100000
27+
28+int (*prom) (void *);
29+
30+
31+static unsigned long claim_base;
32+
33+static int call_prom(const char *service, int nargs, int nret, ...)
2034 {
2135 int i;
2236 struct prom_args {
@@ -45,7 +59,7 @@ int call_prom(const char *service, int nargs, int nret, ...) · 22 unmodified lines
4559 return (nret > 0)? args.args[nargs]: 0;
4660 }
4761
48−int call_prom_ret(const char *service, int nargs, int nret,
62+static int call_prom_ret(const char *service, int nargs, int nret,
4963 unsigned int *rets, ...)
5064 {
5165 int i;
@@ -79,11 +93,6 @@ int call_prom_ret(const char *service, int nargs, int nret, · 27 unmodified lines
7993 return (nret > 0)? args.args[nargs]: 0;
8094 }
8195
82−int write(void *handle, void *ptr, int nb)
83−{
84− return call_prom("write", 3, 1, handle, ptr, nb);
85−}
86−
8796 /*
8897 * Older OF's require that when claiming a specific range of addresses,
8998 * we claim the physical space in the /memory node and the virtual
@@ -142,7 +151,7 @@ static int check_of_version(void) · 52 unmodified lines
142151 return 1;
143152 }
144153
145−void *claim(unsigned long virt, unsigned long size, unsigned long align)
154+static void *claim(unsigned long virt, unsigned long size, unsigned long align)
146155 {
147156 int ret;
148157 unsigned int result;
@@ -151,7 +160,7 @@ void *claim(unsigned long virt, unsigned long size, unsigned long align) · 2 unmodified lines
151160 need_map = check_of_version();
152161 if (align || !need_map)
153162 return (void *) call_prom("claim", 3, 1, virt, size, align);
154−
163+
155164 ret = call_prom_ret("call-method", 5, 2, &result, "claim", memory,
156165 align, size, virt);
157166 if (ret != 0 || result == -1)
@@ -163,3 +172,112 @@ void *claim(unsigned long virt, unsigned long size, unsigned long align) · 5 unmodified lines
163172 0x12, size, virt, virt);
164173 return (void *) virt;
165174 }
175+
176+static void *of_try_claim(u32 size)
177+{
178+ unsigned long addr = 0;
179+ static u8 first_time = 1;
180+
181+ if (first_time) {
182+ claim_base = _ALIGN_UP((unsigned long)_end, ONE_MB);
183+ first_time = 0;
184+ }
185+
186+ for(; claim_base < RAM_END; claim_base += ONE_MB) {
187+#ifdef DEBUG
188+ printf(" trying: 0x%08lx\n\r", claim_base);
189+#endif
190+ addr = (unsigned long)claim(claim_base, size, 0);
191+ if ((void *)addr != (void *)-1)
192+ break;
193+ }
194+ if (addr == 0)
195+ return NULL;
196+ claim_base = PAGE_ALIGN(claim_base + size);
197+ return (void *)addr;
198+}
199+
200+static void of_image_hdr(const void *hdr)
201+{
202+ const Elf64_Ehdr *elf64 = hdr;
203+
204+ if (elf64->e_ident[EI_CLASS] == ELFCLASS64) {
205+ /*
206+ * Maintain a "magic" minimum address. This keeps some older
207+ * firmware platforms running.
208+ */
209+ if (claim_base < PROG_START)
210+ claim_base = PROG_START;
211+ }
212+}
213+
214+static void of_exit(void)
215+{
216+ call_prom("exit", 0, 0);
217+}
218+
219+/*
220+ * OF device tree routines
221+ */
222+static void *of_finddevice(const char *name)
223+{
224+ return (phandle) call_prom("finddevice", 1, 1, name);
225+}
226+
227+static int of_getprop(const void *phandle, const char *name, void *buf,
228+ const int buflen)
229+{
230+ return call_prom("getprop", 4, 1, phandle, name, buf, buflen);
231+}
232+
233+static int of_setprop(const void *phandle, const char *name, const void *buf,
234+ const int buflen)
235+{
236+ return call_prom("setprop", 4, 1, phandle, name, buf, buflen);
237+}
238+
239+/*
240+ * OF console routines
241+ */
242+static void *of_stdout_handle;
243+
244+static int of_console_open(void)
245+{
246+ void *devp;
247+
248+ if (((devp = finddevice("/chosen")) != NULL)
249+ && (getprop(devp, "stdout", &of_stdout_handle,
250+ sizeof(of_stdout_handle))
251+ == sizeof(of_stdout_handle)))
252+ return 0;
253+
254+ return -1;
255+}
256+
257+static void of_console_write(char *buf, int len)
258+{
259+ call_prom("write", 3, 1, of_stdout_handle, buf, len);
260+}
261+
262+int platform_init(void *promptr)
263+{
264+ platform_ops.fixups = NULL;
265+ platform_ops.image_hdr = of_image_hdr;
266+ platform_ops.malloc = of_try_claim;
267+ platform_ops.free = NULL;
268+ platform_ops.exit = of_exit;
269+
270+ dt_ops.finddevice = of_finddevice;
271+ dt_ops.getprop = of_getprop;
272+ dt_ops.setprop = of_setprop;
273+ dt_ops.translate_addr = NULL;
274+
275+ console_ops.open = of_console_open;
276+ console_ops.write = of_console_write;
277+ console_ops.edit_cmdline = NULL;
278+ console_ops.close = NULL;
279+ console_ops.data = NULL;
280+
281+ prom = (int (*)(void *))promptr;
282+ return 0;
283+}
arch/powerpc/boot/ops.h+100−0
@@ -0,0 +1,100 @@
1+/*
2+ * Global definition of all the bootwrapper operations.
3+ *
4+ * Author: Mark A. Greer <mgreer@mvista.com>
5+ *
6+ * 2006 (c) MontaVista Software, Inc. This file is licensed under
7+ * the terms of the GNU General Public License version 2. This program
8+ * is licensed "as is" without any warranty of any kind, whether express
9+ * or implied.
10+ */
11+#ifndef _PPC_BOOT_OPS_H_
12+#define _PPC_BOOT_OPS_H_
13+
14+#include "types.h"
15+
16+#define COMMAND_LINE_SIZE 512
17+#define MAX_PATH_LEN 256
18+#define MAX_PROP_LEN 256 /* What should this be? */
19+
20+/* Platform specific operations */
21+struct platform_ops {
22+ void (*fixups)(void);
23+ void (*image_hdr)(const void *);
24+ void * (*malloc)(u32 size);
25+ void (*free)(void *ptr, u32 size);
26+ void (*exit)(void);
27+};
28+extern struct platform_ops platform_ops;
29+
30+/* Device Tree operations */
31+struct dt_ops {
32+ void * (*finddevice)(const char *name);
33+ int (*getprop)(const void *node, const char *name, void *buf,
34+ const int buflen);
35+ int (*setprop)(const void *node, const char *name,
36+ const void *buf, const int buflen);
37+ u64 (*translate_addr)(const char *path, const u32 *in_addr,
38+ const u32 addr_len);
39+ unsigned long (*ft_addr)(void);
40+};
41+extern struct dt_ops dt_ops;
42+
43+/* Console operations */
44+struct console_ops {
45+ int (*open)(void);
46+ void (*write)(char *buf, int len);
47+ void (*edit_cmdline)(char *buf, int len);
48+ void (*close)(void);
49+ void *data;
50+};
51+extern struct console_ops console_ops;
52+
53+/* Serial console operations */
54+struct serial_console_data {
55+ int (*open)(void);
56+ void (*putc)(unsigned char c);
57+ unsigned char (*getc)(void);
58+ u8 (*tstc)(void);
59+ void (*close)(void);
60+};
61+
62+extern int platform_init(void *promptr);
63+extern void simple_alloc_init(void);
64+extern void ft_init(void *dt_blob);
65+extern int serial_console_init(void);
66+
67+static inline void *finddevice(const char *name)
68+{
69+ return (dt_ops.finddevice) ? dt_ops.finddevice(name) : NULL;
70+}
71+
72+static inline int getprop(void *devp, const char *name, void *buf, int buflen)
73+{
74+ return (dt_ops.getprop) ? dt_ops.getprop(devp, name, buf, buflen) : -1;
75+}
76+
77+static inline int setprop(void *devp, const char *name, void *buf, int buflen)
78+{
79+ return (dt_ops.setprop) ? dt_ops.setprop(devp, name, buf, buflen) : -1;
80+}
81+
82+static inline void *malloc(u32 size)
83+{
84+ return (platform_ops.malloc) ? platform_ops.malloc(size) : NULL;
85+}
86+
87+static inline void free(void *ptr, u32 size)
88+{
89+ if (platform_ops.free)
90+ platform_ops.free(ptr, size);
91+}
92+
93+static inline void exit(void)
94+{
95+ if (platform_ops.exit)
96+ platform_ops.exit();
97+ for(;;);
98+}
99+
100+#endif /* _PPC_BOOT_OPS_H_ */
arch/powerpc/boot/prom.h+0−41
@@ -1,41 +0,0 @@
1−#ifndef _PPC_BOOT_PROM_H_
2−#define _PPC_BOOT_PROM_H_
3−
4−typedef void *phandle;
5−typedef void *ihandle;
6−
7−extern int (*prom) (void *);
8−extern phandle chosen_handle;
9−extern ihandle stdout;
10−
11−int call_prom(const char *service, int nargs, int nret, ...);
12−int call_prom_ret(const char *service, int nargs, int nret,
13− unsigned int *rets, ...);
14−
15−extern int write(void *handle, void *ptr, int nb);
16−extern void *claim(unsigned long virt, unsigned long size, unsigned long aln);
17−
18−static inline void exit(void)
19−{
20− call_prom("exit", 0, 0);
21−}
22−
23−static inline phandle finddevice(const char *name)
24−{
25− return (phandle) call_prom("finddevice", 1, 1, name);
26−}
27−
28−static inline int getprop(void *phandle, const char *name,
29− void *buf, int buflen)
30−{
31− return call_prom("getprop", 4, 1, phandle, name, buf, buflen);
32−}
33−
34−
35−static inline int setprop(void *phandle, const char *name,
36− void *buf, int buflen)
37−{
38− return call_prom("setprop", 4, 1, phandle, name, buf, buflen);
39−}
40−
41−#endif /* _PPC_BOOT_PROM_H_ */
arch/powerpc/boot/stdio.c+2−2
@@ -10,7 +10,7 @@ · 9 unmodified lines
1010 #include <stddef.h>
1111 #include "string.h"
1212 #include "stdio.h"
13−#include "prom.h"
13+#include "ops.h"
1414
1515 size_t strnlen(const char * s, size_t count)
1616 {
@@ -320,6 +320,6 @@ printf(const char *fmt, ...) · 303 unmodified lines
320320 va_start(args, fmt);
321321 n = vsprintf(sprint_buf, fmt, args);
322322 va_end(args);
323− write(stdout, sprint_buf, n);
323+ console_ops.write(sprint_buf, n);
324324 return n;
325325 }
arch/powerpc/boot/stdio.h+8−0
@@ -1,8 +1,16 @@
11 #ifndef _PPC_BOOT_STDIO_H_
22 #define _PPC_BOOT_STDIO_H_
33
4+#include <stdarg.h>
5+
6+#define ENOMEM 12 /* Out of Memory */
7+#define EINVAL 22 /* Invalid argument */
8+#define ENOSPC 28 /* No space left on device */
9+
410 extern int printf(const char *fmt, ...);
511
12+#define fprintf(fmt, args...) printf(args)
13+
614 extern int sprintf(char *buf, const char *fmt, ...);
715
816 extern int vsprintf(char *buf, const char *fmt, va_list args);
arch/powerpc/boot/types.h+23−0
@@ -0,0 +1,23 @@
1+#ifndef _TYPES_H_
2+#define _TYPES_H_
3+
4+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
5+
6+typedef unsigned char u8;
7+typedef unsigned short u16;
8+typedef unsigned int u32;
9+typedef unsigned long long u64;
10+
11+#define min(x,y) ({ \
12+ typeof(x) _x = (x); \
13+ typeof(y) _y = (y); \
14+ (void) (&_x == &_y); \
15+ _x < _y ? _x : _y; })
16+
17+#define max(x,y) ({ \
18+ typeof(x) _x = (x); \
19+ typeof(y) _y = (y); \
20+ (void) (&_x == &_y); \
21+ _x > _y ? _x : _y; })
22+
23+#endif /* _TYPES_H_ */
arch/powerpc/configs/maple_defconfig+1−1
@@ -496,7 +496,7 @@ CONFIG_E1000=y · 495 unmodified lines
496496 # CONFIG_SKY2 is not set
497497 # CONFIG_SK98LIN is not set
498498 # CONFIG_VIA_VELOCITY is not set
499−# CONFIG_TIGON3 is not set
499+CONFIG_TIGON3=y
500500 # CONFIG_BNX2 is not set
501501 # CONFIG_MV643XX_ETH is not set
502502
arch/powerpc/kernel/Makefile+2−2
@@ -16,7 +16,7 @@ obj-y := semaphore.o cputable.o ptrace.o syscalls.o \ · 15 unmodified lines
1616 obj-y += vdso32/
1717 obj-$(CONFIG_PPC64) += setup_64.o binfmt_elf32.o sys_ppc32.o \
1818 signal_64.o ptrace32.o \
19− paca.o cpu_setup_power4.o \
19+ paca.o cpu_setup_ppc970.o \
2020 firmware.o sysfs.o
2121 obj-$(CONFIG_PPC64) += vdso64/
2222 obj-$(CONFIG_ALTIVEC) += vecemu.o vector.o
@@ -51,7 +51,7 @@ extra-$(CONFIG_8xx) := head_8xx.o · 28 unmodified lines
5151 extra-y += vmlinux.lds
5252
5353 obj-y += time.o prom.o traps.o setup-common.o \
54− udbg.o misc.o
54+ udbg.o misc.o io.o
5555 obj-$(CONFIG_PPC32) += entry_32.o setup_32.o misc_32.o
5656 obj-$(CONFIG_PPC64) += misc_64.o dma_64.o iommu.o
5757 obj-$(CONFIG_PPC_MULTIPLATFORM) += prom_init.o
arch/powerpc/kernel/asm-offsets.c+16−1
@@ -40,9 +40,10 @@ · 39 unmodified lines
4040 #ifdef CONFIG_PPC64
4141 #include <asm/paca.h>
4242 #include <asm/lppaca.h>
43−#include <asm/iseries/hv_lp_event.h>
4443 #include <asm/cache.h>
4544 #include <asm/compat.h>
45+#include <asm/mmu.h>
46+#include <asm/hvcall.h>
4647 #endif
4748
4849 #define DEFINE(sym, val) \
@@ -136,11 +137,18 @@ int main(void) · 87 unmodified lines
136137 DEFINE(PACA_STARTPURR, offsetof(struct paca_struct, startpurr));
137138 DEFINE(PACA_USER_TIME, offsetof(struct paca_struct, user_time));
138139 DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time));
140+ DEFINE(PACA_SLBSHADOWPTR, offsetof(struct paca_struct, slb_shadow_ptr));
141+ DEFINE(PACA_DATA_OFFSET, offsetof(struct paca_struct, data_offset));
139142
143+ DEFINE(SLBSHADOW_STACKVSID,
144+ offsetof(struct slb_shadow, save_area[SLB_NUM_BOLTED - 1].vsid));
145+ DEFINE(SLBSHADOW_STACKESID,
146+ offsetof(struct slb_shadow, save_area[SLB_NUM_BOLTED - 1].esid));
140147 DEFINE(LPPACASRR0, offsetof(struct lppaca, saved_srr0));
141148 DEFINE(LPPACASRR1, offsetof(struct lppaca, saved_srr1));
142149 DEFINE(LPPACAANYINT, offsetof(struct lppaca, int_dword.any_int));
143150 DEFINE(LPPACADECRINT, offsetof(struct lppaca, int_dword.fields.decr_int));
151+ DEFINE(SLBSHADOW_SAVEAREA, offsetof(struct slb_shadow, save_area));
144152 #endif /* CONFIG_PPC64 */
145153
146154 /* RTAS */
@@ -159,6 +167,12 @@ int main(void) · 12 unmodified lines
159167 /* Create extra stack space for SRR0 and SRR1 when calling prom/rtas. */
160168 DEFINE(PROM_FRAME_SIZE, STACK_FRAME_OVERHEAD + sizeof(struct pt_regs) + 16);
161169 DEFINE(RTAS_FRAME_SIZE, STACK_FRAME_OVERHEAD + sizeof(struct pt_regs) + 16);
170+
171+ /* hcall statistics */
172+ DEFINE(HCALL_STAT_SIZE, sizeof(struct hcall_stats));
173+ DEFINE(HCALL_STAT_CALLS, offsetof(struct hcall_stats, num_calls));
174+ DEFINE(HCALL_STAT_TB, offsetof(struct hcall_stats, tb_total));
175+ DEFINE(HCALL_STAT_PURR, offsetof(struct hcall_stats, purr_total));
162176 #endif /* CONFIG_PPC64 */
163177 DEFINE(GPR0, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[0]));
164178 DEFINE(GPR1, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[1]));
@@ -240,6 +254,7 @@ int main(void) · 75 unmodified lines
240254 DEFINE(CPU_SPEC_PVR_VALUE, offsetof(struct cpu_spec, pvr_value));
241255 DEFINE(CPU_SPEC_FEATURES, offsetof(struct cpu_spec, cpu_features));
242256 DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup));
257+ DEFINE(CPU_SPEC_RESTORE, offsetof(struct cpu_spec, cpu_restore));
243258
244259 #ifndef CONFIG_PPC64
245260 DEFINE(pbe_address, offsetof(struct pbe, address));
arch/powerpc/kernel/btext.c+12−12
@@ -158,35 +158,35 @@ int btext_initialize(struct device_node *np) · 157 unmodified lines
158158 {
159159 unsigned int width, height, depth, pitch;
160160 unsigned long address = 0;
161− u32 *prop;
161+ const u32 *prop;
162162
163− prop = (u32 *)get_property(np, "linux,bootx-width", NULL);
163+ prop = get_property(np, "linux,bootx-width", NULL);
164164 if (prop == NULL)
165− prop = (u32 *)get_property(np, "width", NULL);
165+ prop = get_property(np, "width", NULL);
166166 if (prop == NULL)
167167 return -EINVAL;
168168 width = *prop;
169− prop = (u32 *)get_property(np, "linux,bootx-height", NULL);
169+ prop = get_property(np, "linux,bootx-height", NULL);
170170 if (prop == NULL)
171− prop = (u32 *)get_property(np, "height", NULL);
171+ prop = get_property(np, "height", NULL);
172172 if (prop == NULL)
173173 return -EINVAL;
174174 height = *prop;
175− prop = (u32 *)get_property(np, "linux,bootx-depth", NULL);
175+ prop = get_property(np, "linux,bootx-depth", NULL);
176176 if (prop == NULL)
177− prop = (u32 *)get_property(np, "depth", NULL);
177+ prop = get_property(np, "depth", NULL);
178178 if (prop == NULL)
179179 return -EINVAL;
180180 depth = *prop;
181181 pitch = width * ((depth + 7) / 8);
182− prop = (u32 *)get_property(np, "linux,bootx-linebytes", NULL);
182+ prop = get_property(np, "linux,bootx-linebytes", NULL);
183183 if (prop == NULL)
184− prop = (u32 *)get_property(np, "linebytes", NULL);
184+ prop = get_property(np, "linebytes", NULL);
185185 if (prop)
186186 pitch = *prop;
187187 if (pitch == 1)
188188 pitch = 0x1000;
189− prop = (u32 *)get_property(np, "address", NULL);
189+ prop = get_property(np, "address", NULL);
190190 if (prop)
191191 address = *prop;
192192
@@ -214,11 +214,11 @@ int btext_initialize(struct device_node *np) · 21 unmodified lines
214214
215215 int __init btext_find_display(int allow_nonstdout)
216216 {
217− char *name;
217+ const char *name;
218218 struct device_node *np = NULL;
219219 int rc = -ENODEV;
220220
221− name = (char *)get_property(of_chosen, "linux,stdout-path", NULL);
221+ name = get_property(of_chosen, "linux,stdout-path", NULL);
222222 if (name != NULL) {
223223 np = of_find_node_by_path(name);
224224 if (np != NULL) {
arch/powerpc/kernel/cpu_setup_ppc970.Srenamed from arch/powerpc/kernel/cpu_setup_power4.S+26−77
@@ -16,27 +16,12 @@ · 15 unmodified lines
1616 #include <asm/asm-offsets.h>
1717 #include <asm/cache.h>
1818
19−_GLOBAL(__970_cpu_preinit)
20− /*
21− * Do nothing if not running in HV mode
22− */
19+_GLOBAL(__cpu_preinit_ppc970)
20+ /* Do nothing if not running in HV mode */
2321 mfmsr r0
2422 rldicl. r0,r0,4,63
2523 beqlr
2624
27− /*
28− * Deal only with PPC970 and PPC970FX.
29− */
30− mfspr r0,SPRN_PVR
31− srwi r0,r0,16
32− cmpwi r0,0x39
33− beq 1f
34− cmpwi r0,0x3c
35− beq 1f
36− cmpwi r0,0x44
37− bnelr
38−1:
39−
4025 /* Make sure HID4:rm_ci is off before MMU is turned off, that large
4126 * pages are enabled with HID4:61 and clear HID5:DCBZ_size and
4227 * HID5:DCBZ32_ill
@@ -72,23 +57,6 @@ _GLOBAL(__970_cpu_preinit) · 29 unmodified lines
7257 isync
7358 blr
7459
75−_GLOBAL(__setup_cpu_ppc970)
76− mfspr r0,SPRN_HID0
77− li r11,5 /* clear DOZE and SLEEP */
78− rldimi r0,r11,52,8 /* set NAP and DPM */
79− li r11,0
80− rldimi r0,r11,32,31 /* clear EN_ATTN */
81− mtspr SPRN_HID0,r0
82− mfspr r0,SPRN_HID0
83− mfspr r0,SPRN_HID0
84− mfspr r0,SPRN_HID0
85− mfspr r0,SPRN_HID0
86− mfspr r0,SPRN_HID0
87− mfspr r0,SPRN_HID0
88− sync
89− isync
90− blr
91−
9260 /* Definitions for the table use to save CPU states */
9361 #define CS_HID0 0
9462 #define CS_HID1 8
@@ -103,33 +71,30 @@ cpu_state_storage: · 8 unmodified lines
10371 .balign L1_CACHE_BYTES,0
10472 .text
10573
106−/* Called in normal context to backup CPU 0 state. This
107− * does not include cache settings. This function is also
108− * called for machine sleep. This does not include the MMU
109− * setup, BATs, etc... but rather the "special" registers
110− * like HID0, HID1, HID4, etc...
111− */
112−_GLOBAL(__save_cpu_setup)
113− /* Some CR fields are volatile, we back it up all */
114− mfcr r7
115−
116− /* Get storage ptr */
117− LOAD_REG_IMMEDIATE(r5,cpu_state_storage)
11874
119− /* We only deal with 970 for now */
120− mfspr r0,SPRN_PVR
121− srwi r0,r0,16
122− cmpwi r0,0x39
123− beq 1f
124− cmpwi r0,0x3c
125− beq 1f
126− cmpwi r0,0x44
127− bne 2f
128−
129−1: /* skip if not running in HV mode */
75+_GLOBAL(__setup_cpu_ppc970)
76+ /* Do nothing if not running in HV mode */
13077 mfmsr r0
13178 rldicl. r0,r0,4,63
132− beq 2f
79+ beqlr
80+
81+ mfspr r0,SPRN_HID0
82+ li r11,5 /* clear DOZE and SLEEP */
83+ rldimi r0,r11,52,8 /* set NAP and DPM */
84+ li r11,0
85+ rldimi r0,r11,32,31 /* clear EN_ATTN */
86+ mtspr SPRN_HID0,r0
87+ mfspr r0,SPRN_HID0
88+ mfspr r0,SPRN_HID0
89+ mfspr r0,SPRN_HID0
90+ mfspr r0,SPRN_HID0
91+ mfspr r0,SPRN_HID0
92+ mfspr r0,SPRN_HID0
93+ sync
94+ isync
95+
96+ /* Save away cpu state */
97+ LOAD_REG_IMMEDIATE(r5,cpu_state_storage)
13398
13499 /* Save HID0,1,4 and 5 */
135100 mfspr r3,SPRN_HID0
@@ -141,35 +106,19 @@ _GLOBAL(__save_cpu_setup) · 5 unmodified lines
141106 mfspr r3,SPRN_HID5
142107 std r3,CS_HID5(r5)
143108
144−2:
145− mtcr r7
146109 blr
147110
148111 /* Called with no MMU context (typically MSR:IR/DR off) to
149112 * restore CPU state as backed up by the previous
150113 * function. This does not include cache setting
151114 */
152−_GLOBAL(__restore_cpu_setup)
153− /* Get storage ptr (FIXME when using anton reloc as we
154− * are running with translation disabled here
155− */
156− LOAD_REG_IMMEDIATE(r5,cpu_state_storage)
157−
158− /* We only deal with 970 for now */
159− mfspr r0,SPRN_PVR
160− srwi r0,r0,16
161− cmpwi r0,0x39
162− beq 1f
163− cmpwi r0,0x3c
164− beq 1f
165− cmpwi r0,0x44
166− bnelr
167−
168−1: /* skip if not running in HV mode */
115+_GLOBAL(__restore_cpu_ppc970)
116+ /* Do nothing if not running in HV mode */
169117 mfmsr r0
170118 rldicl. r0,r0,4,63
171119 beqlr
172120
121+ LOAD_REG_IMMEDIATE(r5,cpu_state_storage)
173122 /* Before accessing memory, we make sure rm_ci is clear */
174123 li r0,0
175124 mfspr r3,SPRN_HID4
arch/powerpc/kernel/cputable.c+21−0
@@ -39,7 +39,10 @@ extern void __setup_cpu_7400(unsigned long offset, struct cpu_spec* spec); · 38 unmodified lines
3939 extern void __setup_cpu_7410(unsigned long offset, struct cpu_spec* spec);
4040 extern void __setup_cpu_745x(unsigned long offset, struct cpu_spec* spec);
4141 #endif /* CONFIG_PPC32 */
42+#ifdef CONFIG_PPC64
4243 extern void __setup_cpu_ppc970(unsigned long offset, struct cpu_spec* spec);
44+extern void __restore_cpu_ppc970(void);
45+#endif /* CONFIG_PPC64 */
4346
4447 /* This table only contains "desktop" CPUs, it need to be filled with embedded
4548 * ones as well...
@@ -55,6 +58,9 @@ extern void __setup_cpu_ppc970(unsigned long offset, struct cpu_spec* spec); · 9 unmodified lines
5558 #define COMMON_USER_POWER6 (COMMON_USER_PPC64 | PPC_FEATURE_ARCH_2_05 |\
5659 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP | \
5760 PPC_FEATURE_TRUE_LE)
61+#define COMMON_USER_PA6T (COMMON_USER_PPC64 | PPC_FEATURE_PA6T |\
62+ PPC_FEATURE_TRUE_LE | \
63+ PPC_FEATURE_HAS_ALTIVEC_COMP)
5864 #define COMMON_USER_BOOKE (PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU | \
5965 PPC_FEATURE_BOOKE)
6066
@@ -184,6 +190,7 @@ struct cpu_spec cpu_specs[] = { · 123 unmodified lines
184190 .dcache_bsize = 128,
185191 .num_pmcs = 8,
186192 .cpu_setup = __setup_cpu_ppc970,
193+ .cpu_restore = __restore_cpu_ppc970,
187194 .oprofile_cpu_type = "ppc64/970",
188195 .oprofile_type = PPC_OPROFILE_POWER4,
189196 .platform = "ppc970",
@@ -199,6 +206,7 @@ struct cpu_spec cpu_specs[] = { · 9 unmodified lines
199206 .dcache_bsize = 128,
200207 .num_pmcs = 8,
201208 .cpu_setup = __setup_cpu_ppc970,
209+ .cpu_restore = __restore_cpu_ppc970,
202210 .oprofile_cpu_type = "ppc64/970",
203211 .oprofile_type = PPC_OPROFILE_POWER4,
204212 .platform = "ppc970",
@@ -214,6 +222,7 @@ struct cpu_spec cpu_specs[] = { · 9 unmodified lines
214222 .dcache_bsize = 128,
215223 .num_pmcs = 8,
216224 .cpu_setup = __setup_cpu_ppc970,
225+ .cpu_restore = __restore_cpu_ppc970,
217226 .oprofile_cpu_type = "ppc64/970",
218227 .oprofile_type = PPC_OPROFILE_POWER4,
219228 .platform = "ppc970",
@@ -280,6 +289,17 @@ struct cpu_spec cpu_specs[] = { · 60 unmodified lines
280289 .dcache_bsize = 128,
281290 .platform = "ppc-cell-be",
282291 },
292+ { /* PA Semi PA6T */
293+ .pvr_mask = 0x7fff0000,
294+ .pvr_value = 0x00900000,
295+ .cpu_name = "PA6T",
296+ .cpu_features = CPU_FTRS_PA6T,
297+ .cpu_user_features = COMMON_USER_PA6T,
298+ .icache_bsize = 64,
299+ .dcache_bsize = 64,
300+ .num_pmcs = 6,
301+ .platform = "pa6t",
302+ },
283303 { /* default match */
284304 .pvr_mask = 0x00000000,
285305 .pvr_value = 0x00000000,
@@ -929,6 +949,7 @@ struct cpu_spec cpu_specs[] = { · 643 unmodified lines
929949 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
930950 .icache_bsize = 32,
931951 .dcache_bsize = 32,
952+ .platform = "ppc405",
932953 },
933954 { /* 405EP */
934955 .pvr_mask = 0xffff0000,
arch/powerpc/kernel/crash_dump.c+1−1
@@ -80,7 +80,7 @@ static int __init parse_savemaxmem(char *p) · 79 unmodified lines
8080 }
8181 __setup("savemaxmem=", parse_savemaxmem);
8282
83−/*
83+/**
8484 * copy_oldmem_page - copy one page from "oldmem"
8585 * @pfn: page frame number to be copied
8686 * @buf: target memory address for the copy; this can be in kernel address
arch/powerpc/kernel/dma_64.c+28−37
@@ -35,10 +35,9 @@ int dma_supported(struct device *dev, u64 mask) · 34 unmodified lines
3535 {
3636 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
3737
38− if (dma_ops)
39− return dma_ops->dma_supported(dev, mask);
40− BUG();
41− return 0;
38+ BUG_ON(!dma_ops);
39+
40+ return dma_ops->dma_supported(dev, mask);
4241 }
4342 EXPORT_SYMBOL(dma_supported);
4443
@@ -66,10 +65,9 @@ void *dma_alloc_coherent(struct device *dev, size_t size, · 21 unmodified lines
6665 {
6766 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
6867
69− if (dma_ops)
70− return dma_ops->alloc_coherent(dev, size, dma_handle, flag);
71− BUG();
72− return NULL;
68+ BUG_ON(!dma_ops);
69+
70+ return dma_ops->alloc_coherent(dev, size, dma_handle, flag);
7371 }
7472 EXPORT_SYMBOL(dma_alloc_coherent);
7573
@@ -78,10 +76,9 @@ void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, · 2 unmodified lines
7876 {
7977 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
8078
81− if (dma_ops)
82− dma_ops->free_coherent(dev, size, cpu_addr, dma_handle);
83− else
84− BUG();
79+ BUG_ON(!dma_ops);
80+
81+ dma_ops->free_coherent(dev, size, cpu_addr, dma_handle);
8582 }
8683 EXPORT_SYMBOL(dma_free_coherent);
8784
@@ -90,10 +87,9 @@ dma_addr_t dma_map_single(struct device *dev, void *cpu_addr, size_t size, · 2 unmodified lines
9087 {
9188 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
9289
93− if (dma_ops)
94− return dma_ops->map_single(dev, cpu_addr, size, direction);
95− BUG();
96− return (dma_addr_t)0;
90+ BUG_ON(!dma_ops);
91+
92+ return dma_ops->map_single(dev, cpu_addr, size, direction);
9793 }
9894 EXPORT_SYMBOL(dma_map_single);
9995
@@ -102,10 +98,9 @@ void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, · 2 unmodified lines
10298 {
10399 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
104100
105− if (dma_ops)
106− dma_ops->unmap_single(dev, dma_addr, size, direction);
107− else
108− BUG();
101+ BUG_ON(!dma_ops);
102+
103+ dma_ops->unmap_single(dev, dma_addr, size, direction);
109104 }
110105 EXPORT_SYMBOL(dma_unmap_single);
111106
@@ -115,11 +110,10 @@ dma_addr_t dma_map_page(struct device *dev, struct page *page, · 3 unmodified lines
115110 {
116111 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
117112
118− if (dma_ops)
119− return dma_ops->map_single(dev,
120− (page_address(page) + offset), size, direction);
121− BUG();
122− return (dma_addr_t)0;
113+ BUG_ON(!dma_ops);
114+
115+ return dma_ops->map_single(dev, page_address(page) + offset, size,
116+ direction);
123117 }
124118 EXPORT_SYMBOL(dma_map_page);
125119
@@ -128,10 +122,9 @@ void dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size, · 2 unmodified lines
128122 {
129123 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
130124
131− if (dma_ops)
132− dma_ops->unmap_single(dev, dma_address, size, direction);
133− else
134− BUG();
125+ BUG_ON(!dma_ops);
126+
127+ dma_ops->unmap_single(dev, dma_address, size, direction);
135128 }
136129 EXPORT_SYMBOL(dma_unmap_page);
137130
@@ -140,10 +133,9 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, · 2 unmodified lines
140133 {
141134 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
142135
143− if (dma_ops)
144− return dma_ops->map_sg(dev, sg, nents, direction);
145− BUG();
146− return 0;
136+ BUG_ON(!dma_ops);
137+
138+ return dma_ops->map_sg(dev, sg, nents, direction);
147139 }
148140 EXPORT_SYMBOL(dma_map_sg);
149141
@@ -152,9 +144,8 @@ void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries, · 2 unmodified lines
152144 {
153145 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
154146
155− if (dma_ops)
156− dma_ops->unmap_sg(dev, sg, nhwentries, direction);
157− else
158− BUG();
147+ BUG_ON(!dma_ops);
148+
149+ dma_ops->unmap_sg(dev, sg, nhwentries, direction);
159150 }
160151 EXPORT_SYMBOL(dma_unmap_sg);
arch/powerpc/kernel/entry_64.S+8−0
@@ -375,6 +375,14 @@ BEGIN_FTR_SECTION · 374 unmodified lines
375375 ld r7,KSP_VSID(r4) /* Get new stack's VSID */
376376 oris r0,r6,(SLB_ESID_V)@h
377377 ori r0,r0,(SLB_NUM_BOLTED-1)@l
378+
379+ /* Update the last bolted SLB */
380+ ld r9,PACA_SLBSHADOWPTR(r13)
381+ li r12,0
382+ std r12,SLBSHADOW_STACKESID(r9) /* Clear ESID */
383+ std r7,SLBSHADOW_STACKVSID(r9) /* Save VSID */
384+ std r0,SLBSHADOW_STACKESID(r9) /* Save ESID */
385+
378386 slbie r6
379387 slbie r6 /* Workaround POWER5 < DD2.1 issue */
380388 slbmte r7,r0
arch/powerpc/kernel/head_64.S+34−20
@@ -132,7 +132,7 @@ _GLOBAL(__secondary_hold) · 131 unmodified lines
132132 bne 100b
133133
134134 #if defined(CONFIG_SMP) || defined(CONFIG_KEXEC)
135− LOAD_REG_IMMEDIATE(r4, .pSeries_secondary_smp_init)
135+ LOAD_REG_IMMEDIATE(r4, .generic_secondary_smp_init)
136136 mtctr r4
137137 mr r3,r24
138138 bctr
@@ -1484,19 +1484,17 @@ fwnmi_data_area: · 1345 unmodified lines
14841484 . = 0x8000
14851485
14861486 /*
1487− * On pSeries, secondary processors spin in the following code.
1487+ * On pSeries and most other platforms, secondary processors spin
1488+ * in the following code.
14881489 * At entry, r3 = this processor's number (physical cpu id)
14891490 */
1490−_GLOBAL(pSeries_secondary_smp_init)
1491+_GLOBAL(generic_secondary_smp_init)
14911492 mr r24,r3
14921493
14931494 /* turn on 64-bit mode */
14941495 bl .enable_64b_mode
14951496 isync
14961497
1497− /* Copy some CPU settings from CPU 0 */
1498− bl .__restore_cpu_setup
1499−
15001498 /* Set up a paca value for this processor. Since we have the
15011499 * physical cpu id in r24, we need to search the pacas to find
15021500 * which logical id maps to our physical one.
@@ -1522,15 +1520,28 @@ _GLOBAL(pSeries_secondary_smp_init) · 19 unmodified lines
15221520 /* start. */
15231521 sync
15241522
1525− /* Create a temp kernel stack for use before relocation is on. */
1523+#ifndef CONFIG_SMP
1524+ b 3b /* Never go on non-SMP */
1525+#else
1526+ cmpwi 0,r23,0
1527+ beq 3b /* Loop until told to go */
1528+
1529+ /* See if we need to call a cpu state restore handler */
1530+ LOAD_REG_IMMEDIATE(r23, cur_cpu_spec)
1531+ ld r23,0(r23)
1532+ ld r23,CPU_SPEC_RESTORE(r23)
1533+ cmpdi 0,r23,0
1534+ beq 4f
1535+ ld r23,0(r23)
1536+ mtctr r23
1537+ bctrl
1538+
1539+4: /* Create a temp kernel stack for use before relocation is on. */
15261540 ld r1,PACAEMERGSP(r13)
15271541 subi r1,r1,STACK_FRAME_OVERHEAD
15281542
1529− cmpwi 0,r23,0
1530−#ifdef CONFIG_SMP
1531− bne .__secondary_start
1543+ b .__secondary_start
15321544 #endif
1533− b 3b /* Loop until told to go */
15341545
15351546 #ifdef CONFIG_PPC_ISERIES
15361547 _STATIC(__start_initialization_iSeries)
@@ -1611,7 +1622,16 @@ _GLOBAL(__start_initialization_multiplatform) · 74 unmodified lines
16111622 bl .enable_64b_mode
16121623
16131624 /* Setup some critical 970 SPRs before switching MMU off */
1614− bl .__970_cpu_preinit
1625+ mfspr r0,SPRN_PVR
1626+ srwi r0,r0,16
1627+ cmpwi r0,0x39 /* 970 */
1628+ beq 1f
1629+ cmpwi r0,0x3c /* 970FX */
1630+ beq 1f
1631+ cmpwi r0,0x44 /* 970MP */
1632+ bne 2f
1633+1: bl .__cpu_preinit_ppc970
1634+2:
16151635
16161636 /* Switch off MMU if not already */
16171637 LOAD_REG_IMMEDIATE(r4, .__after_prom_start - KERNELBASE)
@@ -1728,7 +1748,7 @@ _STATIC(__after_prom_start) · 110 unmodified lines
17281748 _GLOBAL(copy_and_flush)
17291749 addi r5,r5,-8
17301750 addi r6,r6,-8
1731−4: li r0,16 /* Use the least common */
1751+4: li r0,8 /* Use the smallest common */
17321752 /* denominator cache line */
17331753 /* size. This results in */
17341754 /* extra cache line flushes */
@@ -1782,7 +1802,7 @@ _GLOBAL(pmac_secondary_start) · 47 unmodified lines
17821802 isync
17831803
17841804 /* Copy some CPU settings from CPU 0 */
1785− bl .__restore_cpu_setup
1805+ bl .__restore_cpu_ppc970
17861806
17871807 /* pSeries do that early though I don't think we really need it */
17881808 mfmsr r3
@@ -1932,12 +1952,6 @@ _STATIC(start_here_multiplatform) · 143 unmodified lines
19321952 mr r5,r26
19331953 bl .identify_cpu
19341954
1935− /* Save some low level config HIDs of CPU0 to be copied to
1936− * other CPUs later on, or used for suspend/resume
1937− */
1938− bl .__save_cpu_setup
1939− sync
1940−
19411955 /* Do very early kernel initializations, including initial hash table,
19421956 * stab and slb setup before we turn on relocation. */
19431957
arch/powerpc/kernel/ibmebus.c+3−3
@@ -167,7 +167,7 @@ static DEVICE_ATTR(name, S_IRUSR | S_IRGRP | S_IROTH, ibmebusdev_show_name, · 166 unmodified lines
167167 NULL);
168168
169169 static struct ibmebus_dev* __devinit ibmebus_register_device_common(
170− struct ibmebus_dev *dev, char *name)
170+ struct ibmebus_dev *dev, const char *name)
171171 {
172172 int err = 0;
173173
@@ -194,10 +194,10 @@ static struct ibmebus_dev* __devinit ibmebus_register_device_node( · 20 unmodified lines
194194 struct device_node *dn)
195195 {
196196 struct ibmebus_dev *dev;
197− char *loc_code;
197+ const char *loc_code;
198198 int length;
199199
200− loc_code = (char *)get_property(dn, "ibm,loc-code", NULL);
200+ loc_code = get_property(dn, "ibm,loc-code", NULL);
201201 if (!loc_code) {
202202 printk(KERN_WARNING "%s: node %s missing 'ibm,loc-code'\n",
203203 __FUNCTION__, dn->name ? dn->name : "<unknown>");
arch/powerpc/kernel/io.c+131−0
@@ -0,0 +1,131 @@
1+/*
2+ * I/O string operations
3+ * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
4+ * Copyright (C) 2006 IBM Corporation
5+ *
6+ * Largely rewritten by Cort Dougan (cort@cs.nmt.edu)
7+ * and Paul Mackerras.
8+ *
9+ * Adapted for iSeries by Mike Corrigan (mikejc@us.ibm.com)
10+ * PPC64 updates by Dave Engebretsen (engebret@us.ibm.com)
11+ *
12+ * Rewritten in C by Stephen Rothwell.
13+ *
14+ * This program is free software; you can redistribute it and/or
15+ * modify it under the terms of the GNU General Public License
16+ * as published by the Free Software Foundation; either version
17+ * 2 of the License, or (at your option) any later version.
18+ */
19+#include <linux/kernel.h>
20+#include <linux/types.h>
21+#include <linux/compiler.h>
22+#include <linux/module.h>
23+
24+#include <asm/io.h>
25+#include <asm/firmware.h>
26+#include <asm/bug.h>
27+
28+void _insb(volatile u8 __iomem *port, void *buf, long count)
29+{
30+ u8 *tbuf = buf;
31+ u8 tmp;
32+
33+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
34+
35+ if (unlikely(count <= 0))
36+ return;
37+ asm volatile("sync");
38+ do {
39+ tmp = *port;
40+ asm volatile("eieio");
41+ *tbuf++ = tmp;
42+ } while (--count != 0);
43+ asm volatile("twi 0,%0,0; isync" : : "r" (tmp));
44+}
45+EXPORT_SYMBOL(_insb);
46+
47+void _outsb(volatile u8 __iomem *port, const void *buf, long count)
48+{
49+ const u8 *tbuf = buf;
50+
51+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
52+
53+ if (unlikely(count <= 0))
54+ return;
55+ asm volatile("sync");
56+ do {
57+ *port = *tbuf++;
58+ } while (--count != 0);
59+ asm volatile("sync");
60+}
61+EXPORT_SYMBOL(_outsb);
62+
63+void _insw_ns(volatile u16 __iomem *port, void *buf, long count)
64+{
65+ u16 *tbuf = buf;
66+ u16 tmp;
67+
68+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
69+
70+ if (unlikely(count <= 0))
71+ return;
72+ asm volatile("sync");
73+ do {
74+ tmp = *port;
75+ asm volatile("eieio");
76+ *tbuf++ = tmp;
77+ } while (--count != 0);
78+ asm volatile("twi 0,%0,0; isync" : : "r" (tmp));
79+}
80+EXPORT_SYMBOL(_insw_ns);
81+
82+void _outsw_ns(volatile u16 __iomem *port, const void *buf, long count)
83+{
84+ const u16 *tbuf = buf;
85+
86+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
87+
88+ if (unlikely(count <= 0))
89+ return;
90+ asm volatile("sync");
91+ do {
92+ *port = *tbuf++;
93+ } while (--count != 0);
94+ asm volatile("sync");
95+}
96+EXPORT_SYMBOL(_outsw_ns);
97+
98+void _insl_ns(volatile u32 __iomem *port, void *buf, long count)
99+{
100+ u32 *tbuf = buf;
101+ u32 tmp;
102+
103+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
104+
105+ if (unlikely(count <= 0))
106+ return;
107+ asm volatile("sync");
108+ do {
109+ tmp = *port;
110+ asm volatile("eieio");
111+ *tbuf++ = tmp;
112+ } while (--count != 0);
113+ asm volatile("twi 0,%0,0; isync" : : "r" (tmp));
114+}
115+EXPORT_SYMBOL(_insl_ns);
116+
117+void _outsl_ns(volatile u32 __iomem *port, const void *buf, long count)
118+{
119+ const u32 *tbuf = buf;
120+
121+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
122+
123+ if (unlikely(count <= 0))
124+ return;
125+ asm volatile("sync");
126+ do {
127+ *port = *tbuf++;
128+ } while (--count != 0);
129+ asm volatile("sync");
130+}
131+EXPORT_SYMBOL(_outsl_ns);
arch/powerpc/kernel/irq.c+5−0
@@ -52,6 +52,7 @@ · 51 unmodified lines
5252 #include <linux/radix-tree.h>
5353 #include <linux/mutex.h>
5454 #include <linux/bootmem.h>
55+#include <linux/pci.h>
5556
5657 #include <asm/uaccess.h>
5758 #include <asm/system.h>
@@ -875,12 +876,14 @@ int pci_enable_msi(struct pci_dev * pdev) · 817 unmodified lines
875876 else
876877 return -1;
877878 }
879+EXPORT_SYMBOL(pci_enable_msi);
878880
879881 void pci_disable_msi(struct pci_dev * pdev)
880882 {
881883 if (ppc_md.disable_msi)
882884 ppc_md.disable_msi(pdev);
883885 }
886+EXPORT_SYMBOL(pci_disable_msi);
884887
885888 void pci_scan_msi_device(struct pci_dev *dev) {}
886889 int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec) {return -1;}
@@ -888,6 +891,8 @@ void pci_disable_msix(struct pci_dev *dev) {} · 1 unmodified line
888891 void msi_remove_pci_irq_vectors(struct pci_dev *dev) {}
889892 void disable_msi_mode(struct pci_dev *dev, int pos, int type) {}
890893 void pci_no_msi(void) {}
894+EXPORT_SYMBOL(pci_enable_msix);
895+EXPORT_SYMBOL(pci_disable_msix);
891896
892897 #endif
893898
arch/powerpc/kernel/legacy_serial.c+18−17
@@ -39,16 +39,17 @@ static int __init add_legacy_port(struct device_node *np, int want_index, · 38 unmodified lines
3939 phys_addr_t taddr, unsigned long irq,
4040 upf_t flags, int irq_check_parent)
4141 {
42− u32 *clk, *spd, clock = BASE_BAUD * 16;
42+ const u32 *clk, *spd;
43+ u32 clock = BASE_BAUD * 16;
4344 int index;
4445
4546 /* get clock freq. if present */
46− clk = (u32 *)get_property(np, "clock-frequency", NULL);
47+ clk = get_property(np, "clock-frequency", NULL);
4748 if (clk && *clk)
4849 clock = *clk;
4950
5051 /* get default speed if present */
51− spd = (u32 *)get_property(np, "current-speed", NULL);
52+ spd = get_property(np, "current-speed", NULL);
5253
5354 /* If we have a location index, then try to use it */
5455 if (want_index >= 0 && want_index < MAX_LEGACY_SERIAL_PORTS)
@@ -113,7 +114,7 @@ static int __init add_legacy_soc_port(struct device_node *np, · 58 unmodified lines
113114 struct device_node *soc_dev)
114115 {
115116 u64 addr;
116− u32 *addrp;
117+ const u32 *addrp;
117118 upf_t flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_SHARE_IRQ;
118119 struct device_node *tsi = of_get_parent(np);
119120
@@ -144,15 +145,15 @@ static int __init add_legacy_soc_port(struct device_node *np, · 24 unmodified lines
144145 static int __init add_legacy_isa_port(struct device_node *np,
145146 struct device_node *isa_brg)
146147 {
147− u32 *reg;
148− char *typep;
148+ const u32 *reg;
149+ const char *typep;
149150 int index = -1;
150151 u64 taddr;
151152
152153 DBG(" -> add_legacy_isa_port(%s)\n", np->full_name);
153154
154155 /* Get the ISA port number */
155− reg = (u32 *)get_property(np, "reg", NULL);
156+ reg = get_property(np, "reg", NULL);
156157 if (reg == NULL)
157158 return -1;
158159
@@ -163,7 +164,7 @@ static int __init add_legacy_isa_port(struct device_node *np, · 4 unmodified lines
163164 /* Now look for an "ibm,aix-loc" property that gives us ordering
164165 * if any...
165166 */
166− typep = (char *)get_property(np, "ibm,aix-loc", NULL);
167+ typep = get_property(np, "ibm,aix-loc", NULL);
167168
168169 /* If we have a location index, then use it */
169170 if (typep && *typep == 'S')
@@ -188,7 +189,7 @@ static int __init add_legacy_pci_port(struct device_node *np, · 18 unmodified lines
188189 struct device_node *pci_dev)
189190 {
190191 u64 addr, base;
191− u32 *addrp;
192+ const u32 *addrp;
192193 unsigned int flags;
193194 int iotype, index = -1, lindex = 0;
194195
@@ -227,7 +228,7 @@ static int __init add_legacy_pci_port(struct device_node *np, · 32 unmodified lines
227228 * we get to their "reg" property
228229 */
229230 if (np != pci_dev) {
230− u32 *reg = (u32 *)get_property(np, "reg", NULL);
231+ const u32 *reg = get_property(np, "reg", NULL);
231232 if (reg && (*reg < 4))
232233 index = lindex = *reg;
233234 }
@@ -285,13 +286,13 @@ static void __init setup_legacy_serial_console(int console) · 51 unmodified lines
285286 void __init find_legacy_serial_ports(void)
286287 {
287288 struct device_node *np, *stdout = NULL;
288− char *path;
289+ const char *path;
289290 int index;
290291
291292 DBG(" -> find_legacy_serial_port()\n");
292293
293294 /* Now find out if one of these is out firmware console */
294− path = (char *)get_property(of_chosen, "linux,stdout-path", NULL);
295+ path = get_property(of_chosen, "linux,stdout-path", NULL);
295296 if (path != NULL) {
296297 stdout = of_find_node_by_path(path);
297298 if (stdout)
@@ -491,8 +492,8 @@ static int __init check_legacy_serial_console(void) · 193 unmodified lines
491492 {
492493 struct device_node *prom_stdout = NULL;
493494 int speed = 0, offset = 0;
494− char *name;
495− u32 *spd;
495+ const char *name;
496+ const u32 *spd;
496497
497498 DBG(" -> check_legacy_serial_console()\n");
498499
@@ -513,7 +514,7 @@ static int __init check_legacy_serial_console(void) · 14 unmodified lines
513514 }
514515 /* We are getting a weird phandle from OF ... */
515516 /* ... So use the full path instead */
516− name = (char *)get_property(of_chosen, "linux,stdout-path", NULL);
517+ name = get_property(of_chosen, "linux,stdout-path", NULL);
517518 if (name == NULL) {
518519 DBG(" no linux,stdout-path !\n");
519520 return -ENODEV;
@@ -525,12 +526,12 @@ static int __init check_legacy_serial_console(void) · 5 unmodified lines
525526 }
526527 DBG("stdout is %s\n", prom_stdout->full_name);
527528
528− name = (char *)get_property(prom_stdout, "name", NULL);
529+ name = get_property(prom_stdout, "name", NULL);
529530 if (!name) {
530531 DBG(" stdout package has no name !\n");
531532 goto not_found;
532533 }
533− spd = (u32 *)get_property(prom_stdout, "current-speed", NULL);
534+ spd = get_property(prom_stdout, "current-speed", NULL);
534535 if (spd)
535536 speed = *spd;
536537
arch/powerpc/kernel/lparcfg.c+19−11
@@ -32,7 +32,6 @@ · 31 unmodified lines
3232 #include <asm/rtas.h>
3333 #include <asm/system.h>
3434 #include <asm/time.h>
35−#include <asm/iseries/it_exp_vpd_panel.h>
3635 #include <asm/prom.h>
3736 #include <asm/vdso_datapage.h>
3837
@@ -183,8 +182,14 @@ static unsigned int h_get_ppp(unsigned long *entitled, · 144 unmodified lines
183182 unsigned long *resource)
184183 {
185184 unsigned long rc;
186− rc = plpar_hcall_4out(H_GET_PPP, 0, 0, 0, 0, entitled, unallocated,
187− aggregation, resource);
185+ unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
186+
187+ rc = plpar_hcall(H_GET_PPP, retbuf);
188+
189+ *entitled = retbuf[0];
190+ *unallocated = retbuf[1];
191+ *aggregation = retbuf[2];
192+ *resource = retbuf[3];
188193
189194 log_plpar_hcall_return(rc, "H_GET_PPP");
190195
@@ -194,8 +199,12 @@ static unsigned int h_get_ppp(unsigned long *entitled, · 3 unmodified lines
194199 static void h_pic(unsigned long *pool_idle_time, unsigned long *num_procs)
195200 {
196201 unsigned long rc;
197− unsigned long dummy;
198− rc = plpar_hcall(H_PIC, 0, 0, 0, 0, pool_idle_time, num_procs, &dummy);
202+ unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
203+
204+ rc = plpar_hcall(H_PIC, retbuf);
205+
206+ *pool_idle_time = retbuf[0];
207+ *num_procs = retbuf[1];
199208
200209 if (rc != H_AUTHORITY)
201210 log_plpar_hcall_return(rc, "H_PIC");
@@ -310,12 +319,11 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v) · 108 unmodified lines
310319 int partition_potential_processors;
311320 int partition_active_processors;
312321 struct device_node *rtas_node;
313− int *lrdrp = NULL;
322+ const int *lrdrp = NULL;
314323
315324 rtas_node = find_path_device("/rtas");
316325 if (rtas_node)
317− lrdrp = (int *)get_property(rtas_node, "ibm,lrdr-capacity",
318− NULL);
326+ lrdrp = get_property(rtas_node, "ibm,lrdr-capacity", NULL);
319327
320328 if (lrdrp == NULL) {
321329 partition_potential_processors = vdso_data->processorCount;
@@ -520,7 +528,8 @@ static int lparcfg_data(struct seq_file *m, void *v) · 198 unmodified lines
520528 const char *model = "";
521529 const char *system_id = "";
522530 const char *tmp;
523− unsigned int *lp_index_ptr, lp_index = 0;
531+ const unsigned int *lp_index_ptr;
532+ unsigned int lp_index = 0;
524533
525534 seq_printf(m, "%s %s \n", MODULE_NAME, MODULE_VERS);
526535
@@ -540,8 +549,7 @@ static int lparcfg_data(struct seq_file *m, void *v) · 13 unmodified lines
540549 if (firmware_has_feature(FW_FEATURE_ISERIES))
541550 system_id += 4;
542551 }
543− lp_index_ptr = (unsigned int *)
544− get_property(rootdn, "ibm,partition-no", NULL);
552+ lp_index_ptr = get_property(rootdn, "ibm,partition-no", NULL);
545553 if (lp_index_ptr)
546554 lp_index = *lp_index_ptr;
547555 }
arch/powerpc/kernel/machine_kexec_64.c+4−6
@@ -31,8 +31,8 @@ int default_machine_kexec_prepare(struct kimage *image) · 30 unmodified lines
3131 unsigned long begin, end; /* limits of segment */
3232 unsigned long low, high; /* limits of blocked memory range */
3333 struct device_node *node;
34− unsigned long *basep;
35− unsigned int *sizep;
34+ const unsigned long *basep;
35+ const unsigned int *sizep;
3636
3737 if (!ppc_md.hpte_clear_all)
3838 return -ENOENT;
@@ -72,10 +72,8 @@ int default_machine_kexec_prepare(struct kimage *image) · 33 unmodified lines
7272 /* We also should not overwrite the tce tables */
7373 for (node = of_find_node_by_type(NULL, "pci"); node != NULL;
7474 node = of_find_node_by_type(node, "pci")) {
75− basep = (unsigned long *)get_property(node, "linux,tce-base",
76− NULL);
77− sizep = (unsigned int *)get_property(node, "linux,tce-size",
78− NULL);
75+ basep = get_property(node, "linux,tce-base", NULL);
76+ sizep = get_property(node, "linux,tce-size", NULL);
7977 if (basep == NULL || sizep == NULL)
8078 continue;
8179
arch/powerpc/kernel/misc.S+0−159
@@ -43,162 +43,3 @@ _GLOBAL(add_reloc_offset) · 42 unmodified lines
4343 add r3,r3,r5
4444 mtlr r0
4545 blr
46−
47−/*
48− * I/O string operations
49− *
50− * insb(port, buf, len)
51− * outsb(port, buf, len)
52− * insw(port, buf, len)
53− * outsw(port, buf, len)
54− * insl(port, buf, len)
55− * outsl(port, buf, len)
56− * insw_ns(port, buf, len)
57− * outsw_ns(port, buf, len)
58− * insl_ns(port, buf, len)
59− * outsl_ns(port, buf, len)
60− *
61− * The *_ns versions don't do byte-swapping.
62− */
63−_GLOBAL(_insb)
64− sync
65− cmpwi 0,r5,0
66− mtctr r5
67− subi r4,r4,1
68− blelr-
69−00: lbz r5,0(r3)
70− eieio
71− stbu r5,1(r4)
72− bdnz 00b
73− twi 0,r5,0
74− isync
75− blr
76−
77−_GLOBAL(_outsb)
78− cmpwi 0,r5,0
79− mtctr r5
80− subi r4,r4,1
81− blelr-
82− sync
83−00: lbzu r5,1(r4)
84− stb r5,0(r3)
85− bdnz 00b
86− sync
87− blr
88−
89−_GLOBAL(_insw)
90− sync
91− cmpwi 0,r5,0
92− mtctr r5
93− subi r4,r4,2
94− blelr-
95−00: lhbrx r5,0,r3
96− eieio
97− sthu r5,2(r4)
98− bdnz 00b
99− twi 0,r5,0
100− isync
101− blr
102−
103−_GLOBAL(_outsw)
104− cmpwi 0,r5,0
105− mtctr r5
106− subi r4,r4,2
107− blelr-
108− sync
109−00: lhzu r5,2(r4)
110− sthbrx r5,0,r3
111− bdnz 00b
112− sync
113− blr
114−
115−_GLOBAL(_insl)
116− sync
117− cmpwi 0,r5,0
118− mtctr r5
119− subi r4,r4,4
120− blelr-
121−00: lwbrx r5,0,r3
122− eieio
123− stwu r5,4(r4)
124− bdnz 00b
125− twi 0,r5,0
126− isync
127− blr
128−
129−_GLOBAL(_outsl)
130− cmpwi 0,r5,0
131− mtctr r5
132− subi r4,r4,4
133− blelr-
134− sync
135−00: lwzu r5,4(r4)
136− stwbrx r5,0,r3
137− bdnz 00b
138− sync
139− blr
140−
141−#ifdef CONFIG_PPC32
142−_GLOBAL(__ide_mm_insw)
143−#endif
144−_GLOBAL(_insw_ns)
145− sync
146− cmpwi 0,r5,0
147− mtctr r5
148− subi r4,r4,2
149− blelr-
150−00: lhz r5,0(r3)
151− eieio
152− sthu r5,2(r4)
153− bdnz 00b
154− twi 0,r5,0
155− isync
156− blr
157−
158−#ifdef CONFIG_PPC32
159−_GLOBAL(__ide_mm_outsw)
160−#endif
161−_GLOBAL(_outsw_ns)
162− cmpwi 0,r5,0
163− mtctr r5
164− subi r4,r4,2
165− blelr-
166− sync
167−00: lhzu r5,2(r4)
168− sth r5,0(r3)
169− bdnz 00b
170− sync
171− blr
172−
173−#ifdef CONFIG_PPC32
174−_GLOBAL(__ide_mm_insl)
175−#endif
176−_GLOBAL(_insl_ns)
177− sync
178− cmpwi 0,r5,0
179− mtctr r5
180− subi r4,r4,4
181− blelr-
182−00: lwz r5,0(r3)
183− eieio
184− stwu r5,4(r4)
185− bdnz 00b
186− twi 0,r5,0
187− isync
188− blr
189−
190−#ifdef CONFIG_PPC32
191−_GLOBAL(__ide_mm_outsl)
192−#endif
193−_GLOBAL(_outsl_ns)
194− cmpwi 0,r5,0
195− mtctr r5
196− subi r4,r4,4
197− blelr-
198− sync
199−00: lwzu r5,4(r4)
200− stw r5,0(r3)
201− bdnz 00b
202− sync
203− blr
204−
arch/powerpc/kernel/of_device.c+0−24
@@ -189,27 +189,9 @@ void of_release_dev(struct device *dev) · 188 unmodified lines
189189 int of_device_register(struct of_device *ofdev)
190190 {
191191 int rc;
192− struct of_device **odprop;
193192
194193 BUG_ON(ofdev->node == NULL);
195194
196− odprop = (struct of_device **)get_property(ofdev->node, "linux,device", NULL);
197− if (!odprop) {
198− struct property *new_prop;
199−
200− new_prop = kmalloc(sizeof(struct property) + sizeof(struct of_device *),
201− GFP_KERNEL);
202− if (new_prop == NULL)
203− return -ENOMEM;
204− new_prop->name = "linux,device";
205− new_prop->length = sizeof(sizeof(struct of_device *));
206− new_prop->value = (unsigned char *)&new_prop[1];
207− odprop = (struct of_device **)new_prop->value;
208− *odprop = NULL;
209− prom_add_property(ofdev->node, new_prop);
210− }
211− *odprop = ofdev;
212−
213195 rc = device_register(&ofdev->dev);
214196 if (rc)
215197 return rc;
@@ -221,14 +203,8 @@ int of_device_register(struct of_device *ofdev) · 5 unmodified lines
221203
222204 void of_device_unregister(struct of_device *ofdev)
223205 {
224− struct of_device **odprop;
225−
226206 device_remove_file(&ofdev->dev, &dev_attr_devspec);
227207
228− odprop = (struct of_device **)get_property(ofdev->node, "linux,device", NULL);
229− if (odprop)
230− *odprop = NULL;
231−
232208 device_unregister(&ofdev->dev);
233209 }
234210
arch/powerpc/kernel/paca.c+14−1
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717 #include <asm/lppaca.h>
1818 #include <asm/iseries/it_lp_reg_save.h>
1919 #include <asm/paca.h>
20+#include <asm/mmu.h>
2021
2122
2223 /* This symbol is provided by the linker - let it fill in the paca
@@ -45,6 +46,17 @@ struct lppaca lppaca[] = { · 22 unmodified lines
4546 },
4647 };
4748
49+/*
50+ * 3 persistent SLBs are registered here. The buffer will be zero
51+ * initially, hence will all be invaild until we actually write them.
52+ */
53+struct slb_shadow slb_shadow[] __cacheline_aligned = {
54+ [0 ... (NR_CPUS-1)] = {
55+ .persistent = SLB_NUM_BOLTED,
56+ .buffer_length = sizeof(struct slb_shadow),
57+ },
58+};
59+
4860 /* The Paca is an array with one entry per processor. Each contains an
4961 * lppaca, which contains the information shared between the
5062 * hypervisor and Linux.
@@ -59,7 +71,8 @@ struct lppaca lppaca[] = { · 8 unmodified lines
5971 .lock_token = 0x8000, \
6072 .paca_index = (number), /* Paca Index */ \
6173 .kernel_toc = (unsigned long)(&__toc_start) + 0x8000UL, \
62− .hw_cpu_id = 0xffff,
74+ .hw_cpu_id = 0xffff, \
75+ .slb_shadow_ptr = &slb_shadow[number],
6376
6477 #ifdef CONFIG_PPC_ISERIES
6578 #define PACA_INIT_ISERIES(number) \
arch/powerpc/kernel/pci_32.c+21−18
@@ -633,12 +633,12 @@ pcibios_alloc_controller(void) · 632 unmodified lines
633633 static void
634634 make_one_node_map(struct device_node* node, u8 pci_bus)
635635 {
636− int *bus_range;
636+ const int *bus_range;
637637 int len;
638638
639639 if (pci_bus >= pci_bus_count)
640640 return;
641− bus_range = (int *) get_property(node, "bus-range", &len);
641+ bus_range = get_property(node, "bus-range", &len);
642642 if (bus_range == NULL || len < 2 * sizeof(int)) {
643643 printk(KERN_WARNING "Can't get bus-range for %s, "
644644 "assuming it starts at 0\n", node->full_name);
@@ -648,13 +648,13 @@ make_one_node_map(struct device_node* node, u8 pci_bus) · 3 unmodified lines
648648
649649 for (node=node->child; node != 0;node = node->sibling) {
650650 struct pci_dev* dev;
651− unsigned int *class_code, *reg;
651+ const unsigned int *class_code, *reg;
652652
653− class_code = (unsigned int *) get_property(node, "class-code", NULL);
653+ class_code = get_property(node, "class-code", NULL);
654654 if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI &&
655655 (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS))
656656 continue;
657− reg = (unsigned int *)get_property(node, "reg", NULL);
657+ reg = get_property(node, "reg", NULL);
658658 if (!reg)
659659 continue;
660660 dev = pci_find_slot(pci_bus, ((reg[0] >> 8) & 0xff));
@@ -669,7 +669,7 @@ pcibios_make_OF_bus_map(void) · 8 unmodified lines
669669 {
670670 int i;
671671 struct pci_controller* hose;
672− u8* of_prop_map;
672+ struct property *map_prop;
673673
674674 pci_to_OF_bus_map = (u8*)kmalloc(pci_bus_count, GFP_KERNEL);
675675 if (!pci_to_OF_bus_map) {
@@ -691,9 +691,12 @@ pcibios_make_OF_bus_map(void) · 15 unmodified lines
691691 continue;
692692 make_one_node_map(node, hose->first_busno);
693693 }
694− of_prop_map = get_property(find_path_device("/"), "pci-OF-bus-map", NULL);
695− if (of_prop_map)
696− memcpy(of_prop_map, pci_to_OF_bus_map, pci_bus_count);
694+ map_prop = of_find_property(find_path_device("/"),
695+ "pci-OF-bus-map", NULL);
696+ if (map_prop) {
697+ BUG_ON(pci_bus_count > map_prop->length);
698+ memcpy(map_prop->value, pci_to_OF_bus_map, pci_bus_count);
699+ }
697700 #ifdef DEBUG
698701 printk("PCI->OF bus map:\n");
699702 for (i=0; i<pci_bus_count; i++) {
@@ -712,7 +715,7 @@ scan_OF_pci_childs(struct device_node* node, pci_OF_scan_iterator filter, void* · 12 unmodified lines
712715 struct device_node* sub_node;
713716
714717 for (; node != 0;node = node->sibling) {
715− unsigned int *class_code;
718+ const unsigned int *class_code;
716719
717720 if (filter(node, data))
718721 return node;
@@ -722,7 +725,7 @@ scan_OF_pci_childs(struct device_node* node, pci_OF_scan_iterator filter, void* · 3 unmodified lines
722725 * a fake root for all functions of a multi-function device,
723726 * we go down them as well.
724727 */
725− class_code = (unsigned int *) get_property(node, "class-code", NULL);
728+ class_code = get_property(node, "class-code", NULL);
726729 if ((!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI &&
727730 (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) &&
728731 strcmp(node->name, "multifunc-device"))
@@ -737,10 +740,10 @@ scan_OF_pci_childs(struct device_node* node, pci_OF_scan_iterator filter, void* · 8 unmodified lines
737740 static int
738741 scan_OF_pci_childs_iterator(struct device_node* node, void* data)
739742 {
740− unsigned int *reg;
743+ const unsigned int *reg;
741744 u8* fdata = (u8*)data;
742745
743− reg = (unsigned int *) get_property(node, "reg", NULL);
746+ reg = get_property(node, "reg", NULL);
744747 if (reg && ((reg[0] >> 8) & 0xff) == fdata[1]
745748 && ((reg[0] >> 16) & 0xff) == fdata[0])
746749 return 1;
@@ -841,7 +844,7 @@ find_OF_pci_device_filter(struct device_node* node, void* data) · 94 unmodified lines
841844 int
842845 pci_device_from_OF_node(struct device_node* node, u8* bus, u8* devfn)
843846 {
844− unsigned int *reg;
847+ const unsigned int *reg;
845848 struct pci_controller* hose;
846849 struct pci_dev* dev = NULL;
847850
@@ -854,7 +857,7 @@ pci_device_from_OF_node(struct device_node* node, u8* bus, u8* devfn) · 6 unmodified lines
854857 if (!scan_OF_pci_childs(((struct device_node*)hose->arch_data)->child,
855858 find_OF_pci_device_filter, (void *)node))
856859 return -ENODEV;
857− reg = (unsigned int *) get_property(node, "reg", NULL);
860+ reg = get_property(node, "reg", NULL);
858861 if (!reg)
859862 return -ENODEV;
860863 *bus = (reg[0] >> 16) & 0xff;
@@ -885,8 +888,8 @@ pci_process_bridge_OF_ranges(struct pci_controller *hose, · 24 unmodified lines
885888 struct device_node *dev, int primary)
886889 {
887890 static unsigned int static_lc_ranges[256] __initdata;
888− unsigned int *dt_ranges, *lc_ranges, *ranges, *prev;
889− unsigned int size;
891+ const unsigned int *dt_ranges;
892+ unsigned int *lc_ranges, *ranges, *prev, size;
890893 int rlen = 0, orig_rlen;
891894 int memno = 0;
892895 struct resource *res;
@@ -897,7 +900,7 @@ pci_process_bridge_OF_ranges(struct pci_controller *hose, · 4 unmodified lines
897900 * that can have more than 3 ranges, fortunately using contiguous
898901 * addresses -- BenH
899902 */
900− dt_ranges = (unsigned int *) get_property(dev, "ranges", &rlen);
903+ dt_ranges = get_property(dev, "ranges", &rlen);
901904 if (!dt_ranges)
902905 return;
903906 /* Sanity check, though hopefully that never happens */
arch/powerpc/kernel/pci_64.c+16−51
@@ -185,34 +185,6 @@ static void __devinit pci_setup_pci_controller(struct pci_controller *hose) · 184 unmodified lines
185185 spin_unlock(&hose_spinlock);
186186 }
187187
188−static void add_linux_pci_domain(struct device_node *dev,
189− struct pci_controller *phb)
190−{
191− struct property *of_prop;
192− unsigned int size;
193−
194− of_prop = (struct property *)
195− get_property(dev, "linux,pci-domain", &size);
196− if (of_prop != NULL)
197− return;
198− WARN_ON(of_prop && size < sizeof(int));
199− if (of_prop && size < sizeof(int))
200− of_prop = NULL;
201− size = sizeof(struct property) + sizeof(int);
202− if (of_prop == NULL) {
203− if (mem_init_done)
204− of_prop = kmalloc(size, GFP_KERNEL);
205− else
206− of_prop = alloc_bootmem(size);
207− }
208− memset(of_prop, 0, sizeof(struct property));
209− of_prop->name = "linux,pci-domain";
210− of_prop->length = sizeof(int);
211− of_prop->value = (unsigned char *)&of_prop[1];
212− *((int *)of_prop->value) = phb->global_number;
213− prom_add_property(dev, of_prop);
214−}
215−
216188 struct pci_controller * pcibios_alloc_controller(struct device_node *dev)
217189 {
218190 struct pci_controller *phb;
@@ -226,22 +198,13 @@ struct pci_controller * pcibios_alloc_controller(struct device_node *dev) · 7 unmodified lines
226198 pci_setup_pci_controller(phb);
227199 phb->arch_data = dev;
228200 phb->is_dynamic = mem_init_done;
229− if (dev) {
201+ if (dev)
230202 PHB_SET_NODE(phb, of_node_to_nid(dev));
231− add_linux_pci_domain(dev, phb);
232− }
233203 return phb;
234204 }
235205
236206 void pcibios_free_controller(struct pci_controller *phb)
237207 {
238− if (phb->arch_data) {
239− struct device_node *np = phb->arch_data;
240− int *domain = (int *)get_property(np,
241− "linux,pci-domain", NULL);
242− if (domain)
243− *domain = -1;
244− }
245208 if (phb->is_dynamic)
246209 kfree(phb);
247210 }
@@ -283,10 +246,10 @@ static void __init pcibios_claim_of_setup(void) · 35 unmodified lines
283246 #ifdef CONFIG_PPC_MULTIPLATFORM
284247 static u32 get_int_prop(struct device_node *np, const char *name, u32 def)
285248 {
286− u32 *prop;
249+ const u32 *prop;
287250 int len;
288251
289− prop = (u32 *) get_property(np, name, &len);
252+ prop = get_property(np, name, &len);
290253 if (prop && len >= 4)
291254 return *prop;
292255 return def;
@@ -315,10 +278,11 @@ static void pci_parse_of_addrs(struct device_node *node, struct pci_dev *dev) · 22 unmodified lines
315278 u64 base, size;
316279 unsigned int flags;
317280 struct resource *res;
318− u32 *addrs, i;
281+ const u32 *addrs;
282+ u32 i;
319283 int proplen;
320284
321− addrs = (u32 *) get_property(node, "assigned-addresses", &proplen);
285+ addrs = get_property(node, "assigned-addresses", &proplen);
322286 if (!addrs)
323287 return;
324288 DBG(" parse addresses (%d bytes) @ %p\n", proplen, addrs);
@@ -418,7 +382,7 @@ void __devinit of_scan_bus(struct device_node *node, · 93 unmodified lines
418382 struct pci_bus *bus)
419383 {
420384 struct device_node *child = NULL;
421− u32 *reg;
385+ const u32 *reg;
422386 int reglen, devfn;
423387 struct pci_dev *dev;
424388
@@ -426,7 +390,7 @@ void __devinit of_scan_bus(struct device_node *node, · 1 unmodified line
426390
427391 while ((child = of_get_next_child(node, child)) != NULL) {
428392 DBG(" * %s\n", child->full_name);
429− reg = (u32 *) get_property(child, "reg", &reglen);
393+ reg = get_property(child, "reg", &reglen);
430394 if (reg == NULL || reglen < 20)
431395 continue;
432396 devfn = (reg[0] >> 8) & 0xff;
@@ -450,7 +414,7 @@ void __devinit of_scan_pci_bridge(struct device_node *node, · 17 unmodified lines
450414 struct pci_dev *dev)
451415 {
452416 struct pci_bus *bus;
453− u32 *busrange, *ranges;
417+ const u32 *busrange, *ranges;
454418 int len, i, mode;
455419 struct resource *res;
456420 unsigned int flags;
@@ -459,13 +423,13 @@ void __devinit of_scan_pci_bridge(struct device_node *node, · 2 unmodified lines
459423 DBG("of_scan_pci_bridge(%s)\n", node->full_name);
460424
461425 /* parse bus-range property */
462− busrange = (u32 *) get_property(node, "bus-range", &len);
426+ busrange = get_property(node, "bus-range", &len);
463427 if (busrange == NULL || len != 8) {
464428 printk(KERN_DEBUG "Can't get bus-range for PCI-PCI bridge %s\n",
465429 node->full_name);
466430 return;
467431 }
468− ranges = (u32 *) get_property(node, "ranges", &len);
432+ ranges = get_property(node, "ranges", &len);
469433 if (ranges == NULL) {
470434 printk(KERN_DEBUG "Can't get ranges for PCI-PCI bridge %s\n",
471435 node->full_name);
@@ -929,13 +893,13 @@ static void __devinit pci_process_ISA_OF_ranges(struct device_node *isa_node, · 457 unmodified lines
929893 unsigned int size;
930894 };
931895
932− struct isa_range *range;
896+ const struct isa_range *range;
933897 unsigned long pci_addr;
934898 unsigned int isa_addr;
935899 unsigned int size;
936900 int rlen = 0;
937901
938− range = (struct isa_range *) get_property(isa_node, "ranges", &rlen);
902+ range = get_property(isa_node, "ranges", &rlen);
939903 if (range == NULL || (rlen < sizeof(struct isa_range))) {
940904 printk(KERN_ERR "no ISA ranges or unexpected isa range size,"
941905 "mapping 64k\n");
@@ -976,7 +940,8 @@ static void __devinit pci_process_ISA_OF_ranges(struct device_node *isa_node, · 34 unmodified lines
976940 void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose,
977941 struct device_node *dev, int prim)
978942 {
979− unsigned int *ranges, pci_space;
943+ const unsigned int *ranges;
944+ unsigned int pci_space;
980945 unsigned long size;
981946 int rlen = 0;
982947 int memno = 0;
@@ -994,7 +959,7 @@ void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose, · 11 unmodified lines
994959 * (size depending on dev->n_addr_cells)
995960 * cells 4+5 or 5+6: the size of the range
996961 */
997− ranges = (unsigned int *) get_property(dev, "ranges", &rlen);
962+ ranges = get_property(dev, "ranges", &rlen);
998963 if (ranges == NULL)
999964 return;
1000965 hose->io_base_phys = 0;
arch/powerpc/kernel/pci_dn.c+7−6
@@ -40,8 +40,8 @@ · 39 unmodified lines
4040 static void * __devinit update_dn_pci_info(struct device_node *dn, void *data)
4141 {
4242 struct pci_controller *phb = data;
43− int *type = (int *)get_property(dn, "ibm,pci-config-space-type", NULL);
44− u32 *regs;
43+ const int *type = get_property(dn, "ibm,pci-config-space-type", NULL);
44+ const u32 *regs;
4545 struct pci_dn *pdn;
4646
4747 if (mem_init_done)
@@ -54,14 +54,14 @@ static void * __devinit update_dn_pci_info(struct device_node *dn, void *data) · 6 unmodified lines
5454 dn->data = pdn;
5555 pdn->node = dn;
5656 pdn->phb = phb;
57− regs = (u32 *)get_property(dn, "reg", NULL);
57+ regs = get_property(dn, "reg", NULL);
5858 if (regs) {
5959 /* First register entry is addr (00BBSS00) */
6060 pdn->busno = (regs[0] >> 16) & 0xff;
6161 pdn->devfn = (regs[0] >> 8) & 0xff;
6262 }
6363 if (firmware_has_feature(FW_FEATURE_ISERIES)) {
64− u32 *busp = (u32 *)get_property(dn, "linux,subbus", NULL);
64+ const u32 *busp = get_property(dn, "linux,subbus", NULL);
6565 if (busp)
6666 pdn->bussubno = *busp;
6767 }
@@ -96,10 +96,11 @@ void *traverse_pci_devices(struct device_node *start, traverse_func pre, · 28 unmodified lines
9696
9797 /* We started with a phb, iterate all childs */
9898 for (dn = start->child; dn; dn = nextdn) {
99− u32 *classp, class;
99+ const u32 *classp;
100+ u32 class;
100101
101102 nextdn = NULL;
102− classp = (u32 *)get_property(dn, "class-code", NULL);
103+ classp = get_property(dn, "class-code", NULL);
103104 class = classp ? *classp : 0;
104105
105106 if (pre && ((ret = pre(dn, data)) != NULL))
arch/powerpc/kernel/ppc_ksyms.c+2−17
@@ -91,25 +91,10 @@ EXPORT_SYMBOL(__copy_tofrom_user); · 90 unmodified lines
9191 EXPORT_SYMBOL(__clear_user);
9292 EXPORT_SYMBOL(__strncpy_from_user);
9393 EXPORT_SYMBOL(__strnlen_user);
94−
95−#ifndef __powerpc64__
96−EXPORT_SYMBOL(__ide_mm_insl);
97−EXPORT_SYMBOL(__ide_mm_outsw);
98−EXPORT_SYMBOL(__ide_mm_insw);
99−EXPORT_SYMBOL(__ide_mm_outsl);
94+#ifdef CONFIG_PPC64
95+EXPORT_SYMBOL(copy_4K_page);
10096 #endif
10197
102−EXPORT_SYMBOL(_insb);
103−EXPORT_SYMBOL(_outsb);
104−EXPORT_SYMBOL(_insw);
105−EXPORT_SYMBOL(_outsw);
106−EXPORT_SYMBOL(_insl);
107−EXPORT_SYMBOL(_outsl);
108−EXPORT_SYMBOL(_insw_ns);
109−EXPORT_SYMBOL(_outsw_ns);
110−EXPORT_SYMBOL(_insl_ns);
111−EXPORT_SYMBOL(_outsl_ns);
112−
11398 #if defined(CONFIG_PPC32) && (defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE))
11499 EXPORT_SYMBOL(ppc_ide_md);
115100 #endif
arch/powerpc/kernel/prom.c+14−30
@@ -757,24 +757,9 @@ static int __init early_init_dt_scan_root(unsigned long node, · 756 unmodified lines
757757 static unsigned long __init dt_mem_next_cell(int s, cell_t **cellp)
758758 {
759759 cell_t *p = *cellp;
760− unsigned long r;
761760
762− /* Ignore more than 2 cells */
763− while (s > sizeof(unsigned long) / 4) {
764− p++;
765− s--;
766− }
767− r = *p++;
768−#ifdef CONFIG_PPC64
769− if (s > 1) {
770− r <<= 32;
771− r |= *(p++);
772− s--;
773− }
774−#endif
775−
776− *cellp = p;
777− return r;
761+ *cellp = p + s;
762+ return of_read_ulong(p, s);
778763 }
779764
780765
@@ -942,11 +927,11 @@ void __init early_init_devtree(void *params) · 161 unmodified lines
942927 int
943928 prom_n_addr_cells(struct device_node* np)
944929 {
945− int* ip;
930+ const int *ip;
946931 do {
947932 if (np->parent)
948933 np = np->parent;
949− ip = (int *) get_property(np, "#address-cells", NULL);
934+ ip = get_property(np, "#address-cells", NULL);
950935 if (ip != NULL)
951936 return *ip;
952937 } while (np->parent);
@@ -958,11 +943,11 @@ EXPORT_SYMBOL(prom_n_addr_cells); · 5 unmodified lines
958943 int
959944 prom_n_size_cells(struct device_node* np)
960945 {
961− int* ip;
946+ const int* ip;
962947 do {
963948 if (np->parent)
964949 np = np->parent;
965− ip = (int *) get_property(np, "#size-cells", NULL);
950+ ip = get_property(np, "#size-cells", NULL);
966951 if (ip != NULL)
967952 return *ip;
968953 } while (np->parent);
@@ -1034,7 +1019,7 @@ int device_is_compatible(struct device_node *device, const char *compat) · 65 unmodified lines
10341019 const char* cp;
10351020 int cplen, l;
10361021
1037− cp = (char *) get_property(device, "compatible", &cplen);
1022+ cp = get_property(device, "compatible", &cplen);
10381023 if (cp == NULL)
10391024 return 0;
10401025 while (cplen > 0) {
@@ -1449,7 +1434,7 @@ static int of_finish_dynamic_node(struct device_node *node) · 408 unmodified lines
14491434 {
14501435 struct device_node *parent = of_get_parent(node);
14511436 int err = 0;
1452− phandle *ibm_phandle;
1437+ const phandle *ibm_phandle;
14531438
14541439 node->name = get_property(node, "name", NULL);
14551440 node->type = get_property(node, "device_type", NULL);
@@ -1466,8 +1451,7 @@ static int of_finish_dynamic_node(struct device_node *node) · 10 unmodified lines
14661451 return -ENODEV;
14671452
14681453 /* fix up new node's linux_phandle field */
1469− if ((ibm_phandle = (unsigned int *)get_property(node,
1470− "ibm,phandle", NULL)))
1454+ if ((ibm_phandle = get_property(node, "ibm,phandle", NULL)))
14711455 node->linux_phandle = *ibm_phandle;
14721456
14731457 out:
@@ -1528,7 +1512,7 @@ struct property *of_find_property(struct device_node *np, const char *name, · 54 unmodified lines
15281512 * Find a property with a given name for a given node
15291513 * and return the value.
15301514 */
1531−void *get_property(struct device_node *np, const char *name, int *lenp)
1515+const void *get_property(struct device_node *np, const char *name, int *lenp)
15321516 {
15331517 struct property *pp = of_find_property(np,name,lenp);
15341518 return pp ? pp->value : NULL;
@@ -1658,16 +1642,16 @@ struct device_node *of_get_cpu_node(int cpu, unsigned int *thread) · 123 unmodified lines
16581642 hardid = get_hard_smp_processor_id(cpu);
16591643
16601644 for_each_node_by_type(np, "cpu") {
1661− u32 *intserv;
1645+ const u32 *intserv;
16621646 unsigned int plen, t;
16631647
16641648 /* Check for ibm,ppc-interrupt-server#s. If it doesn't exist
16651649 * fallback to "reg" property and assume no threads
16661650 */
1667− intserv = (u32 *)get_property(np, "ibm,ppc-interrupt-server#s",
1668− &plen);
1651+ intserv = get_property(np, "ibm,ppc-interrupt-server#s",
1652+ &plen);
16691653 if (intserv == NULL) {
1670− u32 *reg = (u32 *)get_property(np, "reg", NULL);
1654+ const u32 *reg = get_property(np, "reg", NULL);
16711655 if (reg == NULL)
16721656 continue;
16731657 if (*reg == hardid) {
arch/powerpc/kernel/prom_init.c+8−2
@@ -2033,16 +2033,22 @@ static void __init fixup_device_tree_maple(void) · 2032 unmodified lines
20332033 #endif
20342034
20352035 #ifdef CONFIG_PPC_CHRP
2036−/* Pegasos lacks the "ranges" property in the isa node */
2036+/* Pegasos and BriQ lacks the "ranges" property in the isa node */
20372037 static void __init fixup_device_tree_chrp(void)
20382038 {
20392039 phandle isa;
20402040 u32 isa_ranges[6];
2041+ u32 rloc = 0x01006000; /* IO space; PCI device = 12 */
20412042 char *name;
20422043 int rc;
20432044
20442045 name = "/pci@80000000/isa@c";
20452046 isa = call_prom("finddevice", 1, 1, ADDR(name));
2047+ if (!PHANDLE_VALID(isa)) {
2048+ name = "/pci@ff500000/isa@6";
2049+ isa = call_prom("finddevice", 1, 1, ADDR(name));
2050+ rloc = 0x01003000; /* IO space; PCI device = 6 */
2051+ }
20462052 if (!PHANDLE_VALID(isa))
20472053 return;
20482054
@@ -2054,7 +2060,7 @@ static void __init fixup_device_tree_chrp(void) · 5 unmodified lines
20542060
20552061 isa_ranges[0] = 0x1;
20562062 isa_ranges[1] = 0x0;
2057− isa_ranges[2] = 0x01006000;
2063+ isa_ranges[2] = rloc;
20582064 isa_ranges[3] = 0x0;
20592065 isa_ranges[4] = 0x0;
20602066 isa_ranges[5] = 0x00010000;
arch/powerpc/kernel/prom_parse.c+47−43
@@ -27,7 +27,7 @@ · 26 unmodified lines
2727
2828 /* Debug utility */
2929 #ifdef DEBUG
30−static void of_dump_addr(const char *s, u32 *addr, int na)
30+static void of_dump_addr(const char *s, const u32 *addr, int na)
3131 {
3232 printk("%s", s);
3333 while(na--)
@@ -35,7 +35,7 @@ static void of_dump_addr(const char *s, u32 *addr, int na) · 1 unmodified line
3535 printk("\n");
3636 }
3737 #else
38−static void of_dump_addr(const char *s, u32 *addr, int na) { }
38+static void of_dump_addr(const char *s, const u32 *addr, int na) { }
3939 #endif
4040
4141
@@ -46,9 +46,10 @@ struct of_bus { · 4 unmodified lines
4646 int (*match)(struct device_node *parent);
4747 void (*count_cells)(struct device_node *child,
4848 int *addrc, int *sizec);
49− u64 (*map)(u32 *addr, u32 *range, int na, int ns, int pna);
49+ u64 (*map)(u32 *addr, const u32 *range,
50+ int na, int ns, int pna);
5051 int (*translate)(u32 *addr, u64 offset, int na);
51− unsigned int (*get_flags)(u32 *addr);
52+ unsigned int (*get_flags)(const u32 *addr);
5253 };
5354
5455
@@ -65,7 +66,8 @@ static void of_bus_default_count_cells(struct device_node *dev, · 10 unmodified lines
6566 *sizec = prom_n_size_cells(dev);
6667 }
6768
68−static u64 of_bus_default_map(u32 *addr, u32 *range, int na, int ns, int pna)
69+static u64 of_bus_default_map(u32 *addr, const u32 *range,
70+ int na, int ns, int pna)
6971 {
7072 u64 cp, s, da;
7173
@@ -93,7 +95,7 @@ static int of_bus_default_translate(u32 *addr, u64 offset, int na) · 21 unmodified lines
9395 return 0;
9496 }
9597
96−static unsigned int of_bus_default_get_flags(u32 *addr)
98+static unsigned int of_bus_default_get_flags(const u32 *addr)
9799 {
98100 return IORESOURCE_MEM;
99101 }
@@ -118,7 +120,7 @@ static void of_bus_pci_count_cells(struct device_node *np, · 18 unmodified lines
118120 *sizec = 2;
119121 }
120122
121−static u64 of_bus_pci_map(u32 *addr, u32 *range, int na, int ns, int pna)
123+static u64 of_bus_pci_map(u32 *addr, const u32 *range, int na, int ns, int pna)
122124 {
123125 u64 cp, s, da;
124126
@@ -143,7 +145,7 @@ static int of_bus_pci_translate(u32 *addr, u64 offset, int na) · 18 unmodified lines
143145 return of_bus_default_translate(addr + 1, offset, na - 1);
144146 }
145147
146−static unsigned int of_bus_pci_get_flags(u32 *addr)
148+static unsigned int of_bus_pci_get_flags(const u32 *addr)
147149 {
148150 unsigned int flags = 0;
149151 u32 w = addr[0];
@@ -178,7 +180,7 @@ static void of_bus_isa_count_cells(struct device_node *child, · 28 unmodified lines
178180 *sizec = 1;
179181 }
180182
181−static u64 of_bus_isa_map(u32 *addr, u32 *range, int na, int ns, int pna)
183+static u64 of_bus_isa_map(u32 *addr, const u32 *range, int na, int ns, int pna)
182184 {
183185 u64 cp, s, da;
184186
@@ -203,7 +205,7 @@ static int of_bus_isa_translate(u32 *addr, u64 offset, int na) · 18 unmodified lines
203205 return of_bus_default_translate(addr + 1, offset, na - 1);
204206 }
205207
206−static unsigned int of_bus_isa_get_flags(u32 *addr)
208+static unsigned int of_bus_isa_get_flags(const u32 *addr)
207209 {
208210 unsigned int flags = 0;
209211 u32 w = addr[0];
@@ -268,7 +270,7 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus, · 58 unmodified lines
268270 struct of_bus *pbus, u32 *addr,
269271 int na, int ns, int pna)
270272 {
271− u32 *ranges;
273+ const u32 *ranges;
272274 unsigned int rlen;
273275 int rone;
274276 u64 offset = OF_BAD_ADDR;
@@ -285,7 +287,7 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus, · 10 unmodified lines
285287 * to translate addresses that aren't supposed to be translated in
286288 * the first place. --BenH.
287289 */
288− ranges = (u32 *)get_property(parent, "ranges", &rlen);
290+ ranges = get_property(parent, "ranges", &rlen);
289291 if (ranges == NULL || rlen == 0) {
290292 offset = of_read_number(addr, na);
291293 memset(addr, 0, pna * 4);
@@ -328,7 +330,7 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus, · 36 unmodified lines
328330 * that can be mapped to a cpu physical address). This is not really specified
329331 * that way, but this is traditionally the way IBM at least do things
330332 */
331−u64 of_translate_address(struct device_node *dev, u32 *in_addr)
333+u64 of_translate_address(struct device_node *dev, const u32 *in_addr)
332334 {
333335 struct device_node *parent = NULL;
334336 struct of_bus *bus, *pbus;
@@ -405,10 +407,10 @@ u64 of_translate_address(struct device_node *dev, u32 *in_addr) · 70 unmodified lines
405407 }
406408 EXPORT_SYMBOL(of_translate_address);
407409
408−u32 *of_get_address(struct device_node *dev, int index, u64 *size,
410+const u32 *of_get_address(struct device_node *dev, int index, u64 *size,
409411 unsigned int *flags)
410412 {
411− u32 *prop;
413+ const u32 *prop;
412414 unsigned int psize;
413415 struct device_node *parent;
414416 struct of_bus *bus;
@@ -425,7 +427,7 @@ u32 *of_get_address(struct device_node *dev, int index, u64 *size, · 10 unmodified lines
425427 return NULL;
426428
427429 /* Get "reg" or "assigned-addresses" property */
428− prop = (u32 *)get_property(dev, bus->addresses, &psize);
430+ prop = get_property(dev, bus->addresses, &psize);
429431 if (prop == NULL)
430432 return NULL;
431433 psize /= 4;
@@ -443,10 +445,10 @@ u32 *of_get_address(struct device_node *dev, int index, u64 *size, · 11 unmodified lines
443445 }
444446 EXPORT_SYMBOL(of_get_address);
445447
446−u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size,
448+const u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size,
447449 unsigned int *flags)
448450 {
449− u32 *prop;
451+ const u32 *prop;
450452 unsigned int psize;
451453 struct device_node *parent;
452454 struct of_bus *bus;
@@ -467,7 +469,7 @@ u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size, · 14 unmodified lines
467469 return NULL;
468470
469471 /* Get "reg" or "assigned-addresses" property */
470− prop = (u32 *)get_property(dev, bus->addresses, &psize);
472+ prop = get_property(dev, bus->addresses, &psize);
471473 if (prop == NULL)
472474 return NULL;
473475 psize /= 4;
@@ -485,7 +487,7 @@ u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size, · 11 unmodified lines
485487 }
486488 EXPORT_SYMBOL(of_get_pci_address);
487489
488−static int __of_address_to_resource(struct device_node *dev, u32 *addrp,
490+static int __of_address_to_resource(struct device_node *dev, const u32 *addrp,
489491 u64 size, unsigned int flags,
490492 struct resource *r)
491493 {
@@ -516,7 +518,7 @@ static int __of_address_to_resource(struct device_node *dev, u32 *addrp, · 24 unmodified lines
516518 int of_address_to_resource(struct device_node *dev, int index,
517519 struct resource *r)
518520 {
519− u32 *addrp;
521+ const u32 *addrp;
520522 u64 size;
521523 unsigned int flags;
522524
@@ -530,7 +532,7 @@ EXPORT_SYMBOL_GPL(of_address_to_resource); · 7 unmodified lines
530532 int of_pci_address_to_resource(struct device_node *dev, int bar,
531533 struct resource *r)
532534 {
533− u32 *addrp;
535+ const u32 *addrp;
534536 u64 size;
535537 unsigned int flags;
536538
@@ -541,13 +543,14 @@ int of_pci_address_to_resource(struct device_node *dev, int bar, · 4 unmodified lines
541543 }
542544 EXPORT_SYMBOL_GPL(of_pci_address_to_resource);
543545
544−void of_parse_dma_window(struct device_node *dn, unsigned char *dma_window_prop,
546+void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop,
545547 unsigned long *busno, unsigned long *phys, unsigned long *size)
546548 {
547− u32 *dma_window, cells;
548− unsigned char *prop;
549+ const u32 *dma_window;
550+ u32 cells;
551+ const unsigned char *prop;
549552
550− dma_window = (u32 *)dma_window_prop;
553+ dma_window = dma_window_prop;
551554
552555 /* busno is always one cell */
553556 *busno = *(dma_window++);
@@ -576,13 +579,13 @@ static struct device_node *of_irq_dflt_pic; · 22 unmodified lines
576579 static struct device_node *of_irq_find_parent(struct device_node *child)
577580 {
578581 struct device_node *p;
579− phandle *parp;
582+ const phandle *parp;
580583
581584 if (!of_node_get(child))
582585 return NULL;
583586
584587 do {
585− parp = (phandle *)get_property(child, "interrupt-parent", NULL);
588+ parp = get_property(child, "interrupt-parent", NULL);
586589 if (parp == NULL)
587590 p = of_get_parent(child);
588591 else {
@@ -639,11 +642,11 @@ void of_irq_map_init(unsigned int flags) · 50 unmodified lines
639642
640643 }
641644
642−int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 ointsize,
643− u32 *addr, struct of_irq *out_irq)
645+int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize,
646+ const u32 *addr, struct of_irq *out_irq)
644647 {
645648 struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL;
646− u32 *tmp, *imap, *imask;
649+ const u32 *tmp, *imap, *imask;
647650 u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0;
648651 int imaplen, match, i;
649652
@@ -657,7 +660,7 @@ int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 ointsize, · 7 unmodified lines
657660 * is none, we are nice and just walk up the tree
658661 */
659662 do {
660− tmp = (u32 *)get_property(ipar, "#interrupt-cells", NULL);
663+ tmp = get_property(ipar, "#interrupt-cells", NULL);
661664 if (tmp != NULL) {
662665 intsize = *tmp;
663666 break;
@@ -681,7 +684,7 @@ int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 ointsize, · 17 unmodified lines
681684 */
682685 old = of_node_get(ipar);
683686 do {
684− tmp = (u32 *)get_property(old, "#address-cells", NULL);
687+ tmp = get_property(old, "#address-cells", NULL);
685688 tnode = of_get_parent(old);
686689 of_node_put(old);
687690 old = tnode;
@@ -708,7 +711,7 @@ int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 ointsize, · 20 unmodified lines
708711 }
709712
710713 /* Now look for an interrupt-map */
711− imap = (u32 *)get_property(ipar, "interrupt-map", &imaplen);
714+ imap = get_property(ipar, "interrupt-map", &imaplen);
712715 /* No interrupt map, check for an interrupt parent */
713716 if (imap == NULL) {
714717 DBG(" -> no map, getting parent\n");
@@ -718,7 +721,7 @@ int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 ointsize, · 3 unmodified lines
718721 imaplen /= sizeof(u32);
719722
720723 /* Look for a mask */
721− imask = (u32 *)get_property(ipar, "interrupt-map-mask", NULL);
724+ imask = get_property(ipar, "interrupt-map-mask", NULL);
722725
723726 /* If we were passed no "reg" property and we attempt to parse
724727 * an interrupt-map, then #address-cells must be 0.
@@ -765,14 +768,14 @@ int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 ointsize, · 40 unmodified lines
765768 /* Get #interrupt-cells and #address-cells of new
766769 * parent
767770 */
768− tmp = (u32 *)get_property(newpar, "#interrupt-cells",
771+ tmp = get_property(newpar, "#interrupt-cells",
769772 NULL);
770773 if (tmp == NULL) {
771774 DBG(" -> parent lacks #interrupt-cells !\n");
772775 goto fail;
773776 }
774777 newintsize = *tmp;
775− tmp = (u32 *)get_property(newpar, "#address-cells",
778+ tmp = get_property(newpar, "#address-cells",
776779 NULL);
777780 newaddrsize = (tmp == NULL) ? 0 : *tmp;
778781
@@ -818,14 +821,14 @@ EXPORT_SYMBOL_GPL(of_irq_map_raw); · 39 unmodified lines
818821 static int of_irq_map_oldworld(struct device_node *device, int index,
819822 struct of_irq *out_irq)
820823 {
821− u32 *ints;
824+ const u32 *ints;
822825 int intlen;
823826
824827 /*
825828 * Old machines just have a list of interrupt numbers
826829 * and no interrupt-controller nodes.
827830 */
828− ints = (u32 *) get_property(device, "AAPL,interrupts", &intlen);
831+ ints = get_property(device, "AAPL,interrupts", &intlen);
829832 if (ints == NULL)
830833 return -EINVAL;
831834 intlen /= sizeof(u32);
@@ -850,7 +853,8 @@ static int of_irq_map_oldworld(struct device_node *device, int index, · 18 unmodified lines
850853 int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq)
851854 {
852855 struct device_node *p;
853− u32 *intspec, *tmp, intsize, intlen, *addr;
856+ const u32 *intspec, *tmp, *addr;
857+ u32 intsize, intlen;
854858 int res;
855859
856860 DBG("of_irq_map_one: dev=%s, index=%d\n", device->full_name, index);
@@ -860,13 +864,13 @@ int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq · 3 unmodified lines
860864 return of_irq_map_oldworld(device, index, out_irq);
861865
862866 /* Get the interrupts property */
863− intspec = (u32 *)get_property(device, "interrupts", &intlen);
867+ intspec = get_property(device, "interrupts", &intlen);
864868 if (intspec == NULL)
865869 return -EINVAL;
866870 intlen /= sizeof(u32);
867871
868872 /* Get the reg property (if any) */
869− addr = (u32 *)get_property(device, "reg", NULL);
873+ addr = get_property(device, "reg", NULL);
870874
871875 /* Look for the interrupt parent. */
872876 p = of_irq_find_parent(device);
@@ -874,7 +878,7 @@ int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq · 1 unmodified line
874878 return -EINVAL;
875879
876880 /* Get size of interrupt specifier */
877− tmp = (u32 *)get_property(p, "#interrupt-cells", NULL);
881+ tmp = get_property(p, "#interrupt-cells", NULL);
878882 if (tmp == NULL) {
879883 of_node_put(p);
880884 return -EINVAL;
arch/powerpc/kernel/rtas-proc.c+13−12
@@ -246,12 +246,12 @@ struct file_operations ppc_rtas_rmo_buf_ops = { · 245 unmodified lines
246246
247247 static int ppc_rtas_find_all_sensors(void);
248248 static void ppc_rtas_process_sensor(struct seq_file *m,
249− struct individual_sensor *s, int state, int error, char *loc);
249+ struct individual_sensor *s, int state, int error, const char *loc);
250250 static char *ppc_rtas_process_error(int error);
251251 static void get_location_code(struct seq_file *m,
252− struct individual_sensor *s, char *loc);
253−static void check_location_string(struct seq_file *m, char *c);
254−static void check_location(struct seq_file *m, char *c);
252+ struct individual_sensor *s, const char *loc);
253+static void check_location_string(struct seq_file *m, const char *c);
254+static void check_location(struct seq_file *m, const char *c);
255255
256256 static int __init proc_rtas_init(void)
257257 {
@@ -446,11 +446,11 @@ static int ppc_rtas_sensors_show(struct seq_file *m, void *v) · 188 unmodified lines
446446 for (i=0; i<sensors.quant; i++) {
447447 struct individual_sensor *p = &sensors.sensor[i];
448448 char rstr[64];
449− char *loc;
449+ const char *loc;
450450 int llen, offs;
451451
452452 sprintf (rstr, SENSOR_PREFIX"%04d", p->token);
453− loc = (char *) get_property(rtas_node, rstr, &llen);
453+ loc = get_property(rtas_node, rstr, &llen);
454454
455455 /* A sensor may have multiple instances */
456456 for (j = 0, offs = 0; j <= p->quant; j++) {
@@ -474,10 +474,10 @@ static int ppc_rtas_sensors_show(struct seq_file *m, void *v) · 17 unmodified lines
474474
475475 static int ppc_rtas_find_all_sensors(void)
476476 {
477− unsigned int *utmp;
477+ const unsigned int *utmp;
478478 int len, i;
479479
480− utmp = (unsigned int *) get_property(rtas_node, "rtas-sensors", &len);
480+ utmp = get_property(rtas_node, "rtas-sensors", &len);
481481 if (utmp == NULL) {
482482 printk (KERN_ERR "error: could not get rtas-sensors\n");
483483 return 1;
@@ -530,7 +530,7 @@ static char *ppc_rtas_process_error(int error) · 46 unmodified lines
530530 */
531531
532532 static void ppc_rtas_process_sensor(struct seq_file *m,
533− struct individual_sensor *s, int state, int error, char *loc)
533+ struct individual_sensor *s, int state, int error, const char *loc)
534534 {
535535 /* Defined return vales */
536536 const char * key_switch[] = { "Off\t", "Normal\t", "Secure\t",
@@ -682,7 +682,7 @@ static void ppc_rtas_process_sensor(struct seq_file *m, · 145 unmodified lines
682682
683683 /* ****************************************************************** */
684684
685−static void check_location(struct seq_file *m, char *c)
685+static void check_location(struct seq_file *m, const char *c)
686686 {
687687 switch (c[0]) {
688688 case LOC_PLANAR:
@@ -719,7 +719,7 @@ static void check_location(struct seq_file *m, char *c) · 30 unmodified lines
719719 * ${LETTER}${NUMBER}[[-/]${LETTER}${NUMBER} [ ... ] ]
720720 * the '.' may be an abbrevation
721721 */
722−static void check_location_string(struct seq_file *m, char *c)
722+static void check_location_string(struct seq_file *m, const char *c)
723723 {
724724 while (*c) {
725725 if (isalpha(*c) || *c == '.')
@@ -733,7 +733,8 @@ static void check_location_string(struct seq_file *m, char *c) · 7 unmodified lines
733733
734734 /* ****************************************************************** */
735735
736−static void get_location_code(struct seq_file *m, struct individual_sensor *s, char *loc)
736+static void get_location_code(struct seq_file *m, struct individual_sensor *s,
737+ const char *loc)
737738 {
738739 if (!loc || !*loc) {
739740 seq_printf(m, "---");/* does not have a location */
arch/powerpc/kernel/rtas.c+28−19
@@ -177,10 +177,12 @@ void __init udbg_init_rtas_console(void) · 176 unmodified lines
177177 void rtas_progress(char *s, unsigned short hex)
178178 {
179179 struct device_node *root;
180− int width, *p;
180+ int width;
181+ const int *p;
181182 char *os;
182183 static int display_character, set_indicator;
183− static int display_width, display_lines, *row_width, form_feed;
184+ static int display_width, display_lines, form_feed;
185+ const static int *row_width;
184186 static DEFINE_SPINLOCK(progress_lock);
185187 static int current_line;
186188 static int pending_newline = 0; /* did last write end with unprinted newline? */
@@ -191,16 +193,16 @@ void rtas_progress(char *s, unsigned short hex) · 4 unmodified lines
191193 if (display_width == 0) {
192194 display_width = 0x10;
193195 if ((root = find_path_device("/rtas"))) {
194− if ((p = (unsigned int *)get_property(root,
196+ if ((p = get_property(root,
195197 "ibm,display-line-length", NULL)))
196198 display_width = *p;
197− if ((p = (unsigned int *)get_property(root,
199+ if ((p = get_property(root,
198200 "ibm,form-feed", NULL)))
199201 form_feed = *p;
200− if ((p = (unsigned int *)get_property(root,
202+ if ((p = get_property(root,
201203 "ibm,display-number-of-lines", NULL)))
202204 display_lines = *p;
203− row_width = (unsigned int *)get_property(root,
205+ row_width = get_property(root,
204206 "ibm,display-truncation-length", NULL);
205207 }
206208 display_character = rtas_token("display-character");
@@ -293,10 +295,10 @@ EXPORT_SYMBOL(rtas_progress); /* needed by rtas_flash module */ · 86 unmodified lines
293295
294296 int rtas_token(const char *service)
295297 {
296− int *tokp;
298+ const int *tokp;
297299 if (rtas.dev == NULL)
298300 return RTAS_UNKNOWN_SERVICE;
299− tokp = (int *) get_property(rtas.dev, service, NULL);
301+ tokp = get_property(rtas.dev, service, NULL);
300302 return tokp ? *tokp : RTAS_UNKNOWN_SERVICE;
301303 }
302304 EXPORT_SYMBOL(rtas_token);
@@ -626,6 +628,9 @@ void rtas_os_term(char *str) · 323 unmodified lines
626628 {
627629 int status;
628630
631+ if (panic_timeout)
632+ return;
633+
629634 if (RTAS_UNKNOWN_SERVICE == rtas_token("ibm,os-term"))
630635 return;
631636
@@ -687,15 +692,14 @@ static int rtas_ibm_suspend_me(struct rtas_args *args) · 55 unmodified lines
687692 int i;
688693 long state;
689694 long rc;
690− unsigned long dummy;
691−
695+ unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
692696 struct rtas_suspend_me_data data;
693697
694698 /* Make sure the state is valid */
695− rc = plpar_hcall(H_VASI_STATE,
696− ((u64)args->args[0] << 32) | args->args[1],
697− 0, 0, 0,
698− &state, &dummy, &dummy);
699+ rc = plpar_hcall(H_VASI_STATE, retbuf,
700+ ((u64)args->args[0] << 32) | args->args[1]);
701+
702+ state = retbuf[0];
699703
700704 if (rc) {
701705 printk(KERN_ERR "rtas_ibm_suspend_me: vasi_state returned %ld\n",rc);
@@ -845,15 +849,15 @@ void __init rtas_initialize(void) · 143 unmodified lines
845849 */
846850 rtas.dev = of_find_node_by_name(NULL, "rtas");
847851 if (rtas.dev) {
848− u32 *basep, *entryp;
849− u32 *sizep;
852+ const u32 *basep, *entryp, *sizep;
850853
851− basep = (u32 *)get_property(rtas.dev, "linux,rtas-base", NULL);
852− sizep = (u32 *)get_property(rtas.dev, "rtas-size", NULL);
854+ basep = get_property(rtas.dev, "linux,rtas-base", NULL);
855+ sizep = get_property(rtas.dev, "rtas-size", NULL);
853856 if (basep != NULL && sizep != NULL) {
854857 rtas.base = *basep;
855858 rtas.size = *sizep;
856− entryp = (u32 *)get_property(rtas.dev, "linux,rtas-entry", NULL);
859+ entryp = get_property(rtas.dev,
860+ "linux,rtas-entry", NULL);
857861 if (entryp == NULL) /* Ugh */
858862 rtas.entry = rtas.base;
859863 else
@@ -909,6 +913,11 @@ int __init early_init_dt_scan_rtas(unsigned long node, · 49 unmodified lines
909913 basep = of_get_flat_dt_prop(node, "get-term-char", NULL);
910914 if (basep)
911915 rtas_getchar_token = *basep;
916+
917+ if (rtas_putchar_token != RTAS_UNKNOWN_SERVICE &&
918+ rtas_getchar_token != RTAS_UNKNOWN_SERVICE)
919+ udbg_init_rtas_console();
920+
912921 #endif
913922
914923 /* break now */
arch/powerpc/kernel/rtas_pci.c+13−15
@@ -57,7 +57,7 @@ static inline int config_access_valid(struct pci_dn *dn, int where) · 56 unmodified lines
5757
5858 static int of_device_available(struct device_node * dn)
5959 {
60− char * status;
60+ const char *status;
6161
6262 status = get_property(dn, "status", NULL);
6363
@@ -81,8 +81,7 @@ int rtas_read_config(struct pci_dn *pdn, int where, int size, u32 *val) · 17 unmodified lines
8181 if (!config_access_valid(pdn, where))
8282 return PCIBIOS_BAD_REGISTER_NUMBER;
8383
84− addr = ((where & 0xf00) << 20) | (pdn->busno << 16) |
85− (pdn->devfn << 8) | (where & 0xff);
84+ addr = rtas_config_addr(pdn->busno, pdn->devfn, where);
8685 buid = pdn->phb->buid;
8786 if (buid) {
8887 ret = rtas_call(ibm_read_pci_config, 4, 2, &returnval,
@@ -134,8 +133,7 @@ int rtas_write_config(struct pci_dn *pdn, int where, int size, u32 val) · 45 unmodified lines
134133 if (!config_access_valid(pdn, where))
135134 return PCIBIOS_BAD_REGISTER_NUMBER;
136135
137− addr = ((where & 0xf00) << 20) | (pdn->busno << 16) |
138− (pdn->devfn << 8) | (where & 0xff);
136+ addr = rtas_config_addr(pdn->busno, pdn->devfn, where);
139137 buid = pdn->phb->buid;
140138 if (buid) {
141139 ret = rtas_call(ibm_write_pci_config, 5, 1, NULL, addr,
@@ -178,7 +176,7 @@ struct pci_ops rtas_pci_ops = { · 36 unmodified lines
178176
179177 int is_python(struct device_node *dev)
180178 {
181− char *model = (char *)get_property(dev, "model", NULL);
179+ const char *model = get_property(dev, "model", NULL);
182180
183181 if (model && strstr(model, "Python"))
184182 return 1;
@@ -234,7 +232,7 @@ void __init init_pci_config_tokens (void) · 49 unmodified lines
234232 unsigned long __devinit get_phb_buid (struct device_node *phb)
235233 {
236234 int addr_cells;
237− unsigned int *buid_vals;
235+ const unsigned int *buid_vals;
238236 unsigned int len;
239237 unsigned long buid;
240238
@@ -247,7 +245,7 @@ unsigned long __devinit get_phb_buid (struct device_node *phb) · 6 unmodified lines
247245 if (phb->parent->parent)
248246 return 0;
249247
250− buid_vals = (unsigned int *) get_property(phb, "reg", &len);
248+ buid_vals = get_property(phb, "reg", &len);
251249 if (buid_vals == NULL)
252250 return 0;
253251
@@ -264,10 +262,10 @@ unsigned long __devinit get_phb_buid (struct device_node *phb) · 10 unmodified lines
264262 static int phb_set_bus_ranges(struct device_node *dev,
265263 struct pci_controller *phb)
266264 {
267− int *bus_range;
265+ const int *bus_range;
268266 unsigned int len;
269267
270− bus_range = (int *) get_property(dev, "bus-range", &len);
268+ bus_range = get_property(dev, "bus-range", &len);
271269 if (bus_range == NULL || len < 2 * sizeof(int)) {
272270 return 1;
273271 }
@@ -325,15 +323,15 @@ unsigned long __init find_and_init_phbs(void) · 51 unmodified lines
325323 * in chosen.
326324 */
327325 if (of_chosen) {
328− int *prop;
326+ const int *prop;
329327
330− prop = (int *)get_property(of_chosen, "linux,pci-probe-only",
331− NULL);
328+ prop = get_property(of_chosen,
329+ "linux,pci-probe-only", NULL);
332330 if (prop)
333331 pci_probe_only = *prop;
334332
335− prop = (int *)get_property(of_chosen,
336− "linux,pci-assign-all-buses", NULL);
333+ prop = get_property(of_chosen,
334+ "linux,pci-assign-all-buses", NULL);
337335 if (prop)
338336 pci_assign_all_buses = *prop;
339337 }
arch/powerpc/kernel/setup-common.c+18−14
@@ -304,19 +304,21 @@ struct seq_operations cpuinfo_op = { · 303 unmodified lines
304304 void __init check_for_initrd(void)
305305 {
306306 #ifdef CONFIG_BLK_DEV_INITRD
307− unsigned long *prop;
307+ const unsigned int *prop;
308+ int len;
308309
309310 DBG(" -> check_for_initrd()\n");
310311
311312 if (of_chosen) {
312− prop = (unsigned long *)get_property(of_chosen,
313− "linux,initrd-start", NULL);
313+ prop = get_property(of_chosen, "linux,initrd-start", &len);
314314 if (prop != NULL) {
315− initrd_start = (unsigned long)__va(*prop);
316− prop = (unsigned long *)get_property(of_chosen,
317− "linux,initrd-end", NULL);
315+ initrd_start = (unsigned long)
316+ __va(of_read_ulong(prop, len / 4));
317+ prop = get_property(of_chosen,
318+ "linux,initrd-end", &len);
318319 if (prop != NULL) {
319− initrd_end = (unsigned long)__va(*prop);
320+ initrd_end = (unsigned long)
321+ __va(of_read_ulong(prop, len / 4));
320322 initrd_below_start_ok = 1;
321323 } else
322324 initrd_start = 0;
@@ -366,15 +368,14 @@ void __init smp_setup_cpu_maps(void) · 43 unmodified lines
366368 int cpu = 0;
367369
368370 while ((dn = of_find_node_by_type(dn, "cpu")) && cpu < NR_CPUS) {
369− int *intserv;
371+ const int *intserv;
370372 int j, len = sizeof(u32), nthreads = 1;
371373
372− intserv = (int *)get_property(dn, "ibm,ppc-interrupt-server#s",
373− &len);
374+ intserv = get_property(dn, "ibm,ppc-interrupt-server#s", &len);
374375 if (intserv)
375376 nthreads = len / sizeof(int);
376377 else {
377− intserv = (int *) get_property(dn, "reg", NULL);
378+ intserv = get_property(dn, "reg", NULL);
378379 if (!intserv)
379380 intserv = &cpu; /* assume logical == phys */
380381 }
@@ -395,13 +396,12 @@ void __init smp_setup_cpu_maps(void) · 14 unmodified lines
395396 if (machine_is(pseries) && firmware_has_feature(FW_FEATURE_LPAR) &&
396397 (dn = of_find_node_by_path("/rtas"))) {
397398 int num_addr_cell, num_size_cell, maxcpus;
398− unsigned int *ireg;
399+ const unsigned int *ireg;
399400
400401 num_addr_cell = prom_n_addr_cells(dn);
401402 num_size_cell = prom_n_size_cells(dn);
402403
403− ireg = (unsigned int *)
404− get_property(dn, "ibm,lrdr-capacity", NULL);
404+ ireg = get_property(dn, "ibm,lrdr-capacity", NULL);
405405
406406 if (!ireg)
407407 goto out;
@@ -444,6 +444,8 @@ void __init smp_setup_cpu_maps(void) · 36 unmodified lines
444444
445445 int __initdata do_early_xmon;
446446 #ifdef CONFIG_XMON
447+extern int xmon_no_auto_backtrace;
448+
447449 static int __init early_xmon(char *p)
448450 {
449451 /* ensure xmon is enabled */
@@ -452,6 +454,8 @@ static int __init early_xmon(char *p) · 2 unmodified lines
452454 xmon_init(1);
453455 if (strncmp(p, "off", 3) == 0)
454456 xmon_init(0);
457+ if (strncmp(p, "nobt", 4) == 0)
458+ xmon_no_auto_backtrace = 1;
455459 if (strncmp(p, "early", 5) != 0)
456460 return 0;
457461 }
arch/powerpc/kernel/setup_64.c+11−12
@@ -56,7 +56,6 @@ · 55 unmodified lines
5656 #include <asm/page.h>
5757 #include <asm/mmu.h>
5858 #include <asm/lmb.h>
59−#include <asm/iseries/it_lp_naca.h>
6059 #include <asm/firmware.h>
6160 #include <asm/xmon.h>
6261 #include <asm/udbg.h>
@@ -79,10 +78,10 @@ u64 ppc64_pft_size; · 16 unmodified lines
7978 * before we've read this from the device tree.
8079 */
8180 struct ppc64_caches ppc64_caches = {
82− .dline_size = 0x80,
83− .log_dline_size = 7,
84− .iline_size = 0x80,
85− .log_iline_size = 7
81+ .dline_size = 0x40,
82+ .log_dline_size = 6,
83+ .iline_size = 0x40,
84+ .log_iline_size = 6
8685 };
8786 EXPORT_SYMBOL_GPL(ppc64_caches);
8887
@@ -107,7 +106,7 @@ static int smt_enabled_cmdline; · 18 unmodified lines
107106 static void check_smt_enabled(void)
108107 {
109108 struct device_node *dn;
110− char *smt_option;
109+ const char *smt_option;
111110
112111 /* Allow the command line to overrule the OF option */
113112 if (smt_enabled_cmdline)
@@ -116,7 +115,7 @@ static void check_smt_enabled(void) · 2 unmodified lines
116115 dn = of_find_node_by_path("/options");
117116
118117 if (dn) {
119− smt_option = (char *)get_property(dn, "ibm,smt-enabled", NULL);
118+ smt_option = get_property(dn, "ibm,smt-enabled", NULL);
120119
121120 if (smt_option) {
122121 if (!strcmp(smt_option, "on"))
@@ -293,7 +292,7 @@ static void __init initialize_cache_info(void) · 170 unmodified lines
293292 */
294293
295294 if ( num_cpus == 1 ) {
296− u32 *sizep, *lsizep;
295+ const u32 *sizep, *lsizep;
297296 u32 size, lsize;
298297 const char *dc, *ic;
299298
@@ -308,10 +307,10 @@ static void __init initialize_cache_info(void) · 8 unmodified lines
308307
309308 size = 0;
310309 lsize = cur_cpu_spec->dcache_bsize;
311− sizep = (u32 *)get_property(np, "d-cache-size", NULL);
310+ sizep = get_property(np, "d-cache-size", NULL);
312311 if (sizep != NULL)
313312 size = *sizep;
314− lsizep = (u32 *) get_property(np, dc, NULL);
313+ lsizep = get_property(np, dc, NULL);
315314 if (lsizep != NULL)
316315 lsize = *lsizep;
317316 if (sizep == 0 || lsizep == 0)
@@ -325,10 +324,10 @@ static void __init initialize_cache_info(void) · 7 unmodified lines
325324
326325 size = 0;
327326 lsize = cur_cpu_spec->icache_bsize;
328− sizep = (u32 *)get_property(np, "i-cache-size", NULL);
327+ sizep = get_property(np, "i-cache-size", NULL);
329328 if (sizep != NULL)
330329 size = *sizep;
331− lsizep = (u32 *)get_property(np, ic, NULL);
330+ lsizep = get_property(np, ic, NULL);
332331 if (lsizep != NULL)
333332 lsize = *lsizep;
334333 if (sizep == 0 || lsizep == 0)
arch/powerpc/kernel/sysfs.c+4−5
@@ -60,7 +60,7 @@ static int smt_snooze_cmdline; · 59 unmodified lines
6060 static int __init smt_setup(void)
6161 {
6262 struct device_node *options;
63− unsigned int *val;
63+ const unsigned int *val;
6464 unsigned int cpu;
6565
6666 if (!cpu_has_feature(CPU_FTR_SMT))
@@ -70,8 +70,7 @@ static int __init smt_setup(void) · 3 unmodified lines
7070 if (!options)
7171 return -ENODEV;
7272
73− val = (unsigned int *)get_property(options, "ibm,smt-snooze-delay",
74− NULL);
73+ val = get_property(options, "ibm,smt-snooze-delay", NULL);
7574 if (!smt_snooze_cmdline && val) {
7675 for_each_possible_cpu(cpu)
7776 per_cpu(smt_snooze_delay, cpu) = *val;
@@ -231,7 +230,7 @@ static void register_cpu_online(unsigned int cpu) · 153 unmodified lines
231230 if (cur_cpu_spec->num_pmcs >= 8)
232231 sysdev_create_file(s, &attr_pmc8);
233232
234− if (cpu_has_feature(CPU_FTR_SMT))
233+ if (cpu_has_feature(CPU_FTR_PURR))
235234 sysdev_create_file(s, &attr_purr);
236235 }
237236
@@ -273,7 +272,7 @@ static void unregister_cpu_online(unsigned int cpu) · 35 unmodified lines
273272 if (cur_cpu_spec->num_pmcs >= 8)
274273 sysdev_remove_file(s, &attr_pmc8);
275274
276− if (cpu_has_feature(CPU_FTR_SMT))
275+ if (cpu_has_feature(CPU_FTR_PURR))
277276 sysdev_remove_file(s, &attr_purr);
278277 }
279278 #endif /* CONFIG_HOTPLUG_CPU */
arch/powerpc/kernel/time.c+3−5
@@ -860,19 +860,17 @@ EXPORT_SYMBOL(do_settimeofday); · 859 unmodified lines
860860 static int __init get_freq(char *name, int cells, unsigned long *val)
861861 {
862862 struct device_node *cpu;
863− unsigned int *fp;
863+ const unsigned int *fp;
864864 int found = 0;
865865
866866 /* The cpu node should have timebase and clock frequency properties */
867867 cpu = of_find_node_by_type(NULL, "cpu");
868868
869869 if (cpu) {
870− fp = (unsigned int *)get_property(cpu, name, NULL);
870+ fp = get_property(cpu, name, NULL);
871871 if (fp) {
872872 found = 1;
873− *val = 0;
874− while (cells--)
875− *val = (*val << 32) | *fp++;
873+ *val = of_read_ulong(fp, cells);
876874 }
877875
878876 of_node_put(cpu);
arch/powerpc/kernel/traps.c+25−0
@@ -598,6 +598,9 @@ static void parse_fpe(struct pt_regs *regs) · 597 unmodified lines
598598 #define INST_STSWI 0x7c0005aa
599599 #define INST_STSWX 0x7c00052a
600600
601+#define INST_POPCNTB 0x7c0000f4
602+#define INST_POPCNTB_MASK 0xfc0007fe
603+
601604 static int emulate_string_inst(struct pt_regs *regs, u32 instword)
602605 {
603606 u8 rT = (instword >> 21) & 0x1f;
@@ -666,6 +669,23 @@ static int emulate_string_inst(struct pt_regs *regs, u32 instword) · 62 unmodified lines
666669 return 0;
667670 }
668671
672+static int emulate_popcntb_inst(struct pt_regs *regs, u32 instword)
673+{
674+ u32 ra,rs;
675+ unsigned long tmp;
676+
677+ ra = (instword >> 16) & 0x1f;
678+ rs = (instword >> 21) & 0x1f;
679+
680+ tmp = regs->gpr[rs];
681+ tmp = tmp - ((tmp >> 1) & 0x5555555555555555ULL);
682+ tmp = (tmp & 0x3333333333333333ULL) + ((tmp >> 2) & 0x3333333333333333ULL);
683+ tmp = (tmp + (tmp >> 4)) & 0x0f0f0f0f0f0f0f0fULL;
684+ regs->gpr[ra] = tmp;
685+
686+ return 0;
687+}
688+
669689 static int emulate_instruction(struct pt_regs *regs)
670690 {
671691 u32 instword;
@@ -703,6 +723,11 @@ static int emulate_instruction(struct pt_regs *regs) · 31 unmodified lines
703723 if ((instword & INST_STRING_GEN_MASK) == INST_STRING)
704724 return emulate_string_inst(regs, instword);
705725
726+ /* Emulate the popcntb (Population Count Bytes) instruction. */
727+ if ((instword & INST_POPCNTB_MASK) == INST_POPCNTB) {
728+ return emulate_popcntb_inst(regs, instword);
729+ }
730+
706731 return -EINVAL;
707732 }
708733
arch/powerpc/kernel/vio.c+8−8
@@ -77,7 +77,7 @@ static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev) · 76 unmodified lines
7777 } else
7878 #endif
7979 {
80− unsigned char *dma_window;
80+ const unsigned char *dma_window;
8181 struct iommu_table *tbl;
8282 unsigned long offset, size;
8383
@@ -217,7 +217,7 @@ static void __devinit vio_dev_release(struct device *dev) · 133 unmodified lines
217217 struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node)
218218 {
219219 struct vio_dev *viodev;
220− unsigned int *unit_address;
220+ const unsigned int *unit_address;
221221
222222 /* we need the 'device_type' property, in order to match with drivers */
223223 if (of_node->type == NULL) {
@@ -227,7 +227,7 @@ struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node) · 3 unmodified lines
227227 return NULL;
228228 }
229229
230− unit_address = (unsigned int *)get_property(of_node, "reg", NULL);
230+ unit_address = get_property(of_node, "reg", NULL);
231231 if (unit_address == NULL) {
232232 printk(KERN_WARNING "%s: node %s missing 'reg'\n",
233233 __FUNCTION__,
@@ -249,7 +249,7 @@ struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node) · 15 unmodified lines
249249 viodev->type = of_node->type;
250250 viodev->unit_address = *unit_address;
251251 if (firmware_has_feature(FW_FEATURE_ISERIES)) {
252− unit_address = (unsigned int *)get_property(of_node,
252+ unit_address = get_property(of_node,
253253 "linux,unit_address", NULL);
254254 if (unit_address != NULL)
255255 viodev->unit_address = *unit_address;
@@ -423,7 +423,7 @@ static int vio_hotplug(struct device *dev, char **envp, int num_envp, · 167 unmodified lines
423423 {
424424 const struct vio_dev *vio_dev = to_vio_dev(dev);
425425 struct device_node *dn = dev->platform_data;
426− char *cp;
426+ const char *cp;
427427 int length;
428428
429429 if (!num_envp)
@@ -431,7 +431,7 @@ static int vio_hotplug(struct device *dev, char **envp, int num_envp, · 1 unmodified line
431431
432432 if (!dn)
433433 return -ENODEV;
434− cp = (char *)get_property(dn, "compatible", &length);
434+ cp = get_property(dn, "compatible", &length);
435435 if (!cp)
436436 return -ENODEV;
437437
@@ -493,11 +493,11 @@ static struct vio_dev *vio_find_name(const char *kobj_name) · 55 unmodified lines
493493 */
494494 struct vio_dev *vio_find_node(struct device_node *vnode)
495495 {
496− uint32_t *unit_address;
496+ const uint32_t *unit_address;
497497 char kobj_name[BUS_ID_SIZE];
498498
499499 /* construct the kobject name from the device node */
500− unit_address = (uint32_t *)get_property(vnode, "reg", NULL);
500+ unit_address = get_property(vnode, "reg", NULL);
501501 if (!unit_address)
502502 return NULL;
503503 snprintf(kobj_name, BUS_ID_SIZE, "%x", *unit_address);
arch/powerpc/lib/Makefile+0−1
@@ -14,7 +14,6 @@ endif · 13 unmodified lines
1414 obj-$(CONFIG_PPC64) += checksum_64.o copypage_64.o copyuser_64.o \
1515 memcpy_64.o usercopy_64.o mem_64.o string.o \
1616 strcase.o
17−obj-$(CONFIG_PPC_ISERIES) += e2a.o
1817 obj-$(CONFIG_XMON) += sstep.o
1918
2019 ifeq ($(CONFIG_PPC64),y)
arch/powerpc/lib/e2a.c+0−116
@@ -1,116 +0,0 @@
1−/*
2− * EBCDIC to ASCII conversion
3− *
4− * This function moved here from arch/powerpc/platforms/iseries/viopath.c
5− *
6− * (C) Copyright 2000-2004 IBM Corporation
7− *
8− * This program is free software; you can redistribute it and/or
9− * modify it under the terms of the GNU General Public License as
10− * published by the Free Software Foundation; either version 2 of the
11− * License, or (at your option) anyu later version.
12− *
13− * This program is distributed in the hope that it will be useful, but
14− * WITHOUT ANY WARRANTY; without even the implied warranty of
15− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16− * General Public License for more details.
17− *
18− * You should have received a copy of the GNU General Public License
19− * along with this program; if not, write to the Free Software Foundation,
20− * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21− *
22− */
23−
24−#include <linux/module.h>
25−
26−unsigned char e2a(unsigned char x)
27−{
28− switch (x) {
29− case 0xF0:
30− return '0';
31− case 0xF1:
32− return '1';
33− case 0xF2:
34− return '2';
35− case 0xF3:
36− return '3';
37− case 0xF4:
38− return '4';
39− case 0xF5:
40− return '5';
41− case 0xF6:
42− return '6';
43− case 0xF7:
44− return '7';
45− case 0xF8:
46− return '8';
47− case 0xF9:
48− return '9';
49− case 0xC1:
50− return 'A';
51− case 0xC2:
52− return 'B';
53− case 0xC3:
54− return 'C';
55− case 0xC4:
56− return 'D';
57− case 0xC5:
58− return 'E';
59− case 0xC6:
60− return 'F';
61− case 0xC7:
62− return 'G';
63− case 0xC8:
64− return 'H';
65− case 0xC9:
66− return 'I';
67− case 0xD1:
68− return 'J';
69− case 0xD2:
70− return 'K';
71− case 0xD3:
72− return 'L';
73− case 0xD4:
74− return 'M';
75− case 0xD5:
76− return 'N';
77− case 0xD6:
78− return 'O';
79− case 0xD7:
80− return 'P';
81− case 0xD8:
82− return 'Q';
83− case 0xD9:
84− return 'R';
85− case 0xE2:
86− return 'S';
87− case 0xE3:
88− return 'T';
89− case 0xE4:
90− return 'U';
91− case 0xE5:
92− return 'V';
93− case 0xE6:
94− return 'W';
95− case 0xE7:
96− return 'X';
97− case 0xE8:
98− return 'Y';
99− case 0xE9:
100− return 'Z';
101− }
102− return ' ';
103−}
104−EXPORT_SYMBOL(e2a);
105−
106−unsigned char* strne2a(unsigned char *dest, const unsigned char *src, size_t n)
107−{
108− int i;
109−
110− n = strnlen(src, n);
111−
112− for (i = 0; i < n; i++)
113− dest[i] = e2a(src[i]);
114−
115− return dest;
116−}
arch/powerpc/lib/locks.c+13−14
@@ -23,6 +23,7 @@ · 22 unmodified lines
2323 #include <asm/hvcall.h>
2424 #include <asm/iseries/hv_call.h>
2525 #include <asm/smp.h>
26+#include <asm/firmware.h>
2627
2728 void __spin_yield(raw_spinlock_t *lock)
2829 {
@@ -39,13 +40,12 @@ void __spin_yield(raw_spinlock_t *lock) · 10 unmodified lines
3940 rmb();
4041 if (lock->slock != lock_value)
4142 return; /* something has changed */
42−#ifdef CONFIG_PPC_ISERIES
43− HvCall2(HvCallBaseYieldProcessor, HvCall_YieldToProc,
44− ((u64)holder_cpu << 32) | yield_count);
45−#else
46− plpar_hcall_norets(H_CONFER, get_hard_smp_processor_id(holder_cpu),
47− yield_count);
48−#endif
43+ if (firmware_has_feature(FW_FEATURE_ISERIES))
44+ HvCall2(HvCallBaseYieldProcessor, HvCall_YieldToProc,
45+ ((u64)holder_cpu << 32) | yield_count);
46+ else
47+ plpar_hcall_norets(H_CONFER,
48+ get_hard_smp_processor_id(holder_cpu), yield_count);
4949 }
5050
5151 /*
@@ -69,13 +69,12 @@ void __rw_yield(raw_rwlock_t *rw) · 17 unmodified lines
6969 rmb();
7070 if (rw->lock != lock_value)
7171 return; /* something has changed */
72−#ifdef CONFIG_PPC_ISERIES
73− HvCall2(HvCallBaseYieldProcessor, HvCall_YieldToProc,
74− ((u64)holder_cpu << 32) | yield_count);
75−#else
76− plpar_hcall_norets(H_CONFER, get_hard_smp_processor_id(holder_cpu),
77− yield_count);
78−#endif
72+ if (firmware_has_feature(FW_FEATURE_ISERIES))
73+ HvCall2(HvCallBaseYieldProcessor, HvCall_YieldToProc,
74+ ((u64)holder_cpu << 32) | yield_count);
75+ else
76+ plpar_hcall_norets(H_CONFER,
77+ get_hard_smp_processor_id(holder_cpu), yield_count);
7978 }
8079 #endif
8180
arch/powerpc/mm/numa.c+14−17
@@ -159,12 +159,12 @@ static struct device_node * __cpuinit find_cpu_node(unsigned int cpu) · 158 unmodified lines
159159 {
160160 unsigned int hw_cpuid = get_hard_smp_processor_id(cpu);
161161 struct device_node *cpu_node = NULL;
162− unsigned int *interrupt_server, *reg;
162+ const unsigned int *interrupt_server, *reg;
163163 int len;
164164
165165 while ((cpu_node = of_find_node_by_type(cpu_node, "cpu")) != NULL) {
166166 /* Try interrupt server first */
167− interrupt_server = (unsigned int *)get_property(cpu_node,
167+ interrupt_server = get_property(cpu_node,
168168 "ibm,ppc-interrupt-server#s", &len);
169169
170170 len = len / sizeof(u32);
@@ -175,8 +175,7 @@ static struct device_node * __cpuinit find_cpu_node(unsigned int cpu) · 4 unmodified lines
175175 return cpu_node;
176176 }
177177 } else {
178− reg = (unsigned int *)get_property(cpu_node,
179− "reg", &len);
178+ reg = get_property(cpu_node, "reg", &len);
180179 if (reg && (len > 0) && (reg[0] == hw_cpuid))
181180 return cpu_node;
182181 }
@@ -186,9 +185,9 @@ static struct device_node * __cpuinit find_cpu_node(unsigned int cpu) · 3 unmodified lines
186185 }
187186
188187 /* must hold reference to node during call */
189−static int *of_get_associativity(struct device_node *dev)
188+static const int *of_get_associativity(struct device_node *dev)
190189 {
191− return (unsigned int *)get_property(dev, "ibm,associativity", NULL);
190+ return get_property(dev, "ibm,associativity", NULL);
192191 }
193192
194193 /* Returns nid in the range [0..MAX_NUMNODES-1], or -1 if no useful numa
@@ -197,7 +196,7 @@ static int *of_get_associativity(struct device_node *dev) · 2 unmodified lines
197196 static int of_node_to_nid_single(struct device_node *device)
198197 {
199198 int nid = -1;
200− unsigned int *tmp;
199+ const unsigned int *tmp;
201200
202201 if (min_common_depth == -1)
203202 goto out;
@@ -255,7 +254,7 @@ EXPORT_SYMBOL_GPL(of_node_to_nid); · 51 unmodified lines
255254 static int __init find_min_common_depth(void)
256255 {
257256 int depth;
258− unsigned int *ref_points;
257+ const unsigned int *ref_points;
259258 struct device_node *rtas_root;
260259 unsigned int len;
261260
@@ -270,7 +269,7 @@ static int __init find_min_common_depth(void) · 8 unmodified lines
270269 * configuration (should be all 0's) and the second is for a normal
271270 * NUMA configuration.
272271 */
273− ref_points = (unsigned int *)get_property(rtas_root,
272+ ref_points = get_property(rtas_root,
274273 "ibm,associativity-reference-points", &len);
275274
276275 if ((len >= 1) && ref_points) {
@@ -297,7 +296,7 @@ static void __init get_n_mem_cells(int *n_addr_cells, int *n_size_cells) · 20 unmodified lines
297296 of_node_put(memory);
298297 }
299298
300−static unsigned long __devinit read_n_cells(int n, unsigned int **buf)
299+static unsigned long __devinit read_n_cells(int n, const unsigned int **buf)
301300 {
302301 unsigned long result = 0;
303302
@@ -435,15 +434,13 @@ static int __init parse_numa_properties(void) · 131 unmodified lines
435434 unsigned long size;
436435 int nid;
437436 int ranges;
438− unsigned int *memcell_buf;
437+ const unsigned int *memcell_buf;
439438 unsigned int len;
440439
441− memcell_buf = (unsigned int *)get_property(memory,
440+ memcell_buf = get_property(memory,
442441 "linux,usable-memory", &len);
443442 if (!memcell_buf || len <= 0)
444− memcell_buf =
445− (unsigned int *)get_property(memory, "reg",
446− &len);
443+ memcell_buf = get_property(memory, "reg", &len);
447444 if (!memcell_buf || len <= 0)
448445 continue;
449446
@@ -787,10 +784,10 @@ int hot_add_scn_to_nid(unsigned long scn_addr) · 337 unmodified lines
787784 while ((memory = of_find_node_by_type(memory, "memory")) != NULL) {
788785 unsigned long start, size;
789786 int ranges;
790− unsigned int *memcell_buf;
787+ const unsigned int *memcell_buf;
791788 unsigned int len;
792789
793− memcell_buf = (unsigned int *)get_property(memory, "reg", &len);
790+ memcell_buf = get_property(memory, "reg", &len);
794791 if (!memcell_buf || len <= 0)
795792 continue;
796793
arch/powerpc/mm/slb.c+33−4
@@ -22,6 +22,8 @@ · 21 unmodified lines
2222 #include <asm/paca.h>
2323 #include <asm/cputable.h>
2424 #include <asm/cacheflush.h>
25+#include <asm/smp.h>
26+#include <linux/compiler.h>
2527
2628 #ifdef DEBUG
2729 #define DBG(fmt...) udbg_printf(fmt)
@@ -50,9 +52,32 @@ static inline unsigned long mk_vsid_data(unsigned long ea, unsigned long flags) · 22 unmodified lines
5052 return (get_kernel_vsid(ea) << SLB_VSID_SHIFT) | flags;
5153 }
5254
53−static inline void create_slbe(unsigned long ea, unsigned long flags,
54− unsigned long entry)
55+static inline void slb_shadow_update(unsigned long esid, unsigned long vsid,
56+ unsigned long entry)
5557 {
58+ /*
59+ * Clear the ESID first so the entry is not valid while we are
60+ * updating it.
61+ */
62+ get_slb_shadow()->save_area[entry].esid = 0;
63+ barrier();
64+ get_slb_shadow()->save_area[entry].vsid = vsid;
65+ barrier();
66+ get_slb_shadow()->save_area[entry].esid = esid;
67+
68+}
69+
70+static inline void create_shadowed_slbe(unsigned long ea, unsigned long flags,
71+ unsigned long entry)
72+{
73+ /*
74+ * Updating the shadow buffer before writing the SLB ensures
75+ * we don't get a stale entry here if we get preempted by PHYP
76+ * between these two statements.
77+ */
78+ slb_shadow_update(mk_esid_data(ea, entry), mk_vsid_data(ea, flags),
79+ entry);
80+
5681 asm volatile("slbmte %0,%1" :
5782 : "r" (mk_vsid_data(ea, flags)),
5883 "r" (mk_esid_data(ea, entry))
@@ -77,6 +102,10 @@ void slb_flush_and_rebolt(void) · 18 unmodified lines
77102 if ((ksp_esid_data & ESID_MASK) == PAGE_OFFSET)
78103 ksp_esid_data &= ~SLB_ESID_V;
79104
105+ /* Only third entry (stack) may change here so only resave that */
106+ slb_shadow_update(ksp_esid_data,
107+ mk_vsid_data(ksp_esid_data, lflags), 2);
108+
80109 /* We need to do this all in asm, so we're sure we don't touch
81110 * the stack between the slbia and rebolting it. */
82111 asm volatile("isync\n"
@@ -209,9 +238,9 @@ void slb_initialize(void) · 126 unmodified lines
209238 asm volatile("isync":::"memory");
210239 asm volatile("slbmte %0,%0"::"r" (0) : "memory");
211240 asm volatile("isync; slbia; isync":::"memory");
212− create_slbe(PAGE_OFFSET, lflags, 0);
241+ create_shadowed_slbe(PAGE_OFFSET, lflags, 0);
213242
214− create_slbe(VMALLOC_START, vflags, 1);
243+ create_shadowed_slbe(VMALLOC_START, vflags, 1);
215244
216245 /* We don't bolt the stack for the time being - we're in boot,
217246 * so the stack is in the bolted segment. By the time it goes
arch/powerpc/mm/tlb_64.c+1−0
@@ -146,6 +146,7 @@ void hpte_update(struct mm_struct *mm, unsigned long addr, · 145 unmodified lines
146146 psize = mmu_huge_psize;
147147 #else
148148 BUG();
149+ psize = pte_pagesize_index(pte); /* shutup gcc */
149150 #endif
150151 } else
151152 psize = pte_pagesize_index(pte);
arch/powerpc/platforms/83xx/mpc834x_itx.c+2−2
@@ -60,8 +60,8 @@ static void __init mpc834x_itx_setup_arch(void) · 59 unmodified lines
6060
6161 np = of_find_node_by_type(NULL, "cpu");
6262 if (np != 0) {
63− unsigned int *fp =
64− (int *)get_property(np, "clock-frequency", NULL);
63+ const unsigned int *fp =
64+ get_property(np, "clock-frequency", NULL);
6565 if (fp != 0)
6666 loops_per_jiffy = *fp / HZ;
6767 else
arch/powerpc/platforms/83xx/mpc834x_sys.c+2−2
@@ -57,8 +57,8 @@ static void __init mpc834x_sys_setup_arch(void) · 56 unmodified lines
5757
5858 np = of_find_node_by_type(NULL, "cpu");
5959 if (np != 0) {
60− unsigned int *fp =
61− (int *)get_property(np, "clock-frequency", NULL);
60+ const unsigned int *fp =
61+ get_property(np, "clock-frequency", NULL);
6262 if (fp != 0)
6363 loops_per_jiffy = *fp / HZ;
6464 else
arch/powerpc/platforms/83xx/pci.c+2−2
@@ -59,7 +59,7 @@ int __init add_bridge(struct device_node *dev) · 58 unmodified lines
5959 int len;
6060 struct pci_controller *hose;
6161 struct resource rsrc;
62− int *bus_range;
62+ const int *bus_range;
6363 int primary = 1, has_address = 0;
6464 phys_addr_t immr = get_immrbase();
6565
@@ -69,7 +69,7 @@ int __init add_bridge(struct device_node *dev) · 3 unmodified lines
6969 has_address = (of_address_to_resource(dev, 0, &rsrc) == 0);
7070
7171 /* Get bus range if any */
72− bus_range = (int *)get_property(dev, "bus-range", &len);
72+ bus_range = get_property(dev, "bus-range", &len);
7373 if (bus_range == NULL || len < 2 * sizeof(int)) {
7474 printk(KERN_WARNING "Can't get bus-range for %s, assume"
7575 " bus 0\n", dev->full_name);
arch/powerpc/platforms/85xx/mpc85xx_ads.c+2−2
@@ -121,9 +121,9 @@ static void __init mpc85xx_ads_setup_arch(void) · 120 unmodified lines
121121
122122 cpu = of_find_node_by_type(NULL, "cpu");
123123 if (cpu != 0) {
124− unsigned int *fp;
124+ const unsigned int *fp;
125125
126− fp = (int *)get_property(cpu, "clock-frequency", NULL);
126+ fp = get_property(cpu, "clock-frequency", NULL);
127127 if (fp != 0)
128128 loops_per_jiffy = *fp / HZ;
129129 else
arch/powerpc/platforms/85xx/mpc85xx_cds.c+2−2
@@ -241,9 +241,9 @@ mpc85xx_cds_setup_arch(void) · 240 unmodified lines
241241
242242 cpu = of_find_node_by_type(NULL, "cpu");
243243 if (cpu != 0) {
244− unsigned int *fp;
244+ const unsigned int *fp;
245245
246− fp = (int *)get_property(cpu, "clock-frequency", NULL);
246+ fp = get_property(cpu, "clock-frequency", NULL);
247247 if (fp != 0)
248248 loops_per_jiffy = *fp / HZ;
249249 else
arch/powerpc/platforms/85xx/pci.c+2−2
@@ -41,7 +41,7 @@ int __init add_bridge(struct device_node *dev) · 40 unmodified lines
4141 int len;
4242 struct pci_controller *hose;
4343 struct resource rsrc;
44− int *bus_range;
44+ const int *bus_range;
4545 int primary = 1, has_address = 0;
4646 phys_addr_t immr = get_immrbase();
4747
@@ -51,7 +51,7 @@ int __init add_bridge(struct device_node *dev) · 3 unmodified lines
5151 has_address = (of_address_to_resource(dev, 0, &rsrc) == 0);
5252
5353 /* Get bus range if any */
54− bus_range = (int *) get_property(dev, "bus-range", &len);
54+ bus_range = get_property(dev, "bus-range", &len);
5555 if (bus_range == NULL || len < 2 * sizeof(int)) {
5656 printk(KERN_WARNING "Can't get bus-range for %s, assume"
5757 " bus 0\n", dev->full_name);
arch/powerpc/platforms/86xx/mpc86xx_hpcn.c+2−2
@@ -347,9 +347,9 @@ mpc86xx_hpcn_setup_arch(void) · 346 unmodified lines
347347
348348 np = of_find_node_by_type(NULL, "cpu");
349349 if (np != 0) {
350− unsigned int *fp;
350+ const unsigned int *fp;
351351
352− fp = (int *)get_property(np, "clock-frequency", NULL);
352+ fp = get_property(np, "clock-frequency", NULL);
353353 if (fp != 0)
354354 loops_per_jiffy = *fp / HZ;
355355 else
arch/powerpc/platforms/86xx/pci.c+2−2
@@ -153,7 +153,7 @@ int __init add_bridge(struct device_node *dev) · 152 unmodified lines
153153 int len;
154154 struct pci_controller *hose;
155155 struct resource rsrc;
156− int *bus_range;
156+ const int *bus_range;
157157 int has_address = 0;
158158 int primary = 0;
159159
@@ -163,7 +163,7 @@ int __init add_bridge(struct device_node *dev) · 3 unmodified lines
163163 has_address = (of_address_to_resource(dev, 0, &rsrc) == 0);
164164
165165 /* Get bus range if any */
166− bus_range = (int *) get_property(dev, "bus-range", &len);
166+ bus_range = get_property(dev, "bus-range", &len);
167167 if (bus_range == NULL || len < 2 * sizeof(int))
168168 printk(KERN_WARNING "Can't get bus-range for %s, assume"
169169 " bus 0\n", dev->full_name);
arch/powerpc/platforms/Makefile+1−0
@@ -13,5 +13,6 @@ obj-$(CONFIG_PPC_86xx) += 86xx/ · 12 unmodified lines
1313 obj-$(CONFIG_PPC_PSERIES) += pseries/
1414 obj-$(CONFIG_PPC_ISERIES) += iseries/
1515 obj-$(CONFIG_PPC_MAPLE) += maple/
16+obj-$(CONFIG_PPC_PASEMI) += pasemi/
1617 obj-$(CONFIG_PPC_CELL) += cell/
1718 obj-$(CONFIG_EMBEDDED6xx) += embedded6xx/
arch/powerpc/platforms/cell/cbe_regs.c+3−5
@@ -97,7 +97,7 @@ void __init cbe_regs_init(void) · 96 unmodified lines
9797 struct cbe_regs_map *map = &cbe_regs_maps[cbe_regs_map_count++];
9898
9999 /* That hack must die die die ! */
100− struct address_prop {
100+ const struct address_prop {
101101 unsigned long address;
102102 unsigned int len;
103103 } __attribute__((packed)) *prop;
@@ -114,13 +114,11 @@ void __init cbe_regs_init(void) · 10 unmodified lines
114114 if (cbe_thread_map[i].cpu_node == cpu)
115115 cbe_thread_map[i].regs = map;
116116
117− prop = (struct address_prop *)get_property(cpu, "pervasive",
118− NULL);
117+ prop = get_property(cpu, "pervasive", NULL);
119118 if (prop != NULL)
120119 map->pmd_regs = ioremap(prop->address, prop->len);
121120
122− prop = (struct address_prop *)get_property(cpu, "iic",
123− NULL);
121+ prop = get_property(cpu, "iic", NULL);
124122 if (prop != NULL)
125123 map->iic_regs = ioremap(prop->address, prop->len);
126124 }
arch/powerpc/platforms/cell/interrupt.c+12−13
@@ -89,17 +89,17 @@ static struct irq_chip iic_chip = { · 88 unmodified lines
8989 /* Get an IRQ number from the pending state register of the IIC */
9090 static unsigned int iic_get_irq(struct pt_regs *regs)
9191 {
92− struct cbe_iic_pending_bits pending;
93− struct iic *iic;
94−
95− iic = &__get_cpu_var(iic);
96− *(unsigned long *) &pending =
97− in_be64((unsigned long __iomem *) &iic->regs->pending_destr);
98− iic->eoi_stack[++iic->eoi_ptr] = pending.prio;
99− BUG_ON(iic->eoi_ptr > 15);
92+ struct cbe_iic_pending_bits pending;
93+ struct iic *iic;
94+
95+ iic = &__get_cpu_var(iic);
96+ *(unsigned long *) &pending =
97+ in_be64((unsigned long __iomem *) &iic->regs->pending_destr);
98+ iic->eoi_stack[++iic->eoi_ptr] = pending.prio;
99+ BUG_ON(iic->eoi_ptr > 15);
100100 if (pending.flags & CBE_IIC_IRQ_VALID)
101101 return irq_linear_revmap(iic->host,
102− iic_pending_to_hwnum(pending));
102+ iic_pending_to_hwnum(pending));
103103 return NO_IRQ;
104104 }
105105
@@ -250,16 +250,15 @@ static int __init setup_iic(void) · 144 unmodified lines
250250 struct resource r0, r1;
251251 struct irq_host *host;
252252 int found = 0;
253− u32 *np;
253+ const u32 *np;
254254
255255 for (dn = NULL;
256256 (dn = of_find_node_by_name(dn,"interrupt-controller")) != NULL;) {
257257 if (!device_is_compatible(dn,
258258 "IBM,CBEA-Internal-Interrupt-Controller"))
259259 continue;
260− np = (u32 *)get_property(dn, "ibm,interrupt-server-ranges",
261− NULL);
262− if (np == NULL) {
260+ np = get_property(dn, "ibm,interrupt-server-ranges", NULL);
261+ if (np == NULL) {
263262 printk(KERN_WARNING "IIC: CPU association not found\n");
264263 of_node_put(dn);
265264 return -ENODEV;
arch/powerpc/platforms/cell/iommu.c+12−10
@@ -308,15 +308,16 @@ static void cell_do_map_iommu(struct cell_iommu *iommu, · 307 unmodified lines
308308
309309 static void iommu_devnode_setup(struct device_node *d)
310310 {
311− unsigned int *ioid;
312− unsigned long *dma_window, map_start, map_size, token;
311+ const unsigned int *ioid;
312+ unsigned long map_start, map_size, token;
313+ const unsigned long *dma_window;
313314 struct cell_iommu *iommu;
314315
315− ioid = (unsigned int *)get_property(d, "ioid", NULL);
316+ ioid = get_property(d, "ioid", NULL);
316317 if (!ioid)
317318 pr_debug("No ioid entry found !\n");
318319
319− dma_window = (unsigned long *)get_property(d, "ibm,dma-window", NULL);
320+ dma_window = get_property(d, "ibm,dma-window", NULL);
320321 if (!dma_window)
321322 pr_debug("No ibm,dma-window entry found !\n");
322323
@@ -371,8 +372,9 @@ static int cell_map_iommu_hardcoded(int num_nodes) · 48 unmodified lines
371372
372373 static int cell_map_iommu(void)
373374 {
374− unsigned int num_nodes = 0, *node_id;
375− unsigned long *base, *mmio_base;
375+ unsigned int num_nodes = 0;
376+ const unsigned int *node_id;
377+ const unsigned long *base, *mmio_base;
376378 struct device_node *dn;
377379 struct cell_iommu *iommu = NULL;
378380
@@ -381,7 +383,7 @@ static int cell_map_iommu(void) · 2 unmodified lines
381383 for(dn = of_find_node_by_type(NULL, "cpu");
382384 dn;
383385 dn = of_find_node_by_type(dn, "cpu")) {
384− node_id = (unsigned int *)get_property(dn, "node-id", NULL);
386+ node_id = get_property(dn, "node-id", NULL);
385387
386388 if (num_nodes < *node_id)
387389 num_nodes = *node_id;
@@ -396,9 +398,9 @@ static int cell_map_iommu(void) · 8 unmodified lines
396398 dn;
397399 dn = of_find_node_by_type(dn, "cpu")) {
398400
399− node_id = (unsigned int *)get_property(dn, "node-id", NULL);
400− base = (unsigned long *)get_property(dn, "ioc-cache", NULL);
401− mmio_base = (unsigned long *)get_property(dn, "ioc-translation", NULL);
401+ node_id = get_property(dn, "node-id", NULL);
402+ base = get_property(dn, "ioc-cache", NULL);
403+ mmio_base = get_property(dn, "ioc-translation", NULL);
402404
403405 if (!base || !mmio_base || !node_id)
404406 return cell_map_iommu_hardcoded(num_nodes);
arch/powerpc/platforms/cell/setup.c+0−4
@@ -150,10 +150,6 @@ static int __init cell_probe(void) · 149 unmodified lines
150150 !of_flat_dt_is_compatible(root, "IBM,CPBW-1.0"))
151151 return 0;
152152
153−#ifdef CONFIG_UDBG_RTAS_CONSOLE
154− udbg_init_rtas_console();
155−#endif
156−
157153 hpte_init_native();
158154
159155 return 1;
arch/powerpc/platforms/cell/smp.c+2−2
@@ -57,7 +57,7 @@ · 56 unmodified lines
5757 */
5858 static cpumask_t of_spin_map;
5959
60−extern void pSeries_secondary_smp_init(unsigned long);
60+extern void generic_secondary_smp_init(unsigned long);
6161
6262 /**
6363 * smp_startup_cpu() - start the given cpu
@@ -74,7 +74,7 @@ static inline int __devinit smp_startup_cpu(unsigned int lcpu) · 10 unmodified lines
7474 {
7575 int status;
7676 unsigned long start_here = __pa((u32)*((unsigned long *)
77− pSeries_secondary_smp_init));
77+ generic_secondary_smp_init));
7878 unsigned int pcpu;
7979 int start_cpu;
8080
arch/powerpc/platforms/cell/spider-pic.c+5−5
@@ -240,7 +240,7 @@ static void spider_irq_cascade(unsigned int irq, struct irq_desc *desc, · 239 unmodified lines
240240 static unsigned int __init spider_find_cascade_and_node(struct spider_pic *pic)
241241 {
242242 unsigned int virq;
243− u32 *imap, *tmp;
243+ const u32 *imap, *tmp;
244244 int imaplen, intsize, unit;
245245 struct device_node *iic;
246246 struct irq_host *iic_host;
@@ -258,25 +258,25 @@ static unsigned int __init spider_find_cascade_and_node(struct spider_pic *pic) · 11 unmodified lines
258258 #endif
259259
260260 /* Now do the horrible hacks */
261− tmp = (u32 *)get_property(pic->of_node, "#interrupt-cells", NULL);
261+ tmp = get_property(pic->of_node, "#interrupt-cells", NULL);
262262 if (tmp == NULL)
263263 return NO_IRQ;
264264 intsize = *tmp;
265− imap = (u32 *)get_property(pic->of_node, "interrupt-map", &imaplen);
265+ imap = get_property(pic->of_node, "interrupt-map", &imaplen);
266266 if (imap == NULL || imaplen < (intsize + 1))
267267 return NO_IRQ;
268268 iic = of_find_node_by_phandle(imap[intsize]);
269269 if (iic == NULL)
270270 return NO_IRQ;
271271 imap += intsize + 1;
272− tmp = (u32 *)get_property(iic, "#interrupt-cells", NULL);
272+ tmp = get_property(iic, "#interrupt-cells", NULL);
273273 if (tmp == NULL)
274274 return NO_IRQ;
275275 intsize = *tmp;
276276 /* Assume unit is last entry of interrupt specifier */
277277 unit = imap[intsize - 1];
278278 /* Ok, we have a unit, now let's try to get the node */
279− tmp = (u32 *)get_property(iic, "ibm,interrupt-server-ranges", NULL);
279+ tmp = get_property(iic, "ibm,interrupt-server-ranges", NULL);
280280 if (tmp == NULL) {
281281 of_node_put(iic);
282282 return NO_IRQ;
arch/powerpc/platforms/cell/spu_base.c+9−9
@@ -488,10 +488,10 @@ int spu_irq_class_1_bottom(struct spu *spu) · 487 unmodified lines
488488
489489 static int __init find_spu_node_id(struct device_node *spe)
490490 {
491− unsigned int *id;
491+ const unsigned int *id;
492492 struct device_node *cpu;
493493 cpu = spe->parent->parent;
494− id = (unsigned int *)get_property(cpu, "node-id", NULL);
494+ id = get_property(cpu, "node-id", NULL);
495495 return id ? *id : 0;
496496 }
497497
@@ -500,7 +500,7 @@ static int __init cell_spuprop_present(struct spu *spu, struct device_node *spe, · 2 unmodified lines
500500 {
501501 static DEFINE_MUTEX(add_spumem_mutex);
502502
503− struct address_prop {
503+ const struct address_prop {
504504 unsigned long address;
505505 unsigned int len;
506506 } __attribute__((packed)) *p;
@@ -511,7 +511,7 @@ static int __init cell_spuprop_present(struct spu *spu, struct device_node *spe, · 4 unmodified lines
511511 struct zone *zone;
512512 int ret;
513513
514− p = (void*)get_property(spe, prop, &proplen);
514+ p = get_property(spe, prop, &proplen);
515515 WARN_ON(proplen != sizeof (*p));
516516
517517 start_pfn = p->address >> PAGE_SHIFT;
@@ -531,12 +531,12 @@ static int __init cell_spuprop_present(struct spu *spu, struct device_node *spe, · 13 unmodified lines
531531 static void __iomem * __init map_spe_prop(struct spu *spu,
532532 struct device_node *n, const char *name)
533533 {
534− struct address_prop {
534+ const struct address_prop {
535535 unsigned long address;
536536 unsigned int len;
537537 } __attribute__((packed)) *prop;
538538
539− void *p;
539+ const void *p;
540540 int proplen;
541541 void* ret = NULL;
542542 int err = 0;
@@ -570,14 +570,14 @@ static int __init spu_map_interrupts(struct spu *spu, struct device_node *np) · 27 unmodified lines
570570 {
571571 struct irq_host *host;
572572 unsigned int isrc;
573− u32 *tmp;
573+ const u32 *tmp;
574574
575575 host = iic_get_irq_host(spu->node);
576576 if (host == NULL)
577577 return -ENODEV;
578578
579579 /* Get the interrupt source from the device-tree */
580− tmp = (u32 *)get_property(np, "isrc", NULL);
580+ tmp = get_property(np, "isrc", NULL);
581581 if (!tmp)
582582 return -ENODEV;
583583 spu->isrc = isrc = tmp[0];
@@ -593,7 +593,7 @@ static int __init spu_map_interrupts(struct spu *spu, struct device_node *np) · 9 unmodified lines
593593
594594 static int __init spu_map_device(struct spu *spu, struct device_node *node)
595595 {
596− char *prop;
596+ const char *prop;
597597 int ret;
598598
599599 ret = -ENODEV;
arch/powerpc/platforms/chrp/nvram.c+3−2
@@ -67,13 +67,14 @@ static void chrp_nvram_write(int addr, unsigned char val) · 66 unmodified lines
6767 void __init chrp_nvram_init(void)
6868 {
6969 struct device_node *nvram;
70− unsigned int *nbytes_p, proplen;
70+ const unsigned int *nbytes_p;
71+ unsigned int proplen;
7172
7273 nvram = of_find_node_by_type(NULL, "nvram");
7374 if (nvram == NULL)
7475 return;
7576
76− nbytes_p = (unsigned int *)get_property(nvram, "#bytes", &proplen);
77+ nbytes_p = get_property(nvram, "#bytes", &proplen);
7778 if (nbytes_p == NULL || proplen != sizeof(unsigned int))
7879 return;
7980
arch/powerpc/platforms/chrp/pci.c+43−10
@@ -214,11 +214,11 @@ void __init · 213 unmodified lines
214214 chrp_find_bridges(void)
215215 {
216216 struct device_node *dev;
217− int *bus_range;
217+ const int *bus_range;
218218 int len, index = -1;
219219 struct pci_controller *hose;
220− unsigned int *dma;
221− char *model, *machine;
220+ const unsigned int *dma;
221+ const char *model, *machine;
222222 int is_longtrail = 0, is_mot = 0, is_pegasos = 0;
223223 struct device_node *root = find_path_device("/");
224224 struct resource r;
@@ -246,7 +246,7 @@ chrp_find_bridges(void) · 21 unmodified lines
246246 dev->full_name);
247247 continue;
248248 }
249− bus_range = (int *) get_property(dev, "bus-range", &len);
249+ bus_range = get_property(dev, "bus-range", &len);
250250 if (bus_range == NULL || len < 2 * sizeof(int)) {
251251 printk(KERN_WARNING "Can't get bus-range for %s\n",
252252 dev->full_name);
@@ -257,7 +257,7 @@ chrp_find_bridges(void) · 4 unmodified lines
257257 else
258258 printk(KERN_INFO "PCI buses %d..%d",
259259 bus_range[0], bus_range[1]);
260− printk(" controlled by %s", dev->type);
260+ printk(" controlled by %s", dev->full_name);
261261 if (!is_longtrail)
262262 printk(" at %llx", (unsigned long long)r.start);
263263 printk("\n");
@@ -289,6 +289,19 @@ chrp_find_bridges(void) · 25 unmodified lines
289289 setup_indirect_pci(hose, 0xfec00cf8, 0xfee00cfc);
290290 } else if (is_pegasos == 2) {
291291 setup_peg2(hose, dev);
292+ } else if (!strncmp(model, "IBM,CPC710", 10)) {
293+ setup_indirect_pci(hose,
294+ r.start + 0x000f8000,
295+ r.start + 0x000f8010);
296+ if (index == 0) {
297+ dma = get_property(dev, "system-dma-base",&len);
298+ if (dma && len >= sizeof(*dma)) {
299+ dma = (unsigned int *)
300+ (((unsigned long)dma) +
301+ len - sizeof(*dma));
302+ pci_dram_offset = *dma;
303+ }
304+ }
292305 } else {
293306 printk("No methods for %s (model %s), using RTAS\n",
294307 dev->full_name, model);
@@ -299,15 +312,35 @@ chrp_find_bridges(void) · 4 unmodified lines
299312
300313 /* check the first bridge for a property that we can
301314 use to set pci_dram_offset */
302− dma = (unsigned int *)
303− get_property(dev, "ibm,dma-ranges", &len);
315+ dma = get_property(dev, "ibm,dma-ranges", &len);
304316 if (index == 0 && dma != NULL && len >= 6 * sizeof(*dma)) {
305317 pci_dram_offset = dma[2] - dma[3];
306318 printk("pci_dram_offset = %lx\n", pci_dram_offset);
307319 }
308320 }
321+}
322+
323+/* SL82C105 IDE Control/Status Register */
324+#define SL82C105_IDECSR 0x40
325+
326+/* Fixup for Winbond ATA quirk, required for briq */
327+void chrp_pci_fixup_winbond_ata(struct pci_dev *sl82c105)
328+{
329+ u8 progif;
309330
310− /* Do not fixup interrupts from OF tree on pegasos */
311− if (is_pegasos)
312− ppc_md.pcibios_fixup = NULL;
331+ /* If non-briq machines need that fixup too, please speak up */
332+ if (!machine_is(chrp) || _chrp_type != _CHRP_briq)
333+ return;
334+
335+ if ((sl82c105->class & 5) != 5) {
336+ printk("W83C553: Switching SL82C105 IDE to PCI native mode\n");
337+ /* Enable SL82C105 PCI native IDE mode */
338+ pci_read_config_byte(sl82c105, PCI_CLASS_PROG, &progif);
339+ pci_write_config_byte(sl82c105, PCI_CLASS_PROG, progif | 0x05);
340+ sl82c105->class |= 0x05;
341+ /* Disable SL82C105 second port */
342+ pci_write_config_word(sl82c105, SL82C105_IDECSR, 0x0003);
343+ }
313344 }
345+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105,
346+ chrp_pci_fixup_winbond_ata);
arch/powerpc/platforms/chrp/setup.c+35−13
@@ -74,6 +74,9 @@ extern irqreturn_t xmon_irq(int, void *, struct pt_regs *); · 73 unmodified lines
7474
7575 extern unsigned long loops_per_jiffy;
7676
77+/* To be replaced by RTAS when available */
78+static unsigned int *briq_SPOR;
79+
7780 #ifdef CONFIG_SMP
7881 extern struct smp_ops_t chrp_smp_ops;
7982 #endif
@@ -92,6 +95,15 @@ static const char *gg2_cachemodes[4] = { · 12 unmodified lines
9295 "Disabled", "Write-Through", "Copy-Back", "Transparent Mode"
9396 };
9497
98+static const char *chrp_names[] = {
99+ "Unknown",
100+ "","","",
101+ "Motorola",
102+ "IBM or Longtrail",
103+ "Genesi Pegasos",
104+ "Total Impact Briq"
105+};
106+
95107 void chrp_show_cpuinfo(struct seq_file *m)
96108 {
97109 int i, sdramen;
@@ -214,8 +226,7 @@ static void __init pegasos_set_l2cr(void) · 116 unmodified lines
214226 /* Enable L2 cache if needed */
215227 np = find_type_devices("cpu");
216228 if (np != NULL) {
217− unsigned int *l2cr = (unsigned int *)
218− get_property (np, "l2cr", NULL);
229+ const unsigned int *l2cr = get_property(np, "l2cr", NULL);
219230 if (l2cr == NULL) {
220231 printk ("Pegasos l2cr : no cpu l2cr property found\n");
221232 return;
@@ -229,10 +240,18 @@ static void __init pegasos_set_l2cr(void) · 7 unmodified lines
229240 }
230241 }
231242
243+static void briq_restart(char *cmd)
244+{
245+ local_irq_disable();
246+ if (briq_SPOR)
247+ out_be32(briq_SPOR, 0);
248+ for(;;);
249+}
250+
232251 void __init chrp_setup_arch(void)
233252 {
234253 struct device_node *root = find_path_device ("/");
235− char *machine = NULL;
254+ const char *machine = NULL;
236255
237256 /* init to some ~sane value until calibrate_delay() runs */
238257 loops_per_jiffy = 50000000/HZ;
@@ -245,11 +264,16 @@ void __init chrp_setup_arch(void) · 6 unmodified lines
245264 _chrp_type = _CHRP_IBM;
246265 } else if (machine && strncmp(machine, "MOT", 3) == 0) {
247266 _chrp_type = _CHRP_Motorola;
267+ } else if (machine && strncmp(machine, "TotalImpact,BRIQ-1", 18) == 0) {
268+ _chrp_type = _CHRP_briq;
269+ /* Map the SPOR register on briq and change the restart hook */
270+ briq_SPOR = (unsigned int *)ioremap(0xff0000e8, 4);
271+ ppc_md.restart = briq_restart;
248272 } else {
249273 /* Let's assume it is an IBM chrp if all else fails */
250274 _chrp_type = _CHRP_IBM;
251275 }
252− printk("chrp type = %x\n", _chrp_type);
276+ printk("chrp type = %x [%s]\n", _chrp_type, chrp_names[_chrp_type]);
253277
254278 rtas_initialize();
255279 if (rtas_token("display-character") >= 0)
@@ -328,7 +352,7 @@ static void __init chrp_find_openpic(void) · 72 unmodified lines
328352 struct device_node *np, *root;
329353 int len, i, j;
330354 int isu_size, idu_size;
331− unsigned int *iranges, *opprop = NULL;
355+ const unsigned int *iranges, *opprop = NULL;
332356 int oplen = 0;
333357 unsigned long opaddr;
334358 int na = 1;
@@ -338,8 +362,7 @@ static void __init chrp_find_openpic(void) · 3 unmodified lines
338362 return;
339363 root = of_find_node_by_path("/");
340364 if (root) {
341− opprop = (unsigned int *) get_property
342− (root, "platform-open-pic", &oplen);
365+ opprop = get_property(root, "platform-open-pic", &oplen);
343366 na = prom_n_addr_cells(root);
344367 }
345368 if (opprop && oplen >= na * sizeof(unsigned int)) {
@@ -356,7 +379,7 @@ static void __init chrp_find_openpic(void) · 10 unmodified lines
356379
357380 printk(KERN_INFO "OpenPIC at %lx\n", opaddr);
358381
359− iranges = (unsigned int *) get_property(np, "interrupt-ranges", &len);
382+ iranges = get_property(np, "interrupt-ranges", &len);
360383 if (iranges == NULL)
361384 len = 0; /* non-distributed mpic */
362385 else
@@ -442,8 +465,8 @@ static void __init chrp_find_8259(void) · 79 unmodified lines
442465 * from anyway
443466 */
444467 for (np = find_devices("pci"); np != NULL; np = np->next) {
445− unsigned int *addrp = (unsigned int *)
446− get_property(np, "8259-interrupt-acknowledge", NULL);
468+ const unsigned int *addrp = get_property(np,
469+ "8259-interrupt-acknowledge", NULL);
447470
448471 if (addrp == NULL)
449472 continue;
@@ -502,7 +525,7 @@ void __init · 52 unmodified lines
502525 chrp_init2(void)
503526 {
504527 struct device_node *device;
505− unsigned int *p = NULL;
528+ const unsigned int *p = NULL;
506529
507530 #ifdef CONFIG_NVRAM
508531 chrp_nvram_init();
@@ -520,8 +543,7 @@ chrp_init2(void) · 11 unmodified lines
520543 */
521544 device = find_devices("rtas");
522545 if (device)
523− p = (unsigned int *) get_property
524− (device, "rtas-event-scan-rate", NULL);
546+ p = get_property(device, "rtas-event-scan-rate", NULL);
525547 if (p && *p) {
526548 /*
527549 * Arrange to call chrp_event_scan at least *p times
arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c+4−4
@@ -95,7 +95,7 @@ void mpc7448_hpc2_fixup_irq(struct pci_dev *dev) · 94 unmodified lines
9595 {
9696 struct pci_controller *hose;
9797 struct device_node *node;
98− unsigned int *interrupt;
98+ const unsigned int *interrupt;
9999 int busnr;
100100 int len;
101101 u8 slot;
@@ -112,7 +112,7 @@ void mpc7448_hpc2_fixup_irq(struct pci_dev *dev) · 10 unmodified lines
112112 if (!node)
113113 printk(KERN_ERR "No pci node found\n");
114114
115− interrupt = (unsigned int *) get_property(node, "interrupt-map", &len);
115+ interrupt = get_property(node, "interrupt-map", &len);
116116 slot = find_slot_by_devfn(interrupt, dev->devfn);
117117 pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
118118 if (pin == 0 || pin > 4)
@@ -141,9 +141,9 @@ static void __init mpc7448_hpc2_setup_arch(void) · 22 unmodified lines
141141
142142 cpu = of_find_node_by_type(NULL, "cpu");
143143 if (cpu != 0) {
144− unsigned int *fp;
144+ const unsigned int *fp;
145145
146− fp = (int *)get_property(cpu, "clock-frequency", NULL);
146+ fp = get_property(cpu, "clock-frequency", NULL);
147147 if (fp != 0)
148148 loops_per_jiffy = *fp / HZ;
149149 else
arch/powerpc/platforms/iseries/Kconfig+6−2
@@ -3,13 +3,17 @@ menu "iSeries device drivers" · 2 unmodified lines
33 depends on PPC_ISERIES
44
55 config VIOCONS
6− tristate "iSeries Virtual Console Support"
6+ tristate "iSeries Virtual Console Support (Obsolete)"
7+ help
8+ This is the old virtual console driver for legacy iSeries.
9+ You should use the iSeries Hypervisor Virtual Console
10+ support instead.
711
812 config VIODASD
913 tristate "iSeries Virtual I/O disk support"
1014 help
1115 If you are running on an iSeries system and you want to use
12− virtual disks created and managed by OS/400, say Y.
16+ virtual disks created and managed by OS/400, say Y.
1317
1418 config VIOCD
1519 tristate "iSeries Virtual I/O CD support"
arch/powerpc/platforms/iseries/dt.c+42−3
@@ -1,5 +1,6 @@
11 /*
2− * Copyright (c) 2005-2006 Michael Ellerman, IBM Corporation
2+ * Copyright (C) 2005-2006 Michael Ellerman, IBM Corporation
3+ * Copyright (C) 2000-2004, IBM Corporation
34 *
45 * Description:
56 * This file contains all the routines to build a flattened device
@@ -33,13 +34,13 @@ · 27 unmodified lines
3334 #include <asm/iseries/hv_types.h>
3435 #include <asm/iseries/hv_lp_config.h>
3536 #include <asm/iseries/hv_call_xm.h>
36−#include <asm/iseries/it_exp_vpd_panel.h>
3737 #include <asm/udbg.h>
3838
3939 #include "processor_vpd.h"
4040 #include "call_hpt.h"
4141 #include "call_pci.h"
4242 #include "pci.h"
43+#include "it_exp_vpd_panel.h"
4344
4445 #ifdef DEBUG
4546 #define DBG(fmt...) udbg_printf(fmt)
@@ -76,6 +77,43 @@ static char __initdata device_type_pci[] = "pci"; · 30 unmodified lines
7677 static char __initdata device_type_vdevice[] = "vdevice";
7778 static char __initdata device_type_vscsi[] = "vscsi";
7879
80+
81+/* EBCDIC to ASCII conversion routines */
82+
83+static unsigned char __init e2a(unsigned char x)
84+{
85+ switch (x) {
86+ case 0x81 ... 0x89:
87+ return x - 0x81 + 'a';
88+ case 0x91 ... 0x99:
89+ return x - 0x91 + 'j';
90+ case 0xA2 ... 0xA9:
91+ return x - 0xA2 + 's';
92+ case 0xC1 ... 0xC9:
93+ return x - 0xC1 + 'A';
94+ case 0xD1 ... 0xD9:
95+ return x - 0xD1 + 'J';
96+ case 0xE2 ... 0xE9:
97+ return x - 0xE2 + 'S';
98+ case 0xF0 ... 0xF9:
99+ return x - 0xF0 + '0';
100+ }
101+ return ' ';
102+}
103+
104+static unsigned char * __init strne2a(unsigned char *dest,
105+ const unsigned char *src, size_t n)
106+{
107+ int i;
108+
109+ n = strnlen(src, n);
110+
111+ for (i = 0; i < n; i++)
112+ dest[i] = e2a(src[i]);
113+
114+ return dest;
115+}
116+
79117 static struct iseries_flat_dt * __init dt_init(void)
80118 {
81119 struct iseries_flat_dt *dt;
@@ -298,7 +336,8 @@ static void __init dt_vdevices(struct iseries_flat_dt *dt) · 216 unmodified lines
298336 dt_prop_u32(dt, "#address-cells", 1);
299337 dt_prop_u32(dt, "#size-cells", 0);
300338
301− dt_do_vdevice(dt, "vty", reg, -1, device_type_serial, NULL, 1);
339+ dt_do_vdevice(dt, "vty", reg, -1, device_type_serial,
340+ "IBM,iSeries-vty", 1);
302341 reg++;
303342
304343 dt_do_vdevice(dt, "v-scsi", reg, -1, device_type_vscsi,
arch/powerpc/platforms/iseries/hvlpconfig.c+13−0
@@ -18,9 +18,22 @@ · 17 unmodified lines
1818
1919 #include <linux/module.h>
2020 #include <asm/iseries/hv_lp_config.h>
21+#include "it_lp_naca.h"
2122
2223 HvLpIndex HvLpConfig_getLpIndex_outline(void)
2324 {
2425 return HvLpConfig_getLpIndex();
2526 }
2627 EXPORT_SYMBOL(HvLpConfig_getLpIndex_outline);
28+
29+HvLpIndex HvLpConfig_getLpIndex(void)
30+{
31+ return itLpNaca.xLpIndex;
32+}
33+EXPORT_SYMBOL(HvLpConfig_getLpIndex);
34+
35+HvLpIndex HvLpConfig_getPrimaryLpIndex(void)
36+{
37+ return itLpNaca.xPrimaryLpIndex;
38+}
39+EXPORT_SYMBOL_GPL(HvLpConfig_getPrimaryLpIndex);
arch/powerpc/platforms/iseries/iommu.c+18−1
@@ -87,6 +87,23 @@ static void tce_free_iSeries(struct iommu_table *tbl, long index, long npages) · 86 unmodified lines
8787 }
8888 }
8989
90+/*
91+ * Structure passed to HvCallXm_getTceTableParms
92+ */
93+struct iommu_table_cb {
94+ unsigned long itc_busno; /* Bus number for this tce table */
95+ unsigned long itc_start; /* Will be NULL for secondary */
96+ unsigned long itc_totalsize; /* Size (in pages) of whole table */
97+ unsigned long itc_offset; /* Index into real tce table of the
98+ start of our section */
99+ unsigned long itc_size; /* Size (in pages) of our section */
100+ unsigned long itc_index; /* Index of this tce table */
101+ unsigned short itc_maxtables; /* Max num of tables for partition */
102+ unsigned char itc_virtbus; /* Flag to indicate virtual bus */
103+ unsigned char itc_slotno; /* IOA Tce Slot Index */
104+ unsigned char itc_rsvd[4];
105+};
106+
90107 /*
91108 * Call Hv with the architected data structure to get TCE table info.
92109 * info. Put the returned data into the Linux representation of the
@@ -162,7 +179,7 @@ void iommu_devnode_init_iSeries(struct device_node *dn) · 69 unmodified lines
162179 {
163180 struct iommu_table *tbl;
164181 struct pci_dn *pdn = PCI_DN(dn);
165− u32 *lsn = (u32 *)get_property(dn, "linux,logical-slot-number", NULL);
182+ const u32 *lsn = get_property(dn, "linux,logical-slot-number", NULL);
166183
167184 BUG_ON(lsn == NULL);
168185
arch/powerpc/platforms/iseries/it_exp_vpd_panel.hrenamed from include/asm-powerpc/iseries/it_exp_vpd_panel.h+3−3
@@ -15,8 +15,8 @@ · 14 unmodified lines
1515 * along with this program; if not, write to the Free Software
1616 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1717 */
18−#ifndef _ASM_POWERPC_ISERIES_IT_EXT_VPD_PANEL_H
19−#define _ASM_POWERPC_ISERIES_IT_EXT_VPD_PANEL_H
18+#ifndef _PLATFORMS_ISERIES_IT_EXT_VPD_PANEL_H
19+#define _PLATFORMS_ISERIES_IT_EXT_VPD_PANEL_H
2020
2121 /*
2222 * This struct maps the panel information
@@ -48,4 +48,4 @@ struct ItExtVpdPanel { · 25 unmodified lines
4848
4949 extern struct ItExtVpdPanel xItExtVpdPanel;
5050
51−#endif /* _ASM_POWERPC_ISERIES_IT_EXT_VPD_PANEL_H */
51+#endif /* _PLATFORMS_ISERIES_IT_EXT_VPD_PANEL_H */
arch/powerpc/platforms/iseries/it_lp_naca.hrenamed from include/asm-powerpc/iseries/it_lp_naca.h+3−3
@@ -15,8 +15,8 @@ · 14 unmodified lines
1515 * along with this program; if not, write to the Free Software
1616 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1717 */
18−#ifndef _ASM_POWERPC_ISERIES_IT_LP_NACA_H
19−#define _ASM_POWERPC_ISERIES_IT_LP_NACA_H
18+#ifndef _PLATFORMS_ISERIES_IT_LP_NACA_H
19+#define _PLATFORMS_ISERIES_IT_LP_NACA_H
2020
2121 #include <linux/types.h>
2222
@@ -77,4 +77,4 @@ extern struct ItLpNaca itLpNaca; · 54 unmodified lines
7777 #define ITLPNACA_HWSYNCEDTBS 0x20 /* Hardware synced TBs */
7878 #define ITLPNACA_HMTINT 0x10 /* Utilize MHT for interrupts */
7979
80−#endif /* _ASM_POWERPC_ISERIES_IT_LP_NACA_H */
80+#endif /* _PLATFORMS_ISERIES_IT_LP_NACA_H */
arch/powerpc/platforms/iseries/lpardata.c+2−4
@@ -13,12 +13,10 @@ · 12 unmodified lines
1313 #include <asm/processor.h>
1414 #include <asm/ptrace.h>
1515 #include <asm/abs_addr.h>
16−#include <asm/iseries/it_lp_naca.h>
1716 #include <asm/lppaca.h>
1817 #include <asm/iseries/it_lp_reg_save.h>
1918 #include <asm/paca.h>
2019 #include <asm/iseries/lpar_map.h>
21−#include <asm/iseries/it_exp_vpd_panel.h>
2220 #include <asm/iseries/it_lp_queue.h>
2321
2422 #include "naca.h"
@@ -27,6 +25,8 @@ · 2 unmodified lines
2725 #include "ipl_parms.h"
2826 #include "processor_vpd.h"
2927 #include "release_data.h"
28+#include "it_exp_vpd_panel.h"
29+#include "it_lp_naca.h"
3030
3131 /* The HvReleaseData is the root of the information shared between
3232 * the hypervisor and Linux.
@@ -127,14 +127,12 @@ struct ItLpNaca itLpNaca = { · 94 unmodified lines
127127 (u64)instruction_access_slb_iSeries /* 0x480 I-SLB */
128128 }
129129 };
130−EXPORT_SYMBOL(itLpNaca);
131130
132131 /* May be filled in by the hypervisor so cannot end up in the BSS */
133132 struct ItIplParmsReal xItIplParmsReal __attribute__((__section__(".data")));
134133
135134 /* May be filled in by the hypervisor so cannot end up in the BSS */
136135 struct ItExtVpdPanel xItExtVpdPanel __attribute__((__section__(".data")));
137−EXPORT_SYMBOL(xItExtVpdPanel);
138136
139137 #define maxPhysicalProcessors 32
140138
arch/powerpc/platforms/iseries/lpevents.c+1−1
@@ -20,7 +20,7 @@ · 19 unmodified lines
2020 #include <asm/iseries/it_lp_queue.h>
2121 #include <asm/iseries/hv_lp_event.h>
2222 #include <asm/iseries/hv_call_event.h>
23−#include <asm/iseries/it_lp_naca.h>
23+#include "it_lp_naca.h"
2424
2525 /*
2626 * The LpQueue is used to pass event data from the hypervisor to
arch/powerpc/platforms/iseries/main_store.h+63−63
@@ -61,9 +61,9 @@ struct IoHriMainStoreSegment4 { · 60 unmodified lines
6161 };
6262
6363 /* Main Store VPD for Power4 */
64−struct IoHriMainStoreChipInfo1 {
65− u32 chipMfgID __attribute((packed));
66− char chipECLevel[4] __attribute((packed));
64+struct __attribute((packed)) IoHriMainStoreChipInfo1 {
65+ u32 chipMfgID;
66+ char chipECLevel[4];
6767 };
6868
6969 struct IoHriMainStoreVpdIdData {
@@ -73,72 +73,72 @@ struct IoHriMainStoreVpdIdData { · 3 unmodified lines
7373 char serialNumber[12];
7474 };
7575
76−struct IoHriMainStoreVpdFruData {
77− char fruLabel[8] __attribute((packed));
78− u8 numberOfSlots __attribute((packed));
79− u8 pluggingType __attribute((packed));
80− u16 slotMapIndex __attribute((packed));
76+struct __attribute((packed)) IoHriMainStoreVpdFruData {
77+ char fruLabel[8];
78+ u8 numberOfSlots;
79+ u8 pluggingType;
80+ u16 slotMapIndex;
8181 };
8282
83−struct IoHriMainStoreAdrRangeBlock {
84− void *blockStart __attribute((packed));
85− void *blockEnd __attribute((packed));
86− u32 blockProcChipId __attribute((packed));
83+struct __attribute((packed)) IoHriMainStoreAdrRangeBlock {
84+ void *blockStart;
85+ void *blockEnd;
86+ u32 blockProcChipId;
8787 };
8888
8989 #define MaxAreaAdrRangeBlocks 4
9090
91−struct IoHriMainStoreArea4 {
92− u32 msVpdFormat __attribute((packed));
93− u8 containedVpdType __attribute((packed));
94− u8 reserved1 __attribute((packed));
95− u16 reserved2 __attribute((packed));
96−
97− u64 msExists __attribute((packed));
98− u64 msFunctional __attribute((packed));
99−
100− u32 memorySize __attribute((packed));
101− u32 procNodeId __attribute((packed));
102−
103− u32 numAdrRangeBlocks __attribute((packed));
104− struct IoHriMainStoreAdrRangeBlock xAdrRangeBlock[MaxAreaAdrRangeBlocks] __attribute((packed));
105−
106− struct IoHriMainStoreChipInfo1 chipInfo0 __attribute((packed));
107− struct IoHriMainStoreChipInfo1 chipInfo1 __attribute((packed));
108− struct IoHriMainStoreChipInfo1 chipInfo2 __attribute((packed));
109− struct IoHriMainStoreChipInfo1 chipInfo3 __attribute((packed));
110− struct IoHriMainStoreChipInfo1 chipInfo4 __attribute((packed));
111− struct IoHriMainStoreChipInfo1 chipInfo5 __attribute((packed));
112− struct IoHriMainStoreChipInfo1 chipInfo6 __attribute((packed));
113− struct IoHriMainStoreChipInfo1 chipInfo7 __attribute((packed));
114−
115− void *msRamAreaArray __attribute((packed));
116− u32 msRamAreaArrayNumEntries __attribute((packed));
117− u32 msRamAreaArrayEntrySize __attribute((packed));
118−
119− u32 numaDimmExists __attribute((packed));
120− u32 numaDimmFunctional __attribute((packed));
121− void *numaDimmArray __attribute((packed));
122− u32 numaDimmArrayNumEntries __attribute((packed));
123− u32 numaDimmArrayEntrySize __attribute((packed));
124−
125− struct IoHriMainStoreVpdIdData idData __attribute((packed));
126−
127− u64 powerData __attribute((packed));
128− u64 cardAssemblyPartNum __attribute((packed));
129− u64 chipSerialNum __attribute((packed));
130−
131− u64 reserved3 __attribute((packed));
132− char reserved4[16] __attribute((packed));
133−
134− struct IoHriMainStoreVpdFruData fruData __attribute((packed));
135−
136− u8 vpdPortNum __attribute((packed));
137− u8 reserved5 __attribute((packed));
138− u8 frameId __attribute((packed));
139− u8 rackUnit __attribute((packed));
140− char asciiKeywordVpd[256] __attribute((packed));
141− u32 reserved6 __attribute((packed));
91+struct __attribute((packed)) IoHriMainStoreArea4 {
92+ u32 msVpdFormat;
93+ u8 containedVpdType;
94+ u8 reserved1;
95+ u16 reserved2;
96+
97+ u64 msExists;
98+ u64 msFunctional;
99+
100+ u32 memorySize;
101+ u32 procNodeId;
102+
103+ u32 numAdrRangeBlocks;
104+ struct IoHriMainStoreAdrRangeBlock xAdrRangeBlock[MaxAreaAdrRangeBlocks];
105+
106+ struct IoHriMainStoreChipInfo1 chipInfo0;
107+ struct IoHriMainStoreChipInfo1 chipInfo1;
108+ struct IoHriMainStoreChipInfo1 chipInfo2;
109+ struct IoHriMainStoreChipInfo1 chipInfo3;
110+ struct IoHriMainStoreChipInfo1 chipInfo4;
111+ struct IoHriMainStoreChipInfo1 chipInfo5;
112+ struct IoHriMainStoreChipInfo1 chipInfo6;
113+ struct IoHriMainStoreChipInfo1 chipInfo7;
114+
115+ void *msRamAreaArray;
116+ u32 msRamAreaArrayNumEntries;
117+ u32 msRamAreaArrayEntrySize;
118+
119+ u32 numaDimmExists;
120+ u32 numaDimmFunctional;
121+ void *numaDimmArray;
122+ u32 numaDimmArrayNumEntries;
123+ u32 numaDimmArrayEntrySize;
124+
125+ struct IoHriMainStoreVpdIdData idData;
126+
127+ u64 powerData;
128+ u64 cardAssemblyPartNum;
129+ u64 chipSerialNum;
130+
131+ u64 reserved3;
132+ char reserved4[16];
133+
134+ struct IoHriMainStoreVpdFruData fruData;
135+
136+ u8 vpdPortNum;
137+ u8 reserved5;
138+ u8 frameId;
139+ u8 rackUnit;
140+ char asciiKeywordVpd[256];
141+ u32 reserved6;
142142 };
143143
144144
arch/powerpc/platforms/iseries/pci.c+232−57
@@ -34,6 +34,7 @@ · 33 unmodified lines
3434 #include <asm/pci-bridge.h>
3535 #include <asm/iommu.h>
3636 #include <asm/abs_addr.h>
37+#include <asm/firmware.h>
3738
3839 #include <asm/iseries/hv_call_xm.h>
3940 #include <asm/iseries/mf.h>
@@ -176,12 +177,12 @@ void iSeries_pcibios_init(void) · 136 unmodified lines
176177 }
177178 while ((node = of_get_next_child(root, node)) != NULL) {
178179 HvBusNumber bus;
179− u32 *busp;
180+ const u32 *busp;
180181
181182 if ((node->type == NULL) || (strcmp(node->type, "pci") != 0))
182183 continue;
183184
184− busp = (u32 *)get_property(node, "bus-range", NULL);
185+ busp = get_property(node, "bus-range", NULL);
185186 if (busp == NULL)
186187 continue;
187188 bus = *busp;
@@ -221,10 +222,9 @@ void __init iSeries_pci_final_fixup(void) · 33 unmodified lines
221222
222223 if (node != NULL) {
223224 struct pci_dn *pdn = PCI_DN(node);
224− u32 *agent;
225+ const u32 *agent;
225226
226− agent = (u32 *)get_property(node, "linux,agent-id",
227− NULL);
227+ agent = get_property(node, "linux,agent-id", NULL);
228228 if ((pdn != NULL) && (agent != NULL)) {
229229 u8 irq = iSeries_allocate_IRQ(pdn->busno, 0,
230230 pdn->bussubno);
@@ -270,46 +270,6 @@ void pcibios_fixup_resources(struct pci_dev *pdev) · 39 unmodified lines
270270 {
271271 }
272272
273−/*
274− * I/0 Memory copy MUST use mmio commands on iSeries
275− * To do; For performance, include the hv call directly
276− */
277−void iSeries_memset_io(volatile void __iomem *dest, char c, size_t Count)
278−{
279− u8 ByteValue = c;
280− long NumberOfBytes = Count;
281−
282− while (NumberOfBytes > 0) {
283− iSeries_Write_Byte(ByteValue, dest++);
284− -- NumberOfBytes;
285− }
286−}
287−EXPORT_SYMBOL(iSeries_memset_io);
288−
289−void iSeries_memcpy_toio(volatile void __iomem *dest, void *source, size_t count)
290−{
291− char *src = source;
292− long NumberOfBytes = count;
293−
294− while (NumberOfBytes > 0) {
295− iSeries_Write_Byte(*src++, dest++);
296− -- NumberOfBytes;
297− }
298−}
299−EXPORT_SYMBOL(iSeries_memcpy_toio);
300−
301−void iSeries_memcpy_fromio(void *dest, const volatile void __iomem *src, size_t count)
302−{
303− char *dst = dest;
304− long NumberOfBytes = count;
305−
306− while (NumberOfBytes > 0) {
307− *dst++ = iSeries_Read_Byte(src++);
308− -- NumberOfBytes;
309− }
310−}
311−EXPORT_SYMBOL(iSeries_memcpy_fromio);
312−
313273 /*
314274 * Look down the chain to find the matching Device Device
315275 */
@@ -492,7 +452,7 @@ static inline struct device_node *xlate_iomm_address( · 176 unmodified lines
492452 * iSeries_Read_Word = Read Word (16 bit)
493453 * iSeries_Read_Long = Read Long (32 bit)
494454 */
495−u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress)
455+static u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress)
496456 {
497457 u64 BarOffset;
498458 u64 dsa;
@@ -519,9 +479,8 @@ u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress) · 20 unmodified lines
519479
520480 return (u8)ret.value;
521481 }
522−EXPORT_SYMBOL(iSeries_Read_Byte);
523482
524−u16 iSeries_Read_Word(const volatile void __iomem *IoAddress)
483+static u16 iSeries_Read_Word(const volatile void __iomem *IoAddress)
525484 {
526485 u64 BarOffset;
527486 u64 dsa;
@@ -549,9 +508,8 @@ u16 iSeries_Read_Word(const volatile void __iomem *IoAddress) · 21 unmodified lines
549508
550509 return swab16((u16)ret.value);
551510 }
552−EXPORT_SYMBOL(iSeries_Read_Word);
553511
554−u32 iSeries_Read_Long(const volatile void __iomem *IoAddress)
512+static u32 iSeries_Read_Long(const volatile void __iomem *IoAddress)
555513 {
556514 u64 BarOffset;
557515 u64 dsa;
@@ -579,7 +537,6 @@ u32 iSeries_Read_Long(const volatile void __iomem *IoAddress) · 21 unmodified lines
579537
580538 return swab32((u32)ret.value);
581539 }
582−EXPORT_SYMBOL(iSeries_Read_Long);
583540
584541 /*
585542 * Write MM I/O Instructions for the iSeries
@@ -588,7 +545,7 @@ EXPORT_SYMBOL(iSeries_Read_Long); · 2 unmodified lines
588545 * iSeries_Write_Word = Write Word(16 bit)
589546 * iSeries_Write_Long = Write Long(32 bit)
590547 */
591−void iSeries_Write_Byte(u8 data, volatile void __iomem *IoAddress)
548+static void iSeries_Write_Byte(u8 data, volatile void __iomem *IoAddress)
592549 {
593550 u64 BarOffset;
594551 u64 dsa;
@@ -613,9 +570,8 @@ void iSeries_Write_Byte(u8 data, volatile void __iomem *IoAddress) · 18 unmodified lines
613570 rc = HvCall4(HvCallPciBarStore8, dsa, BarOffset, data, 0);
614571 } while (CheckReturnCode("WWB", DevNode, &retry, rc) != 0);
615572 }
616−EXPORT_SYMBOL(iSeries_Write_Byte);
617573
618−void iSeries_Write_Word(u16 data, volatile void __iomem *IoAddress)
574+static void iSeries_Write_Word(u16 data, volatile void __iomem *IoAddress)
619575 {
620576 u64 BarOffset;
621577 u64 dsa;
@@ -640,9 +596,8 @@ void iSeries_Write_Word(u16 data, volatile void __iomem *IoAddress) · 18 unmodified lines
640596 rc = HvCall4(HvCallPciBarStore16, dsa, BarOffset, swab16(data), 0);
641597 } while (CheckReturnCode("WWW", DevNode, &retry, rc) != 0);
642598 }
643−EXPORT_SYMBOL(iSeries_Write_Word);
644599
645−void iSeries_Write_Long(u32 data, volatile void __iomem *IoAddress)
600+static void iSeries_Write_Long(u32 data, volatile void __iomem *IoAddress)
646601 {
647602 u64 BarOffset;
648603 u64 dsa;
@@ -667,4 +622,224 @@ void iSeries_Write_Long(u32 data, volatile void __iomem *IoAddress) · 18 unmodified lines
667622 rc = HvCall4(HvCallPciBarStore32, dsa, BarOffset, swab32(data), 0);
668623 } while (CheckReturnCode("WWL", DevNode, &retry, rc) != 0);
669624 }
670−EXPORT_SYMBOL(iSeries_Write_Long);
625+
626+extern unsigned char __raw_readb(const volatile void __iomem *addr)
627+{
628+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
629+
630+ return *(volatile unsigned char __force *)addr;
631+}
632+EXPORT_SYMBOL(__raw_readb);
633+
634+extern unsigned short __raw_readw(const volatile void __iomem *addr)
635+{
636+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
637+
638+ return *(volatile unsigned short __force *)addr;
639+}
640+EXPORT_SYMBOL(__raw_readw);
641+
642+extern unsigned int __raw_readl(const volatile void __iomem *addr)
643+{
644+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
645+
646+ return *(volatile unsigned int __force *)addr;
647+}
648+EXPORT_SYMBOL(__raw_readl);
649+
650+extern unsigned long __raw_readq(const volatile void __iomem *addr)
651+{
652+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
653+
654+ return *(volatile unsigned long __force *)addr;
655+}
656+EXPORT_SYMBOL(__raw_readq);
657+
658+extern void __raw_writeb(unsigned char v, volatile void __iomem *addr)
659+{
660+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
661+
662+ *(volatile unsigned char __force *)addr = v;
663+}
664+EXPORT_SYMBOL(__raw_writeb);
665+
666+extern void __raw_writew(unsigned short v, volatile void __iomem *addr)
667+{
668+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
669+
670+ *(volatile unsigned short __force *)addr = v;
671+}
672+EXPORT_SYMBOL(__raw_writew);
673+
674+extern void __raw_writel(unsigned int v, volatile void __iomem *addr)
675+{
676+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
677+
678+ *(volatile unsigned int __force *)addr = v;
679+}
680+EXPORT_SYMBOL(__raw_writel);
681+
682+extern void __raw_writeq(unsigned long v, volatile void __iomem *addr)
683+{
684+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
685+
686+ *(volatile unsigned long __force *)addr = v;
687+}
688+EXPORT_SYMBOL(__raw_writeq);
689+
690+int in_8(const volatile unsigned char __iomem *addr)
691+{
692+ if (firmware_has_feature(FW_FEATURE_ISERIES))
693+ return iSeries_Read_Byte(addr);
694+ return __in_8(addr);
695+}
696+EXPORT_SYMBOL(in_8);
697+
698+void out_8(volatile unsigned char __iomem *addr, int val)
699+{
700+ if (firmware_has_feature(FW_FEATURE_ISERIES))
701+ iSeries_Write_Byte(val, addr);
702+ else
703+ __out_8(addr, val);
704+}
705+EXPORT_SYMBOL(out_8);
706+
707+int in_le16(const volatile unsigned short __iomem *addr)
708+{
709+ if (firmware_has_feature(FW_FEATURE_ISERIES))
710+ return iSeries_Read_Word(addr);
711+ return __in_le16(addr);
712+}
713+EXPORT_SYMBOL(in_le16);
714+
715+int in_be16(const volatile unsigned short __iomem *addr)
716+{
717+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
718+
719+ return __in_be16(addr);
720+}
721+EXPORT_SYMBOL(in_be16);
722+
723+void out_le16(volatile unsigned short __iomem *addr, int val)
724+{
725+ if (firmware_has_feature(FW_FEATURE_ISERIES))
726+ iSeries_Write_Word(val, addr);
727+ else
728+ __out_le16(addr, val);
729+}
730+EXPORT_SYMBOL(out_le16);
731+
732+void out_be16(volatile unsigned short __iomem *addr, int val)
733+{
734+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
735+
736+ __out_be16(addr, val);
737+}
738+EXPORT_SYMBOL(out_be16);
739+
740+unsigned in_le32(const volatile unsigned __iomem *addr)
741+{
742+ if (firmware_has_feature(FW_FEATURE_ISERIES))
743+ return iSeries_Read_Long(addr);
744+ return __in_le32(addr);
745+}
746+EXPORT_SYMBOL(in_le32);
747+
748+unsigned in_be32(const volatile unsigned __iomem *addr)
749+{
750+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
751+
752+ return __in_be32(addr);
753+}
754+EXPORT_SYMBOL(in_be32);
755+
756+void out_le32(volatile unsigned __iomem *addr, int val)
757+{
758+ if (firmware_has_feature(FW_FEATURE_ISERIES))
759+ iSeries_Write_Long(val, addr);
760+ else
761+ __out_le32(addr, val);
762+}
763+EXPORT_SYMBOL(out_le32);
764+
765+void out_be32(volatile unsigned __iomem *addr, int val)
766+{
767+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
768+
769+ __out_be32(addr, val);
770+}
771+EXPORT_SYMBOL(out_be32);
772+
773+unsigned long in_le64(const volatile unsigned long __iomem *addr)
774+{
775+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
776+
777+ return __in_le64(addr);
778+}
779+EXPORT_SYMBOL(in_le64);
780+
781+unsigned long in_be64(const volatile unsigned long __iomem *addr)
782+{
783+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
784+
785+ return __in_be64(addr);
786+}
787+EXPORT_SYMBOL(in_be64);
788+
789+void out_le64(volatile unsigned long __iomem *addr, unsigned long val)
790+{
791+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
792+
793+ __out_le64(addr, val);
794+}
795+EXPORT_SYMBOL(out_le64);
796+
797+void out_be64(volatile unsigned long __iomem *addr, unsigned long val)
798+{
799+ BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES));
800+
801+ __out_be64(addr, val);
802+}
803+EXPORT_SYMBOL(out_be64);
804+
805+void memset_io(volatile void __iomem *addr, int c, unsigned long n)
806+{
807+ if (firmware_has_feature(FW_FEATURE_ISERIES)) {
808+ volatile char __iomem *d = addr;
809+
810+ while (n-- > 0) {
811+ iSeries_Write_Byte(c, d++);
812+ }
813+ } else
814+ eeh_memset_io(addr, c, n);
815+}
816+EXPORT_SYMBOL(memset_io);
817+
818+void memcpy_fromio(void *dest, const volatile void __iomem *src,
819+ unsigned long n)
820+{
821+ if (firmware_has_feature(FW_FEATURE_ISERIES)) {
822+ char *d = dest;
823+ const volatile char __iomem *s = src;
824+
825+ while (n-- > 0) {
826+ *d++ = iSeries_Read_Byte(s++);
827+ }
828+ } else
829+ eeh_memcpy_fromio(dest, src, n);
830+}
831+EXPORT_SYMBOL(memcpy_fromio);
832+
833+void memcpy_toio(volatile void __iomem *dest, const void *src, unsigned long n)
834+{
835+ if (firmware_has_feature(FW_FEATURE_ISERIES)) {
836+ const char *s = src;
837+ volatile char __iomem *d = dest;
838+
839+ while (n-- > 0) {
840+ iSeries_Write_Byte(*s++, d++);
841+ }
842+ } else
843+ eeh_memcpy_toio(dest, src, n);
844+}
845+EXPORT_SYMBOL(memcpy_toio);
arch/powerpc/platforms/iseries/setup.c+1−0
@@ -59,6 +59,7 @@ · 58 unmodified lines
5959 #include "irq.h"
6060 #include "vpd_areas.h"
6161 #include "processor_vpd.h"
62+#include "it_lp_naca.h"
6263 #include "main_store.h"
6364 #include "call_sm.h"
6465 #include "call_hpt.h"
arch/powerpc/platforms/iseries/viopath.c+18−10
@@ -41,8 +41,8 @@ · 40 unmodified lines
4141
4242 #include <asm/system.h>
4343 #include <asm/uaccess.h>
44+#include <asm/prom.h>
4445 #include <asm/iseries/hv_types.h>
45−#include <asm/iseries/it_exp_vpd_panel.h>
4646 #include <asm/iseries/hv_lp_event.h>
4747 #include <asm/iseries/hv_lp_config.h>
4848 #include <asm/iseries/mf.h>
@@ -116,6 +116,8 @@ static int proc_viopath_show(struct seq_file *m, void *v) · 67 unmodified lines
116116 dma_addr_t handle;
117117 HvLpEvent_Rc hvrc;
118118 DECLARE_MUTEX_LOCKED(Semaphore);
119+ struct device_node *node;
120+ const char *sysid;
119121
120122 buf = kmalloc(HW_PAGE_SIZE, GFP_KERNEL);
121123 if (!buf)
@@ -143,20 +145,26 @@ static int proc_viopath_show(struct seq_file *m, void *v) · 21 unmodified lines
143145
144146 buf[HW_PAGE_SIZE-1] = '\0';
145147 seq_printf(m, "%s", buf);
146− seq_printf(m, "AVAILABLE_VETH=%x\n", vlanMap);
147− seq_printf(m, "SRLNBR=%c%c%c%c%c%c%c\n",
148− e2a(xItExtVpdPanel.mfgID[2]),
149− e2a(xItExtVpdPanel.mfgID[3]),
150− e2a(xItExtVpdPanel.systemSerial[1]),
151− e2a(xItExtVpdPanel.systemSerial[2]),
152− e2a(xItExtVpdPanel.systemSerial[3]),
153− e2a(xItExtVpdPanel.systemSerial[4]),
154− e2a(xItExtVpdPanel.systemSerial[5]));
155148
156149 dma_unmap_single(iSeries_vio_dev, handle, HW_PAGE_SIZE,
157150 DMA_FROM_DEVICE);
158151 kfree(buf);
159152
153+ seq_printf(m, "AVAILABLE_VETH=%x\n", vlanMap);
154+
155+ node = of_find_node_by_path("/");
156+ sysid = NULL;
157+ if (node != NULL)
158+ sysid = get_property(node, "system-id", NULL);
159+
160+ if (sysid == NULL)
161+ seq_printf(m, "SRLNBR=<UNKNOWN>\n");
162+ else
163+ /* Skip "IBM," on front of serial number, see dt.c */
164+ seq_printf(m, "SRLNBR=%s\n", sysid + 4);
165+
166+ of_node_put(node);
167+
160168 return 0;
161169 }
162170
arch/powerpc/platforms/iseries/vpdinfo.c+13−9
@@ -188,7 +188,7 @@ static void __init iSeries_Parse_Vpd(u8 *VpdData, int VpdDataLen, · 187 unmodified lines
188188 {
189189 u8 *TagPtr = VpdData;
190190 int DataLen = VpdDataLen - 3;
191− u8 PhbId;
191+ u8 PhbId = 0xff;
192192
193193 while ((*TagPtr != VpdEndOfAreaTag) && (DataLen > 0)) {
194194 int AreaLen = *(TagPtr + 1) + (*(TagPtr + 2) * 256);
@@ -205,15 +205,16 @@ static void __init iSeries_Parse_Vpd(u8 *VpdData, int VpdDataLen, · 10 unmodified lines
205205 }
206206 }
207207
208−static void __init iSeries_Get_Location_Code(u16 bus, HvAgentId agent,
208+static int __init iSeries_Get_Location_Code(u16 bus, HvAgentId agent,
209209 u8 *frame, char card[4])
210210 {
211+ int status = 0;
211212 int BusVpdLen = 0;
212213 u8 *BusVpdPtr = kmalloc(BUS_VPDSIZE, GFP_KERNEL);
213214
214215 if (BusVpdPtr == NULL) {
215216 printk("PCI: Bus VPD Buffer allocation failure.\n");
216− return;
217+ return 0;
217218 }
218219 BusVpdLen = HvCallPci_getBusVpd(bus, iseries_hv_addr(BusVpdPtr),
219220 BUS_VPDSIZE);
@@ -228,8 +229,10 @@ static void __init iSeries_Get_Location_Code(u16 bus, HvAgentId agent, · 8 unmodified lines
228229 goto out_free;
229230 }
230231 iSeries_Parse_Vpd(BusVpdPtr, BusVpdLen, agent, frame, card);
232+ status = 1;
231233 out_free:
232234 kfree(BusVpdPtr);
235+ return status;
233236 }
234237
235238 /*
@@ -246,7 +249,7 @@ void __init iSeries_Device_Information(struct pci_dev *PciDev, int count) · 10 unmodified lines
246249 struct device_node *DevNode = PciDev->sysdata;
247250 struct pci_dn *pdn;
248251 u16 bus;
249− u8 frame;
252+ u8 frame = 0;
250253 char card[4];
251254 HvSubBusNumber subbus;
252255 HvAgentId agent;
@@ -262,10 +265,11 @@ void __init iSeries_Device_Information(struct pci_dev *PciDev, int count) · 9 unmodified lines
262265 subbus = pdn->bussubno;
263266 agent = ISERIES_PCI_AGENTID(ISERIES_GET_DEVICE_FROM_SUBBUS(subbus),
264267 ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus));
265− iSeries_Get_Location_Code(bus, agent, &frame, card);
266268
267− printk("%d. PCI: Bus%3d, Device%3d, Vendor %04X Frame%3d, Card %4s ",
268− count, bus, PCI_SLOT(PciDev->devfn), PciDev->vendor,
269− frame, card);
270− printk("0x%04X\n", (int)(PciDev->class >> 8));
269+ if (iSeries_Get_Location_Code(bus, agent, &frame, card)) {
270+ printk("%d. PCI: Bus%3d, Device%3d, Vendor %04X Frame%3d, "
271+ "Card %4s 0x%04X\n", count, bus,
272+ PCI_SLOT(PciDev->devfn), PciDev->vendor, frame,
273+ card, (int)(PciDev->class >> 8));
274+ }
271275 }
arch/powerpc/platforms/maple/pci.c+42−28
@@ -38,16 +38,16 @@ static struct pci_controller *u3_agp, *u3_ht; · 37 unmodified lines
3838 static int __init fixup_one_level_bus_range(struct device_node *node, int higher)
3939 {
4040 for (; node != 0;node = node->sibling) {
41− int * bus_range;
42− unsigned int *class_code;
41+ const int *bus_range;
42+ const unsigned int *class_code;
4343 int len;
4444
4545 /* For PCI<->PCI bridges or CardBus bridges, we go down */
46− class_code = (unsigned int *) get_property(node, "class-code", NULL);
46+ class_code = get_property(node, "class-code", NULL);
4747 if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI &&
4848 (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS))
4949 continue;
50− bus_range = (int *) get_property(node, "bus-range", &len);
50+ bus_range = get_property(node, "bus-range", &len);
5151 if (bus_range != NULL && len > 2 * sizeof(int)) {
5252 if (bus_range[1] > higher)
5353 higher = bus_range[1];
@@ -65,30 +65,36 @@ static int __init fixup_one_level_bus_range(struct device_node *node, int higher · 11 unmodified lines
6565 */
6666 static void __init fixup_bus_range(struct device_node *bridge)
6767 {
68− int * bus_range;
68+ int *bus_range;
69+ struct property *prop;
6970 int len;
7071
7172 /* Lookup the "bus-range" property for the hose */
72− bus_range = (int *) get_property(bridge, "bus-range", &len);
73− if (bus_range == NULL || len < 2 * sizeof(int)) {
73+ prop = of_find_property(bridge, "bus-range", &len);
74+ if (prop == NULL || prop->value == NULL || len < 2 * sizeof(int)) {
7475 printk(KERN_WARNING "Can't get bus-range for %s\n",
7576 bridge->full_name);
7677 return;
7778 }
79+ bus_range = (int *)prop->value;
7880 bus_range[1] = fixup_one_level_bus_range(bridge->child, bus_range[1]);
7981 }
8082
8183
82−#define U3_AGP_CFA0(devfn, off) \
83− ((1 << (unsigned long)PCI_SLOT(dev_fn)) \
84− | (((unsigned long)PCI_FUNC(dev_fn)) << 8) \
85− | (((unsigned long)(off)) & 0xFCUL))
84+static unsigned long u3_agp_cfa0(u8 devfn, u8 off)
85+{
86+ return (1 << (unsigned long)PCI_SLOT(devfn)) |
87+ ((unsigned long)PCI_FUNC(devfn) << 8) |
88+ ((unsigned long)off & 0xFCUL);
89+}
8690
87−#define U3_AGP_CFA1(bus, devfn, off) \
88− ((((unsigned long)(bus)) << 16) \
89− |(((unsigned long)(devfn)) << 8) \
90− |(((unsigned long)(off)) & 0xFCUL) \
91− |1UL)
91+static unsigned long u3_agp_cfa1(u8 bus, u8 devfn, u8 off)
92+{
93+ return ((unsigned long)bus << 16) |
94+ ((unsigned long)devfn << 8) |
95+ ((unsigned long)off & 0xFCUL) |
96+ 1UL;
97+}
9298
9399 static unsigned long u3_agp_cfg_access(struct pci_controller* hose,
94100 u8 bus, u8 dev_fn, u8 offset)
@@ -98,9 +104,9 @@ static unsigned long u3_agp_cfg_access(struct pci_controller* hose, · 3 unmodified lines
98104 if (bus == hose->first_busno) {
99105 if (dev_fn < (11 << 3))
100106 return 0;
101− caddr = U3_AGP_CFA0(dev_fn, offset);
107+ caddr = u3_agp_cfa0(dev_fn, offset);
102108 } else
103− caddr = U3_AGP_CFA1(bus, dev_fn, offset);
109+ caddr = u3_agp_cfa1(bus, dev_fn, offset);
104110
105111 /* Uninorth will return garbage if we don't read back the value ! */
106112 do {
@@ -182,13 +188,15 @@ static struct pci_ops u3_agp_pci_ops = · 75 unmodified lines
182188 u3_agp_write_config
183189 };
184190
191+static unsigned long u3_ht_cfa0(u8 devfn, u8 off)
192+{
193+ return (devfn << 8) | off;
194+}
185195
186−#define U3_HT_CFA0(devfn, off) \
187− ((((unsigned long)devfn) << 8) | offset)
188−#define U3_HT_CFA1(bus, devfn, off) \
189− (U3_HT_CFA0(devfn, off) \
190− + (((unsigned long)bus) << 16) \
191− + 0x01000000UL)
196+static unsigned long u3_ht_cfa1(u8 bus, u8 devfn, u8 off)
197+{
198+ return u3_ht_cfa0(devfn, off) + (bus << 16) + 0x01000000UL;
199+}
192200
193201 static unsigned long u3_ht_cfg_access(struct pci_controller* hose,
194202 u8 bus, u8 devfn, u8 offset)
@@ -196,9 +204,9 @@ static unsigned long u3_ht_cfg_access(struct pci_controller* hose, · 1 unmodified line
196204 if (bus == hose->first_busno) {
197205 if (PCI_SLOT(devfn) == 0)
198206 return 0;
199− return ((unsigned long)hose->cfg_data) + U3_HT_CFA0(devfn, offset);
207+ return ((unsigned long)hose->cfg_data) + u3_ht_cfa0(devfn, offset);
200208 } else
201− return ((unsigned long)hose->cfg_data) + U3_HT_CFA1(bus, devfn, offset);
209+ return ((unsigned long)hose->cfg_data) + u3_ht_cfa1(bus, devfn, offset);
202210 }
203211
204212 static int u3_ht_read_config(struct pci_bus *bus, unsigned int devfn,
@@ -211,6 +219,9 @@ static int u3_ht_read_config(struct pci_bus *bus, unsigned int devfn, · 6 unmodified lines
211219 if (hose == NULL)
212220 return PCIBIOS_DEVICE_NOT_FOUND;
213221
222+ if (offset > 0xff)
223+ return PCIBIOS_BAD_REGISTER_NUMBER;
224+
214225 addr = u3_ht_cfg_access(hose, bus->number, devfn, offset);
215226 if (!addr)
216227 return PCIBIOS_DEVICE_NOT_FOUND;
@@ -243,6 +254,9 @@ static int u3_ht_write_config(struct pci_bus *bus, unsigned int devfn, · 26 unmodified lines
243254 if (hose == NULL)
244255 return PCIBIOS_DEVICE_NOT_FOUND;
245256
257+ if (offset > 0xff)
258+ return PCIBIOS_BAD_REGISTER_NUMBER;
259+
246260 addr = u3_ht_cfg_access(hose, bus->number, devfn, offset);
247261 if (!addr)
248262 return PCIBIOS_DEVICE_NOT_FOUND;
@@ -314,12 +328,12 @@ static int __init add_bridge(struct device_node *dev) · 65 unmodified lines
314328 int len;
315329 struct pci_controller *hose;
316330 char* disp_name;
317− int *bus_range;
331+ const int *bus_range;
318332 int primary = 1;
319333
320334 DBG("Adding PCI host bridge %s\n", dev->full_name);
321335
322− bus_range = (int *) get_property(dev, "bus-range", &len);
336+ bus_range = get_property(dev, "bus-range", &len);
323337 if (bus_range == NULL || len < 2 * sizeof(int)) {
324338 printk(KERN_WARNING "Can't get bus-range for %s, assume bus 0\n",
325339 dev->full_name);
arch/powerpc/platforms/maple/setup.c+10−17
@@ -99,8 +99,7 @@ static unsigned long maple_find_nvram_base(void) · 98 unmodified lines
9999 static void maple_restart(char *cmd)
100100 {
101101 unsigned int maple_nvram_base;
102− unsigned int maple_nvram_offset;
103− unsigned int maple_nvram_command;
102+ const unsigned int *maple_nvram_offset, *maple_nvram_command;
104103 struct device_node *sp;
105104
106105 maple_nvram_base = maple_find_nvram_base();
@@ -113,14 +112,12 @@ static void maple_restart(char *cmd) · 6 unmodified lines
113112 printk(KERN_EMERG "Maple: Unable to find Service Processor\n");
114113 goto fail;
115114 }
116− maple_nvram_offset = *(unsigned int*) get_property(sp,
117− "restart-addr", NULL);
118− maple_nvram_command = *(unsigned int*) get_property(sp,
119− "restart-value", NULL);
115+ maple_nvram_offset = get_property(sp, "restart-addr", NULL);
116+ maple_nvram_command = get_property(sp, "restart-value", NULL);
120117 of_node_put(sp);
121118
122119 /* send command */
123− outb_p(maple_nvram_command, maple_nvram_base + maple_nvram_offset);
120+ outb_p(*maple_nvram_command, maple_nvram_base + *maple_nvram_offset);
124121 for (;;) ;
125122 fail:
126123 printk(KERN_EMERG "Maple: Manual Restart Required\n");
@@ -129,8 +126,7 @@ static void maple_restart(char *cmd) · 2 unmodified lines
129126 static void maple_power_off(void)
130127 {
131128 unsigned int maple_nvram_base;
132− unsigned int maple_nvram_offset;
133− unsigned int maple_nvram_command;
129+ const unsigned int *maple_nvram_offset, *maple_nvram_command;
134130 struct device_node *sp;
135131
136132 maple_nvram_base = maple_find_nvram_base();
@@ -143,14 +139,12 @@ static void maple_power_off(void) · 6 unmodified lines
143139 printk(KERN_EMERG "Maple: Unable to find Service Processor\n");
144140 goto fail;
145141 }
146− maple_nvram_offset = *(unsigned int*) get_property(sp,
147− "power-off-addr", NULL);
148− maple_nvram_command = *(unsigned int*) get_property(sp,
149− "power-off-value", NULL);
142+ maple_nvram_offset = get_property(sp, "power-off-addr", NULL);
143+ maple_nvram_command = get_property(sp, "power-off-value", NULL);
150144 of_node_put(sp);
151145
152146 /* send command */
153− outb_p(maple_nvram_command, maple_nvram_base + maple_nvram_offset);
147+ outb_p(*maple_nvram_command, maple_nvram_base + *maple_nvram_offset);
154148 for (;;) ;
155149 fail:
156150 printk(KERN_EMERG "Maple: Manual Power-Down Required\n");
@@ -211,7 +205,7 @@ static void __init maple_init_early(void) · 54 unmodified lines
211205 static void __init maple_init_IRQ(void)
212206 {
213207 struct device_node *root, *np, *mpic_node = NULL;
214− unsigned int *opprop;
208+ const unsigned int *opprop;
215209 unsigned long openpic_addr = 0;
216210 int naddr, n, i, opplen, has_isus = 0;
217211 struct mpic *mpic;
@@ -241,8 +235,7 @@ static void __init maple_init_IRQ(void) · 23 unmodified lines
241235 /* Find address list in /platform-open-pic */
242236 root = of_find_node_by_path("/");
243237 naddr = prom_n_addr_cells(root);
244− opprop = (unsigned int *) get_property(root, "platform-open-pic",
245− &opplen);
238+ opprop = get_property(root, "platform-open-pic", &opplen);
246239 if (opprop != 0) {
247240 openpic_addr = of_read_number(opprop, naddr);
248241 has_isus = (opplen > naddr);
arch/powerpc/platforms/pasemi/Makefile+1−0
@@ -0,0 +1 @@
1+obj-y += setup.o pci.o time.o
arch/powerpc/platforms/pasemi/pasemi.h+8−0
@@ -0,0 +1,8 @@
1+#ifndef _PASEMI_PASEMI_H
2+#define _PASEMI_PASEMI_H
3+
4+extern unsigned long pas_get_boot_time(void);
5+extern void pas_pci_init(void);
6+extern void pas_pcibios_fixup(void);
7+
8+#endif /* _PASEMI_PASEMI_H */
arch/powerpc/platforms/pasemi/pci.c+198−0
@@ -0,0 +1,198 @@
1+/*
2+ * Copyright (C) 2006 PA Semi, Inc
3+ *
4+ * Authors: Kip Walker, PA Semi
5+ * Olof Johansson, PA Semi
6+ *
7+ * Maintained by: Olof Johansson <olof@lixom.net>
8+ *
9+ * Based on arch/powerpc/platforms/maple/pci.c
10+ *
11+ * This program is free software; you can redistribute it and/or modify
12+ * it under the terms of the GNU General Public License version 2 as
13+ * published by the Free Software Foundation.
14+ *
15+ * This program is distributed in the hope that it will be useful,
16+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
17+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+ * GNU General Public License for more details.
19+ *
20+ * You should have received a copy of the GNU General Public License
21+ * along with this program; if not, write to the Free Software
22+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23+ */
24+
25+
26+#include <linux/kernel.h>
27+#include <linux/pci.h>
28+
29+#include <asm/pci-bridge.h>
30+#include <asm/machdep.h>
31+
32+#include <asm/ppc-pci.h>
33+
34+#define PA_PXP_CFA(bus, devfn, off) (((bus) << 20) | ((devfn) << 12) | (off))
35+
36+#define CONFIG_OFFSET_VALID(off) ((off) < 4096)
37+
38+static unsigned long pa_pxp_cfg_addr(struct pci_controller *hose,
39+ u8 bus, u8 devfn, int offset)
40+{
41+ return ((unsigned long)hose->cfg_data) + PA_PXP_CFA(bus, devfn, offset);
42+}
43+
44+static int pa_pxp_read_config(struct pci_bus *bus, unsigned int devfn,
45+ int offset, int len, u32 *val)
46+{
47+ struct pci_controller *hose;
48+ unsigned long addr;
49+
50+ hose = pci_bus_to_host(bus);
51+ if (!hose)
52+ return PCIBIOS_DEVICE_NOT_FOUND;
53+
54+ if (!CONFIG_OFFSET_VALID(offset))
55+ return PCIBIOS_BAD_REGISTER_NUMBER;
56+
57+ addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset);
58+
59+ /*
60+ * Note: the caller has already checked that offset is
61+ * suitably aligned and that len is 1, 2 or 4.
62+ */
63+ switch (len) {
64+ case 1:
65+ *val = in_8((u8 *)addr);
66+ break;
67+ case 2:
68+ *val = in_le16((u16 *)addr);
69+ break;
70+ default:
71+ *val = in_le32((u32 *)addr);
72+ break;
73+ }
74+
75+ return PCIBIOS_SUCCESSFUL;
76+}
77+
78+static int pa_pxp_write_config(struct pci_bus *bus, unsigned int devfn,
79+ int offset, int len, u32 val)
80+{
81+ struct pci_controller *hose;
82+ unsigned long addr;
83+
84+ hose = pci_bus_to_host(bus);
85+ if (!hose)
86+ return PCIBIOS_DEVICE_NOT_FOUND;
87+
88+ if (!CONFIG_OFFSET_VALID(offset))
89+ return PCIBIOS_BAD_REGISTER_NUMBER;
90+
91+ addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset);
92+
93+ /*
94+ * Note: the caller has already checked that offset is
95+ * suitably aligned and that len is 1, 2 or 4.
96+ */
97+ switch (len) {
98+ case 1:
99+ out_8((u8 *)addr, val);
100+ (void) in_8((u8 *)addr);
101+ break;
102+ case 2:
103+ out_le16((u16 *)addr, val);
104+ (void) in_le16((u16 *)addr);
105+ break;
106+ default:
107+ out_le32((u32 *)addr, val);
108+ (void) in_le32((u32 *)addr);
109+ break;
110+ }
111+ return PCIBIOS_SUCCESSFUL;
112+}
113+
114+static struct pci_ops pa_pxp_ops = {
115+ pa_pxp_read_config,
116+ pa_pxp_write_config,
117+};
118+
119+static void __init setup_pa_pxp(struct pci_controller *hose)
120+{
121+ hose->ops = &pa_pxp_ops;
122+ hose->cfg_data = ioremap(0xe0000000, 0x10000000);
123+}
124+
125+static int __init add_bridge(struct device_node *dev)
126+{
127+ struct pci_controller *hose;
128+
129+ pr_debug("Adding PCI host bridge %s\n", dev->full_name);
130+
131+ hose = pcibios_alloc_controller(dev);
132+ if (!hose)
133+ return -ENOMEM;
134+
135+ hose->first_busno = 0;
136+ hose->last_busno = 0xff;
137+
138+ setup_pa_pxp(hose);
139+
140+ printk(KERN_INFO "Found PA-PXP PCI host bridge.\n");
141+
142+ /* Interpret the "ranges" property */
143+ /* This also maps the I/O region and sets isa_io/mem_base */
144+ pci_process_bridge_OF_ranges(hose, dev, 1);
145+ pci_setup_phb_io(hose, 1);
146+
147+ return 0;
148+}
149+
150+
151+void __init pas_pcibios_fixup(void)
152+{
153+ struct pci_dev *dev = NULL;
154+
155+ for_each_pci_dev(dev)
156+ pci_read_irq_line(dev);
157+}
158+
159+static void __init pas_fixup_phb_resources(void)
160+{
161+ struct pci_controller *hose, *tmp;
162+
163+ list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
164+ unsigned long offset = (unsigned long)hose->io_base_virt - pci_io_base;
165+ hose->io_resource.start += offset;
166+ hose->io_resource.end += offset;
167+ printk(KERN_INFO "PCI Host %d, io start: %lx; io end: %lx\n",
168+ hose->global_number,
169+ hose->io_resource.start, hose->io_resource.end);
170+ }
171+}
172+
173+
174+void __init pas_pci_init(void)
175+{
176+ struct device_node *np, *root;
177+
178+ root = of_find_node_by_path("/");
179+ if (!root) {
180+ printk(KERN_CRIT "pas_pci_init: can't find root "
181+ "of device tree\n");
182+ return;
183+ }
184+
185+ for (np = NULL; (np = of_get_next_child(root, np)) != NULL;)
186+ if (np->name && !strcmp(np->name, "pxp") && !add_bridge(np))
187+ of_node_get(np);
188+
189+ of_node_put(root);
190+
191+ pas_fixup_phb_resources();
192+
193+ /* Setup the linkage between OF nodes and PHBs */
194+ pci_devs_phb_init();
195+
196+ /* Use the common resource allocation mechanism */
197+ pci_probe_only = 1;
198+}
arch/powerpc/platforms/pasemi/setup.c+188−0
@@ -0,0 +1,188 @@
1+/*
2+ * Copyright (C) 2006 PA Semi, Inc
3+ *
4+ * Authors: Kip Walker, PA Semi
5+ * Olof Johansson, PA Semi
6+ *
7+ * Maintained by: Olof Johansson <olof@lixom.net>
8+ *
9+ * Based on arch/powerpc/platforms/maple/setup.c
10+ *
11+ * This program is free software; you can redistribute it and/or modify
12+ * it under the terms of the GNU General Public License version 2 as
13+ * published by the Free Software Foundation.
14+ *
15+ * This program is distributed in the hope that it will be useful,
16+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
17+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+ * GNU General Public License for more details.
19+ *
20+ * You should have received a copy of the GNU General Public License
21+ * along with this program; if not, write to the Free Software
22+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23+ */
24+
25+#include <linux/config.h>
26+#include <linux/errno.h>
27+#include <linux/kernel.h>
28+#include <linux/delay.h>
29+#include <linux/console.h>
30+
31+#include <asm/prom.h>
32+#include <asm/system.h>
33+#include <asm/iommu.h>
34+#include <asm/machdep.h>
35+#include <asm/mpic.h>
36+#include <asm/smp.h>
37+#include <asm/time.h>
38+
39+#include "pasemi.h"
40+
41+static void pas_restart(char *cmd)
42+{
43+ printk("restart unimplemented, looping...\n");
44+ for (;;) ;
45+}
46+
47+static void pas_power_off(void)
48+{
49+ printk("power off unimplemented, looping...\n");
50+ for (;;) ;
51+}
52+
53+static void pas_halt(void)
54+{
55+ pas_power_off();
56+}
57+
58+#ifdef CONFIG_SMP
59+struct smp_ops_t pas_smp_ops = {
60+ .probe = smp_mpic_probe,
61+ .message_pass = smp_mpic_message_pass,
62+ .kick_cpu = smp_generic_kick_cpu,
63+ .setup_cpu = smp_mpic_setup_cpu,
64+ .give_timebase = smp_generic_give_timebase,
65+ .take_timebase = smp_generic_take_timebase,
66+};
67+#endif /* CONFIG_SMP */
68+
69+void __init pas_setup_arch(void)
70+{
71+#ifdef CONFIG_SMP
72+ /* Setup SMP callback */
73+ smp_ops = &pas_smp_ops;
74+#endif
75+ /* Lookup PCI hosts */
76+ pas_pci_init();
77+
78+#ifdef CONFIG_DUMMY_CONSOLE
79+ conswitchp = &dummy_con;
80+#endif
81+
82+ printk(KERN_DEBUG "Using default idle loop\n");
83+}
84+
85+static void iommu_dev_setup_null(struct pci_dev *dev) { }
86+static void iommu_bus_setup_null(struct pci_bus *bus) { }
87+
88+static void __init pas_init_early(void)
89+{
90+ /* No iommu code yet */
91+ ppc_md.iommu_dev_setup = iommu_dev_setup_null;
92+ ppc_md.iommu_bus_setup = iommu_bus_setup_null;
93+ pci_direct_iommu_init();
94+}
95+
96+/* No legacy IO on our parts */
97+static int pas_check_legacy_ioport(unsigned int baseport)
98+{
99+ return -ENODEV;
100+}
101+
102+static __init void pas_init_IRQ(void)
103+{
104+ struct device_node *np;
105+ struct device_node *root, *mpic_node;
106+ unsigned long openpic_addr;
107+ const unsigned int *opprop;
108+ int naddr, opplen;
109+ struct mpic *mpic;
110+
111+ mpic_node = NULL;
112+
113+ for_each_node_by_type(np, "interrupt-controller")
114+ if (device_is_compatible(np, "open-pic")) {
115+ mpic_node = np;
116+ break;
117+ }
118+ if (!mpic_node)
119+ for_each_node_by_type(np, "open-pic") {
120+ mpic_node = np;
121+ break;
122+ }
123+ if (!mpic_node) {
124+ printk(KERN_ERR
125+ "Failed to locate the MPIC interrupt controller\n");
126+ return;
127+ }
128+
129+ /* Find address list in /platform-open-pic */
130+ root = of_find_node_by_path("/");
131+ naddr = prom_n_addr_cells(root);
132+ opprop = get_property(root, "platform-open-pic", &opplen);
133+ if (!opprop) {
134+ printk(KERN_ERR "No platform-open-pic property.\n");
135+ of_node_put(root);
136+ return;
137+ }
138+ openpic_addr = of_read_number(opprop, naddr);
139+ printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr);
140+ of_node_put(root);
141+
142+ mpic = mpic_alloc(mpic_node, openpic_addr, MPIC_PRIMARY, 0, 0,
143+ " PAS-OPIC ");
144+ BUG_ON(!mpic);
145+
146+ mpic_assign_isu(mpic, 0, openpic_addr + 0x10000);
147+ mpic_init(mpic);
148+ of_node_put(mpic_node);
149+ of_node_put(root);
150+}
151+
152+static void __init pas_progress(char *s, unsigned short hex)
153+{
154+ printk("[%04x] : %s\n", hex, s ? s : "");
155+}
156+
157+
158+/*
159+ * Called very early, MMU is off, device-tree isn't unflattened
160+ */
161+static int __init pas_probe(void)
162+{
163+ unsigned long root = of_get_flat_dt_root();
164+
165+ if (!of_flat_dt_is_compatible(root, "PA6T-1682M"))
166+ return 0;
167+
168+ hpte_init_native();
169+
170+ return 1;
171+}
172+
173+define_machine(pas) {
174+ .name = "PA Semi PA6T-1682M",
175+ .probe = pas_probe,
176+ .setup_arch = pas_setup_arch,
177+ .init_early = pas_init_early,
178+ .init_IRQ = pas_init_IRQ,
179+ .get_irq = mpic_get_irq,
180+ .pcibios_fixup = pas_pcibios_fixup,
181+ .restart = pas_restart,
182+ .power_off = pas_power_off,
183+ .halt = pas_halt,
184+ .get_boot_time = pas_get_boot_time,
185+ .calibrate_decr = generic_calibrate_decr,
186+ .check_legacy_ioport = pas_check_legacy_ioport,
187+ .progress = pas_progress,
188+};
arch/powerpc/platforms/pasemi/time.c+29−0
@@ -0,0 +1,29 @@
1+/*
2+ * Copyright (C) 2006 PA Semi, Inc
3+ *
4+ * Maintained by: Olof Johansson <olof@lixom.net>
5+ *
6+ * This program is free software; you can redistribute it and/or modify
7+ * it under the terms of the GNU General Public License version 2 as
8+ * published by the Free Software Foundation.
9+ *
10+ * This program is distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+ * GNU General Public License for more details.
14+ *
15+ * You should have received a copy of the GNU General Public License
16+ * along with this program; if not, write to the Free Software
17+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18+ */
19+
20+#include <linux/config.h>
21+#include <linux/time.h>
22+
23+#include <asm/time.h>
24+
25+unsigned long __init pas_get_boot_time(void)
26+{
27+ /* Let's just return a fake date right now */
28+ return mktime(2006, 1, 1, 12, 0, 0);
29+}
arch/powerpc/platforms/powermac/backlight.c+2−1
@@ -60,7 +60,8 @@ int pmac_has_backlight_type(const char *type) · 59 unmodified lines
6060 struct device_node* bk_node = find_devices("backlight");
6161
6262 if (bk_node) {
63− char *prop = get_property(bk_node, "backlight-control", NULL);
63+ const char *prop = get_property(bk_node,
64+ "backlight-control", NULL);
6465 if (prop && strncmp(prop, type, strlen(type)) == 0)
6566 return 1;
6667 }
arch/powerpc/platforms/powermac/cpufreq_32.c+12−11
@@ -421,7 +421,7 @@ static int pmac_cpufreq_cpu_init(struct cpufreq_policy *policy) · 420 unmodified lines
421421
422422 static u32 read_gpio(struct device_node *np)
423423 {
424− u32 *reg = (u32 *)get_property(np, "reg", NULL);
424+ const u32 *reg = get_property(np, "reg", NULL);
425425 u32 offset;
426426
427427 if (reg == NULL)
@@ -497,7 +497,7 @@ static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode) · 69 unmodified lines
497497 "frequency-gpio");
498498 struct device_node *slew_done_gpio_np = of_find_node_by_name(NULL,
499499 "slewing-done");
500− u32 *value;
500+ const u32 *value;
501501
502502 /*
503503 * Check to see if it's GPIO driven or PMU only
@@ -519,15 +519,15 @@ static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode) · 15 unmodified lines
519519 */
520520 if (frequency_gpio && slew_done_gpio) {
521521 int lenp, rc;
522− u32 *freqs, *ratio;
522+ const u32 *freqs, *ratio;
523523
524− freqs = (u32 *)get_property(cpunode, "bus-frequencies", &lenp);
524+ freqs = get_property(cpunode, "bus-frequencies", &lenp);
525525 lenp /= sizeof(u32);
526526 if (freqs == NULL || lenp != 2) {
527527 printk(KERN_ERR "cpufreq: bus-frequencies incorrect or missing\n");
528528 return 1;
529529 }
530− ratio = (u32 *)get_property(cpunode, "processor-to-bus-ratio*2", NULL);
530+ ratio = get_property(cpunode, "processor-to-bus-ratio*2", NULL);
531531 if (ratio == NULL) {
532532 printk(KERN_ERR "cpufreq: processor-to-bus-ratio*2 missing\n");
533533 return 1;
@@ -562,7 +562,7 @@ static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode) · 28 unmodified lines
562562 /* If we use the PMU, look for the min & max frequencies in the
563563 * device-tree
564564 */
565− value = (u32 *)get_property(cpunode, "min-clock-frequency", NULL);
565+ value = get_property(cpunode, "min-clock-frequency", NULL);
566566 if (!value)
567567 return 1;
568568 low_freq = (*value) / 1000;
@@ -571,7 +571,7 @@ static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode) · 2 unmodified lines
571571 if (low_freq < 100000)
572572 low_freq *= 10;
573573
574− value = (u32 *)get_property(cpunode, "max-clock-frequency", NULL);
574+ value = get_property(cpunode, "max-clock-frequency", NULL);
575575 if (!value)
576576 return 1;
577577 hi_freq = (*value) / 1000;
@@ -611,13 +611,14 @@ static int pmac_cpufreq_init_7447A(struct device_node *cpunode) · 33 unmodified lines
611611 static int pmac_cpufreq_init_750FX(struct device_node *cpunode)
612612 {
613613 struct device_node *volt_gpio_np;
614− u32 pvr, *value;
614+ u32 pvr;
615+ const u32 *value;
615616
616617 if (get_property(cpunode, "dynamic-power-step", NULL) == NULL)
617618 return 1;
618619
619620 hi_freq = cur_freq;
620− value = (u32 *)get_property(cpunode, "reduced-clock-frequency", NULL);
621+ value = get_property(cpunode, "reduced-clock-frequency", NULL);
621622 if (!value)
622623 return 1;
623624 low_freq = (*value) / 1000;
@@ -650,7 +651,7 @@ static int pmac_cpufreq_init_750FX(struct device_node *cpunode) · 26 unmodified lines
650651 static int __init pmac_cpufreq_setup(void)
651652 {
652653 struct device_node *cpunode;
653− u32 *value;
654+ const u32 *value;
654655
655656 if (strstr(cmd_line, "nocpufreq"))
656657 return 0;
@@ -661,7 +662,7 @@ static int __init pmac_cpufreq_setup(void) · 4 unmodified lines
661662 goto out;
662663
663664 /* Get current cpu clock freq */
664− value = (u32 *)get_property(cpunode, "clock-frequency", NULL);
665+ value = get_property(cpunode, "clock-frequency", NULL);
665666 if (!value)
666667 goto out;
667668 cur_freq = (*value) / 1000;
arch/powerpc/platforms/powermac/cpufreq_64.c+14−13
@@ -89,7 +89,7 @@ static DEFINE_MUTEX(g5_switch_mutex); · 88 unmodified lines
8989
9090 #ifdef CONFIG_PMAC_SMU
9191
92−static u32 *g5_pmode_data;
92+static const u32 *g5_pmode_data;
9393 static int g5_pmode_max;
9494
9595 static struct smu_sdbp_fvt *g5_fvt_table; /* table of op. points */
@@ -391,7 +391,8 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus) · 295 unmodified lines
391391 unsigned int psize, ssize;
392392 unsigned long max_freq;
393393 char *freq_method, *volt_method;
394− u32 *valp, pvr_hi;
394+ const u32 *valp;
395+ u32 pvr_hi;
395396 int use_volts_vdnap = 0;
396397 int use_volts_smu = 0;
397398 int rc = -ENODEV;
@@ -409,8 +410,7 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus) · 11 unmodified lines
409410 /* Get first CPU node */
410411 for (cpunode = NULL;
411412 (cpunode = of_get_next_child(cpus, cpunode)) != NULL;) {
412− u32 *reg =
413− (u32 *)get_property(cpunode, "reg", NULL);
413+ const u32 *reg = get_property(cpunode, "reg", NULL);
414414 if (reg == NULL || (*reg) != 0)
415415 continue;
416416 if (!strcmp(cpunode->type, "cpu"))
@@ -422,7 +422,7 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus) · 5 unmodified lines
422422 }
423423
424424 /* Check 970FX for now */
425− valp = (u32 *)get_property(cpunode, "cpu-version", NULL);
425+ valp = get_property(cpunode, "cpu-version", NULL);
426426 if (!valp) {
427427 DBG("No cpu-version property !\n");
428428 goto bail_noprops;
@@ -434,7 +434,7 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus) · 5 unmodified lines
434434 }
435435
436436 /* Look for the powertune data in the device-tree */
437− g5_pmode_data = (u32 *)get_property(cpunode, "power-mode-data",&psize);
437+ g5_pmode_data = get_property(cpunode, "power-mode-data",&psize);
438438 if (!g5_pmode_data) {
439439 DBG("No power-mode-data !\n");
440440 goto bail_noprops;
@@ -442,7 +442,7 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus) · 1 unmodified line
442442 g5_pmode_max = psize / sizeof(u32) - 1;
443443
444444 if (use_volts_smu) {
445− struct smu_sdbp_header *shdr;
445+ const struct smu_sdbp_header *shdr;
446446
447447 /* Look for the FVT table */
448448 shdr = smu_get_sdb_partition(SMU_SDB_FVT_ID, NULL);
@@ -493,7 +493,7 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus) · 44 unmodified lines
493493 * half freq in this version. So far, I haven't yet seen a machine
494494 * supporting anything else.
495495 */
496− valp = (u32 *)get_property(cpunode, "clock-frequency", NULL);
496+ valp = get_property(cpunode, "clock-frequency", NULL);
497497 if (!valp)
498498 return -ENODEV;
499499 max_freq = (*valp)/1000;
@@ -541,8 +541,8 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus) · 41 unmodified lines
541541 static int __init g5_pm72_cpufreq_init(struct device_node *cpus)
542542 {
543543 struct device_node *cpuid = NULL, *hwclock = NULL, *cpunode = NULL;
544− u8 *eeprom = NULL;
545− u32 *valp;
544+ const u8 *eeprom = NULL;
545+ const u32 *valp;
546546 u64 max_freq, min_freq, ih, il;
547547 int has_volt = 1, rc = 0;
548548
@@ -563,7 +563,7 @@ static int __init g5_pm72_cpufreq_init(struct device_node *cpus) · 14 unmodified lines
563563 /* Lookup the cpuid eeprom node */
564564 cpuid = of_find_node_by_path("/u3@0,f8000000/i2c@f8001000/cpuid@a0");
565565 if (cpuid != NULL)
566− eeprom = (u8 *)get_property(cpuid, "cpuid", NULL);
566+ eeprom = get_property(cpuid, "cpuid", NULL);
567567 if (eeprom == NULL) {
568568 printk(KERN_ERR "cpufreq: Can't find cpuid EEPROM !\n");
569569 rc = -ENODEV;
@@ -573,7 +573,8 @@ static int __init g5_pm72_cpufreq_init(struct device_node *cpus) · 3 unmodified lines
573573 /* Lookup the i2c hwclock */
574574 for (hwclock = NULL;
575575 (hwclock = of_find_node_by_name(hwclock, "i2c-hwclock")) != NULL;){
576− char *loc = get_property(hwclock, "hwctrl-location", NULL);
576+ const char *loc = get_property(hwclock,
577+ "hwctrl-location", NULL);
577578 if (loc == NULL)
578579 continue;
579580 if (strcmp(loc, "CPU CLOCK"))
@@ -637,7 +638,7 @@ static int __init g5_pm72_cpufreq_init(struct device_node *cpus) · 57 unmodified lines
637638 */
638639
639640 /* Get max frequency from device-tree */
640− valp = (u32 *)get_property(cpunode, "clock-frequency", NULL);
641+ valp = get_property(cpunode, "clock-frequency", NULL);
641642 if (!valp) {
642643 printk(KERN_ERR "cpufreq: Can't find CPU frequency !\n");
643644 rc = -ENODEV;
arch/powerpc/platforms/powermac/feature.c+15−15
@@ -1058,8 +1058,8 @@ core99_reset_cpu(struct device_node *node, long param, long value) · 1057 unmodified lines
10581058 if (np == NULL)
10591059 return -ENODEV;
10601060 for (np = np->child; np != NULL; np = np->sibling) {
1061− u32 *num = (u32 *)get_property(np, "reg", NULL);
1062− u32 *rst = (u32 *)get_property(np, "soft-reset", NULL);
1061+ u32 *num = get_property(np, "reg", NULL);
1062+ u32 *rst = get_property(np, "soft-reset", NULL);
10631063 if (num == NULL || rst == NULL)
10641064 continue;
10651065 if (param == *num) {
@@ -1087,7 +1087,7 @@ core99_usb_enable(struct device_node *node, long param, long value) · 21 unmodified lines
10871087 {
10881088 struct macio_chip *macio;
10891089 unsigned long flags;
1090− char *prop;
1090+ const char *prop;
10911091 int number;
10921092 u32 reg;
10931093
@@ -1096,7 +1096,7 @@ core99_usb_enable(struct device_node *node, long param, long value) · 2 unmodified lines
10961096 macio->type != macio_intrepid)
10971097 return -ENODEV;
10981098
1099− prop = (char *)get_property(node, "AAPL,clock-id", NULL);
1099+ prop = get_property(node, "AAPL,clock-id", NULL);
11001100 if (!prop)
11011101 return -ENODEV;
11021102 if (strncmp(prop, "usb0u048", 8) == 0)
@@ -1507,8 +1507,8 @@ static long g5_reset_cpu(struct device_node *node, long param, long value) · 404 unmodified lines
15071507 if (np == NULL)
15081508 return -ENODEV;
15091509 for (np = np->child; np != NULL; np = np->sibling) {
1510− u32 *num = (u32 *)get_property(np, "reg", NULL);
1511− u32 *rst = (u32 *)get_property(np, "soft-reset", NULL);
1510+ const u32 *num = get_property(np, "reg", NULL);
1511+ const u32 *rst = get_property(np, "soft-reset", NULL);
15121512 if (num == NULL || rst == NULL)
15131513 continue;
15141514 if (param == *num) {
@@ -2408,7 +2408,7 @@ static int __init probe_motherboard(void) · 893 unmodified lines
24082408 */
24092409 dt = find_devices("device-tree");
24102410 if (dt != NULL)
2411− model = (const char *) get_property(dt, "model", NULL);
2411+ model = get_property(dt, "model", NULL);
24122412 for(i=0; model && i<(sizeof(pmac_mb_defs)/sizeof(struct pmac_mb_def)); i++) {
24132413 if (strcmp(model, pmac_mb_defs[i].model_string) == 0) {
24142414 pmac_mb = pmac_mb_defs[i];
@@ -2536,7 +2536,7 @@ found: · 121 unmodified lines
25362536 */
25372537 static void __init probe_uninorth(void)
25382538 {
2539− u32 *addrp;
2539+ const u32 *addrp;
25402540 phys_addr_t address;
25412541 unsigned long actrl;
25422542
@@ -2555,7 +2555,7 @@ static void __init probe_uninorth(void) · 12 unmodified lines
25552555 if (uninorth_node == NULL)
25562556 return;
25572557
2558− addrp = (u32 *)get_property(uninorth_node, "reg", NULL);
2558+ addrp = get_property(uninorth_node, "reg", NULL);
25592559 if (addrp == NULL)
25602560 return;
25612561 address = of_translate_address(uninorth_node, addrp);
@@ -2596,7 +2596,7 @@ static void __init probe_one_macio(const char *name, const char *compat, int typ · 34 unmodified lines
25962596 struct device_node* node;
25972597 int i;
25982598 volatile u32 __iomem *base;
2599− u32 *addrp, *revp;
2599+ const u32 *addrp, *revp;
26002600 phys_addr_t addr;
26012601 u64 size;
26022602
@@ -2639,7 +2639,7 @@ static void __init probe_one_macio(const char *name, const char *compat, int typ · 36 unmodified lines
26392639 return;
26402640 }
26412641 if (type == macio_keylargo || type == macio_keylargo2) {
2642− u32 *did = (u32 *)get_property(node, "device-id", NULL);
2642+ const u32 *did = get_property(node, "device-id", NULL);
26432643 if (*did == 0x00000025)
26442644 type = macio_pangea;
26452645 if (*did == 0x0000003e)
@@ -2652,7 +2652,7 @@ static void __init probe_one_macio(const char *name, const char *compat, int typ · 6 unmodified lines
26522652 macio_chips[i].base = base;
26532653 macio_chips[i].flags = MACIO_FLAG_SCCB_ON | MACIO_FLAG_SCCB_ON;
26542654 macio_chips[i].name = macio_names[type];
2655− revp = (u32 *)get_property(node, "revision-id", NULL);
2655+ revp = get_property(node, "revision-id", NULL);
26562656 if (revp)
26572657 macio_chips[i].rev = *revp;
26582658 printk(KERN_INFO "Found a %s mac-io controller, rev: %d, mapped at 0x%p\n",
@@ -2695,15 +2695,15 @@ static void __init · 36 unmodified lines
26952695 initial_serial_shutdown(struct device_node *np)
26962696 {
26972697 int len;
2698− struct slot_names_prop {
2698+ const struct slot_names_prop {
26992699 int count;
27002700 char name[1];
27012701 } *slots;
2702− char *conn;
2702+ const char *conn;
27032703 int port_type = PMAC_SCC_ASYNC;
27042704 int modem = 0;
27052705
2706− slots = (struct slot_names_prop *)get_property(np, "slot-names", &len);
2706+ slots = get_property(np, "slot-names", &len);
27072707 conn = get_property(np, "AAPL,connector", &len);
27082708 if (conn && (strcmp(conn, "infrared") == 0))
27092709 port_type = PMAC_SCC_IRDA;
arch/powerpc/platforms/powermac/low_i2c.c+12−12
@@ -477,7 +477,8 @@ static int kw_i2c_xfer(struct pmac_i2c_bus *bus, u8 addrdir, int subsize, · 476 unmodified lines
477477 static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np)
478478 {
479479 struct pmac_i2c_host_kw *host;
480− u32 *psteps, *prate, *addrp, steps;
480+ const u32 *psteps, *prate, *addrp;
481+ u32 steps;
481482
482483 host = kzalloc(sizeof(struct pmac_i2c_host_kw), GFP_KERNEL);
483484 if (host == NULL) {
@@ -490,7 +491,7 @@ static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np) · 6 unmodified lines
490491 * on all i2c keywest nodes so far ... we would have to fallback
491492 * to macio parsing if that wasn't the case
492493 */
493− addrp = (u32 *)get_property(np, "AAPL,address", NULL);
494+ addrp = get_property(np, "AAPL,address", NULL);
494495 if (addrp == NULL) {
495496 printk(KERN_ERR "low_i2c: Can't find address for %s\n",
496497 np->full_name);
@@ -504,13 +505,13 @@ static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np) · 7 unmodified lines
504505 host->timeout_timer.function = kw_i2c_timeout;
505506 host->timeout_timer.data = (unsigned long)host;
506507
507− psteps = (u32 *)get_property(np, "AAPL,address-step", NULL);
508+ psteps = get_property(np, "AAPL,address-step", NULL);
508509 steps = psteps ? (*psteps) : 0x10;
509510 for (host->bsteps = 0; (steps & 0x01) == 0; host->bsteps++)
510511 steps >>= 1;
511512 /* Select interface rate */
512513 host->speed = KW_I2C_MODE_25KHZ;
513− prate = (u32 *)get_property(np, "AAPL,i2c-rate", NULL);
514+ prate = get_property(np, "AAPL,i2c-rate", NULL);
514515 if (prate) switch(*prate) {
515516 case 100:
516517 host->speed = KW_I2C_MODE_100KHZ;
@@ -618,8 +619,8 @@ static void __init kw_i2c_probe(void) · 101 unmodified lines
618619 } else {
619620 for (child = NULL;
620621 (child = of_get_next_child(np, child)) != NULL;) {
621− u32 *reg =
622− (u32 *)get_property(child, "reg", NULL);
622+ const u32 *reg = get_property(child,
623+ "reg", NULL);
623624 if (reg == NULL)
624625 continue;
625626 kw_i2c_add(host, np, child, *reg);
@@ -881,7 +882,7 @@ static void __init smu_i2c_probe(void) · 255 unmodified lines
881882 {
882883 struct device_node *controller, *busnode;
883884 struct pmac_i2c_bus *bus;
884− u32 *reg;
885+ const u32 *reg;
885886 int sz;
886887
887888 if (!smu_present())
@@ -904,7 +905,7 @@ static void __init smu_i2c_probe(void) · 16 unmodified lines
904905 if (strcmp(busnode->type, "i2c") &&
905906 strcmp(busnode->type, "i2c-bus"))
906907 continue;
907− reg = (u32 *)get_property(busnode, "reg", NULL);
908+ reg = get_property(busnode, "reg", NULL);
908909 if (reg == NULL)
909910 continue;
910911
@@ -948,9 +949,8 @@ struct pmac_i2c_bus *pmac_i2c_find_bus(struct device_node *node) · 37 unmodified lines
948949 list_for_each_entry(bus, &pmac_i2c_busses, link) {
949950 if (p == bus->busnode) {
950951 if (prev && bus->flags & pmac_i2c_multibus) {
951− u32 *reg;
952− reg = (u32 *)get_property(prev, "reg",
953− NULL);
952+ const u32 *reg;
953+ reg = get_property(prev, "reg", NULL);
954954 if (!reg)
955955 continue;
956956 if (((*reg) >> 8) != bus->channel)
@@ -971,7 +971,7 @@ EXPORT_SYMBOL_GPL(pmac_i2c_find_bus); · 14 unmodified lines
971971
972972 u8 pmac_i2c_get_dev_addr(struct device_node *device)
973973 {
974− u32 *reg = (u32 *)get_property(device, "reg", NULL);
974+ const u32 *reg = get_property(device, "reg", NULL);
975975
976976 if (reg == NULL)
977977 return 0;
arch/powerpc/platforms/powermac/pci.c+20−17
@@ -66,16 +66,16 @@ struct device_node *k2_skiplist[2]; · 65 unmodified lines
6666 static int __init fixup_one_level_bus_range(struct device_node *node, int higher)
6767 {
6868 for (; node != 0;node = node->sibling) {
69− int * bus_range;
70− unsigned int *class_code;
69+ const int * bus_range;
70+ const unsigned int *class_code;
7171 int len;
7272
7373 /* For PCI<->PCI bridges or CardBus bridges, we go down */
74− class_code = (unsigned int *) get_property(node, "class-code", NULL);
74+ class_code = get_property(node, "class-code", NULL);
7575 if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI &&
7676 (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS))
7777 continue;
78− bus_range = (int *) get_property(node, "bus-range", &len);
78+ bus_range = get_property(node, "bus-range", &len);
7979 if (bus_range != NULL && len > 2 * sizeof(int)) {
8080 if (bus_range[1] > higher)
8181 higher = bus_range[1];
@@ -93,13 +93,15 @@ static int __init fixup_one_level_bus_range(struct device_node *node, int higher · 11 unmodified lines
9393 */
9494 static void __init fixup_bus_range(struct device_node *bridge)
9595 {
96− int * bus_range;
97− int len;
96+ int *bus_range, len;
97+ struct property *prop;
9898
9999 /* Lookup the "bus-range" property for the hose */
100− bus_range = (int *) get_property(bridge, "bus-range", &len);
101− if (bus_range == NULL || len < 2 * sizeof(int))
100+ prop = of_find_property(bridge, "bus-range", &len);
101+ if (prop == NULL || prop->length < 2 * sizeof(int))
102102 return;
103+
104+ bus_range = (int *)prop->value;
103105 bus_range[1] = fixup_one_level_bus_range(bridge->child, bus_range[1]);
104106 }
105107
@@ -237,7 +239,7 @@ static struct pci_ops macrisc_pci_ops = · 131 unmodified lines
237239 static int chaos_validate_dev(struct pci_bus *bus, int devfn, int offset)
238240 {
239241 struct device_node *np;
240− u32 *vendor, *device;
242+ const u32 *vendor, *device;
241243
242244 if (offset >= 0x100)
243245 return PCIBIOS_BAD_REGISTER_NUMBER;
@@ -245,8 +247,8 @@ static int chaos_validate_dev(struct pci_bus *bus, int devfn, int offset) · 1 unmodified line
245247 if (np == NULL)
246248 return PCIBIOS_DEVICE_NOT_FOUND;
247249
248− vendor = (u32 *)get_property(np, "vendor-id", NULL);
249− device = (u32 *)get_property(np, "device-id", NULL);
250+ vendor = get_property(np, "vendor-id", NULL);
251+ device = get_property(np, "device-id", NULL);
250252 if (vendor == NULL || device == NULL)
251253 return PCIBIOS_DEVICE_NOT_FOUND;
252254
@@ -686,20 +688,21 @@ static void __init fixup_nec_usb2(void) · 433 unmodified lines
686688
687689 for (nec = NULL; (nec = of_find_node_by_name(nec, "usb")) != NULL;) {
688690 struct pci_controller *hose;
689− u32 data, *prop;
691+ u32 data;
692+ const u32 *prop;
690693 u8 bus, devfn;
691694
692− prop = (u32 *)get_property(nec, "vendor-id", NULL);
695+ prop = get_property(nec, "vendor-id", NULL);
693696 if (prop == NULL)
694697 continue;
695698 if (0x1033 != *prop)
696699 continue;
697− prop = (u32 *)get_property(nec, "device-id", NULL);
700+ prop = get_property(nec, "device-id", NULL);
698701 if (prop == NULL)
699702 continue;
700703 if (0x0035 != *prop)
701704 continue;
702− prop = (u32 *)get_property(nec, "reg", NULL);
705+ prop = get_property(nec, "reg", NULL);
703706 if (prop == NULL)
704707 continue;
705708 devfn = (prop[0] >> 8) & 0xff;
@@ -898,7 +901,7 @@ static int __init add_bridge(struct device_node *dev) · 192 unmodified lines
898901 struct pci_controller *hose;
899902 struct resource rsrc;
900903 char *disp_name;
901− int *bus_range;
904+ const int *bus_range;
902905 int primary = 1, has_address = 0;
903906
904907 DBG("Adding PCI host bridge %s\n", dev->full_name);
@@ -907,7 +910,7 @@ static int __init add_bridge(struct device_node *dev) · 2 unmodified lines
907910 has_address = (of_address_to_resource(dev, 0, &rsrc) == 0);
908911
909912 /* Get bus range if any */
910− bus_range = (int *) get_property(dev, "bus-range", &len);
913+ bus_range = get_property(dev, "bus-range", &len);
911914 if (bus_range == NULL || len < 2 * sizeof(int)) {
912915 printk(KERN_WARNING "Can't get bus-range for %s, assume"
913916 " bus 0\n", dev->full_name);
arch/powerpc/platforms/powermac/pfunc_base.c+1−1
@@ -114,7 +114,7 @@ static void macio_gpio_init_one(struct macio_chip *macio) · 113 unmodified lines
114114 * we just create them all
115115 */
116116 for (gp = NULL; (gp = of_get_next_child(gparent, gp)) != NULL;) {
117− u32 *reg = (u32 *)get_property(gp, "reg", NULL);
117+ const u32 *reg = get_property(gp, "reg", NULL);
118118 unsigned long offset;
119119 if (reg == NULL)
120120 continue;
arch/powerpc/platforms/powermac/pfunc_core.c+3−2
@@ -813,14 +813,15 @@ struct pmf_function *__pmf_find_function(struct device_node *target, · 812 unmodified lines
813813 struct pmf_device *dev;
814814 struct pmf_function *func, *result = NULL;
815815 char fname[64];
816− u32 *prop, ph;
816+ const u32 *prop;
817+ u32 ph;
817818
818819 /*
819820 * Look for a "platform-*" function reference. If we can't find
820821 * one, then we fallback to a direct call attempt
821822 */
822823 snprintf(fname, 63, "platform-%s", name);
823− prop = (u32 *)get_property(target, fname, NULL);
824+ prop = get_property(target, fname, NULL);
824825 if (prop == NULL)
825826 goto find_it;
826827 ph = *prop;
arch/powerpc/platforms/powermac/setup.c+8−10
@@ -116,7 +116,7 @@ extern struct smp_ops_t core99_smp_ops; · 115 unmodified lines
116116 static void pmac_show_cpuinfo(struct seq_file *m)
117117 {
118118 struct device_node *np;
119− char *pp;
119+ const char *pp;
120120 int plen;
121121 int mbmodel;
122122 unsigned int mbflags;
@@ -134,12 +134,12 @@ static void pmac_show_cpuinfo(struct seq_file *m) · 11 unmodified lines
134134 seq_printf(m, "machine\t\t: ");
135135 np = of_find_node_by_path("/");
136136 if (np != NULL) {
137− pp = (char *) get_property(np, "model", NULL);
137+ pp = get_property(np, "model", NULL);
138138 if (pp != NULL)
139139 seq_printf(m, "%s\n", pp);
140140 else
141141 seq_printf(m, "PowerMac\n");
142− pp = (char *) get_property(np, "compatible", &plen);
142+ pp = get_property(np, "compatible", &plen);
143143 if (pp != NULL) {
144144 seq_printf(m, "motherboard\t:");
145145 while (plen > 0) {
@@ -163,10 +163,8 @@ static void pmac_show_cpuinfo(struct seq_file *m) · 17 unmodified lines
163163 if (np == NULL)
164164 np = of_find_node_by_type(NULL, "cache");
165165 if (np != NULL) {
166− unsigned int *ic = (unsigned int *)
167− get_property(np, "i-cache-size", NULL);
168− unsigned int *dc = (unsigned int *)
169− get_property(np, "d-cache-size", NULL);
166+ const unsigned int *ic = get_property(np, "i-cache-size", NULL);
167+ const unsigned int *dc = get_property(np, "d-cache-size", NULL);
170168 seq_printf(m, "L2 cache\t:");
171169 has_l2cache = 1;
172170 if (get_property(np, "cache-unified", NULL) != 0 && dc) {
@@ -254,7 +252,7 @@ static void __init l2cr_init(void) · 81 unmodified lines
254252 if (np == 0)
255253 np = find_type_devices("cpu");
256254 if (np != 0) {
257− unsigned int *l2cr = (unsigned int *)
255+ const unsigned int *l2cr =
258256 get_property(np, "l2cr-value", NULL);
259257 if (l2cr != 0) {
260258 ppc_override_l2cr = 1;
@@ -277,7 +275,7 @@ static void __init l2cr_init(void) · 16 unmodified lines
277275 static void __init pmac_setup_arch(void)
278276 {
279277 struct device_node *cpu, *ic;
280− int *fp;
278+ const int *fp;
281279 unsigned long pvr;
282280
283281 pvr = PVR_VER(mfspr(SPRN_PVR));
@@ -287,7 +285,7 @@ static void __init pmac_setup_arch(void) · 3 unmodified lines
287285 loops_per_jiffy = 50000000 / HZ;
288286 cpu = of_find_node_by_type(NULL, "cpu");
289287 if (cpu != NULL) {
290− fp = (int *) get_property(cpu, "clock-frequency", NULL);
288+ fp = get_property(cpu, "clock-frequency", NULL);
291289 if (fp != NULL) {
292290 if (pvr >= 0x30 && pvr < 0x80)
293291 /* PPC970 etc. */
arch/powerpc/platforms/powermac/smp.c+3−4
@@ -548,7 +548,7 @@ static void __init smp_core99_setup_i2c_hwsync(int ncpus) · 547 unmodified lines
548548 struct device_node *cc = NULL;
549549 struct device_node *p;
550550 const char *name = NULL;
551− u32 *reg;
551+ const u32 *reg;
552552 int ok;
553553
554554 /* Look for the clock chip */
@@ -562,7 +562,7 @@ static void __init smp_core99_setup_i2c_hwsync(int ncpus) · 7 unmodified lines
562562 pmac_tb_clock_chip_host = pmac_i2c_find_bus(cc);
563563 if (pmac_tb_clock_chip_host == NULL)
564564 continue;
565− reg = (u32 *)get_property(cc, "reg", NULL);
565+ reg = get_property(cc, "reg", NULL);
566566 if (reg == NULL)
567567 continue;
568568 switch (*reg) {
@@ -707,8 +707,7 @@ static void __init smp_core99_setup(int ncpus) · 138 unmodified lines
707707 core99_tb_gpio = KL_GPIO_TB_ENABLE; /* default value */
708708 cpu = of_find_node_by_type(NULL, "cpu");
709709 if (cpu != NULL) {
710− tbprop = (u32 *)get_property(cpu, "timebase-enable",
711− NULL);
710+ tbprop = get_property(cpu, "timebase-enable", NULL);
712711 if (tbprop)
713712 core99_tb_gpio = *tbprop;
714713 of_node_put(cpu);
arch/powerpc/platforms/powermac/udbg_scc.c+5−5
@@ -68,11 +68,11 @@ static unsigned char scc_inittab[] = { · 67 unmodified lines
6868
6969 void udbg_scc_init(int force_scc)
7070 {
71− u32 *reg;
71+ const u32 *reg;
7272 unsigned long addr;
7373 struct device_node *stdout = NULL, *escc = NULL, *macio = NULL;
7474 struct device_node *ch, *ch_def = NULL, *ch_a = NULL;
75− char *path;
75+ const char *path;
7676 int i, x;
7777
7878 escc = of_find_node_by_name(NULL, "escc");
@@ -81,7 +81,7 @@ void udbg_scc_init(int force_scc) · 2 unmodified lines
8181 macio = of_get_parent(escc);
8282 if (macio == NULL)
8383 goto bail;
84− path = (char *)get_property(of_chosen, "linux,stdout-path", NULL);
84+ path = get_property(of_chosen, "linux,stdout-path", NULL);
8585 if (path != NULL)
8686 stdout = of_find_node_by_path(path);
8787 for (ch = NULL; (ch = of_get_next_child(escc, ch)) != NULL;) {
@@ -96,13 +96,13 @@ void udbg_scc_init(int force_scc) · 8 unmodified lines
9696 ch = ch_def ? ch_def : ch_a;
9797
9898 /* Get address within mac-io ASIC */
99− reg = (u32 *)get_property(escc, "reg", NULL);
99+ reg = get_property(escc, "reg", NULL);
100100 if (reg == NULL)
101101 goto bail;
102102 addr = reg[0];
103103
104104 /* Get address of mac-io PCI itself */
105− reg = (u32 *)get_property(macio, "assigned-addresses", NULL);
105+ reg = get_property(macio, "assigned-addresses", NULL);
106106 if (reg == NULL)
107107 goto bail;
108108 addr += reg[2];
arch/powerpc/platforms/pseries/Makefile+1−0
@@ -12,3 +12,4 @@ obj-$(CONFIG_EEH) += eeh.o eeh_cache.o eeh_driver.o eeh_event.o · 11 unmodified lines
1212
1313 obj-$(CONFIG_HVC_CONSOLE) += hvconsole.o
1414 obj-$(CONFIG_HVCS) += hvcserver.o
15+obj-$(CONFIG_HCALL_STATS) += hvCall_inst.o
arch/powerpc/platforms/pseries/eeh.c+73−23
@@ -449,7 +449,11 @@ EXPORT_SYMBOL(eeh_check_failure); · 448 unmodified lines
449449 /* ------------------------------------------------------------- */
450450 /* The code below deals with error recovery */
451451
452−/** Return negative value if a permanent error, else return
452+/**
453+ * eeh_slot_availability - returns error status of slot
454+ * @pdn pci device node
455+ *
456+ * Return negative value if a permanent error, else return
453457 * a number of milliseconds to wait until the PCI slot is
454458 * ready to be used.
455459 */
@@ -474,11 +478,42 @@ eeh_slot_availability(struct pci_dn *pdn) · 18 unmodified lines
474478
475479 printk (KERN_ERR "EEH: Slot unavailable: rc=%d, rets=%d %d %d\n",
476480 rc, rets[0], rets[1], rets[2]);
477− return -1;
481+ return -2;
482+}
483+
484+/**
485+ * rtas_pci_enable - enable MMIO or DMA transfers for this slot
486+ * @pdn pci device node
487+ */
488+
489+int
490+rtas_pci_enable(struct pci_dn *pdn, int function)
491+{
492+ int config_addr;
493+ int rc;
494+
495+ /* Use PE configuration address, if present */
496+ config_addr = pdn->eeh_config_addr;
497+ if (pdn->eeh_pe_config_addr)
498+ config_addr = pdn->eeh_pe_config_addr;
499+
500+ rc = rtas_call(ibm_set_eeh_option, 4, 1, NULL,
501+ config_addr,
502+ BUID_HI(pdn->phb->buid),
503+ BUID_LO(pdn->phb->buid),
504+ function);
505+
506+ if (rc)
507+ printk(KERN_WARNING "EEH: Cannot enable function %d, err=%d dn=%s\n",
508+ function, rc, pdn->node->full_name);
509+
510+ return rc;
478511 }
479512
480−/** rtas_pci_slot_reset raises/lowers the pci #RST line
481− * state: 1/0 to raise/lower the #RST
513+/**
514+ * rtas_pci_slot_reset - raises/lowers the pci #RST line
515+ * @pdn pci device node
516+ * @state: 1/0 to raise/lower the #RST
482517 *
483518 * Clear the EEH-frozen condition on a slot. This routine
484519 * asserts the PCI #RST line if the 'state' argument is '1',
@@ -511,24 +546,21 @@ rtas_pci_slot_reset(struct pci_dn *pdn, int state) · 26 unmodified lines
511546 BUID_HI(pdn->phb->buid),
512547 BUID_LO(pdn->phb->buid),
513548 state);
514− if (rc) {
515− printk (KERN_WARNING "EEH: Unable to reset the failed slot, (%d) #RST=%d dn=%s\n",
549+ if (rc)
550+ printk (KERN_WARNING "EEH: Unable to reset the failed slot,"
551+ " (%d) #RST=%d dn=%s\n",
516552 rc, state, pdn->node->full_name);
517− return;
518− }
519553 }
520554
521−/** rtas_set_slot_reset -- assert the pci #RST line for 1/4 second
522− * dn -- device node to be reset.
555+/**
556+ * rtas_set_slot_reset -- assert the pci #RST line for 1/4 second
557+ * @pdn: pci device node to be reset.
523558 *
524559 * Return 0 if success, else a non-zero value.
525560 */
526561
527−int
528−rtas_set_slot_reset(struct pci_dn *pdn)
562+static void __rtas_set_slot_reset(struct pci_dn *pdn)
529563 {
530− int i, rc;
531−
532564 rtas_pci_slot_reset (pdn, 1);
533565
534566 /* The PCI bus requires that the reset be held high for at least
@@ -549,17 +581,33 @@ rtas_set_slot_reset(struct pci_dn *pdn) · 14 unmodified lines
549581 * up traffic. */
550582 #define PCI_BUS_SETTLE_TIME_MSEC 1800
551583 msleep (PCI_BUS_SETTLE_TIME_MSEC);
584+}
585+
586+int rtas_set_slot_reset(struct pci_dn *pdn)
587+{
588+ int i, rc;
589+
590+ __rtas_set_slot_reset(pdn);
552591
553592 /* Now double check with the firmware to make sure the device is
554593 * ready to be used; if not, wait for recovery. */
555594 for (i=0; i<10; i++) {
556595 rc = eeh_slot_availability (pdn);
557− if (rc < 0)
558− printk (KERN_ERR "EEH: failed (%d) to reset slot %s\n", rc, pdn->node->full_name);
559596 if (rc == 0)
560597 return 0;
561− if (rc < 0)
598+
599+ if (rc == -2) {
600+ printk (KERN_ERR "EEH: failed (%d) to reset slot %s\n",
601+ i, pdn->node->full_name);
602+ __rtas_set_slot_reset(pdn);
603+ continue;
604+ }
605+
606+ if (rc < 0) {
607+ printk (KERN_ERR "EEH: unrecoverable slot failure %s\n",
608+ pdn->node->full_name);
562609 return -1;
610+ }
563611
564612 msleep (rc+100);
565613 }
@@ -582,6 +630,8 @@ rtas_set_slot_reset(struct pci_dn *pdn) · 16 unmodified lines
582630
583631 /**
584632 * __restore_bars - Restore the Base Address Registers
633+ * @pdn: pci device node
634+ *
585635 * Loads the PCI configuration space base address registers,
586636 * the expansion ROM base address, the latency timer, and etc.
587637 * from the saved values in the device node.
@@ -691,11 +741,11 @@ static void *early_enable_eeh(struct device_node *dn, void *data) · 103 unmodified lines
691741 {
692742 struct eeh_early_enable_info *info = data;
693743 int ret;
694− char *status = get_property(dn, "status", NULL);
695− u32 *class_code = (u32 *)get_property(dn, "class-code", NULL);
696− u32 *vendor_id = (u32 *)get_property(dn, "vendor-id", NULL);
697− u32 *device_id = (u32 *)get_property(dn, "device-id", NULL);
698− u32 *regs;
744+ const char *status = get_property(dn, "status", NULL);
745+ const u32 *class_code = get_property(dn, "class-code", NULL);
746+ const u32 *vendor_id = get_property(dn, "vendor-id", NULL);
747+ const u32 *device_id = get_property(dn, "device-id", NULL);
748+ const u32 *regs;
699749 int enable;
700750 struct pci_dn *pdn = PCI_DN(dn);
701751
@@ -737,7 +787,7 @@ static void *early_enable_eeh(struct device_node *dn, void *data) · 35 unmodified lines
737787
738788 /* Ok... see if this device supports EEH. Some do, some don't,
739789 * and the only way to find out is to check each and every one. */
740− regs = (u32 *)get_property(dn, "reg", NULL);
790+ regs = get_property(dn, "reg", NULL);
741791 if (regs) {
742792 /* First register entry is addr (00BBSS00) */
743793 /* Try to enable eeh */
arch/powerpc/platforms/pseries/eeh_cache.c+2−15
@@ -157,6 +157,7 @@ pci_addr_cache_insert(struct pci_dev *dev, unsigned long alo, · 156 unmodified lines
157157 if (!piar)
158158 return NULL;
159159
160+ pci_dev_get(dev);
160161 piar->addr_lo = alo;
161162 piar->addr_hi = ahi;
162163 piar->pcidev = dev;
@@ -178,7 +179,6 @@ static void __pci_addr_cache_insert_device(struct pci_dev *dev) · 15 unmodified lines
178179 struct device_node *dn;
179180 struct pci_dn *pdn;
180181 int i;
181− int inserted = 0;
182182
183183 dn = pci_device_to_OF_node(dev);
184184 if (!dn) {
@@ -197,9 +197,6 @@ static void __pci_addr_cache_insert_device(struct pci_dev *dev) · 12 unmodified lines
197197 return;
198198 }
199199
200− /* The cache holds a reference to the device... */
201− pci_dev_get(dev);
202−
203200 /* Walk resources on this device, poke them into the tree */
204201 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
205202 unsigned long start = pci_resource_start(dev,i);
@@ -212,12 +209,7 @@ static void __pci_addr_cache_insert_device(struct pci_dev *dev) · 6 unmodified lines
212209 if (start == 0 || ~start == 0 || end == 0 || ~end == 0)
213210 continue;
214211 pci_addr_cache_insert(dev, start, end, flags);
215− inserted = 1;
216212 }
217−
218− /* If there was nothing to add, the cache has no reference... */
219− if (!inserted)
220− pci_dev_put(dev);
221213 }
222214
223215 /**
@@ -240,7 +232,6 @@ void pci_addr_cache_insert_device(struct pci_dev *dev) · 16 unmodified lines
240232 static inline void __pci_addr_cache_remove_device(struct pci_dev *dev)
241233 {
242234 struct rb_node *n;
243− int removed = 0;
244235
245236 restart:
246237 n = rb_first(&pci_io_addr_cache_root.rb_root);
@@ -250,16 +241,12 @@ restart: · 3 unmodified lines
250241
251242 if (piar->pcidev == dev) {
252243 rb_erase(n, &pci_io_addr_cache_root.rb_root);
253− removed = 1;
244+ pci_dev_put(piar->pcidev);
254245 kfree(piar);
255246 goto restart;
256247 }
257248 n = rb_next(n);
258249 }
259−
260− /* The cache no longer holds its reference to this device... */
261− if (removed)
262− pci_dev_put(dev);
263250 }
264251
265252 /**
arch/powerpc/platforms/pseries/eeh_driver.c+87−25
@@ -77,8 +77,12 @@ static int irq_in_use(unsigned int irq) · 76 unmodified lines
7777 }
7878
7979 /* ------------------------------------------------------- */
80−/** eeh_report_error - report an EEH error to each device,
81− * collect up and merge the device responses.
80+/**
81+ * eeh_report_error - report pci error to each device driver
82+ *
83+ * Report an EEH error to each device driver, collect up and
84+ * merge the device driver responses. Cumulative response
85+ * passed back in "userdata".
8286 */
8387
8488 static void eeh_report_error(struct pci_dev *dev, void *userdata)
@@ -96,24 +100,49 @@ static void eeh_report_error(struct pci_dev *dev, void *userdata) · 11 unmodified lines
96100 PCI_DN(dn)->eeh_mode |= EEH_MODE_IRQ_DISABLED;
97101 disable_irq_nosync(dev->irq);
98102 }
99− if (!driver->err_handler)
100− return;
101− if (!driver->err_handler->error_detected)
103+ if (!driver->err_handler ||
104+ !driver->err_handler->error_detected)
102105 return;
103106
104107 rc = driver->err_handler->error_detected (dev, pci_channel_io_frozen);
105108 if (*res == PCI_ERS_RESULT_NONE) *res = rc;
106− if (*res == PCI_ERS_RESULT_NEED_RESET) return;
107109 if (*res == PCI_ERS_RESULT_DISCONNECT &&
108110 rc == PCI_ERS_RESULT_NEED_RESET) *res = rc;
109111 }
110112
111−/** eeh_report_reset -- tell this device that the pci slot
112− * has been reset.
113+/**
114+ * eeh_report_mmio_enabled - tell drivers that MMIO has been enabled
115+ *
116+ * Report an EEH error to each device driver, collect up and
117+ * merge the device driver responses. Cumulative response
118+ * passed back in "userdata".
119+ */
120+
121+static void eeh_report_mmio_enabled(struct pci_dev *dev, void *userdata)
122+{
123+ enum pci_ers_result rc, *res = userdata;
124+ struct pci_driver *driver = dev->driver;
125+
126+ // dev->error_state = pci_channel_mmio_enabled;
127+
128+ if (!driver ||
129+ !driver->err_handler ||
130+ !driver->err_handler->mmio_enabled)
131+ return;
132+
133+ rc = driver->err_handler->mmio_enabled (dev);
134+ if (*res == PCI_ERS_RESULT_NONE) *res = rc;
135+ if (*res == PCI_ERS_RESULT_DISCONNECT &&
136+ rc == PCI_ERS_RESULT_NEED_RESET) *res = rc;
137+}
138+
139+/**
140+ * eeh_report_reset - tell device that slot has been reset
113141 */
114142
115143 static void eeh_report_reset(struct pci_dev *dev, void *userdata)
116144 {
145+ enum pci_ers_result rc, *res = userdata;
117146 struct pci_driver *driver = dev->driver;
118147 struct device_node *dn = pci_device_to_OF_node(dev);
119148
@@ -124,14 +153,20 @@ static void eeh_report_reset(struct pci_dev *dev, void *userdata) · 4 unmodified lines
124153 PCI_DN(dn)->eeh_mode &= ~EEH_MODE_IRQ_DISABLED;
125154 enable_irq(dev->irq);
126155 }
127− if (!driver->err_handler)
128− return;
129− if (!driver->err_handler->slot_reset)
156+ if (!driver->err_handler ||
157+ !driver->err_handler->slot_reset)
130158 return;
131159
132− driver->err_handler->slot_reset(dev);
160+ rc = driver->err_handler->slot_reset(dev);
161+ if (*res == PCI_ERS_RESULT_NONE) *res = rc;
162+ if (*res == PCI_ERS_RESULT_DISCONNECT &&
163+ rc == PCI_ERS_RESULT_NEED_RESET) *res = rc;
133164 }
134165
166+/**
167+ * eeh_report_resume - tell device to resume normal operations
168+ */
169+
135170 static void eeh_report_resume(struct pci_dev *dev, void *userdata)
136171 {
137172 struct pci_driver *driver = dev->driver;
@@ -148,6 +183,13 @@ static void eeh_report_resume(struct pci_dev *dev, void *userdata) · 10 unmodified lines
148183 driver->err_handler->resume(dev);
149184 }
150185
186+/**
187+ * eeh_report_failure - tell device driver that device is dead.
188+ *
189+ * This informs the device driver that the device is permanently
190+ * dead, and that no further recovery attempts will be made on it.
191+ */
192+
151193 static void eeh_report_failure(struct pci_dev *dev, void *userdata)
152194 {
153195 struct pci_driver *driver = dev->driver;
@@ -190,11 +232,11 @@ static void eeh_report_failure(struct pci_dev *dev, void *userdata) · 36 unmodified lines
190232
191233 /**
192234 * eeh_reset_device() -- perform actual reset of a pci slot
193− * Args: bus: pointer to the pci bus structure corresponding
235+ * @bus: pointer to the pci bus structure corresponding
194236 * to the isolated slot. A non-null value will
195237 * cause all devices under the bus to be removed
196238 * and then re-added.
197− * pe_dn: pointer to a "Partionable Endpoint" device node.
239+ * @pe_dn: pointer to a "Partionable Endpoint" device node.
198240 * This is the top-level structure on which pci
199241 * bus resets can be performed.
200242 */
@@ -268,14 +310,14 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event) · 67 unmodified lines
268310
269311 if (!frozen_dn) {
270312
271− location = (char *) get_property(event->dn, "ibm,loc-code", NULL);
313+ location = get_property(event->dn, "ibm,loc-code", NULL);
272314 location = location ? location : "unknown";
273315 printk(KERN_ERR "EEH: Error: Cannot find partition endpoint "
274316 "for location=%s pci addr=%s\n",
275317 location, pci_name(event->dev));
276318 return NULL;
277319 }
278− location = (char *) get_property(frozen_dn, "ibm,loc-code", NULL);
320+ location = get_property(frozen_dn, "ibm,loc-code", NULL);
279321 location = location ? location : "unknown";
280322
281323 /* There are two different styles for coming up with the PE.
@@ -347,23 +389,43 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event) · 65 unmodified lines
347389 goto hard_fail;
348390 }
349391
350− /* If any device called out for a reset, then reset the slot */
351− if (result == PCI_ERS_RESULT_NEED_RESET) {
352− rc = eeh_reset_device(frozen_pdn, NULL);
353− if (rc)
354− goto hard_fail;
355− pci_walk_bus(frozen_bus, eeh_report_reset, NULL);
392+ /* If all devices reported they can proceed, then re-enable MMIO */
393+ if (result == PCI_ERS_RESULT_CAN_RECOVER) {
394+ rc = rtas_pci_enable(frozen_pdn, EEH_THAW_MMIO);
395+
396+ if (rc) {
397+ result = PCI_ERS_RESULT_NEED_RESET;
398+ } else {
399+ result = PCI_ERS_RESULT_NONE;
400+ pci_walk_bus(frozen_bus, eeh_report_mmio_enabled, &result);
401+ }
356402 }
357403
358− /* If all devices reported they can proceed, the re-enable PIO */
404+ /* If all devices reported they can proceed, then re-enable DMA */
359405 if (result == PCI_ERS_RESULT_CAN_RECOVER) {
360− /* XXX Not supported; we brute-force reset the device */
406+ rc = rtas_pci_enable(frozen_pdn, EEH_THAW_DMA);
407+
408+ if (rc)
409+ result = PCI_ERS_RESULT_NEED_RESET;
410+ }
411+
412+ /* If any device has a hard failure, then shut off everything. */
413+ if (result == PCI_ERS_RESULT_DISCONNECT)
414+ goto hard_fail;
415+
416+ /* If any device called out for a reset, then reset the slot */
417+ if (result == PCI_ERS_RESULT_NEED_RESET) {
361418 rc = eeh_reset_device(frozen_pdn, NULL);
362419 if (rc)
363420 goto hard_fail;
364− pci_walk_bus(frozen_bus, eeh_report_reset, NULL);
421+ result = PCI_ERS_RESULT_NONE;
422+ pci_walk_bus(frozen_bus, eeh_report_reset, &result);
365423 }
366424
425+ /* All devices should claim they have recovered by now. */
426+ if (result != PCI_ERS_RESULT_RECOVERED)
427+ goto hard_fail;
428+
367429 /* Tell all device drivers that they can resume operations */
368430 pci_walk_bus(frozen_bus, eeh_report_resume, NULL);
369431
arch/powerpc/platforms/pseries/eeh_event.c+2−2
@@ -124,11 +124,11 @@ int eeh_send_failure_event (struct device_node *dn, · 123 unmodified lines
124124 {
125125 unsigned long flags;
126126 struct eeh_event *event;
127− char *location;
127+ const char *location;
128128
129129 if (!mem_init_done) {
130130 printk(KERN_ERR "EEH: event during early boot not handled\n");
131− location = (char *) get_property(dn, "ibm,loc-code", NULL);
131+ location = get_property(dn, "ibm,loc-code", NULL);
132132 printk(KERN_ERR "EEH: device node = %s\n", dn->full_name);
133133 printk(KERN_ERR "EEH: PCI location = %s\n", location);
134134 return 1;
arch/powerpc/platforms/pseries/firmware.c+1−1
@@ -68,7 +68,7 @@ firmware_features_table[FIRMWARE_MAX_FEATURES] = { · 67 unmodified lines
6868 void __init fw_feature_init(void)
6969 {
7070 struct device_node *dn;
71− char *hypertas, *s;
71+ const char *hypertas, *s;
7272 int len, i;
7373
7474 DBG(" -> fw_feature_init()\n");
arch/powerpc/platforms/pseries/hvCall.S+104−169
@@ -1,7 +1,6 @@
11 /*
22 * This file contains the generic code to perform a call to the
33 * pSeries LPAR hypervisor.
4− * NOTE: this file will go away when we move to inline this work.
54 *
65 * This program is free software; you can redistribute it and/or
76 * modify it under the terms of the GNU General Public License
@@ -11,217 +10,153 @@ · 3 unmodified lines
1110 #include <asm/hvcall.h>
1211 #include <asm/processor.h>
1312 #include <asm/ppc_asm.h>
13+#include <asm/asm-offsets.h>
1414
1515 #define STK_PARM(i) (48 + ((i)-3)*8)
1616
17− .text
18−
19−/* long plpar_hcall(unsigned long opcode, R3
20− unsigned long arg1, R4
21− unsigned long arg2, R5
22− unsigned long arg3, R6
23− unsigned long arg4, R7
24− unsigned long *out1, R8
25− unsigned long *out2, R9
26− unsigned long *out3); R10
17+#ifdef CONFIG_HCALL_STATS
18+/*
19+ * precall must preserve all registers. use unused STK_PARM()
20+ * areas to save snapshots and opcode.
2721 */
28−_GLOBAL(plpar_hcall)
29− HMT_MEDIUM
30−
31− mfcr r0
32−
33− std r8,STK_PARM(r8)(r1) /* Save out ptrs */
34− std r9,STK_PARM(r9)(r1)
35− std r10,STK_PARM(r10)(r1)
36−
37− stw r0,8(r1)
38−
39− HVSC /* invoke the hypervisor */
40−
41− lwz r0,8(r1)
42−
43− ld r8,STK_PARM(r8)(r1) /* Fetch r4-r6 ret args */
44− ld r9,STK_PARM(r9)(r1)
45− ld r10,STK_PARM(r10)(r1)
46− std r4,0(r8)
47− std r5,0(r9)
48− std r6,0(r10)
49−
50− mtcrf 0xff,r0
51− blr /* return r3 = status */
22+#define HCALL_INST_PRECALL \
23+ std r3,STK_PARM(r3)(r1); /* save opcode */ \
24+ mftb r0; /* get timebase and */ \
25+ std r0,STK_PARM(r5)(r1); /* save for later */ \
26+BEGIN_FTR_SECTION; \
27+ mfspr r0,SPRN_PURR; /* get PURR and */ \
28+ std r0,STK_PARM(r6)(r1); /* save for later */ \
29+END_FTR_SECTION_IFCLR(CPU_FTR_PURR);
30+
31+/*
32+ * postcall is performed immediately before function return which
33+ * allows liberal use of volatile registers.
34+ */
35+#define HCALL_INST_POSTCALL \
36+ ld r4,STK_PARM(r3)(r1); /* validate opcode */ \
37+ cmpldi cr7,r4,MAX_HCALL_OPCODE; \
38+ bgt- cr7,1f; \
39+ \
40+ /* get time and PURR snapshots after hcall */ \
41+ mftb r7; /* timebase after */ \
42+BEGIN_FTR_SECTION; \
43+ mfspr r8,SPRN_PURR; /* PURR after */ \
44+ ld r6,STK_PARM(r6)(r1); /* PURR before */ \
45+ subf r6,r6,r8; /* delta */ \
46+END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \
47+ ld r5,STK_PARM(r5)(r1); /* timebase before */ \
48+ subf r5,r5,r7; /* time delta */ \
49+ \
50+ /* calculate address of stat structure r4 = opcode */ \
51+ srdi r4,r4,2; /* index into array */ \
52+ mulli r4,r4,HCALL_STAT_SIZE; \
53+ LOAD_REG_ADDR(r7, per_cpu__hcall_stats); \
54+ add r4,r4,r7; \
55+ ld r7,PACA_DATA_OFFSET(r13); /* per cpu offset */ \
56+ add r4,r4,r7; \
57+ \
58+ /* update stats */ \
59+ ld r7,HCALL_STAT_CALLS(r4); /* count */ \
60+ addi r7,r7,1; \
61+ std r7,HCALL_STAT_CALLS(r4); \
62+ ld r7,HCALL_STAT_TB(r4); /* timebase */ \
63+ add r7,r7,r5; \
64+ std r7,HCALL_STAT_TB(r4); \
65+BEGIN_FTR_SECTION; \
66+ ld r7,HCALL_STAT_PURR(r4); /* PURR */ \
67+ add r7,r7,r6; \
68+ std r7,HCALL_STAT_PURR(r4); \
69+END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \
70+1:
71+#else
72+#define HCALL_INST_PRECALL
73+#define HCALL_INST_POSTCALL
74+#endif
5275
76+ .text
5377
54−/* Simple interface with no output values (other than status) */
5578 _GLOBAL(plpar_hcall_norets)
5679 HMT_MEDIUM
5780
5881 mfcr r0
5982 stw r0,8(r1)
6083
61− HVSC /* invoke the hypervisor */
62−
63− lwz r0,8(r1)
64− mtcrf 0xff,r0
65− blr /* return r3 = status */
66−
67−
68−/* long plpar_hcall_8arg_2ret(unsigned long opcode, R3
69− unsigned long arg1, R4
70− unsigned long arg2, R5
71− unsigned long arg3, R6
72− unsigned long arg4, R7
73− unsigned long arg5, R8
74− unsigned long arg6, R9
75− unsigned long arg7, R10
76− unsigned long arg8, 112(R1)
77− unsigned long *out1); 120(R1)
78− */
79−_GLOBAL(plpar_hcall_8arg_2ret)
80− HMT_MEDIUM
81−
82− mfcr r0
83− ld r11,STK_PARM(r11)(r1) /* put arg8 in R11 */
84− stw r0,8(r1)
84+ HCALL_INST_PRECALL
8585
8686 HVSC /* invoke the hypervisor */
8787
88+ HCALL_INST_POSTCALL
89+
8890 lwz r0,8(r1)
89− ld r10,STK_PARM(r12)(r1) /* Fetch r4 ret arg */
90− std r4,0(r10)
9191 mtcrf 0xff,r0
9292 blr /* return r3 = status */
9393
94−
95−/* long plpar_hcall_4out(unsigned long opcode, R3
96− unsigned long arg1, R4
97− unsigned long arg2, R5
98− unsigned long arg3, R6
99− unsigned long arg4, R7
100− unsigned long *out1, R8
101− unsigned long *out2, R9
102− unsigned long *out3, R10
103− unsigned long *out4); 112(R1)
104− */
105−_GLOBAL(plpar_hcall_4out)
94+_GLOBAL(plpar_hcall)
10695 HMT_MEDIUM
10796
10897 mfcr r0
10998 stw r0,8(r1)
11099
111− std r8,STK_PARM(r8)(r1) /* Save out ptrs */
112− std r9,STK_PARM(r9)(r1)
113− std r10,STK_PARM(r10)(r1)
114−
115− HVSC /* invoke the hypervisor */
116−
117− lwz r0,8(r1)
100+ HCALL_INST_PRECALL
118101
119− ld r8,STK_PARM(r8)(r1) /* Fetch r4-r7 ret args */
120− ld r9,STK_PARM(r9)(r1)
121− ld r10,STK_PARM(r10)(r1)
122− ld r11,STK_PARM(r11)(r1)
123− std r4,0(r8)
124− std r5,0(r9)
125− std r6,0(r10)
126− std r7,0(r11)
102+ std r4,STK_PARM(r4)(r1) /* Save ret buffer */
127103
128− mtcrf 0xff,r0
129− blr /* return r3 = status */
130−
131−/* plpar_hcall_7arg_7ret(unsigned long opcode, R3
132− unsigned long arg1, R4
133− unsigned long arg2, R5
134− unsigned long arg3, R6
135− unsigned long arg4, R7
136− unsigned long arg5, R8
137− unsigned long arg6, R9
138− unsigned long arg7, R10
139− unsigned long *out1, 112(R1)
140− unsigned long *out2, 110(R1)
141− unsigned long *out3, 108(R1)
142− unsigned long *out4, 106(R1)
143− unsigned long *out5, 104(R1)
144− unsigned long *out6, 102(R1)
145− unsigned long *out7); 100(R1)
146−*/
147−_GLOBAL(plpar_hcall_7arg_7ret)
148− HMT_MEDIUM
149−
150− mfcr r0
151− stw r0,8(r1)
104+ mr r4,r5
105+ mr r5,r6
106+ mr r6,r7
107+ mr r7,r8
108+ mr r8,r9
109+ mr r9,r10
152110
153111 HVSC /* invoke the hypervisor */
154112
155− lwz r0,8(r1)
113+ ld r12,STK_PARM(r4)(r1)
114+ std r4, 0(r12)
115+ std r5, 8(r12)
116+ std r6, 16(r12)
117+ std r7, 24(r12)
156118
157− ld r11,STK_PARM(r11)(r1) /* Fetch r4 ret arg */
158− std r4,0(r11)
159− ld r11,STK_PARM(r12)(r1) /* Fetch r5 ret arg */
160− std r5,0(r11)
161− ld r11,STK_PARM(r13)(r1) /* Fetch r6 ret arg */
162− std r6,0(r11)
163− ld r11,STK_PARM(r14)(r1) /* Fetch r7 ret arg */
164− std r7,0(r11)
165− ld r11,STK_PARM(r15)(r1) /* Fetch r8 ret arg */
166− std r8,0(r11)
167− ld r11,STK_PARM(r16)(r1) /* Fetch r9 ret arg */
168− std r9,0(r11)
169− ld r11,STK_PARM(r17)(r1) /* Fetch r10 ret arg */
170− std r10,0(r11)
119+ HCALL_INST_POSTCALL
171120
121+ lwz r0,8(r1)
172122 mtcrf 0xff,r0
173123
174124 blr /* return r3 = status */
175125
176−/* plpar_hcall_9arg_9ret(unsigned long opcode, R3
177− unsigned long arg1, R4
178− unsigned long arg2, R5
179− unsigned long arg3, R6
180− unsigned long arg4, R7
181− unsigned long arg5, R8
182− unsigned long arg6, R9
183− unsigned long arg7, R10
184− unsigned long arg8, 112(R1)
185− unsigned long arg9, 110(R1)
186− unsigned long *out1, 108(R1)
187− unsigned long *out2, 106(R1)
188− unsigned long *out3, 104(R1)
189− unsigned long *out4, 102(R1)
190− unsigned long *out5, 100(R1)
191− unsigned long *out6, 98(R1)
192− unsigned long *out7); 96(R1)
193− unsigned long *out8, 94(R1)
194− unsigned long *out9, 92(R1)
195−*/
196−_GLOBAL(plpar_hcall_9arg_9ret)
126+_GLOBAL(plpar_hcall9)
197127 HMT_MEDIUM
198128
199129 mfcr r0
200130 stw r0,8(r1)
201131
202− ld r11,STK_PARM(r11)(r1) /* put arg8 in R11 */
203− ld r12,STK_PARM(r12)(r1) /* put arg9 in R12 */
132+ HCALL_INST_PRECALL
133+
134+ std r4,STK_PARM(r4)(r1) /* Save ret buffer */
135+
136+ mr r4,r5
137+ mr r5,r6
138+ mr r6,r7
139+ mr r7,r8
140+ mr r8,r9
141+ mr r9,r10
142+ ld r10,STK_PARM(r11)(r1) /* put arg7 in R10 */
143+ ld r11,STK_PARM(r12)(r1) /* put arg8 in R11 */
144+ ld r12,STK_PARM(r13)(r1) /* put arg9 in R12 */
204145
205146 HVSC /* invoke the hypervisor */
206147
207− ld r0,STK_PARM(r13)(r1) /* Fetch r4 ret arg */
208− stdx r4,r0,r0
209− ld r0,STK_PARM(r14)(r1) /* Fetch r5 ret arg */
210− stdx r5,r0,r0
211− ld r0,STK_PARM(r15)(r1) /* Fetch r6 ret arg */
212− stdx r6,r0,r0
213− ld r0,STK_PARM(r16)(r1) /* Fetch r7 ret arg */
214− stdx r7,r0,r0
215− ld r0,STK_PARM(r17)(r1) /* Fetch r8 ret arg */
216− stdx r8,r0,r0
217− ld r0,STK_PARM(r18)(r1) /* Fetch r9 ret arg */
218− stdx r9,r0,r0
219− ld r0,STK_PARM(r19)(r1) /* Fetch r10 ret arg */
220− stdx r10,r0,r0
221− ld r0,STK_PARM(r20)(r1) /* Fetch r11 ret arg */
222− stdx r11,r0,r0
223− ld r0,STK_PARM(r21)(r1) /* Fetch r12 ret arg */
224− stdx r12,r0,r0
148+ ld r12,STK_PARM(r4)(r1)
149+ std r4, 0(r12)
150+ std r5, 8(r12)
151+ std r6, 16(r12)
152+ std r7, 24(r12)
153+ std r8, 32(r12)
154+ std r9, 40(r12)
155+ std r10,48(r12)
156+ std r11,56(r12)
157+ std r12,64(r12)
158+
159+ HCALL_INST_POSTCALL
225160
226161 lwz r0,8(r1)
227162 mtcrf 0xff,r0
arch/powerpc/platforms/pseries/hvCall_inst.c+129−0
@@ -0,0 +1,129 @@
1+/*
2+ * Copyright (C) 2006 Mike Kravetz IBM Corporation
3+ *
4+ * Hypervisor Call Instrumentation
5+ *
6+ * This program is free software; you can redistribute it and/or modify
7+ * it under the terms of the GNU General Public License as published by
8+ * the Free Software Foundation; either version 2 of the License, or
9+ * (at your option) any later version.
10+ *
11+ * This program is distributed in the hope that it will be useful,
12+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+ * GNU General Public License for more details.
15+ *
16+ * You should have received a copy of the GNU General Public License
17+ * along with this program; if not, write to the Free Software
18+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19+ */
20+
21+#include <linux/kernel.h>
22+#include <linux/percpu.h>
23+#include <linux/debugfs.h>
24+#include <linux/seq_file.h>
25+#include <linux/cpumask.h>
26+#include <asm/hvcall.h>
27+#include <asm/firmware.h>
28+#include <asm/cputable.h>
29+
30+DEFINE_PER_CPU(struct hcall_stats[HCALL_STAT_ARRAY_SIZE], hcall_stats);
31+
32+/*
33+ * Routines for displaying the statistics in debugfs
34+ */
35+static void *hc_start(struct seq_file *m, loff_t *pos)
36+{
37+ if ((int)*pos < HCALL_STAT_ARRAY_SIZE)
38+ return (void *)(unsigned long)(*pos + 1);
39+
40+ return NULL;
41+}
42+
43+static void *hc_next(struct seq_file *m, void *p, loff_t * pos)
44+{
45+ ++*pos;
46+
47+ return hc_start(m, pos);
48+}
49+
50+static void hc_stop(struct seq_file *m, void *p)
51+{
52+}
53+
54+static int hc_show(struct seq_file *m, void *p)
55+{
56+ unsigned long h_num = (unsigned long)p;
57+ struct hcall_stats *hs = (struct hcall_stats *)m->private;
58+
59+ if (hs[h_num].num_calls) {
60+ if (!cpu_has_feature(CPU_FTR_PURR))
61+ seq_printf(m, "%lu %lu %lu %lu\n", h_num<<2,
62+ hs[h_num].num_calls,
63+ hs[h_num].tb_total,
64+ hs[h_num].purr_total);
65+ else
66+ seq_printf(m, "%lu %lu %lu\n", h_num<<2,
67+ hs[h_num].num_calls,
68+ hs[h_num].tb_total);
69+ }
70+
71+ return 0;
72+}
73+
74+static struct seq_operations hcall_inst_seq_ops = {
75+ .start = hc_start,
76+ .next = hc_next,
77+ .stop = hc_stop,
78+ .show = hc_show
79+};
80+
81+static int hcall_inst_seq_open(struct inode *inode, struct file *file)
82+{
83+ int rc;
84+ struct seq_file *seq;
85+
86+ rc = seq_open(file, &hcall_inst_seq_ops);
87+ seq = file->private_data;
88+ seq->private = file->f_dentry->d_inode->u.generic_ip;
89+
90+ return rc;
91+}
92+
93+static struct file_operations hcall_inst_seq_fops = {
94+ .open = hcall_inst_seq_open,
95+ .read = seq_read,
96+ .llseek = seq_lseek,
97+ .release = seq_release,
98+};
99+
100+#define HCALL_ROOT_DIR "hcall_inst"
101+#define CPU_NAME_BUF_SIZE 32
102+
103+static int __init hcall_inst_init(void)
104+{
105+ struct dentry *hcall_root;
106+ struct dentry *hcall_file;
107+ char cpu_name_buf[CPU_NAME_BUF_SIZE];
108+ int cpu;
109+
110+ if (!firmware_has_feature(FW_FEATURE_LPAR))
111+ return 0;
112+
113+ hcall_root = debugfs_create_dir(HCALL_ROOT_DIR, NULL);
114+ if (!hcall_root)
115+ return -ENOMEM;
116+
117+ for_each_possible_cpu(cpu) {
118+ snprintf(cpu_name_buf, CPU_NAME_BUF_SIZE, "cpu%d", cpu);
119+ hcall_file = debugfs_create_file(cpu_name_buf, S_IRUGO,
120+ hcall_root,
121+ per_cpu(hcall_stats, cpu),
122+ &hcall_inst_seq_fops);
123+ if (!hcall_file)
124+ return -ENOMEM;
125+ }
126+
127+ return 0;
128+}
129+__initcall(hcall_inst_init);
arch/powerpc/platforms/pseries/hvconsole.c+3−2
@@ -27,6 +27,7 @@ · 26 unmodified lines
2727 #include <linux/module.h>
2828 #include <asm/hvcall.h>
2929 #include <asm/hvconsole.h>
30+#include "plpar_wrappers.h"
3031
3132 /**
3233 * hvc_get_chars - retrieve characters from firmware for denoted vterm adatper
@@ -40,9 +41,9 @@ int hvc_get_chars(uint32_t vtermno, char *buf, int count) · 7 unmodified lines
4041 {
4142 unsigned long got;
4243
43− if (plpar_hcall(H_GET_TERM_CHAR, vtermno, 0, 0, 0, &got,
44− (unsigned long *)buf, (unsigned long *)buf+1) == H_SUCCESS)
44+ if (plpar_get_term_char(vtermno, &got, buf) == H_SUCCESS)
4545 return got;
46+
4647 return 0;
4748 }
4849
arch/powerpc/platforms/pseries/iommu.c+6−7
@@ -267,13 +267,12 @@ static void iommu_table_setparms(struct pci_controller *phb, · 266 unmodified lines
267267 struct iommu_table *tbl)
268268 {
269269 struct device_node *node;
270− unsigned long *basep;
271− unsigned int *sizep;
270+ const unsigned long *basep, *sizep;
272271
273272 node = (struct device_node *)phb->arch_data;
274273
275− basep = (unsigned long *)get_property(node, "linux,tce-base", NULL);
276− sizep = (unsigned int *)get_property(node, "linux,tce-size", NULL);
274+ basep = get_property(node, "linux,tce-base", NULL);
275+ sizep = get_property(node, "linux,tce-size", NULL);
277276 if (basep == NULL || sizep == NULL) {
278277 printk(KERN_ERR "PCI_DMA: iommu_table_setparms: %s has "
279278 "missing tce entries !\n", dn->full_name);
@@ -315,7 +314,7 @@ static void iommu_table_setparms(struct pci_controller *phb, · 35 unmodified lines
315314 static void iommu_table_setparms_lpar(struct pci_controller *phb,
316315 struct device_node *dn,
317316 struct iommu_table *tbl,
318− unsigned char *dma_window)
317+ const void *dma_window)
319318 {
320319 unsigned long offset, size;
321320
@@ -415,7 +414,7 @@ static void iommu_bus_setup_pSeriesLP(struct pci_bus *bus) · 93 unmodified lines
415414 struct iommu_table *tbl;
416415 struct device_node *dn, *pdn;
417416 struct pci_dn *ppci;
418− unsigned char *dma_window = NULL;
417+ const void *dma_window = NULL;
419418
420419 DBG("iommu_bus_setup_pSeriesLP, bus %p, bus->self %p\n", bus, bus->self);
421420
@@ -519,7 +518,7 @@ static void iommu_dev_setup_pSeriesLP(struct pci_dev *dev) · 97 unmodified lines
519518 {
520519 struct device_node *pdn, *dn;
521520 struct iommu_table *tbl;
522− unsigned char *dma_window = NULL;
521+ const void *dma_window = NULL;
523522 struct pci_dn *pci;
524523
525524 DBG("iommu_dev_setup_pSeriesLP, dev %p (%s)\n", dev, pci_name(dev));
arch/powerpc/platforms/pseries/lpar.c+29−17
@@ -48,13 +48,11 @@ · 47 unmodified lines
4848 #define DBG_LOW(fmt...) do { } while(0)
4949 #endif
5050
51−/* in pSeries_hvCall.S */
51+/* in hvCall.S */
5252 EXPORT_SYMBOL(plpar_hcall);
53−EXPORT_SYMBOL(plpar_hcall_4out);
53+EXPORT_SYMBOL(plpar_hcall9);
5454 EXPORT_SYMBOL(plpar_hcall_norets);
55−EXPORT_SYMBOL(plpar_hcall_8arg_2ret);
56−EXPORT_SYMBOL(plpar_hcall_7arg_7ret);
57−EXPORT_SYMBOL(plpar_hcall_9arg_9ret);
55+
5856 extern void pSeries_find_serial_port(void);
5957
6058
@@ -204,20 +202,20 @@ void __init udbg_init_debug_lpar(void) · 143 unmodified lines
204202 void __init find_udbg_vterm(void)
205203 {
206204 struct device_node *stdout_node;
207− u32 *termno;
208− char *name;
205+ const u32 *termno;
206+ const char *name;
209207 int add_console;
210208
211209 /* find the boot console from /chosen/stdout */
212210 if (!of_chosen)
213211 return;
214− name = (char *)get_property(of_chosen, "linux,stdout-path", NULL);
212+ name = get_property(of_chosen, "linux,stdout-path", NULL);
215213 if (name == NULL)
216214 return;
217215 stdout_node = of_find_node_by_path(name);
218216 if (!stdout_node)
219217 return;
220− name = (char *)get_property(stdout_node, "name", NULL);
218+ name = get_property(stdout_node, "name", NULL);
221219 if (!name) {
222220 printk(KERN_WARNING "stdout node missing 'name' property!\n");
223221 goto out;
@@ -228,7 +226,7 @@ void __init find_udbg_vterm(void) · 4 unmodified lines
228226 /* Check if it's a virtual terminal */
229227 if (strncmp(name, "vty", 3) != 0)
230228 goto out;
231− termno = (u32 *)get_property(stdout_node, "reg", NULL);
229+ termno = get_property(stdout_node, "reg", NULL);
232230 if (termno == NULL)
233231 goto out;
234232 vtermno = termno[0];
@@ -254,18 +252,34 @@ out: · 19 unmodified lines
254252 void vpa_init(int cpu)
255253 {
256254 int hwcpu = get_hard_smp_processor_id(cpu);
257− unsigned long vpa = __pa(&lppaca[cpu]);
255+ unsigned long addr;
258256 long ret;
259257
260258 if (cpu_has_feature(CPU_FTR_ALTIVEC))
261259 lppaca[cpu].vmxregs_in_use = 1;
262260
263− ret = register_vpa(hwcpu, vpa);
261+ addr = __pa(&lppaca[cpu]);
262+ ret = register_vpa(hwcpu, addr);
264263
265− if (ret)
264+ if (ret) {
266265 printk(KERN_ERR "WARNING: vpa_init: VPA registration for "
267266 "cpu %d (hw %d) of area %lx returns %ld\n",
268− cpu, hwcpu, vpa, ret);
267+ cpu, hwcpu, addr, ret);
268+ return;
269+ }
270+ /*
271+ * PAPR says this feature is SLB-Buffer but firmware never
272+ * reports that. All SPLPAR support SLB shadow buffer.
273+ */
274+ addr = __pa(&slb_shadow[cpu]);
275+ if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
276+ ret = register_slb_shadow(hwcpu, addr);
277+ if (ret)
278+ printk(KERN_ERR
279+ "WARNING: vpa_init: SLB shadow buffer "
280+ "registration for cpu %d (hw %d) of area %lx "
281+ "returns %ld\n", cpu, hwcpu, addr, ret);
282+ }
269283 }
270284
271285 long pSeries_lpar_hpte_insert(unsigned long hpte_group,
@@ -277,7 +291,6 @@ long pSeries_lpar_hpte_insert(unsigned long hpte_group, · 5 unmodified lines
277291 unsigned long flags;
278292 unsigned long slot;
279293 unsigned long hpte_v, hpte_r;
280− unsigned long dummy0, dummy1;
281294
282295 if (!(vflags & HPTE_V_BOLTED))
283296 DBG_LOW("hpte_insert(group=%lx, va=%016lx, pa=%016lx, "
@@ -302,8 +315,7 @@ long pSeries_lpar_hpte_insert(unsigned long hpte_group, · 18 unmodified lines
302315 if (rflags & (_PAGE_GUARDED|_PAGE_NO_CACHE))
303316 hpte_r &= ~_PAGE_COHERENT;
304317
305− lpar_rc = plpar_hcall(H_ENTER, flags, hpte_group, hpte_v,
306− hpte_r, &slot, &dummy0, &dummy1);
318+ lpar_rc = plpar_pte_enter(flags, hpte_group, hpte_v, hpte_r, &slot);
307319 if (unlikely(lpar_rc == H_PTEG_FULL)) {
308320 if (!(vflags & HPTE_V_BOLTED))
309321 DBG_LOW(" full\n");
arch/powerpc/platforms/pseries/nvram.c+3−2
@@ -123,13 +123,14 @@ static ssize_t pSeries_nvram_get_size(void) · 122 unmodified lines
123123 int __init pSeries_nvram_init(void)
124124 {
125125 struct device_node *nvram;
126− unsigned int *nbytes_p, proplen;
126+ const unsigned int *nbytes_p;
127+ unsigned int proplen;
127128
128129 nvram = of_find_node_by_type(NULL, "nvram");
129130 if (nvram == NULL)
130131 return -ENODEV;
131132
132− nbytes_p = (unsigned int *)get_property(nvram, "#bytes", &proplen);
133+ nbytes_p = get_property(nvram, "#bytes", &proplen);
133134 if (nbytes_p == NULL || proplen != sizeof(unsigned int))
134135 return -EIO;
135136
arch/powerpc/platforms/pseries/pci.c+1−1
@@ -60,7 +60,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pcibios_name_device); · 59 unmodified lines
6060 static void __devinit check_s7a(void)
6161 {
6262 struct device_node *root;
63− char *model;
63+ const char *model;
6464
6565 s7a_workaround = 0;
6666 root = of_find_node_by_path("/");
arch/powerpc/platforms/pseries/plpar_wrappers.h+90−17
@@ -5,20 +5,17 @@ · 4 unmodified lines
55
66 static inline long poll_pending(void)
77 {
8− unsigned long dummy;
9− return plpar_hcall(H_POLL_PENDING, 0, 0, 0, 0, &dummy, &dummy, &dummy);
8+ return plpar_hcall_norets(H_POLL_PENDING);
109 }
1110
1211 static inline long prod_processor(void)
1312 {
14− plpar_hcall_norets(H_PROD);
15− return 0;
13+ return plpar_hcall_norets(H_PROD);
1614 }
1715
1816 static inline long cede_processor(void)
1917 {
20− plpar_hcall_norets(H_CEDE);
21− return 0;
18+ return plpar_hcall_norets(H_CEDE);
2219 }
2320
2421 static inline long vpa_call(unsigned long flags, unsigned long cpu,
@@ -40,23 +37,59 @@ static inline long register_vpa(unsigned long cpu, unsigned long vpa) · 15 unmodified lines
4037 return vpa_call(0x1, cpu, vpa);
4138 }
4239
40+static inline long unregister_slb_shadow(unsigned long cpu, unsigned long vpa)
41+{
42+ return vpa_call(0x7, cpu, vpa);
43+}
44+
45+static inline long register_slb_shadow(unsigned long cpu, unsigned long vpa)
46+{
47+ return vpa_call(0x3, cpu, vpa);
48+}
49+
4350 extern void vpa_init(int cpu);
4451
52+static inline long plpar_pte_enter(unsigned long flags,
53+ unsigned long hpte_group, unsigned long hpte_v,
54+ unsigned long hpte_r, unsigned long *slot)
55+{
56+ long rc;
57+ unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
58+
59+ rc = plpar_hcall(H_ENTER, retbuf, flags, hpte_group, hpte_v, hpte_r);
60+
61+ *slot = retbuf[0];
62+
63+ return rc;
64+}
65+
4566 static inline long plpar_pte_remove(unsigned long flags, unsigned long ptex,
4667 unsigned long avpn, unsigned long *old_pteh_ret,
4768 unsigned long *old_ptel_ret)
4869 {
49− unsigned long dummy;
50− return plpar_hcall(H_REMOVE, flags, ptex, avpn, 0, old_pteh_ret,
51− old_ptel_ret, &dummy);
70+ long rc;
71+ unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
72+
73+ rc = plpar_hcall(H_REMOVE, retbuf, flags, ptex, avpn);
74+
75+ *old_pteh_ret = retbuf[0];
76+ *old_ptel_ret = retbuf[1];
77+
78+ return rc;
5279 }
5380
5481 static inline long plpar_pte_read(unsigned long flags, unsigned long ptex,
5582 unsigned long *old_pteh_ret, unsigned long *old_ptel_ret)
5683 {
57− unsigned long dummy;
58− return plpar_hcall(H_READ, flags, ptex, 0, 0, old_pteh_ret,
59− old_ptel_ret, &dummy);
84+ long rc;
85+ unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
86+
87+ rc = plpar_hcall(H_READ, retbuf, flags, ptex);
88+
89+ *old_pteh_ret = retbuf[0];
90+ *old_ptel_ret = retbuf[1];
91+
92+ return rc;
6093 }
6194
6295 static inline long plpar_pte_protect(unsigned long flags, unsigned long ptex,
@@ -68,9 +101,14 @@ static inline long plpar_pte_protect(unsigned long flags, unsigned long ptex, · 5 unmodified lines
68101 static inline long plpar_tce_get(unsigned long liobn, unsigned long ioba,
69102 unsigned long *tce_ret)
70103 {
71− unsigned long dummy;
72− return plpar_hcall(H_GET_TCE, liobn, ioba, 0, 0, tce_ret, &dummy,
73− &dummy);
104+ long rc;
105+ unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
106+
107+ rc = plpar_hcall(H_GET_TCE, retbuf, liobn, ioba);
108+
109+ *tce_ret = retbuf[0];
110+
111+ return rc;
74112 }
75113
76114 static inline long plpar_tce_put(unsigned long liobn, unsigned long ioba,
@@ -94,9 +132,17 @@ static inline long plpar_tce_stuff(unsigned long liobn, unsigned long ioba, · 17 unmodified lines
94132 static inline long plpar_get_term_char(unsigned long termno,
95133 unsigned long *len_ret, char *buf_ret)
96134 {
135+ long rc;
136+ unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
97137 unsigned long *lbuf = (unsigned long *)buf_ret; /* TODO: alignment? */
98− return plpar_hcall(H_GET_TERM_CHAR, termno, 0, 0, 0, len_ret,
99− lbuf + 0, lbuf + 1);
138+
139+ rc = plpar_hcall(H_GET_TERM_CHAR, retbuf, termno);
140+
141+ *len_ret = retbuf[0];
142+ lbuf[0] = retbuf[1];
143+ lbuf[1] = retbuf[2];
144+
145+ return rc;
100146 }
101147
102148 static inline long plpar_put_term_char(unsigned long termno, unsigned long len,
@@ -107,4 +153,31 @@ static inline long plpar_put_term_char(unsigned long termno, unsigned long len, · 4 unmodified lines
107153 lbuf[1]);
108154 }
109155
156+static inline long plpar_eoi(unsigned long xirr)
157+{
158+ return plpar_hcall_norets(H_EOI, xirr);
159+}
160+
161+static inline long plpar_cppr(unsigned long cppr)
162+{
163+ return plpar_hcall_norets(H_CPPR, cppr);
164+}
165+
166+static inline long plpar_ipi(unsigned long servernum, unsigned long mfrr)
167+{
168+ return plpar_hcall_norets(H_IPI, servernum, mfrr);
169+}
170+
171+static inline long plpar_xirr(unsigned long *xirr_ret)
172+{
173+ long rc;
174+ unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
175+
176+ rc = plpar_hcall(H_XIRR, retbuf);
177+
178+ *xirr_ret = retbuf[0];
179+
180+ return rc;
181+}
182+
110183 #endif /* _PSERIES_PLPAR_WRAPPERS_H */
arch/powerpc/platforms/pseries/ras.c+2−2
@@ -79,7 +79,7 @@ static void request_ras_irqs(struct device_node *np, · 78 unmodified lines
7979 {
8080 int i, index, count = 0;
8181 struct of_irq oirq;
82− u32 *opicprop;
82+ const u32 *opicprop;
8383 unsigned int opicplen;
8484 unsigned int virqs[16];
8585
@@ -87,7 +87,7 @@ static void request_ras_irqs(struct device_node *np, · 1 unmodified line
8787 * map those interrupts using the default interrupt host and default
8888 * trigger
8989 */
90− opicprop = (u32 *)get_property(np, "open-pic-interrupt", &opicplen);
90+ opicprop = get_property(np, "open-pic-interrupt", &opicplen);
9191 if (opicprop) {
9292 opicplen /= sizeof(u32);
9393 for (i = 0; i < opicplen; i++) {
arch/powerpc/platforms/pseries/rtasd.c+2−2
@@ -359,11 +359,11 @@ static int enable_surveillance(int timeout) · 358 unmodified lines
359359 static int get_eventscan_parms(void)
360360 {
361361 struct device_node *node;
362− int *ip;
362+ const int *ip;
363363
364364 node = of_find_node_by_path("/rtas");
365365
366− ip = (int *)get_property(node, "rtas-event-scan-rate", NULL);
366+ ip = get_property(node, "rtas-event-scan-rate", NULL);
367367 if (ip == NULL) {
368368 printk(KERN_ERR "rtasd: no rtas-event-scan-rate\n");
369369 of_node_put(node);
arch/powerpc/platforms/pseries/setup.c+28−14
@@ -133,9 +133,9 @@ void pseries_8259_cascade(unsigned int irq, struct irq_desc *desc, · 132 unmodified lines
133133 static void __init pseries_mpic_init_IRQ(void)
134134 {
135135 struct device_node *np, *old, *cascade = NULL;
136− unsigned int *addrp;
136+ const unsigned int *addrp;
137137 unsigned long intack = 0;
138− unsigned int *opprop;
138+ const unsigned int *opprop;
139139 unsigned long openpic_addr = 0;
140140 unsigned int cascade_irq;
141141 int naddr, n, i, opplen;
@@ -143,7 +143,7 @@ static void __init pseries_mpic_init_IRQ(void) · 1 unmodified line
143143
144144 np = of_find_node_by_path("/");
145145 naddr = prom_n_addr_cells(np);
146− opprop = (unsigned int *) get_property(np, "platform-open-pic", &opplen);
146+ opprop = get_property(np, "platform-open-pic", &opplen);
147147 if (opprop != 0) {
148148 openpic_addr = of_read_number(opprop, naddr);
149149 printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr);
@@ -192,7 +192,7 @@ static void __init pseries_mpic_init_IRQ(void) · 42 unmodified lines
192192 break;
193193 if (strcmp(np->name, "pci") != 0)
194194 continue;
195− addrp = (u32 *)get_property(np, "8259-interrupt-acknowledge",
195+ addrp = get_property(np, "8259-interrupt-acknowledge",
196196 NULL);
197197 if (addrp == NULL)
198198 continue;
@@ -223,23 +223,37 @@ static void pseries_lpar_enable_pmcs(void) · 24 unmodified lines
223223 }
224224
225225 #ifdef CONFIG_KEXEC
226−static void pseries_kexec_cpu_down_mpic(int crash_shutdown, int secondary)
227−{
228− mpic_teardown_this_cpu(secondary);
229−}
230−
231−static void pseries_kexec_cpu_down_xics(int crash_shutdown, int secondary)
226+static void pseries_kexec_cpu_down(int crash_shutdown, int secondary)
232227 {
233228 /* Don't risk a hypervisor call if we're crashing */
234229 if (firmware_has_feature(FW_FEATURE_SPLPAR) && !crash_shutdown) {
235− unsigned long vpa = __pa(get_lppaca());
230+ unsigned long addr;
236231
237− if (unregister_vpa(hard_smp_processor_id(), vpa)) {
232+ addr = __pa(get_slb_shadow());
233+ if (unregister_slb_shadow(hard_smp_processor_id(), addr))
234+ printk("SLB shadow buffer deregistration of "
235+ "cpu %u (hw_cpu_id %d) failed\n",
236+ smp_processor_id(),
237+ hard_smp_processor_id());
238+
239+ addr = __pa(get_lppaca());
240+ if (unregister_vpa(hard_smp_processor_id(), addr)) {
238241 printk("VPA deregistration of cpu %u (hw_cpu_id %d) "
239242 "failed\n", smp_processor_id(),
240243 hard_smp_processor_id());
241244 }
242245 }
246+}
247+
248+static void pseries_kexec_cpu_down_mpic(int crash_shutdown, int secondary)
249+{
250+ pseries_kexec_cpu_down(crash_shutdown, secondary);
251+ mpic_teardown_this_cpu(secondary);
252+}
253+
254+static void pseries_kexec_cpu_down_xics(int crash_shutdown, int secondary)
255+{
256+ pseries_kexec_cpu_down(crash_shutdown, secondary);
243257 xics_teardown_cpu(secondary);
244258 }
245259 #endif /* CONFIG_KEXEC */
@@ -247,11 +261,11 @@ static void pseries_kexec_cpu_down_xics(int crash_shutdown, int secondary) · 1 unmodified line
247261 static void __init pseries_discover_pic(void)
248262 {
249263 struct device_node *np;
250− char *typep;
264+ const char *typep;
251265
252266 for (np = NULL; (np = of_find_node_by_name(np,
253267 "interrupt-controller"));) {
254− typep = (char *)get_property(np, "compatible", NULL);
268+ typep = get_property(np, "compatible", NULL);
255269 if (strstr(typep, "open-pic")) {
256270 pSeries_mpic_node = of_node_get(np);
257271 ppc_md.init_IRQ = pseries_mpic_init_IRQ;
arch/powerpc/platforms/pseries/smp.c+6−6
@@ -62,7 +62,7 @@ · 61 unmodified lines
6262 */
6363 static cpumask_t of_spin_map;
6464
65−extern void pSeries_secondary_smp_init(unsigned long);
65+extern void generic_secondary_smp_init(unsigned long);
6666
6767 #ifdef CONFIG_HOTPLUG_CPU
6868
@@ -145,9 +145,9 @@ static int pSeries_add_processor(struct device_node *np) · 76 unmodified lines
145145 unsigned int cpu;
146146 cpumask_t candidate_map, tmp = CPU_MASK_NONE;
147147 int err = -ENOSPC, len, nthreads, i;
148− u32 *intserv;
148+ const u32 *intserv;
149149
150− intserv = (u32 *)get_property(np, "ibm,ppc-interrupt-server#s", &len);
150+ intserv = get_property(np, "ibm,ppc-interrupt-server#s", &len);
151151 if (!intserv)
152152 return 0;
153153
@@ -205,9 +205,9 @@ static void pSeries_remove_processor(struct device_node *np) · 51 unmodified lines
205205 {
206206 unsigned int cpu;
207207 int len, nthreads, i;
208− u32 *intserv;
208+ const u32 *intserv;
209209
210− intserv = (u32 *)get_property(np, "ibm,ppc-interrupt-server#s", &len);
210+ intserv = get_property(np, "ibm,ppc-interrupt-server#s", &len);
211211 if (!intserv)
212212 return;
213213
@@ -270,7 +270,7 @@ static inline int __devinit smp_startup_cpu(unsigned int lcpu) · 56 unmodified lines
270270 {
271271 int status;
272272 unsigned long start_here = __pa((u32)*((unsigned long *)
273− pSeries_secondary_smp_init));
273+ generic_secondary_smp_init));
274274 unsigned int pcpu;
275275 int start_cpu;
276276
arch/powerpc/platforms/pseries/xics.c+12−32
@@ -34,6 +34,7 @@ · 33 unmodified lines
3434 #include <asm/i8259.h>
3535
3636 #include "xics.h"
37+#include "plpar_wrappers.h"
3738
3839 #define XICS_IPI 2
3940 #define XICS_IRQ_SPURIOUS 0
@@ -110,27 +111,6 @@ static inline void direct_qirr_info(int n_cpu, u8 value) · 70 unmodified lines
110111 /* LPAR low level accessors */
111112
112113
113−static inline long plpar_eoi(unsigned long xirr)
114−{
115− return plpar_hcall_norets(H_EOI, xirr);
116−}
117−
118−static inline long plpar_cppr(unsigned long cppr)
119−{
120− return plpar_hcall_norets(H_CPPR, cppr);
121−}
122−
123−static inline long plpar_ipi(unsigned long servernum, unsigned long mfrr)
124−{
125− return plpar_hcall_norets(H_IPI, servernum, mfrr);
126−}
127−
128−static inline long plpar_xirr(unsigned long *xirr_ret)
129−{
130− unsigned long dummy;
131− return plpar_hcall(H_XIRR, 0, 0, 0, 0, xirr_ret, &dummy, &dummy);
132−}
133−
134114 static inline unsigned int lpar_xirr_info_get(int n_cpu)
135115 {
136116 unsigned long lpar_rc;
@@ -590,14 +570,14 @@ static void __init xics_init_one_node(struct device_node *np, · 453 unmodified lines
590570 unsigned int *indx)
591571 {
592572 unsigned int ilen;
593− u32 *ireg;
573+ const u32 *ireg;
594574
595575 /* This code does the theorically broken assumption that the interrupt
596576 * server numbers are the same as the hard CPU numbers.
597577 * This happens to be the case so far but we are playing with fire...
598578 * should be fixed one of these days. -BenH.
599579 */
600− ireg = (u32 *)get_property(np, "ibm,interrupt-server-ranges", NULL);
580+ ireg = get_property(np, "ibm,interrupt-server-ranges", NULL);
601581
602582 /* Do that ever happen ? we'll know soon enough... but even good'old
603583 * f80 does have that property ..
@@ -609,7 +589,7 @@ static void __init xics_init_one_node(struct device_node *np, · 5 unmodified lines
609589 */
610590 *indx = *ireg;
611591 }
612− ireg = (u32 *)get_property(np, "reg", &ilen);
592+ ireg = get_property(np, "reg", &ilen);
613593 if (!ireg)
614594 panic("xics_init_IRQ: can't find interrupt reg property");
615595
@@ -635,7 +615,7 @@ static void __init xics_setup_8259_cascade(void) · 19 unmodified lines
635615 {
636616 struct device_node *np, *old, *found = NULL;
637617 int cascade, naddr;
638− u32 *addrp;
618+ const u32 *addrp;
639619 unsigned long intack = 0;
640620
641621 for_each_node_by_type(np, "interrupt-controller")
@@ -661,7 +641,7 @@ static void __init xics_setup_8259_cascade(void) · 19 unmodified lines
661641 break;
662642 if (strcmp(np->name, "pci") != 0)
663643 continue;
664− addrp = (u32 *)get_property(np, "8259-interrupt-acknowledge", NULL);
644+ addrp = get_property(np, "8259-interrupt-acknowledge", NULL);
665645 if (addrp == NULL)
666646 continue;
667647 naddr = prom_n_addr_cells(np);
@@ -680,7 +660,8 @@ void __init xics_init_IRQ(void) · 12 unmodified lines
680660 {
681661 int i;
682662 struct device_node *np;
683− u32 *ireg, ilen, indx = 0;
663+ u32 ilen, indx = 0;
664+ const u32 *ireg;
684665 int found = 0;
685666
686667 ppc64_boot_msg(0x20, "XICS Init");
@@ -705,18 +686,17 @@ void __init xics_init_IRQ(void) · 18 unmodified lines
705686 for (np = of_find_node_by_type(NULL, "cpu");
706687 np;
707688 np = of_find_node_by_type(np, "cpu")) {
708− ireg = (u32 *)get_property(np, "reg", &ilen);
689+ ireg = get_property(np, "reg", &ilen);
709690 if (ireg && ireg[0] == get_hard_smp_processor_id(boot_cpuid)) {
710− ireg = (u32 *)get_property(np,
711− "ibm,ppc-interrupt-gserver#s",
712− &ilen);
691+ ireg = get_property(np,
692+ "ibm,ppc-interrupt-gserver#s", &ilen);
713693 i = ilen / sizeof(int);
714694 if (ireg && i > 0) {
715695 default_server = ireg[0];
716696 /* take last element */
717697 default_distrib_server = ireg[i-1];
718698 }
719− ireg = (u32 *)get_property(np,
699+ ireg = get_property(np,
720700 "ibm,interrupt-server#-size", NULL);
721701 if (ireg)
722702 interrupt_server_size = *ireg;
arch/powerpc/sysdev/fsl_soc.c+14−14
@@ -41,7 +41,7 @@ phys_addr_t get_immrbase(void) · 40 unmodified lines
4141 soc = of_find_node_by_type(NULL, "soc");
4242 if (soc) {
4343 unsigned int size;
44− void *prop = get_property(soc, "reg", &size);
44+ const void *prop = get_property(soc, "reg", &size);
4545 immrbase = of_translate_address(soc, prop);
4646 of_node_put(soc);
4747 };
@@ -85,7 +85,7 @@ static int __init gfar_mdio_of_init(void) · 37 unmodified lines
8585 mdio_data.irq[k] = -1;
8686
8787 while ((child = of_get_next_child(np, child)) != NULL) {
88− u32 *id = get_property(child, "reg", NULL);
88+ const u32 *id = get_property(child, "reg", NULL);
8989 mdio_data.irq[*id] = irq_of_parse_and_map(child, 0);
9090 }
9191
@@ -124,10 +124,10 @@ static int __init gfar_of_init(void) · 32 unmodified lines
124124 struct resource r[4];
125125 struct device_node *phy, *mdio;
126126 struct gianfar_platform_data gfar_data;
127− unsigned int *id;
128− char *model;
129− void *mac_addr;
130− phandle *ph;
127+ const unsigned int *id;
128+ const char *model;
129+ const void *mac_addr;
130+ const phandle *ph;
131131 int n_res = 1;
132132
133133 memset(r, 0, sizeof(r));
@@ -193,7 +193,7 @@ static int __init gfar_of_init(void) · 59 unmodified lines
193193 FSL_GIANFAR_DEV_HAS_VLAN |
194194 FSL_GIANFAR_DEV_HAS_EXTENDED_HASH;
195195
196− ph = (phandle *) get_property(np, "phy-handle", NULL);
196+ ph = get_property(np, "phy-handle", NULL);
197197 phy = of_find_node_by_phandle(*ph);
198198
199199 if (phy == NULL) {
@@ -203,7 +203,7 @@ static int __init gfar_of_init(void) · 3 unmodified lines
203203
204204 mdio = of_get_parent(phy);
205205
206− id = (u32 *) get_property(phy, "reg", NULL);
206+ id = get_property(phy, "reg", NULL);
207207 ret = of_address_to_resource(mdio, 0, &res);
208208 if (ret) {
209209 of_node_put(phy);
@@ -247,7 +247,7 @@ static int __init fsl_i2c_of_init(void) · 37 unmodified lines
247247 i++) {
248248 struct resource r[2];
249249 struct fsl_i2c_platform_data i2c_data;
250− unsigned char *flags = NULL;
250+ const unsigned char *flags = NULL;
251251
252252 memset(&r, 0, sizeof(r));
253253 memset(&i2c_data, 0, sizeof(i2c_data));
@@ -298,7 +298,7 @@ static int __init mpc83xx_wdt_init(void) · 44 unmodified lines
298298 struct resource r;
299299 struct device_node *soc, *np;
300300 struct platform_device *dev;
301− unsigned int *freq;
301+ const unsigned int *freq;
302302 int ret;
303303
304304 np = of_find_compatible_node(NULL, "watchdog", "mpc83xx_wdt");
@@ -315,7 +315,7 @@ static int __init mpc83xx_wdt_init(void) · 10 unmodified lines
315315 goto nosoc;
316316 }
317317
318− freq = (unsigned int *)get_property(soc, "bus-frequency", NULL);
318+ freq = get_property(soc, "bus-frequency", NULL);
319319 if (!freq) {
320320 ret = -ENODEV;
321321 goto err;
@@ -355,7 +355,7 @@ nodev: · 33 unmodified lines
355355 arch_initcall(mpc83xx_wdt_init);
356356 #endif
357357
358−static enum fsl_usb2_phy_modes determine_usb_phy(char * phy_type)
358+static enum fsl_usb2_phy_modes determine_usb_phy(const char *phy_type)
359359 {
360360 if (!phy_type)
361361 return FSL_USB2_PHY_NONE;
@@ -383,7 +383,7 @@ static int __init fsl_usb_of_init(void) · 21 unmodified lines
383383 i++) {
384384 struct resource r[2];
385385 struct fsl_usb2_platform_data usb_data;
386− unsigned char *prop = NULL;
386+ const unsigned char *prop = NULL;
387387
388388 memset(&r, 0, sizeof(r));
389389 memset(&usb_data, 0, sizeof(usb_data));
@@ -431,7 +431,7 @@ static int __init fsl_usb_of_init(void) · 41 unmodified lines
431431 i++) {
432432 struct resource r[2];
433433 struct fsl_usb2_platform_data usb_data;
434− unsigned char *prop = NULL;
434+ const unsigned char *prop = NULL;
435435
436436 memset(&r, 0, sizeof(r));
437437 memset(&usb_data, 0, sizeof(usb_data));
arch/powerpc/sysdev/fsl_soc.h+2−0
@@ -2,6 +2,8 @@ · 1 unmodified line
22 #define __PPC_FSL_SOC_H
33 #ifdef __KERNEL__
44
5+#include <asm/mmu.h>
6+
57 extern phys_addr_t get_immrbase(void);
68
79 #endif
arch/powerpc/sysdev/i8259.c+1−1
@@ -224,7 +224,7 @@ static struct irq_host_ops i8259_host_ops = { · 223 unmodified lines
224224 .xlate = i8259_host_xlate,
225225 };
226226
227−/****
227+/**
228228 * i8259_init - Initialize the legacy controller
229229 * @node: device node of the legacy PIC (can be NULL, but then, it will match
230230 * all interrupts, so beware)
arch/powerpc/sysdev/ipic.c+21−21
@@ -210,7 +210,7 @@ static struct ipic_info ipic_info[] = { · 209 unmodified lines
210210 .prio_mask = 4,
211211 },
212212 [64] = {
213− .pend = IPIC_SIPNR_H,
213+ .pend = IPIC_SIPNR_L,
214214 .mask = IPIC_SIMSR_L,
215215 .prio = IPIC_SMPRR_A,
216216 .force = IPIC_SIFCR_L,
@@ -218,7 +218,7 @@ static struct ipic_info ipic_info[] = { · 1 unmodified line
218218 .prio_mask = 0,
219219 },
220220 [65] = {
221− .pend = IPIC_SIPNR_H,
221+ .pend = IPIC_SIPNR_L,
222222 .mask = IPIC_SIMSR_L,
223223 .prio = IPIC_SMPRR_A,
224224 .force = IPIC_SIFCR_L,
@@ -226,7 +226,7 @@ static struct ipic_info ipic_info[] = { · 1 unmodified line
226226 .prio_mask = 1,
227227 },
228228 [66] = {
229− .pend = IPIC_SIPNR_H,
229+ .pend = IPIC_SIPNR_L,
230230 .mask = IPIC_SIMSR_L,
231231 .prio = IPIC_SMPRR_A,
232232 .force = IPIC_SIFCR_L,
@@ -234,7 +234,7 @@ static struct ipic_info ipic_info[] = { · 1 unmodified line
234234 .prio_mask = 2,
235235 },
236236 [67] = {
237− .pend = IPIC_SIPNR_H,
237+ .pend = IPIC_SIPNR_L,
238238 .mask = IPIC_SIMSR_L,
239239 .prio = IPIC_SMPRR_A,
240240 .force = IPIC_SIFCR_L,
@@ -242,7 +242,7 @@ static struct ipic_info ipic_info[] = { · 1 unmodified line
242242 .prio_mask = 3,
243243 },
244244 [68] = {
245− .pend = IPIC_SIPNR_H,
245+ .pend = IPIC_SIPNR_L,
246246 .mask = IPIC_SIMSR_L,
247247 .prio = IPIC_SMPRR_B,
248248 .force = IPIC_SIFCR_L,
@@ -250,7 +250,7 @@ static struct ipic_info ipic_info[] = { · 1 unmodified line
250250 .prio_mask = 0,
251251 },
252252 [69] = {
253− .pend = IPIC_SIPNR_H,
253+ .pend = IPIC_SIPNR_L,
254254 .mask = IPIC_SIMSR_L,
255255 .prio = IPIC_SMPRR_B,
256256 .force = IPIC_SIFCR_L,
@@ -258,7 +258,7 @@ static struct ipic_info ipic_info[] = { · 1 unmodified line
258258 .prio_mask = 1,
259259 },
260260 [70] = {
261− .pend = IPIC_SIPNR_H,
261+ .pend = IPIC_SIPNR_L,
262262 .mask = IPIC_SIMSR_L,
263263 .prio = IPIC_SMPRR_B,
264264 .force = IPIC_SIFCR_L,
@@ -266,7 +266,7 @@ static struct ipic_info ipic_info[] = { · 1 unmodified line
266266 .prio_mask = 2,
267267 },
268268 [71] = {
269− .pend = IPIC_SIPNR_H,
269+ .pend = IPIC_SIPNR_L,
270270 .mask = IPIC_SIMSR_L,
271271 .prio = IPIC_SMPRR_B,
272272 .force = IPIC_SIFCR_L,
@@ -274,91 +274,91 @@ static struct ipic_info ipic_info[] = { · 1 unmodified line
274274 .prio_mask = 3,
275275 },
276276 [72] = {
277− .pend = IPIC_SIPNR_H,
277+ .pend = IPIC_SIPNR_L,
278278 .mask = IPIC_SIMSR_L,
279279 .prio = 0,
280280 .force = IPIC_SIFCR_L,
281281 .bit = 8,
282282 },
283283 [73] = {
284− .pend = IPIC_SIPNR_H,
284+ .pend = IPIC_SIPNR_L,
285285 .mask = IPIC_SIMSR_L,
286286 .prio = 0,
287287 .force = IPIC_SIFCR_L,
288288 .bit = 9,
289289 },
290290 [74] = {
291− .pend = IPIC_SIPNR_H,
291+ .pend = IPIC_SIPNR_L,
292292 .mask = IPIC_SIMSR_L,
293293 .prio = 0,
294294 .force = IPIC_SIFCR_L,
295295 .bit = 10,
296296 },
297297 [75] = {
298− .pend = IPIC_SIPNR_H,
298+ .pend = IPIC_SIPNR_L,
299299 .mask = IPIC_SIMSR_L,
300300 .prio = 0,
301301 .force = IPIC_SIFCR_L,
302302 .bit = 11,
303303 },
304304 [76] = {
305− .pend = IPIC_SIPNR_H,
305+ .pend = IPIC_SIPNR_L,
306306 .mask = IPIC_SIMSR_L,
307307 .prio = 0,
308308 .force = IPIC_SIFCR_L,
309309 .bit = 12,
310310 },
311311 [77] = {
312− .pend = IPIC_SIPNR_H,
312+ .pend = IPIC_SIPNR_L,
313313 .mask = IPIC_SIMSR_L,
314314 .prio = 0,
315315 .force = IPIC_SIFCR_L,
316316 .bit = 13,
317317 },
318318 [78] = {
319− .pend = IPIC_SIPNR_H,
319+ .pend = IPIC_SIPNR_L,
320320 .mask = IPIC_SIMSR_L,
321321 .prio = 0,
322322 .force = IPIC_SIFCR_L,
323323 .bit = 14,
324324 },
325325 [79] = {
326− .pend = IPIC_SIPNR_H,
326+ .pend = IPIC_SIPNR_L,
327327 .mask = IPIC_SIMSR_L,
328328 .prio = 0,
329329 .force = IPIC_SIFCR_L,
330330 .bit = 15,
331331 },
332332 [80] = {
333− .pend = IPIC_SIPNR_H,
333+ .pend = IPIC_SIPNR_L,
334334 .mask = IPIC_SIMSR_L,
335335 .prio = 0,
336336 .force = IPIC_SIFCR_L,
337337 .bit = 16,
338338 },
339339 [84] = {
340− .pend = IPIC_SIPNR_H,
340+ .pend = IPIC_SIPNR_L,
341341 .mask = IPIC_SIMSR_L,
342342 .prio = 0,
343343 .force = IPIC_SIFCR_L,
344344 .bit = 20,
345345 },
346346 [85] = {
347− .pend = IPIC_SIPNR_H,
347+ .pend = IPIC_SIPNR_L,
348348 .mask = IPIC_SIMSR_L,
349349 .prio = 0,
350350 .force = IPIC_SIFCR_L,
351351 .bit = 21,
352352 },
353353 [90] = {
354− .pend = IPIC_SIPNR_H,
354+ .pend = IPIC_SIPNR_L,
355355 .mask = IPIC_SIMSR_L,
356356 .prio = 0,
357357 .force = IPIC_SIFCR_L,
358358 .bit = 26,
359359 },
360360 [91] = {
361− .pend = IPIC_SIPNR_H,
361+ .pend = IPIC_SIPNR_L,
362362 .mask = IPIC_SIMSR_L,
363363 .prio = 0,
364364 .force = IPIC_SIFCR_L,
arch/powerpc/sysdev/mmio_nvram.c+2−2
@@ -80,7 +80,7 @@ static ssize_t mmio_nvram_get_size(void) · 79 unmodified lines
8080 int __init mmio_nvram_init(void)
8181 {
8282 struct device_node *nvram_node;
83− unsigned long *buffer;
83+ const unsigned long *buffer;
8484 int proplen;
8585 unsigned long nvram_addr;
8686 int ret;
@@ -91,7 +91,7 @@ int __init mmio_nvram_init(void) · 4 unmodified lines
9191 goto out;
9292
9393 ret = -EIO;
94− buffer = (unsigned long *)get_property(nvram_node, "reg", &proplen);
94+ buffer = get_property(nvram_node, "reg", &proplen);
9595 if (proplen != 2*sizeof(unsigned long))
9696 goto out;
9797
arch/powerpc/sysdev/tsi108_pci.c+2−2
@@ -194,7 +194,7 @@ int __init tsi108_setup_pci(struct device_node *dev) · 193 unmodified lines
194194 int len;
195195 struct pci_controller *hose;
196196 struct resource rsrc;
197− int *bus_range;
197+ const int *bus_range;
198198 int primary = 0, has_address = 0;
199199
200200 /* PCI Config mapping */
@@ -207,7 +207,7 @@ int __init tsi108_setup_pci(struct device_node *dev) · 6 unmodified lines
207207 has_address = (of_address_to_resource(dev, 0, &rsrc) == 0);
208208
209209 /* Get bus range if any */
210− bus_range = (int *)get_property(dev, "bus-range", &len);
210+ bus_range = get_property(dev, "bus-range", &len);
211211 if (bus_range == NULL || len < 2 * sizeof(int)) {
212212 printk(KERN_WARNING "Can't get bus-range for %s, assume"
213213 " bus 0\n", dev->full_name);
arch/powerpc/xmon/xmon.c+10−0
@@ -137,10 +137,14 @@ static void bootcmds(void); · 136 unmodified lines
137137 static void proccall(void);
138138 void dump_segments(void);
139139 static void symbol_lookup(void);
140+static void xmon_show_stack(unsigned long sp, unsigned long lr,
141+ unsigned long pc);
140142 static void xmon_print_symbol(unsigned long address, const char *mid,
141143 const char *after);
142144 static const char *getvecname(unsigned long vec);
143145
146+int xmon_no_auto_backtrace;
147+
144148 extern int print_insn_powerpc(unsigned long, unsigned long, int);
145149
146150 extern void xmon_enter(void);
@@ -736,6 +740,12 @@ cmds(struct pt_regs *excp) · 589 unmodified lines
736740
737741 last_cmd = NULL;
738742 xmon_regs = excp;
743+
744+ if (!xmon_no_auto_backtrace) {
745+ xmon_no_auto_backtrace = 1;
746+ xmon_show_stack(excp->gpr[1], excp->link, excp->nip);
747+ }
748+
739749 for(;;) {
740750 #ifdef CONFIG_SMP
741751 printf("%x:", smp_processor_id());
arch/ppc/Kconfig+3−3
@@ -1204,7 +1204,7 @@ config PCI_DOMAINS · 1203 unmodified lines
12041204 default PCI
12051205
12061206 config MPC83xx_PCI2
1207− bool " Supprt for 2nd PCI host controller"
1207+ bool "Support for 2nd PCI host controller"
12081208 depends on PCI && MPC834x
12091209 default y if MPC834x_SYS
12101210
@@ -1223,12 +1223,12 @@ config PCI_8260 · 12 unmodified lines
12231223 default y
12241224
12251225 config 8260_PCI9
1226− bool " Enable workaround for MPC826x erratum PCI 9"
1226+ bool "Enable workaround for MPC826x erratum PCI 9"
12271227 depends on PCI_8260 && !ADS8272
12281228 default y
12291229
12301230 choice
1231− prompt " IDMA channel for PCI 9 workaround"
1231+ prompt "IDMA channel for PCI 9 workaround"
12321232 depends on 8260_PCI9
12331233
12341234 config 8260_PCI9_IDMA1
arch/ppc/kernel/misc.S+0−88
@@ -768,91 +768,6 @@ _GLOBAL(_outsb) · 767 unmodified lines
768768 bdnz 00b
769769 blr
770770
771−_GLOBAL(_insw)
772− cmpwi 0,r5,0
773− mtctr r5
774− subi r4,r4,2
775− blelr-
776−00: lhbrx r5,0,r3
777−01: eieio
778−02: sthu r5,2(r4)
779− ISYNC_8xx
780− .section .fixup,"ax"
781−03: blr
782− .text
783− .section __ex_table, "a"
784− .align 2
785− .long 00b, 03b
786− .long 01b, 03b
787− .long 02b, 03b
788− .text
789− bdnz 00b
790− blr
791−
792−_GLOBAL(_outsw)
793− cmpwi 0,r5,0
794− mtctr r5
795− subi r4,r4,2
796− blelr-
797−00: lhzu r5,2(r4)
798−01: eieio
799−02: sthbrx r5,0,r3
800− ISYNC_8xx
801− .section .fixup,"ax"
802−03: blr
803− .text
804− .section __ex_table, "a"
805− .align 2
806− .long 00b, 03b
807− .long 01b, 03b
808− .long 02b, 03b
809− .text
810− bdnz 00b
811− blr
812−
813−_GLOBAL(_insl)
814− cmpwi 0,r5,0
815− mtctr r5
816− subi r4,r4,4
817− blelr-
818−00: lwbrx r5,0,r3
819−01: eieio
820−02: stwu r5,4(r4)
821− ISYNC_8xx
822− .section .fixup,"ax"
823−03: blr
824− .text
825− .section __ex_table, "a"
826− .align 2
827− .long 00b, 03b
828− .long 01b, 03b
829− .long 02b, 03b
830− .text
831− bdnz 00b
832− blr
833−
834−_GLOBAL(_outsl)
835− cmpwi 0,r5,0
836− mtctr r5
837− subi r4,r4,4
838− blelr-
839−00: lwzu r5,4(r4)
840−01: stwbrx r5,0,r3
841−02: eieio
842− ISYNC_8xx
843− .section .fixup,"ax"
844−03: blr
845− .text
846− .section __ex_table, "a"
847− .align 2
848− .long 00b, 03b
849− .long 01b, 03b
850− .long 02b, 03b
851− .text
852− bdnz 00b
853− blr
854−
855−_GLOBAL(__ide_mm_insw)
856771 _GLOBAL(_insw_ns)
857772 cmpwi 0,r5,0
858773 mtctr r5
@@ -874,7 +789,6 @@ _GLOBAL(_insw_ns) · 15 unmodified lines
874789 bdnz 00b
875790 blr
876791
877−_GLOBAL(__ide_mm_outsw)
878792 _GLOBAL(_outsw_ns)
879793 cmpwi 0,r5,0
880794 mtctr r5
@@ -896,7 +810,6 @@ _GLOBAL(_outsw_ns) · 15 unmodified lines
896810 bdnz 00b
897811 blr
898812
899−_GLOBAL(__ide_mm_insl)
900813 _GLOBAL(_insl_ns)
901814 cmpwi 0,r5,0
902815 mtctr r5
@@ -918,7 +831,6 @@ _GLOBAL(_insl_ns) · 15 unmodified lines
918831 bdnz 00b
919832 blr
920833
921−_GLOBAL(__ide_mm_outsl)
922834 _GLOBAL(_outsl_ns)
923835 cmpwi 0,r5,0
924836 mtctr r5
arch/ppc/kernel/ppc_ksyms.c+0−9
@@ -115,17 +115,8 @@ EXPORT_SYMBOL(outw); · 114 unmodified lines
115115 EXPORT_SYMBOL(outl);
116116 EXPORT_SYMBOL(outsl);*/
117117
118−EXPORT_SYMBOL(__ide_mm_insl);
119−EXPORT_SYMBOL(__ide_mm_outsw);
120−EXPORT_SYMBOL(__ide_mm_insw);
121−EXPORT_SYMBOL(__ide_mm_outsl);
122−
123118 EXPORT_SYMBOL(_insb);
124119 EXPORT_SYMBOL(_outsb);
125−EXPORT_SYMBOL(_insw);
126−EXPORT_SYMBOL(_outsw);
127−EXPORT_SYMBOL(_insl);
128−EXPORT_SYMBOL(_outsl);
129120 EXPORT_SYMBOL(_insw_ns);
130121 EXPORT_SYMBOL(_outsw_ns);
131122 EXPORT_SYMBOL(_insl_ns);
arch/ppc/kernel/setup.c+12−5
@@ -127,11 +127,8 @@ void machine_restart(char *cmd) · 126 unmodified lines
127127 ppc_md.restart(cmd);
128128 }
129129
130−void machine_power_off(void)
130+static void ppc_generic_power_off(void)
131131 {
132−#ifdef CONFIG_NVRAM
133− nvram_sync();
134−#endif
135132 ppc_md.power_off();
136133 }
137134
@@ -143,7 +140,17 @@ void machine_halt(void) · 5 unmodified lines
143140 ppc_md.halt();
144141 }
145142
146−void (*pm_power_off)(void) = machine_power_off;
143+void (*pm_power_off)(void) = ppc_generic_power_off;
144+
145+void machine_power_off(void)
146+{
147+#ifdef CONFIG_NVRAM
148+ nvram_sync();
149+#endif
150+ if (pm_power_off)
151+ pm_power_off();
152+ ppc_generic_power_off();
153+}
147154
148155 #ifdef CONFIG_TAU
149156 extern u32 cpu_temp(unsigned long cpu);
arch/ppc/platforms/85xx/sbc8560.h+1−0
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414 #define __MACH_SBC8560_H__
1515
1616 #include <platforms/85xx/sbc85xx.h>
17+#include <asm/irq.h>
1718
1819 #define CPM_MAP_ADDR (CCSRBAR + MPC85xx_CPM_OFFSET)
1920
arch/ppc/platforms/85xx/sbc85xx.h+18−0
@@ -49,4 +49,22 @@ extern void sbc8560_init_IRQ(void) __init; · 48 unmodified lines
4949
5050 #define MPC85XX_PCI1_IO_SIZE 0x01000000
5151
52+/* FCC1 Clock Source Configuration. These can be
53+ * redefined in the board specific file.
54+ * Can only choose from CLK9-12 */
55+#define F1_RXCLK 12
56+#define F1_TXCLK 11
57+
58+/* FCC2 Clock Source Configuration. These can be
59+ * redefined in the board specific file.
60+ * Can only choose from CLK13-16 */
61+#define F2_RXCLK 13
62+#define F2_TXCLK 14
63+
64+/* FCC3 Clock Source Configuration. These can be
65+ * redefined in the board specific file.
66+ * Can only choose from CLK13-16 */
67+#define F3_RXCLK 15
68+#define F3_TXCLK 16
69+
5270 #endif /* __PLATFORMS_85XX_SBC85XX_H__ */
arch/ppc/syslib/m8260_pci_erratum9.c+0−16
@@ -339,20 +339,6 @@ void insl(unsigned port, void *buf, int nl) · 338 unmodified lines
339339 idma_pci9_read((u8 *)buf, (u8 *)addr, nl*sizeof(u32), sizeof(u32), 0);
340340 }
341341
342−void insw_ns(unsigned port, void *buf, int ns)
343−{
344− u8 *addr = (u8 *)(port + _IO_BASE);
345−
346− idma_pci9_read((u8 *)buf, (u8 *)addr, ns*sizeof(u16), sizeof(u16), 0);
347−}
348−
349−void insl_ns(unsigned port, void *buf, int nl)
350−{
351− u8 *addr = (u8 *)(port + _IO_BASE);
352−
353− idma_pci9_read((u8 *)buf, (u8 *)addr, nl*sizeof(u32), sizeof(u32), 0);
354−}
355−
356342 void *memcpy_fromio(void *dest, unsigned long src, size_t count)
357343 {
358344 unsigned long pa = iopa((unsigned long) src);
@@ -373,8 +359,6 @@ EXPORT_SYMBOL(inl); · 14 unmodified lines
373359 EXPORT_SYMBOL(insb);
374360 EXPORT_SYMBOL(insw);
375361 EXPORT_SYMBOL(insl);
376−EXPORT_SYMBOL(insw_ns);
377−EXPORT_SYMBOL(insl_ns);
378362 EXPORT_SYMBOL(memcpy_fromio);
379363
380364 #endif /* ifdef CONFIG_8260_PCI9 */
arch/ppc/xmon/start.c+18−10
@@ -15,6 +15,7 @@ · 14 unmodified lines
1515 #include <asm/processor.h>
1616 #include <asm/delay.h>
1717 #include <asm/btext.h>
18+#include <asm/ibm4xx.h>
1819
1920 static volatile unsigned char *sccc, *sccd;
2021 unsigned int TXRDY, RXRDY, DLAB;
@@ -57,23 +58,30 @@ static struct sysrq_key_op sysrq_xmon_op = · 36 unmodified lines
5758 void
5859 xmon_map_scc(void)
5960 {
60−#ifdef CONFIG_PPC_PREP
61− volatile unsigned char *base;
62−
63−#elif defined(CONFIG_GEMINI)
61+#if defined(CONFIG_GEMINI)
6462 /* should already be mapped by the kernel boot */
65− sccc = (volatile unsigned char *) 0xffeffb0d;
6663 sccd = (volatile unsigned char *) 0xffeffb08;
67− TXRDY = 0x20;
68− RXRDY = 1;
69− DLAB = 0x80;
7064 #elif defined(CONFIG_405GP)
71− sccc = (volatile unsigned char *)0xef600305;
7265 sccd = (volatile unsigned char *)0xef600300;
66+#elif defined(CONFIG_440EP)
67+ sccd = (volatile unsigned char *) ioremap(PPC440EP_UART0_ADDR, 8);
68+#elif defined(CONFIG_440SP)
69+ sccd = (volatile unsigned char *) ioremap64(PPC440SP_UART0_ADDR, 8);
70+#elif defined(CONFIG_440SPE)
71+ sccd = (volatile unsigned char *) ioremap64(PPC440SPE_UART0_ADDR, 8);
72+#elif defined(CONFIG_44x)
73+ /* This is the default for 44x platforms. Any boards that have a
74+ different UART address need to be put in cases before this or the
75+ port will be mapped incorrectly */
76+ sccd = (volatile unsigned char *) ioremap64(PPC440GP_UART0_ADDR, 8);
77+#endif /* platform */
78+
79+#ifndef CONFIG_PPC_PREP
80+ sccc = sccd + 5;
7381 TXRDY = 0x20;
7482 RXRDY = 1;
7583 DLAB = 0x80;
76−#endif /* platform */
84+#endif
7785
7886 register_sysrq_key('x', &sysrq_xmon_op);
7987 }
arch/ppc/xmon/xmon.c+21−7
@@ -153,6 +153,12 @@ static int xmon_trace[NR_CPUS]; · 152 unmodified lines
153153 #define SSTEP 1 /* stepping because of 's' command */
154154 #define BRSTEP 2 /* stepping over breakpoint */
155155
156+#ifdef CONFIG_4xx
157+#define MSR_SSTEP_ENABLE 0x200
158+#else
159+#define MSR_SSTEP_ENABLE 0x400
160+#endif
161+
156162 static struct pt_regs *xmon_regs[NR_CPUS];
157163
158164 extern inline void sync(void)
@@ -211,6 +217,14 @@ static void get_tb(unsigned *p) · 52 unmodified lines
211217 p[1] = lo;
212218 }
213219
220+static inline void xmon_enable_sstep(struct pt_regs *regs)
221+{
222+ regs->msr |= MSR_SSTEP_ENABLE;
223+#ifdef CONFIG_4xx
224+ mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) | DBCR0_IC | DBCR0_IDM);
225+#endif
226+}
227+
214228 int xmon(struct pt_regs *excp)
215229 {
216230 struct pt_regs regs;
@@ -254,10 +268,10 @@ int xmon(struct pt_regs *excp) · 37 unmodified lines
254268 cmd = cmds(excp);
255269 if (cmd == 's') {
256270 xmon_trace[smp_processor_id()] = SSTEP;
257− excp->msr |= 0x400;
271+ xmon_enable_sstep(excp);
258272 } else if (at_breakpoint(excp->nip)) {
259273 xmon_trace[smp_processor_id()] = BRSTEP;
260− excp->msr |= 0x400;
274+ xmon_enable_sstep(excp);
261275 } else {
262276 xmon_trace[smp_processor_id()] = 0;
263277 insert_bpts();
@@ -298,7 +312,7 @@ xmon_bpt(struct pt_regs *regs) · 34 unmodified lines
298312 remove_bpts();
299313 excprint(regs);
300314 xmon_trace[smp_processor_id()] = BRSTEP;
301− regs->msr |= 0x400;
315+ xmon_enable_sstep(regs);
302316 } else {
303317 xmon(regs);
304318 }
@@ -385,7 +399,7 @@ insert_bpts(void) · 80 unmodified lines
385399 }
386400 store_inst((void *) bp->address);
387401 }
388−#if !defined(CONFIG_8xx)
402+#if ! (defined(CONFIG_8xx) || defined(CONFIG_4xx))
389403 if (dabr.enabled)
390404 set_dabr(dabr.address);
391405 if (iabr.enabled)
@@ -400,7 +414,7 @@ remove_bpts(void) · 8 unmodified lines
400414 struct bpt *bp;
401415 unsigned instr;
402416
403−#if !defined(CONFIG_8xx)
417+#if ! (defined(CONFIG_8xx) || defined(CONFIG_4xx))
404418 set_dabr(0);
405419 set_iabr(0);
406420 #endif
@@ -677,7 +691,7 @@ bpt_cmds(void) · 270 unmodified lines
677691
678692 cmd = inchar();
679693 switch (cmd) {
680−#if !defined(CONFIG_8xx)
694+#if ! (defined(CONFIG_8xx) || defined(CONFIG_4xx))
681695 case 'd':
682696 mode = 7;
683697 cmd = inchar();
@@ -792,7 +806,7 @@ backtrace(struct pt_regs *excp) · 108 unmodified lines
792806 for (; sp != 0; sp = stack[0]) {
793807 if (mread(sp, stack, sizeof(stack)) != sizeof(stack))
794808 break;
795− printf("[%.8lx] ", stack);
809+ printf("[%.8lx] ", stack[0]);
796810 xmon_print_symbol(stack[1], " ", "\n");
797811 if (stack[1] == (unsigned) &ret_from_except
798812 || stack[1] == (unsigned) &ret_from_except_full
drivers/char/Kconfig+22−0
@@ -495,6 +495,21 @@ config LEGACY_PTY_COUNT · 494 unmodified lines
495495 When not in use, each legacy PTY occupies 12 bytes on 32-bit
496496 architectures and 24 bytes on 64-bit architectures.
497497
498+config BRIQ_PANEL
499+ tristate 'Total Impact briQ front panel driver'
500+ depends on PPC_CHRP
501+ ---help---
502+ The briQ is a small footprint CHRP computer with a frontpanel VFD, a
503+ tristate led and two switches. It is the size of a CDROM drive.
504+
505+ If you have such one and want anything showing on the VFD then you
506+ must answer Y here.
507+
508+ To compile this driver as a module, choose M here: the
509+ module will be called briq_panel.
510+
511+ It's safe to say N here.
512+
498513 config PRINTER
499514 tristate "Parallel printer support"
500515 depends on PARPORT
@@ -596,6 +611,13 @@ config HVC_CONSOLE · 95 unmodified lines
596611 console. This driver allows each pSeries partition to have a console
597612 which is accessed via the HMC.
598613
614+config HVC_ISERIES
615+ bool "iSeries Hypervisor Virtual Console support"
616+ depends on PPC_ISERIES && !VIOCONS
617+ select HVC_DRIVER
618+ help
619+ iSeries machines support a hypervisor virtual console.
620+
599621 config HVC_RTAS
600622 bool "IBM RTAS Console support"
601623 depends on PPC_RTAS
drivers/char/Makefile+2−0
@@ -42,6 +42,7 @@ obj-$(CONFIG_AMIGA_BUILTIN_SERIAL) += amiserial.o · 41 unmodified lines
4242 obj-$(CONFIG_SX) += sx.o generic_serial.o
4343 obj-$(CONFIG_RIO) += rio/ generic_serial.o
4444 obj-$(CONFIG_HVC_CONSOLE) += hvc_vio.o hvsi.o
45+obj-$(CONFIG_HVC_ISERIES) += hvc_iseries.o
4546 obj-$(CONFIG_HVC_RTAS) += hvc_rtas.o
4647 obj-$(CONFIG_HVC_DRIVER) += hvc_console.o
4748 obj-$(CONFIG_RAW_DRIVER) += raw.o
@@ -51,6 +52,7 @@ obj-$(CONFIG_VIOCONS) += viocons.o · 3 unmodified lines
5152 obj-$(CONFIG_VIOTAPE) += viotape.o
5253 obj-$(CONFIG_HVCS) += hvcs.o
5354 obj-$(CONFIG_SGI_MBCS) += mbcs.o
55+obj-$(CONFIG_BRIQ_PANEL) += briq_panel.o
5456
5557 obj-$(CONFIG_PRINTER) += lp.o
5658 obj-$(CONFIG_TIPAR) += tipar.o
drivers/char/agp/uninorth-agp.c+2−2
@@ -601,8 +601,8 @@ static int __devinit agp_uninorth_probe(struct pci_dev *pdev, · 600 unmodified lines
601601 uninorth_node = of_find_node_by_name(NULL, "u3");
602602 }
603603 if (uninorth_node) {
604− int *revprop = (int *)
605− get_property(uninorth_node, "device-rev", NULL);
604+ const int *revprop = get_property(uninorth_node,
605+ "device-rev", NULL);
606606 if (revprop != NULL)
607607 uninorth_rev = *revprop & 0x3f;
608608 of_node_put(uninorth_node);
drivers/char/briq_panel.c+268−0
@@ -0,0 +1,268 @@
1+/*
2+ * Drivers for the Total Impact PPC based computer "BRIQ"
3+ * by Dr. Karsten Jeppesen
4+ *
5+ */
6+
7+#include <linux/module.h>
8+
9+#include <linux/types.h>
10+#include <linux/errno.h>
11+#include <linux/sched.h>
12+#include <linux/tty.h>
13+#include <linux/timer.h>
14+#include <linux/config.h>
15+#include <linux/kernel.h>
16+#include <linux/wait.h>
17+#include <linux/string.h>
18+#include <linux/slab.h>
19+#include <linux/ioport.h>
20+#include <linux/delay.h>
21+#include <linux/miscdevice.h>
22+#include <linux/fs.h>
23+#include <linux/mm.h>
24+#include <linux/init.h>
25+
26+#include <asm/uaccess.h>
27+#include <asm/io.h>
28+#include <asm/prom.h>
29+
30+#define BRIQ_PANEL_MINOR 156
31+#define BRIQ_PANEL_VFD_IOPORT 0x0390
32+#define BRIQ_PANEL_LED_IOPORT 0x0398
33+#define BRIQ_PANEL_VER "1.1 (04/20/2002)"
34+#define BRIQ_PANEL_MSG0 "Loading Linux"
35+
36+static int vfd_is_open;
37+static unsigned char vfd[40];
38+static int vfd_cursor;
39+static unsigned char ledpb, led;
40+
41+static void update_vfd(void)
42+{
43+ int i;
44+
45+ /* cursor home */
46+ outb(0x02, BRIQ_PANEL_VFD_IOPORT);
47+ for (i=0; i<20; i++)
48+ outb(vfd[i], BRIQ_PANEL_VFD_IOPORT + 1);
49+
50+ /* cursor to next line */
51+ outb(0xc0, BRIQ_PANEL_VFD_IOPORT);
52+ for (i=20; i<40; i++)
53+ outb(vfd[i], BRIQ_PANEL_VFD_IOPORT + 1);
54+
55+}
56+
57+static void set_led(char state)
58+{
59+ if (state == 'R')
60+ led = 0x01;
61+ else if (state == 'G')
62+ led = 0x02;
63+ else if (state == 'Y')
64+ led = 0x03;
65+ else if (state == 'X')
66+ led = 0x00;
67+ outb(led, BRIQ_PANEL_LED_IOPORT);
68+}
69+
70+static int briq_panel_open(struct inode *ino, struct file *filep)
71+{
72+ /* enforce single access */
73+ if (vfd_is_open)
74+ return -EBUSY;
75+ vfd_is_open = 1;
76+
77+ return 0;
78+}
79+
80+static int briq_panel_release(struct inode *ino, struct file *filep)
81+{
82+ if (!vfd_is_open)
83+ return -ENODEV;
84+
85+ vfd_is_open = 0;
86+
87+ return 0;
88+}
89+
90+static ssize_t briq_panel_read(struct file *file, char *buf, size_t count,
91+ loff_t *ppos)
92+{
93+ unsigned short c;
94+ unsigned char cp;
95+
96+#if 0 /* Can't seek (pread) on this device */
97+ if (ppos != &file->f_pos)
98+ return -ESPIPE;
99+#endif
100+
101+ if (!vfd_is_open)
102+ return -ENODEV;
103+
104+ c = (inb(BRIQ_PANEL_LED_IOPORT) & 0x000c) | (ledpb & 0x0003);
105+ set_led(' ');
106+ /* upper button released */
107+ if ((!(ledpb & 0x0004)) && (c & 0x0004)) {
108+ cp = ' ';
109+ ledpb = c;
110+ if (copy_to_user(buf, &cp, 1))
111+ return -EFAULT;
112+ return 1;
113+ }
114+ /* lower button released */
115+ else if ((!(ledpb & 0x0008)) && (c & 0x0008)) {
116+ cp = '\r';
117+ ledpb = c;
118+ if (copy_to_user(buf, &cp, 1))
119+ return -EFAULT;
120+ return 1;
121+ } else {
122+ ledpb = c;
123+ return 0;
124+ }
125+}
126+
127+static void scroll_vfd( void )
128+{
129+ int i;
130+
131+ for (i=0; i<20; i++) {
132+ vfd[i] = vfd[i+20];
133+ vfd[i+20] = ' ';
134+ }
135+ vfd_cursor = 20;
136+}
137+
138+static ssize_t briq_panel_write(struct file *file, const char *buf, size_t len,
139+ loff_t *ppos)
140+{
141+ size_t indx = len;
142+ int i, esc = 0;
143+
144+#if 0 /* Can't seek (pwrite) on this device */
145+ if (ppos != &file->f_pos)
146+ return -ESPIPE;
147+#endif
148+
149+ if (!vfd_is_open)
150+ return -EBUSY;
151+
152+ for (;;) {
153+ if (!indx)
154+ break;
155+ if (esc) {
156+ set_led(*buf);
157+ esc = 0;
158+ } else if (*buf == 27) {
159+ esc = 1;
160+ } else if (*buf == 12) {
161+ /* do a form feed */
162+ for (i=0; i<40; i++)
163+ vfd[i] = ' ';
164+ vfd_cursor = 0;
165+ } else if (*buf == 10) {
166+ if (vfd_cursor < 20)
167+ vfd_cursor = 20;
168+ else if (vfd_cursor < 40)
169+ vfd_cursor = 40;
170+ else if (vfd_cursor < 60)
171+ vfd_cursor = 60;
172+ if (vfd_cursor > 59)
173+ scroll_vfd();
174+ } else {
175+ /* just a character */
176+ if (vfd_cursor > 39)
177+ scroll_vfd();
178+ vfd[vfd_cursor++] = *buf;
179+ }
180+ indx--;
181+ buf++;
182+ }
183+ update_vfd();
184+
185+ return len;
186+}
187+
188+static struct file_operations briq_panel_fops = {
189+ .owner = THIS_MODULE,
190+ .read = briq_panel_read,
191+ .write = briq_panel_write,
192+ .open = briq_panel_open,
193+ .release = briq_panel_release,
194+};
195+
196+static struct miscdevice briq_panel_miscdev = {
197+ BRIQ_PANEL_MINOR,
198+ "briq_panel",
199+ &briq_panel_fops
200+};
201+
202+static int __init briq_panel_init(void)
203+{
204+ struct device_node *root = find_path_device("/");
205+ char *machine;
206+ int i;
207+
208+ machine = get_property(root, "model", NULL);
209+ if (!machine || strncmp(machine, "TotalImpact,BRIQ-1", 18) != 0)
210+ return -ENODEV;
211+
212+ printk(KERN_INFO
213+ "briq_panel: v%s Dr. Karsten Jeppesen (kj@totalimpact.com)\n",
214+ BRIQ_PANEL_VER);
215+
216+ if (!request_region(BRIQ_PANEL_VFD_IOPORT, 4, "BRIQ Front Panel"))
217+ return -EBUSY;
218+
219+ if (!request_region(BRIQ_PANEL_LED_IOPORT, 2, "BRIQ Front Panel")) {
220+ release_region(BRIQ_PANEL_VFD_IOPORT, 4);
221+ return -EBUSY;
222+ }
223+ ledpb = inb(BRIQ_PANEL_LED_IOPORT) & 0x000c;
224+
225+ if (misc_register(&briq_panel_miscdev) < 0) {
226+ release_region(BRIQ_PANEL_VFD_IOPORT, 4);
227+ release_region(BRIQ_PANEL_LED_IOPORT, 2);
228+ return -EBUSY;
229+ }
230+
231+ outb(0x38, BRIQ_PANEL_VFD_IOPORT); /* Function set */
232+ outb(0x01, BRIQ_PANEL_VFD_IOPORT); /* Clear display */
233+ outb(0x0c, BRIQ_PANEL_VFD_IOPORT); /* Display on */
234+ outb(0x06, BRIQ_PANEL_VFD_IOPORT); /* Entry normal */
235+ for (i=0; i<40; i++)
236+ vfd[i]=' ';
237+#ifndef MODULE
238+ vfd[0] = 'L';
239+ vfd[1] = 'o';
240+ vfd[2] = 'a';
241+ vfd[3] = 'd';
242+ vfd[4] = 'i';
243+ vfd[5] = 'n';
244+ vfd[6] = 'g';
245+ vfd[7] = ' ';
246+ vfd[8] = '.';
247+ vfd[9] = '.';
248+ vfd[10] = '.';
249+#endif /* !MODULE */
250+
251+ update_vfd();
252+
253+ return 0;
254+}
255+
256+static void __exit briq_panel_exit(void)
257+{
258+ misc_deregister(&briq_panel_miscdev);
259+ release_region(BRIQ_PANEL_VFD_IOPORT, 4);
260+ release_region(BRIQ_PANEL_LED_IOPORT, 2);
261+}
262+
263+module_init(briq_panel_init);
264+module_exit(briq_panel_exit);
265+
266+MODULE_LICENSE("GPL");
267+MODULE_AUTHOR("Karsten Jeppesen <karsten@jeppesens.com>");
268+MODULE_DESCRIPTION("Driver for the Total Impact briQ front panel");
drivers/char/hvc_console.c+10−8
@@ -80,7 +80,8 @@ struct hvc_struct { · 79 unmodified lines
8080 struct tty_struct *tty;
8181 unsigned int count;
8282 int do_wakeup;
83− char outbuf[N_OUTBUF] __ALIGNED__;
83+ char *outbuf;
84+ int outbuf_size;
8485 int n_outbuf;
8586 uint32_t vtermno;
8687 struct hv_ops *ops;
@@ -319,10 +320,8 @@ static int hvc_open(struct tty_struct *tty, struct file * filp) · 232 unmodified lines
319320 struct kobject *kobjp;
320321
321322 /* Auto increments kobject reference if found. */
322− if (!(hp = hvc_get_by_index(tty->index))) {
323− printk(KERN_WARNING "hvc_console: tty open failed, no vty associated with tty.\n");
323+ if (!(hp = hvc_get_by_index(tty->index)))
324324 return -ENODEV;
325− }
326325
327326 spin_lock_irqsave(&hp->lock, flags);
328327 /* Check and then increment for fast path open. */
@@ -505,7 +504,7 @@ static int hvc_write(struct tty_struct *tty, const unsigned char *buf, int count · 176 unmodified lines
505504 if (hp->n_outbuf > 0)
506505 hvc_push(hp);
507506
508− while (count > 0 && (rsize = N_OUTBUF - hp->n_outbuf) > 0) {
507+ while (count > 0 && (rsize = hp->outbuf_size - hp->n_outbuf) > 0) {
509508 if (rsize > count)
510509 rsize = count;
511510 memcpy(hp->outbuf + hp->n_outbuf, buf, rsize);
@@ -538,7 +537,7 @@ static int hvc_write_room(struct tty_struct *tty) · 26 unmodified lines
538537 if (!hp)
539538 return -1;
540539
541− return N_OUTBUF - hp->n_outbuf;
540+ return hp->outbuf_size - hp->n_outbuf;
542541 }
543542
544543 static int hvc_chars_in_buffer(struct tty_struct *tty)
@@ -729,12 +728,13 @@ static struct kobj_type hvc_kobj_type = { · 184 unmodified lines
729728 };
730729
731730 struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int irq,
732− struct hv_ops *ops)
731+ struct hv_ops *ops, int outbuf_size)
733732 {
734733 struct hvc_struct *hp;
735734 int i;
736735
737− hp = kmalloc(sizeof(*hp), GFP_KERNEL);
736+ hp = kmalloc(ALIGN(sizeof(*hp), sizeof(long)) + outbuf_size,
737+ GFP_KERNEL);
738738 if (!hp)
739739 return ERR_PTR(-ENOMEM);
740740
@@ -743,6 +743,8 @@ struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int irq, · 2 unmodified lines
743743 hp->vtermno = vtermno;
744744 hp->irq = irq;
745745 hp->ops = ops;
746+ hp->outbuf_size = outbuf_size;
747+ hp->outbuf = &((char *)hp)[ALIGN(sizeof(*hp), sizeof(long))];
746748
747749 kobject_init(&hp->kobj);
748750 hp->kobj.ktype = &hvc_kobj_type;
drivers/char/hvc_console.h+1−1
@@ -56,7 +56,7 @@ extern int hvc_instantiate(uint32_t vtermno, int index, struct hv_ops *ops); · 55 unmodified lines
5656
5757 /* register a vterm for hvc tty operation (module_init or hotplug add) */
5858 extern struct hvc_struct * __devinit hvc_alloc(uint32_t vtermno, int irq,
59− struct hv_ops *ops);
59+ struct hv_ops *ops, int outbuf_size);
6060 /* remove a vterm from hvc tty operation (modele_exit or hotplug remove) */
6161 extern int __devexit hvc_remove(struct hvc_struct *hp);
6262
drivers/char/hvc_iseries.c+594−0
@@ -0,0 +1,594 @@
1+/*
2+ * iSeries vio driver interface to hvc_console.c
3+ *
4+ * This code is based heavily on hvc_vio.c and viocons.c
5+ *
6+ * Copyright (C) 2006 Stephen Rothwell, IBM Corporation
7+ *
8+ * This program is free software; you can redistribute it and/or modify
9+ * it under the terms of the GNU General Public License as published by
10+ * the Free Software Foundation; either version 2 of the License, or
11+ * (at your option) any later version.
12+ *
13+ * This program is distributed in the hope that it will be useful,
14+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+ * GNU General Public License for more details.
17+ *
18+ * You should have received a copy of the GNU General Public License
19+ * along with this program; if not, write to the Free Software
20+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21+ */
22+#include <stdarg.h>
23+#include <linux/types.h>
24+#include <linux/init.h>
25+#include <linux/kernel.h>
26+#include <linux/spinlock.h>
27+#include <linux/console.h>
28+
29+#include <asm/hvconsole.h>
30+#include <asm/vio.h>
31+#include <asm/prom.h>
32+#include <asm/iseries/vio.h>
33+#include <asm/iseries/hv_call.h>
34+#include <asm/iseries/hv_lp_config.h>
35+#include <asm/iseries/hv_lp_event.h>
36+
37+#include "hvc_console.h"
38+
39+#define VTTY_PORTS 10
40+
41+static DEFINE_SPINLOCK(consolelock);
42+static DEFINE_SPINLOCK(consoleloglock);
43+
44+static const char hvc_driver_name[] = "hvc_console";
45+
46+#define IN_BUF_SIZE 200
47+
48+/*
49+ * Our port information.
50+ */
51+static struct port_info {
52+ HvLpIndex lp;
53+ u64 seq; /* sequence number of last HV send */
54+ u64 ack; /* last ack from HV */
55+ struct hvc_struct *hp;
56+ int in_start;
57+ int in_end;
58+ unsigned char in_buf[IN_BUF_SIZE];
59+} port_info[VTTY_PORTS] = {
60+ [ 0 ... VTTY_PORTS - 1 ] = {
61+ .lp = HvLpIndexInvalid
62+ }
63+};
64+
65+#define viochar_is_console(pi) ((pi) == &port_info[0])
66+
67+static struct vio_device_id hvc_driver_table[] __devinitdata = {
68+ {"serial", "IBM,iSeries-vty"},
69+ { "", "" }
70+};
71+MODULE_DEVICE_TABLE(vio, hvc_driver_table);
72+
73+static void hvlog(char *fmt, ...)
74+{
75+ int i;
76+ unsigned long flags;
77+ va_list args;
78+ static char buf[256];
79+
80+ spin_lock_irqsave(&consoleloglock, flags);
81+ va_start(args, fmt);
82+ i = vscnprintf(buf, sizeof(buf) - 1, fmt, args);
83+ va_end(args);
84+ buf[i++] = '\r';
85+ HvCall_writeLogBuffer(buf, i);
86+ spin_unlock_irqrestore(&consoleloglock, flags);
87+}
88+
89+/*
90+ * Initialize the common fields in a charLpEvent
91+ */
92+static void init_data_event(struct viocharlpevent *viochar, HvLpIndex lp)
93+{
94+ struct HvLpEvent *hev = &viochar->event;
95+
96+ memset(viochar, 0, sizeof(struct viocharlpevent));
97+
98+ hev->flags = HV_LP_EVENT_VALID | HV_LP_EVENT_DEFERRED_ACK |
99+ HV_LP_EVENT_INT;
100+ hev->xType = HvLpEvent_Type_VirtualIo;
101+ hev->xSubtype = viomajorsubtype_chario | viochardata;
102+ hev->xSourceLp = HvLpConfig_getLpIndex();
103+ hev->xTargetLp = lp;
104+ hev->xSizeMinus1 = sizeof(struct viocharlpevent);
105+ hev->xSourceInstanceId = viopath_sourceinst(lp);
106+ hev->xTargetInstanceId = viopath_targetinst(lp);
107+}
108+
109+static int get_chars(uint32_t vtermno, char *buf, int count)
110+{
111+ struct port_info *pi;
112+ int n = 0;
113+ unsigned long flags;
114+
115+ if (vtermno >= VTTY_PORTS)
116+ return -EINVAL;
117+ if (count == 0)
118+ return 0;
119+
120+ pi = &port_info[vtermno];
121+ spin_lock_irqsave(&consolelock, flags);
122+
123+ if (pi->in_end == 0)
124+ goto done;
125+
126+ n = pi->in_end - pi->in_start;
127+ if (n > count)
128+ n = count;
129+ memcpy(buf, &pi->in_buf[pi->in_start], n);
130+ pi->in_start += n;
131+ if (pi->in_start == pi->in_end) {
132+ pi->in_start = 0;
133+ pi->in_end = 0;
134+ }
135+done:
136+ spin_unlock_irqrestore(&consolelock, flags);
137+ return n;
138+}
139+
140+static int put_chars(uint32_t vtermno, const char *buf, int count)
141+{
142+ struct viocharlpevent *viochar;
143+ struct port_info *pi;
144+ HvLpEvent_Rc hvrc;
145+ unsigned long flags;
146+ int sent = 0;
147+
148+ if (vtermno >= VTTY_PORTS)
149+ return -EINVAL;
150+
151+ pi = &port_info[vtermno];
152+
153+ spin_lock_irqsave(&consolelock, flags);
154+
155+ if (viochar_is_console(pi) && !viopath_isactive(pi->lp)) {
156+ spin_lock_irqsave(&consoleloglock, flags);
157+ HvCall_writeLogBuffer(buf, count);
158+ spin_unlock_irqrestore(&consoleloglock, flags);
159+ sent = count;
160+ goto done;
161+ }
162+
163+ viochar = vio_get_event_buffer(viomajorsubtype_chario);
164+ if (viochar == NULL) {
165+ hvlog("\n\rviocons: Can't get viochar buffer.");
166+ goto done;
167+ }
168+
169+ while ((count > 0) && ((pi->seq - pi->ack) < VIOCHAR_WINDOW)) {
170+ int len;
171+
172+ len = (count > VIOCHAR_MAX_DATA) ? VIOCHAR_MAX_DATA : count;
173+
174+ if (viochar_is_console(pi)) {
175+ spin_lock_irqsave(&consoleloglock, flags);
176+ HvCall_writeLogBuffer(buf, len);
177+ spin_unlock_irqrestore(&consoleloglock, flags);
178+ }
179+
180+ init_data_event(viochar, pi->lp);
181+
182+ viochar->len = len;
183+ viochar->event.xCorrelationToken = pi->seq++;
184+ viochar->event.xSizeMinus1 =
185+ offsetof(struct viocharlpevent, data) + len;
186+
187+ memcpy(viochar->data, buf, len);
188+
189+ hvrc = HvCallEvent_signalLpEvent(&viochar->event);
190+ if (hvrc)
191+ hvlog("\n\rerror sending event! return code %d\n\r",
192+ (int)hvrc);
193+ sent += len;
194+ count -= len;
195+ buf += len;
196+ }
197+
198+ vio_free_event_buffer(viomajorsubtype_chario, viochar);
199+done:
200+ spin_unlock_irqrestore(&consolelock, flags);
201+ return sent;
202+}
203+
204+static struct hv_ops hvc_get_put_ops = {
205+ .get_chars = get_chars,
206+ .put_chars = put_chars,
207+};
208+
209+static int __devinit hvc_vio_probe(struct vio_dev *vdev,
210+ const struct vio_device_id *id)
211+{
212+ struct hvc_struct *hp;
213+ struct port_info *pi;
214+
215+ /* probed with invalid parameters. */
216+ if (!vdev || !id)
217+ return -EPERM;
218+
219+ if (vdev->unit_address >= VTTY_PORTS)
220+ return -ENODEV;
221+
222+ pi = &port_info[vdev->unit_address];
223+
224+ hp = hvc_alloc(vdev->unit_address, vdev->irq, &hvc_get_put_ops,
225+ VIOCHAR_MAX_DATA);
226+ if (IS_ERR(hp))
227+ return PTR_ERR(hp);
228+ pi->hp = hp;
229+ dev_set_drvdata(&vdev->dev, pi);
230+
231+ return 0;
232+}
233+
234+static int __devexit hvc_vio_remove(struct vio_dev *vdev)
235+{
236+ struct port_info *pi = dev_get_drvdata(&vdev->dev);
237+ struct hvc_struct *hp = pi->hp;
238+
239+ return hvc_remove(hp);
240+}
241+
242+static struct vio_driver hvc_vio_driver = {
243+ .id_table = hvc_driver_table,
244+ .probe = hvc_vio_probe,
245+ .remove = hvc_vio_remove,
246+ .driver = {
247+ .name = hvc_driver_name,
248+ .owner = THIS_MODULE,
249+ }
250+};
251+
252+static void hvc_open_event(struct HvLpEvent *event)
253+{
254+ unsigned long flags;
255+ struct viocharlpevent *cevent = (struct viocharlpevent *)event;
256+ u8 port = cevent->virtual_device;
257+ struct port_info *pi;
258+ int reject = 0;
259+
260+ if (hvlpevent_is_ack(event)) {
261+ if (port >= VTTY_PORTS)
262+ return;
263+
264+ spin_lock_irqsave(&consolelock, flags);
265+
266+ pi = &port_info[port];
267+ if (event->xRc == HvLpEvent_Rc_Good) {
268+ pi->seq = pi->ack = 0;
269+ /*
270+ * This line allows connections from the primary
271+ * partition but once one is connected from the
272+ * primary partition nothing short of a reboot
273+ * of linux will allow access from the hosting
274+ * partition again without a required iSeries fix.
275+ */
276+ pi->lp = event->xTargetLp;
277+ }
278+
279+ spin_unlock_irqrestore(&consolelock, flags);
280+ if (event->xRc != HvLpEvent_Rc_Good)
281+ printk(KERN_WARNING
282+ "hvc: handle_open_event: event->xRc == (%d).\n",
283+ event->xRc);
284+
285+ if (event->xCorrelationToken != 0) {
286+ atomic_t *aptr= (atomic_t *)event->xCorrelationToken;
287+ atomic_set(aptr, 1);
288+ } else
289+ printk(KERN_WARNING
290+ "hvc: weird...got open ack without atomic\n");
291+ return;
292+ }
293+
294+ /* This had better require an ack, otherwise complain */
295+ if (!hvlpevent_need_ack(event)) {
296+ printk(KERN_WARNING "hvc: viocharopen without ack bit!\n");
297+ return;
298+ }
299+
300+ spin_lock_irqsave(&consolelock, flags);
301+
302+ /* Make sure this is a good virtual tty */
303+ if (port >= VTTY_PORTS) {
304+ event->xRc = HvLpEvent_Rc_SubtypeError;
305+ cevent->subtype_result_code = viorc_openRejected;
306+ /*
307+ * Flag state here since we can't printk while holding
308+ * the consolelock spinlock.
309+ */
310+ reject = 1;
311+ } else {
312+ pi = &port_info[port];
313+ if ((pi->lp != HvLpIndexInvalid) &&
314+ (pi->lp != event->xSourceLp)) {
315+ /*
316+ * If this is tty is already connected to a different
317+ * partition, fail.
318+ */
319+ event->xRc = HvLpEvent_Rc_SubtypeError;
320+ cevent->subtype_result_code = viorc_openRejected;
321+ reject = 2;
322+ } else {
323+ pi->lp = event->xSourceLp;
324+ event->xRc = HvLpEvent_Rc_Good;
325+ cevent->subtype_result_code = viorc_good;
326+ pi->seq = pi->ack = 0;
327+ }
328+ }
329+
330+ spin_unlock_irqrestore(&consolelock, flags);
331+
332+ if (reject == 1)
333+ printk(KERN_WARNING "hvc: open rejected: bad virtual tty.\n");
334+ else if (reject == 2)
335+ printk(KERN_WARNING "hvc: open rejected: console in exclusive "
336+ "use by another partition.\n");
337+
338+ /* Return the acknowledgement */
339+ HvCallEvent_ackLpEvent(event);
340+}
341+
342+/*
343+ * Handle a close charLpEvent. This should ONLY be an Interrupt because the
344+ * virtual console should never actually issue a close event to the hypervisor
345+ * because the virtual console never goes away. A close event coming from the
346+ * hypervisor simply means that there are no client consoles connected to the
347+ * virtual console.
348+ */
349+static void hvc_close_event(struct HvLpEvent *event)
350+{
351+ unsigned long flags;
352+ struct viocharlpevent *cevent = (struct viocharlpevent *)event;
353+ u8 port = cevent->virtual_device;
354+
355+ if (!hvlpevent_is_int(event)) {
356+ printk(KERN_WARNING
357+ "hvc: got unexpected close acknowlegement\n");
358+ return;
359+ }
360+
361+ if (port >= VTTY_PORTS) {
362+ printk(KERN_WARNING
363+ "hvc: close message from invalid virtual device.\n");
364+ return;
365+ }
366+
367+ /* For closes, just mark the console partition invalid */
368+ spin_lock_irqsave(&consolelock, flags);
369+
370+ if (port_info[port].lp == event->xSourceLp)
371+ port_info[port].lp = HvLpIndexInvalid;
372+
373+ spin_unlock_irqrestore(&consolelock, flags);
374+}
375+
376+static void hvc_data_event(struct HvLpEvent *event)
377+{
378+ unsigned long flags;
379+ struct viocharlpevent *cevent = (struct viocharlpevent *)event;
380+ struct port_info *pi;
381+ int n;
382+ u8 port = cevent->virtual_device;
383+
384+ if (port >= VTTY_PORTS) {
385+ printk(KERN_WARNING "hvc: data on invalid virtual device %d\n",
386+ port);
387+ return;
388+ }
389+ if (cevent->len == 0)
390+ return;
391+
392+ /*
393+ * Change 05/01/2003 - Ryan Arnold: If a partition other than
394+ * the current exclusive partition tries to send us data
395+ * events then just drop them on the floor because we don't
396+ * want his stinking data. He isn't authorized to receive
397+ * data because he wasn't the first one to get the console,
398+ * therefore he shouldn't be allowed to send data either.
399+ * This will work without an iSeries fix.
400+ */
401+ pi = &port_info[port];
402+ if (pi->lp != event->xSourceLp)
403+ return;
404+
405+ spin_lock_irqsave(&consolelock, flags);
406+
407+ n = IN_BUF_SIZE - pi->in_end;
408+ if (n > cevent->len)
409+ n = cevent->len;
410+ if (n > 0) {
411+ memcpy(&pi->in_buf[pi->in_end], cevent->data, n);
412+ pi->in_end += n;
413+ }
414+ spin_unlock_irqrestore(&consolelock, flags);
415+ if (n == 0)
416+ printk(KERN_WARNING "hvc: input buffer overflow\n");
417+}
418+
419+static void hvc_ack_event(struct HvLpEvent *event)
420+{
421+ struct viocharlpevent *cevent = (struct viocharlpevent *)event;
422+ unsigned long flags;
423+ u8 port = cevent->virtual_device;
424+
425+ if (port >= VTTY_PORTS) {
426+ printk(KERN_WARNING "hvc: data on invalid virtual device\n");
427+ return;
428+ }
429+
430+ spin_lock_irqsave(&consolelock, flags);
431+ port_info[port].ack = event->xCorrelationToken;
432+ spin_unlock_irqrestore(&consolelock, flags);
433+}
434+
435+static void hvc_config_event(struct HvLpEvent *event)
436+{
437+ struct viocharlpevent *cevent = (struct viocharlpevent *)event;
438+
439+ if (cevent->data[0] == 0x01)
440+ printk(KERN_INFO "hvc: window resized to %d: %d: %d: %d\n",
441+ cevent->data[1], cevent->data[2],
442+ cevent->data[3], cevent->data[4]);
443+ else
444+ printk(KERN_WARNING "hvc: unknown config event\n");
445+}
446+
447+static void hvc_handle_event(struct HvLpEvent *event)
448+{
449+ int charminor;
450+
451+ if (event == NULL)
452+ return;
453+
454+ charminor = event->xSubtype & VIOMINOR_SUBTYPE_MASK;
455+ switch (charminor) {
456+ case viocharopen:
457+ hvc_open_event(event);
458+ break;
459+ case viocharclose:
460+ hvc_close_event(event);
461+ break;
462+ case viochardata:
463+ hvc_data_event(event);
464+ break;
465+ case viocharack:
466+ hvc_ack_event(event);
467+ break;
468+ case viocharconfig:
469+ hvc_config_event(event);
470+ break;
471+ default:
472+ if (hvlpevent_is_int(event) && hvlpevent_need_ack(event)) {
473+ event->xRc = HvLpEvent_Rc_InvalidSubtype;
474+ HvCallEvent_ackLpEvent(event);
475+ }
476+ }
477+}
478+
479+static int send_open(HvLpIndex remoteLp, void *sem)
480+{
481+ return HvCallEvent_signalLpEventFast(remoteLp,
482+ HvLpEvent_Type_VirtualIo,
483+ viomajorsubtype_chario | viocharopen,
484+ HvLpEvent_AckInd_DoAck, HvLpEvent_AckType_ImmediateAck,
485+ viopath_sourceinst(remoteLp),
486+ viopath_targetinst(remoteLp),
487+ (u64)(unsigned long)sem, VIOVERSION << 16,
488+ 0, 0, 0, 0);
489+}
490+
491+static int hvc_vio_init(void)
492+{
493+ atomic_t wait_flag;
494+ int rc;
495+
496+ /* +2 for fudge */
497+ rc = viopath_open(HvLpConfig_getPrimaryLpIndex(),
498+ viomajorsubtype_chario, VIOCHAR_WINDOW + 2);
499+ if (rc)
500+ printk(KERN_WARNING "hvc: error opening to primary %d\n", rc);
501+
502+ if (viopath_hostLp == HvLpIndexInvalid)
503+ vio_set_hostlp();
504+
505+ /*
506+ * And if the primary is not the same as the hosting LP, open to the
507+ * hosting lp
508+ */
509+ if ((viopath_hostLp != HvLpIndexInvalid) &&
510+ (viopath_hostLp != HvLpConfig_getPrimaryLpIndex())) {
511+ printk(KERN_INFO "hvc: open path to hosting (%d)\n",
512+ viopath_hostLp);
513+ rc = viopath_open(viopath_hostLp, viomajorsubtype_chario,
514+ VIOCHAR_WINDOW + 2); /* +2 for fudge */
515+ if (rc)
516+ printk(KERN_WARNING
517+ "error opening to partition %d: %d\n",
518+ viopath_hostLp, rc);
519+ }
520+
521+ if (vio_setHandler(viomajorsubtype_chario, hvc_handle_event) < 0)
522+ printk(KERN_WARNING
523+ "hvc: error seting handler for console events!\n");
524+
525+ /*
526+ * First, try to open the console to the hosting lp.
527+ * Wait on a semaphore for the response.
528+ */
529+ atomic_set(&wait_flag, 0);
530+ if ((viopath_isactive(viopath_hostLp)) &&
531+ (send_open(viopath_hostLp, &wait_flag) == 0)) {
532+ printk(KERN_INFO "hvc: hosting partition %d\n", viopath_hostLp);
533+ while (atomic_read(&wait_flag) == 0)
534+ mb();
535+ atomic_set(&wait_flag, 0);
536+ }
537+
538+ /*
539+ * If we don't have an active console, try the primary
540+ */
541+ if ((!viopath_isactive(port_info[0].lp)) &&
542+ (viopath_isactive(HvLpConfig_getPrimaryLpIndex())) &&
543+ (send_open(HvLpConfig_getPrimaryLpIndex(), &wait_flag) == 0)) {
544+ printk(KERN_INFO "hvc: opening console to primary partition\n");
545+ while (atomic_read(&wait_flag) == 0)
546+ mb();
547+ }
548+
549+ /* Register as a vio device to receive callbacks */
550+ rc = vio_register_driver(&hvc_vio_driver);
551+
552+ return rc;
553+}
554+module_init(hvc_vio_init); /* after drivers/char/hvc_console.c */
555+
556+static void hvc_vio_exit(void)
557+{
558+ vio_unregister_driver(&hvc_vio_driver);
559+}
560+module_exit(hvc_vio_exit);
561+
562+/* the device tree order defines our numbering */
563+static int hvc_find_vtys(void)
564+{
565+ struct device_node *vty;
566+ int num_found = 0;
567+
568+ for (vty = of_find_node_by_name(NULL, "vty"); vty != NULL;
569+ vty = of_find_node_by_name(vty, "vty")) {
570+ uint32_t *vtermno;
571+
572+ /* We have statically defined space for only a certain number
573+ * of console adapters.
574+ */
575+ if ((num_found >= MAX_NR_HVC_CONSOLES) ||
576+ (num_found >= VTTY_PORTS))
577+ break;
578+
579+ vtermno = (uint32_t *)get_property(vty, "reg", NULL);
580+ if (!vtermno)
581+ continue;
582+
583+ if (!device_is_compatible(vty, "IBM,iSeries-vty"))
584+ continue;
585+
586+ if (num_found == 0)
587+ add_preferred_console("hvc", 0, NULL);
588+ hvc_instantiate(*vtermno, num_found, &hvc_get_put_ops);
589+ ++num_found;
590+ }
591+
592+ return num_found;
593+}
594+console_initcall(hvc_find_vtys);
drivers/char/hvc_rtas.c+1−1
@@ -94,7 +94,7 @@ static int hvc_rtas_init(void) · 93 unmodified lines
9494
9595 /* Allocate an hvc_struct for the console device we instantiated
9696 * earlier. Save off hp so that we can return it on exit */
97− hp = hvc_alloc(hvc_rtas_cookie, NO_IRQ, &hvc_rtas_get_put_ops);
97+ hp = hvc_alloc(hvc_rtas_cookie, NO_IRQ, &hvc_rtas_get_put_ops, 16);
9898 if (IS_ERR(hp))
9999 return PTR_ERR(hp);
100100
drivers/char/hvc_vio.c+4−3
@@ -90,7 +90,8 @@ static int __devinit hvc_vio_probe(struct vio_dev *vdev, · 89 unmodified lines
9090 if (!vdev || !id)
9191 return -EPERM;
9292
93− hp = hvc_alloc(vdev->unit_address, vdev->irq, &hvc_get_put_ops);
93+ hp = hvc_alloc(vdev->unit_address, vdev->irq, &hvc_get_put_ops,
94+ MAX_VIO_PUT_CHARS);
9495 if (IS_ERR(hp))
9596 return PTR_ERR(hp);
9697 dev_set_drvdata(&vdev->dev, hp);
@@ -140,7 +141,7 @@ static int hvc_find_vtys(void) · 43 unmodified lines
140141
141142 for (vty = of_find_node_by_name(NULL, "vty"); vty != NULL;
142143 vty = of_find_node_by_name(vty, "vty")) {
143− uint32_t *vtermno;
144+ const uint32_t *vtermno;
144145
145146 /* We have statically defined space for only a certain number
146147 * of console adapters.
@@ -148,7 +149,7 @@ static int hvc_find_vtys(void) · 1 unmodified line
148149 if (num_found >= MAX_NR_HVC_CONSOLES)
149150 break;
150151
151− vtermno = (uint32_t *)get_property(vty, "reg", NULL);
152+ vtermno = get_property(vty, "reg", NULL);
152153 if (!vtermno)
153154 continue;
154155
drivers/char/hvsi.c+3−4
@@ -1274,11 +1274,10 @@ static int __init hvsi_console_init(void) · 1273 unmodified lines
12741274 vty != NULL;
12751275 vty = of_find_compatible_node(vty, "serial", "hvterm-protocol")) {
12761276 struct hvsi_struct *hp;
1277− uint32_t *vtermno;
1278− uint32_t *irq;
1277+ const uint32_t *vtermno, *irq;
12791278
1280− vtermno = (uint32_t *)get_property(vty, "reg", NULL);
1281− irq = (uint32_t *)get_property(vty, "interrupts", NULL);
1279+ vtermno = get_property(vty, "reg", NULL);
1280+ irq = get_property(vty, "interrupts", NULL);
12821281 if (!vtermno || !irq)
12831282 continue;
12841283
drivers/char/tpm/tpm_atmel.h+2−2
@@ -37,7 +37,7 @@ static void __iomem * atmel_get_base_addr(unsigned long *base, int *region_size) · 36 unmodified lines
3737 {
3838 struct device_node *dn;
3939 unsigned long address, size;
40− unsigned int *reg;
40+ const unsigned int *reg;
4141 int reglen;
4242 int naddrc;
4343 int nsizec;
@@ -52,7 +52,7 @@ static void __iomem * atmel_get_base_addr(unsigned long *base, int *region_size) · 8 unmodified lines
5252 return NULL;
5353 }
5454
55− reg = (unsigned int *) get_property(dn, "reg", &reglen);
55+ reg = get_property(dn, "reg", &reglen);
5656 naddrc = prom_n_addr_cells(dn);
5757 nsizec = prom_n_size_cells(dn);
5858
drivers/char/viocons.c+1−30
@@ -43,7 +43,6 @@ · 42 unmodified lines
4343 #include <linux/sysrq.h>
4444
4545 #include <asm/iseries/vio.h>
46−
4746 #include <asm/iseries/hv_lp_event.h>
4847 #include <asm/iseries/hv_call_event.h>
4948 #include <asm/iseries/hv_lp_config.h>
@@ -67,35 +66,6 @@ static int vio_sysrq_pressed; · 17 unmodified lines
6766 extern int sysrq_enabled;
6867 #endif
6968
70−/*
71− * The structure of the events that flow between us and OS/400. You can't
72− * mess with this unless the OS/400 side changes too
73− */
74−struct viocharlpevent {
75− struct HvLpEvent event;
76− u32 reserved;
77− u16 version;
78− u16 subtype_result_code;
79− u8 virtual_device;
80− u8 len;
81− u8 data[VIOCHAR_MAX_DATA];
82−};
83−
84−#define VIOCHAR_WINDOW 10
85−#define VIOCHAR_HIGHWATERMARK 3
86−
87−enum viocharsubtype {
88− viocharopen = 0x0001,
89− viocharclose = 0x0002,
90− viochardata = 0x0003,
91− viocharack = 0x0004,
92− viocharconfig = 0x0005
93−};
94−
95−enum viochar_rc {
96− viochar_rc_ebusy = 1
97−};
98−
9969 #define VIOCHAR_NUM_BUF 16
10070
10171 /*
@@ -1183,6 +1153,7 @@ static int __init viocons_init(void) · 1081 unmodified lines
11831153 port_info[i].magic = VIOTTY_MAGIC;
11841154 }
11851155 HvCall_setLogBufferFormatAndCodepage(HvCall_LogBuffer_ASCII, 437);
1156+ add_preferred_console("viocons", 0, NULL);
11861157 register_console(&viocons_early);
11871158 return 0;
11881159 }
drivers/char/viotape.c+2−4
@@ -940,7 +940,6 @@ static void vioHandleTapeEvent(struct HvLpEvent *event) · 939 unmodified lines
940940
941941 static int viotape_probe(struct vio_dev *vdev, const struct vio_device_id *id)
942942 {
943− char tapename[32];
944943 int i = vdev->unit_address;
945944 int j;
946945
@@ -956,10 +955,9 @@ static int viotape_probe(struct vio_dev *vdev, const struct vio_device_id *id) · 9 unmodified lines
956955 "iseries!vt%d", i);
957956 class_device_create(tape_class, NULL, MKDEV(VIOTAPE_MAJOR, i | 0x80),
958957 NULL, "iseries!nvt%d", i);
959− sprintf(tapename, "iseries/vt%d", i);
960− printk(VIOTAPE_KERN_INFO "tape %s is iSeries "
958+ printk(VIOTAPE_KERN_INFO "tape iseries/vt%d is iSeries "
961959 "resource %10.10s type %4.4s, model %3.3s\n",
962− tapename, viotape_unitinfo[i].rsrcname,
960+ i, viotape_unitinfo[i].rsrcname,
963961 viotape_unitinfo[i].type, viotape_unitinfo[i].model);
964962 return 0;
965963 }
drivers/i2c/busses/i2c-powermac.c+2−1
@@ -207,7 +207,8 @@ static int i2c_powermac_probe(struct device *dev) · 206 unmodified lines
207207 struct pmac_i2c_bus *bus = dev->platform_data;
208208 struct device_node *parent = NULL;
209209 struct i2c_adapter *adapter;
210− char name[32], *basename;
210+ char name[32];
211+ const char *basename;
211212 int rc;
212213
213214 if (bus == NULL)
drivers/ide/ppc/pmac.c+4−4
@@ -1154,7 +1154,7 @@ static int · 1153 unmodified lines
11541154 pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
11551155 {
11561156 struct device_node *np = pmif->node;
1157− int *bidp;
1157+ const int *bidp;
11581158
11591159 pmif->cable_80 = 0;
11601160 pmif->broken_dma = pmif->broken_dma_warn = 0;
@@ -1176,14 +1176,14 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) · 15 unmodified lines
11761176 pmif->broken_dma = 1;
11771177 }
11781178
1179− bidp = (int *)get_property(np, "AAPL,bus-id", NULL);
1179+ bidp = get_property(np, "AAPL,bus-id", NULL);
11801180 pmif->aapl_bus_id = bidp ? *bidp : 0;
11811181
11821182 /* Get cable type from device-tree */
11831183 if (pmif->kind == controller_kl_ata4 || pmif->kind == controller_un_ata6
11841184 || pmif->kind == controller_k2_ata6
11851185 || pmif->kind == controller_sh_ata6) {
1186− char* cable = get_property(np, "cable-type", NULL);
1186+ const char* cable = get_property(np, "cable-type", NULL);
11871187 if (cable && !strncmp(cable, "80-", 3))
11881188 pmif->cable_80 = 1;
11891189 }
@@ -1326,7 +1326,7 @@ pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *match) · 136 unmodified lines
13261326 if (macio_irq_count(mdev) == 0) {
13271327 printk(KERN_WARNING "ide%d: no intrs for device %s, using 13\n",
13281328 i, mdev->ofdev.node->full_name);
1329− irq = 13;
1329+ irq = irq_create_mapping(NULL, 13);
13301330 } else
13311331 irq = macio_irq(mdev, 0);
13321332
drivers/macintosh/macio_asic.c+6−4
@@ -139,7 +139,9 @@ static int macio_uevent(struct device *dev, char **envp, int num_envp, · 138 unmodified lines
139139 {
140140 struct macio_dev * macio_dev;
141141 struct of_device * of;
142− char *scratch, *compat, *compat2;
142+ char *scratch;
143+ const char *compat, *compat2;
144+
143145 int i = 0;
144146 int length, cplen, cplen2, seen = 0;
145147
@@ -173,7 +175,7 @@ static int macio_uevent(struct device *dev, char **envp, int num_envp, · 27 unmodified lines
173175 * it's not really legal to split it out with commas. We split it
174176 * up using a number of environment variables instead. */
175177
176− compat = (char *) get_property(of->node, "compatible", &cplen);
178+ compat = get_property(of->node, "compatible", &cplen);
177179 compat2 = compat;
178180 cplen2= cplen;
179181 while (compat && cplen > 0) {
@@ -454,7 +456,7 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip, · 274 unmodified lines
454456 struct resource *parent_res)
455457 {
456458 struct macio_dev *dev;
457− u32 *reg;
459+ const u32 *reg;
458460
459461 if (np == NULL)
460462 return NULL;
@@ -489,7 +491,7 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip, · 28 unmodified lines
489491 #endif
490492 MAX_NODE_NAME_SIZE, np->name);
491493 } else {
492− reg = (u32 *)get_property(np, "reg", NULL);
494+ reg = get_property(np, "reg", NULL);
493495 sprintf(dev->ofdev.dev.bus_id, "%1d.%08x:%.*s",
494496 chip->lbus.index,
495497 reg ? *reg : 0, MAX_NODE_NAME_SIZE, np->name);
drivers/macintosh/macio_sysfs.c+4−4
@@ -16,12 +16,12 @@ static ssize_t · 15 unmodified lines
1616 compatible_show (struct device *dev, struct device_attribute *attr, char *buf)
1717 {
1818 struct of_device *of;
19− char *compat;
19+ const char *compat;
2020 int cplen;
2121 int length = 0;
2222
2323 of = &to_macio_device (dev)->ofdev;
24− compat = (char *) get_property(of->node, "compatible", &cplen);
24+ compat = get_property(of->node, "compatible", &cplen);
2525 if (!compat) {
2626 *buf = '\0';
2727 return 0;
@@ -42,12 +42,12 @@ static ssize_t modalias_show (struct device *dev, struct device_attribute *attr, · 14 unmodified lines
4242 char *buf)
4343 {
4444 struct of_device *of;
45− char *compat;
45+ const char *compat;
4646 int cplen;
4747 int length;
4848
4949 of = &to_macio_device (dev)->ofdev;
50− compat = (char *) get_property (of->node, "compatible", &cplen);
50+ compat = get_property(of->node, "compatible", &cplen);
5151 if (!compat) compat = "", cplen = 1;
5252 length = sprintf (buf, "of:N%sT%s", of->node->name, of->node->type);
5353 buf += length;
drivers/macintosh/smu.c+9−10
@@ -454,7 +454,7 @@ EXPORT_SYMBOL(smu_present); · 453 unmodified lines
454454 int __init smu_init (void)
455455 {
456456 struct device_node *np;
457− u32 *data;
457+ const u32 *data;
458458
459459 np = of_find_node_by_type(NULL, "smu");
460460 if (np == NULL)
@@ -490,7 +490,7 @@ int __init smu_init (void) · 29 unmodified lines
490490 printk(KERN_ERR "SMU: Can't find doorbell GPIO !\n");
491491 goto fail;
492492 }
493− data = (u32 *)get_property(smu->db_node, "reg", NULL);
493+ data = get_property(smu->db_node, "reg", NULL);
494494 if (data == NULL) {
495495 of_node_put(smu->db_node);
496496 smu->db_node = NULL;
@@ -511,7 +511,7 @@ int __init smu_init (void) · 14 unmodified lines
511511 smu->msg_node = of_find_node_by_name(NULL, "smu-interrupt");
512512 if (smu->msg_node == NULL)
513513 break;
514− data = (u32 *)get_property(smu->msg_node, "reg", NULL);
514+ data = get_property(smu->msg_node, "reg", NULL);
515515 if (data == NULL) {
516516 of_node_put(smu->msg_node);
517517 smu->msg_node = NULL;
@@ -982,11 +982,11 @@ static struct smu_sdbp_header *smu_create_sdb_partition(int id) · 464 unmodified lines
982982 /* Note: Only allowed to return error code in pointers (using ERR_PTR)
983983 * when interruptible is 1
984984 */
985−struct smu_sdbp_header *__smu_get_sdb_partition(int id, unsigned int *size,
986− int interruptible)
985+const struct smu_sdbp_header *__smu_get_sdb_partition(int id,
986+ unsigned int *size, int interruptible)
987987 {
988988 char pname[32];
989− struct smu_sdbp_header *part;
989+ const struct smu_sdbp_header *part;
990990
991991 if (!smu)
992992 return NULL;
@@ -1003,8 +1003,7 @@ struct smu_sdbp_header *__smu_get_sdb_partition(int id, unsigned int *size, · 10 unmodified lines
10031003 } else
10041004 mutex_lock(&smu_part_access);
10051005
1006− part = (struct smu_sdbp_header *)get_property(smu->of_node,
1007− pname, size);
1006+ part = get_property(smu->of_node, pname, size);
10081007 if (part == NULL) {
10091008 DPRINTK("trying to extract from SMU ...\n");
10101009 part = smu_create_sdb_partition(id);
@@ -1015,7 +1014,7 @@ struct smu_sdbp_header *__smu_get_sdb_partition(int id, unsigned int *size, · 4 unmodified lines
10151014 return part;
10161015 }
10171016
1018−struct smu_sdbp_header *smu_get_sdb_partition(int id, unsigned int *size)
1017+const struct smu_sdbp_header *smu_get_sdb_partition(int id, unsigned int *size)
10191018 {
10201019 return __smu_get_sdb_partition(id, size, 0);
10211020 }
@@ -1094,7 +1093,7 @@ static ssize_t smu_write(struct file *file, const char __user *buf, · 72 unmodified lines
10941093 pp->mode = smu_file_events;
10951094 return 0;
10961095 } else if (hdr.cmdtype == SMU_CMDTYPE_GET_PARTITION) {
1097− struct smu_sdbp_header *part;
1096+ const struct smu_sdbp_header *part;
10981097 part = __smu_get_sdb_partition(hdr.cmd, NULL, 1);
10991098 if (part == NULL)
11001099 return -EINVAL;
drivers/macintosh/therm_adt746x.c+4−4
@@ -47,7 +47,7 @@ static u8 FAN_SPD_SET[2] = {0x30, 0x31}; · 46 unmodified lines
4747
4848 static u8 default_limits_local[3] = {70, 50, 70}; /* local, sensor1, sensor2 */
4949 static u8 default_limits_chip[3] = {80, 65, 80}; /* local, sensor1, sensor2 */
50−static char *sensor_location[3] = {NULL, NULL, NULL};
50+static const char *sensor_location[3] = {NULL, NULL, NULL};
5151
5252 static int limit_adjust = 0;
5353 static int fan_speed = -1;
@@ -553,7 +553,7 @@ static int __init · 499 unmodified lines
553553 thermostat_init(void)
554554 {
555555 struct device_node* np;
556− u32 *prop;
556+ const u32 *prop;
557557 int i = 0, offset = 0;
558558
559559 np = of_find_node_by_name(NULL, "fan");
@@ -566,13 +566,13 @@ thermostat_init(void) · 6 unmodified lines
566566 else
567567 return -ENODEV;
568568
569− prop = (u32 *)get_property(np, "hwsensor-params-version", NULL);
569+ prop = get_property(np, "hwsensor-params-version", NULL);
570570 printk(KERN_INFO "adt746x: version %d (%ssupported)\n", *prop,
571571 (*prop == 1)?"":"un");
572572 if (*prop != 1)
573573 return -ENODEV;
574574
575− prop = (u32 *)get_property(np, "reg", NULL);
575+ prop = get_property(np, "reg", NULL);
576576 if (!prop)
577577 return -ENODEV;
578578
drivers/macintosh/therm_pm72.c+7−7
@@ -660,7 +660,7 @@ static int read_eeprom(int cpu, struct mpu_data *out) · 659 unmodified lines
660660 {
661661 struct device_node *np;
662662 char nodename[64];
663− u8 *data;
663+ const u8 *data;
664664 int len;
665665
666666 /* prom.c routine for finding a node by path is a bit brain dead
@@ -673,7 +673,7 @@ static int read_eeprom(int cpu, struct mpu_data *out) · 6 unmodified lines
673673 printk(KERN_ERR "therm_pm72: Failed to retrieve cpuid node from device-tree\n");
674674 return -ENODEV;
675675 }
676− data = (u8 *)get_property(np, "cpuid", &len);
676+ data = get_property(np, "cpuid", &len);
677677 if (data == NULL) {
678678 printk(KERN_ERR "therm_pm72: Failed to retrieve cpuid property from device-tree\n");
679679 of_node_put(np);
@@ -1336,7 +1336,7 @@ static int init_backside_state(struct backside_pid_state *state) · 656 unmodified lines
13361336 */
13371337 u3 = of_find_node_by_path("/u3@0,f8000000");
13381338 if (u3 != NULL) {
1339− u32 *vers = (u32 *)get_property(u3, "device-rev", NULL);
1339+ const u32 *vers = get_property(u3, "device-rev", NULL);
13401340 if (vers)
13411341 if (((*vers) & 0x3f) < 0x34)
13421342 u3h = 0;
@@ -2111,8 +2111,8 @@ static void fcu_lookup_fans(struct device_node *fcu_node) · 768 unmodified lines
21112111
21122112 while ((np = of_get_next_child(fcu_node, np)) != NULL) {
21132113 int type = -1;
2114− char *loc;
2115− u32 *reg;
2114+ const char *loc;
2115+ const u32 *reg;
21162116
21172117 DBG(" control: %s, type: %s\n", np->name, np->type);
21182118
@@ -2128,8 +2128,8 @@ static void fcu_lookup_fans(struct device_node *fcu_node) · 9 unmodified lines
21282128 continue;
21292129
21302130 /* Lookup for a matching location */
2131− loc = (char *)get_property(np, "location", NULL);
2132− reg = (u32 *)get_property(np, "reg", NULL);
2131+ loc = get_property(np, "location", NULL);
2132+ reg = get_property(np, "reg", NULL);
21332133 if (loc == NULL || reg == NULL)
21342134 continue;
21352135 DBG(" matching location: %s, reg: 0x%08x\n", loc, *reg);
drivers/macintosh/therm_windtunnel.c+2−2
@@ -484,14 +484,14 @@ struct apple_thermal_info { · 483 unmodified lines
484484 static int __init
485485 g4fan_init( void )
486486 {
487− struct apple_thermal_info *info;
487+ const struct apple_thermal_info *info;
488488 struct device_node *np;
489489
490490 init_MUTEX( &x.lock );
491491
492492 if( !(np=of_find_node_by_name(NULL, "power-mgt")) )
493493 return -ENODEV;
494− info = (struct apple_thermal_info*)get_property(np, "thermal-info", NULL);
494+ info = get_property(np, "thermal-info", NULL);
495495 of_node_put(np);
496496
497497 if( !info || !machine_is_compatible("PowerMac3,6") )
drivers/macintosh/via-cuda.c+2−2
@@ -123,7 +123,7 @@ int __init find_via_cuda(void) · 122 unmodified lines
123123 {
124124 struct adb_request req;
125125 phys_addr_t taddr;
126− u32 *reg;
126+ const u32 *reg;
127127 int err;
128128
129129 if (vias != 0)
@@ -132,7 +132,7 @@ int __init find_via_cuda(void) · 2 unmodified lines
132132 if (vias == 0)
133133 return 0;
134134
135− reg = (u32 *)get_property(vias, "reg", NULL);
135+ reg = get_property(vias, "reg", NULL);
136136 if (reg == NULL) {
137137 printk(KERN_ERR "via-cuda: No \"reg\" property !\n");
138138 goto fail;
drivers/macintosh/via-pmu-led.c+1−1
@@ -120,7 +120,7 @@ static int __init via_pmu_led_init(void) · 119 unmodified lines
120120 dt = of_find_node_by_path("/");
121121 if (dt == NULL)
122122 return -ENODEV;
123− model = (const char *)get_property(dt, "model", NULL);
123+ model = get_property(dt, "model", NULL);
124124 if (model == NULL)
125125 return -ENODEV;
126126 if (strncmp(model, "PowerBook", strlen("PowerBook")) != 0 &&
drivers/macintosh/via-pmu.c+5−5
@@ -280,7 +280,7 @@ static char *pbook_type[] = { · 279 unmodified lines
280280 int __init find_via_pmu(void)
281281 {
282282 u64 taddr;
283− u32 *reg;
283+ const u32 *reg;
284284
285285 if (via != 0)
286286 return 1;
@@ -288,7 +288,7 @@ int __init find_via_pmu(void) · 1 unmodified line
288288 if (vias == NULL)
289289 return 0;
290290
291− reg = (u32 *)get_property(vias, "reg", NULL);
291+ reg = get_property(vias, "reg", NULL);
292292 if (reg == NULL) {
293293 printk(KERN_ERR "via-pmu: No \"reg\" property !\n");
294294 goto fail;
@@ -330,7 +330,7 @@ int __init find_via_pmu(void) · 35 unmodified lines
330330
331331 gpiop = of_find_node_by_name(NULL, "gpio");
332332 if (gpiop) {
333− reg = (u32 *)get_property(gpiop, "reg", NULL);
333+ reg = get_property(gpiop, "reg", NULL);
334334 if (reg)
335335 gaddr = of_translate_address(gpiop, reg);
336336 if (gaddr != OF_BAD_ADDR)
@@ -479,9 +479,9 @@ static int __init via_pmu_dev_init(void) · 142 unmodified lines
479479 pmu_batteries[1].flags |= PMU_BATT_TYPE_SMART;
480480 } else {
481481 struct device_node* prim = find_devices("power-mgt");
482− u32 *prim_info = NULL;
482+ const u32 *prim_info = NULL;
483483 if (prim)
484− prim_info = (u32 *)get_property(prim, "prim-info", NULL);
484+ prim_info = get_property(prim, "prim-info", NULL);
485485 if (prim_info) {
486486 /* Other stuffs here yet unknown */
487487 pmu_battery_count = (prim_info[6] >> 16) & 0xff;
drivers/macintosh/windfarm_pm81.c+2−2
@@ -396,7 +396,7 @@ static void wf_smu_sys_fans_tick(struct wf_smu_sys_fans_state *st) · 395 unmodified lines
396396 static void wf_smu_create_cpu_fans(void)
397397 {
398398 struct wf_cpu_pid_param pid_param;
399− struct smu_sdbp_header *hdr;
399+ const struct smu_sdbp_header *hdr;
400400 struct smu_sdbp_cpupiddata *piddata;
401401 struct smu_sdbp_fvt *fvt;
402402 s32 tmax, tdelta, maxpow, powadj;
@@ -702,7 +702,7 @@ static struct notifier_block wf_smu_events = { · 299 unmodified lines
702702
703703 static int wf_init_pm(void)
704704 {
705− struct smu_sdbp_header *hdr;
705+ const struct smu_sdbp_header *hdr;
706706
707707 hdr = smu_get_sdb_partition(SMU_SDB_SENSORTREE_ID, NULL);
708708 if (hdr != 0) {
drivers/macintosh/windfarm_pm91.c+1−1
@@ -144,7 +144,7 @@ static struct wf_smu_slots_fans_state *wf_smu_slots_fans; · 143 unmodified lines
144144 static void wf_smu_create_cpu_fans(void)
145145 {
146146 struct wf_cpu_pid_param pid_param;
147− struct smu_sdbp_header *hdr;
147+ const struct smu_sdbp_header *hdr;
148148 struct smu_sdbp_cpupiddata *piddata;
149149 struct smu_sdbp_fvt *fvt;
150150 s32 tmax, tdelta, maxpow, powadj;
drivers/macintosh/windfarm_smu_controls.c+7−6
@@ -159,14 +159,15 @@ static struct smu_fan_control *smu_fan_create(struct device_node *node, · 158 unmodified lines
159159 int pwm_fan)
160160 {
161161 struct smu_fan_control *fct;
162− s32 *v; u32 *reg;
163− char *l;
162+ const s32 *v;
163+ const u32 *reg;
164+ const char *l;
164165
165166 fct = kmalloc(sizeof(struct smu_fan_control), GFP_KERNEL);
166167 if (fct == NULL)
167168 return NULL;
168169 fct->ctrl.ops = &smu_fan_ops;
169− l = (char *)get_property(node, "location", NULL);
170+ l = get_property(node, "location", NULL);
170171 if (l == NULL)
171172 goto fail;
172173
@@ -223,17 +224,17 @@ static struct smu_fan_control *smu_fan_create(struct device_node *node, · 50 unmodified lines
223224 goto fail;
224225
225226 /* Get min & max values*/
226− v = (s32 *)get_property(node, "min-value", NULL);
227+ v = get_property(node, "min-value", NULL);
227228 if (v == NULL)
228229 goto fail;
229230 fct->min = *v;
230− v = (s32 *)get_property(node, "max-value", NULL);
231+ v = get_property(node, "max-value", NULL);
231232 if (v == NULL)
232233 goto fail;
233234 fct->max = *v;
234235
235236 /* Get "reg" value */
236− reg = (u32 *)get_property(node, "reg", NULL);
237+ reg = get_property(node, "reg", NULL);
237238 if (reg == NULL)
238239 goto fail;
239240 fct->reg = *reg;
drivers/macintosh/windfarm_smu_sat.c+4−4
@@ -233,15 +233,15 @@ static void wf_sat_create(struct i2c_adapter *adapter, struct device_node *dev) · 232 unmodified lines
233233 {
234234 struct wf_sat *sat;
235235 struct wf_sat_sensor *sens;
236− u32 *reg;
237− char *loc, *type;
236+ const u32 *reg;
237+ const char *loc, *type;
238238 u8 addr, chip, core;
239239 struct device_node *child;
240240 int shift, cpu, index;
241241 char *name;
242242 int vsens[2], isens[2];
243243
244− reg = (u32 *) get_property(dev, "reg", NULL);
244+ reg = get_property(dev, "reg", NULL);
245245 if (reg == NULL)
246246 return;
247247 addr = *reg;
@@ -268,7 +268,7 @@ static void wf_sat_create(struct i2c_adapter *adapter, struct device_node *dev) · 20 unmodified lines
268268 isens[0] = isens[1] = -1;
269269 child = NULL;
270270 while ((child = of_get_next_child(dev, child)) != NULL) {
271− reg = (u32 *) get_property(child, "reg", NULL);
271+ reg = get_property(child, "reg", NULL);
272272 type = get_property(child, "device_type", NULL);
273273 loc = get_property(child, "location", NULL);
274274 if (reg == NULL || loc == NULL)
drivers/macintosh/windfarm_smu_sensors.c+6−6
@@ -198,14 +198,14 @@ static struct wf_sensor_ops smu_slotspow_ops = { · 197 unmodified lines
198198 static struct smu_ad_sensor *smu_ads_create(struct device_node *node)
199199 {
200200 struct smu_ad_sensor *ads;
201− char *c, *l;
202− u32 *v;
201+ const char *c, *l;
202+ const u32 *v;
203203
204204 ads = kmalloc(sizeof(struct smu_ad_sensor), GFP_KERNEL);
205205 if (ads == NULL)
206206 return NULL;
207− c = (char *)get_property(node, "device_type", NULL);
208− l = (char *)get_property(node, "location", NULL);
207+ c = get_property(node, "device_type", NULL);
208+ l = get_property(node, "location", NULL);
209209 if (c == NULL || l == NULL)
210210 goto fail;
211211
@@ -255,7 +255,7 @@ static struct smu_ad_sensor *smu_ads_create(struct device_node *node) · 43 unmodified lines
255255 } else
256256 goto fail;
257257
258− v = (u32 *)get_property(node, "reg", NULL);
258+ v = get_property(node, "reg", NULL);
259259 if (v == NULL)
260260 goto fail;
261261 ads->reg = *v;
@@ -382,7 +382,7 @@ smu_cpu_power_create(struct wf_sensor *volts, struct wf_sensor *amps) · 120 unmodified lines
382382
383383 static void smu_fetch_param_partitions(void)
384384 {
385− struct smu_sdbp_header *hdr;
385+ const struct smu_sdbp_header *hdr;
386386
387387 /* Get CPU voltage/current/power calibration data */
388388 hdr = smu_get_sdb_partition(SMU_SDB_CPUVCP_ID, NULL);
drivers/net/bmac.c+8−5
@@ -1264,7 +1264,8 @@ static int __devinit bmac_probe(struct macio_dev *mdev, const struct of_device_i · 1263 unmodified lines
12641264 {
12651265 int j, rev, ret;
12661266 struct bmac_data *bp;
1267− unsigned char *addr;
1267+ const unsigned char *prop_addr;
1268+ unsigned char addr[6];
12681269 struct net_device *dev;
12691270 int is_bmac_plus = ((int)match->data) != 0;
12701271
@@ -1272,14 +1273,16 @@ static int __devinit bmac_probe(struct macio_dev *mdev, const struct of_device_i · 1 unmodified line
12721273 printk(KERN_ERR "BMAC: can't use, need 3 addrs and 3 intrs\n");
12731274 return -ENODEV;
12741275 }
1275− addr = get_property(macio_get_of_node(mdev), "mac-address", NULL);
1276− if (addr == NULL) {
1277− addr = get_property(macio_get_of_node(mdev), "local-mac-address", NULL);
1278− if (addr == NULL) {
1276+ prop_addr = get_property(macio_get_of_node(mdev), "mac-address", NULL);
1277+ if (prop_addr == NULL) {
1278+ prop_addr = get_property(macio_get_of_node(mdev),
1279+ "local-mac-address", NULL);
1280+ if (prop_addr == NULL) {
12791281 printk(KERN_ERR "BMAC: Can't get mac-address\n");
12801282 return -ENODEV;
12811283 }
12821284 }
1285+ memcpy(addr, prop_addr, sizeof(addr));
12831286
12841287 dev = alloc_etherdev(PRIV_BYTES);
12851288 if (!dev) {
drivers/net/ibmveth.c+2−1
@@ -702,7 +702,8 @@ static int ibmveth_start_xmit(struct sk_buff *skb, struct net_device *netdev) · 701 unmodified lines
702702 desc[3].desc,
703703 desc[4].desc,
704704 desc[5].desc,
705− correlator);
705+ correlator,
706+ &correlator);
706707 } while ((lpar_rc == H_BUSY) && (retry_count--));
707708
708709 if(lpar_rc != H_SUCCESS && lpar_rc != H_DROPPED) {
drivers/net/ibmveth.h+15−12
@@ -41,16 +41,6 @@ · 40 unmodified lines
4141 #define IbmVethMcastRemoveFilter 0x2UL
4242 #define IbmVethMcastClearFilterTable 0x3UL
4343
44−/* hcall numbers */
45−#define H_VIO_SIGNAL 0x104
46−#define H_REGISTER_LOGICAL_LAN 0x114
47−#define H_FREE_LOGICAL_LAN 0x118
48−#define H_ADD_LOGICAL_LAN_BUFFER 0x11C
49−#define H_SEND_LOGICAL_LAN 0x120
50−#define H_MULTICAST_CTRL 0x130
51−#define H_CHANGE_LOGICAL_LAN_MAC 0x14C
52−#define H_FREE_LOGICAL_LAN_BUFFER 0x1D4
53−
5444 /* hcall macros */
5545 #define h_register_logical_lan(ua, buflst, rxq, fltlst, mac) \
5646 plpar_hcall_norets(H_REGISTER_LOGICAL_LAN, ua, buflst, rxq, fltlst, mac)
@@ -61,8 +51,21 @@ · 4 unmodified lines
6151 #define h_add_logical_lan_buffer(ua, buf) \
6252 plpar_hcall_norets(H_ADD_LOGICAL_LAN_BUFFER, ua, buf)
6353
64−#define h_send_logical_lan(ua, buf1, buf2, buf3, buf4, buf5, buf6, correlator) \
65− plpar_hcall_8arg_2ret(H_SEND_LOGICAL_LAN, ua, buf1, buf2, buf3, buf4, buf5, buf6, correlator, &correlator)
54+static inline long h_send_logical_lan(unsigned long unit_address,
55+ unsigned long desc1, unsigned long desc2, unsigned long desc3,
56+ unsigned long desc4, unsigned long desc5, unsigned long desc6,
57+ unsigned long corellator_in, unsigned long *corellator_out)
58+{
59+ long rc;
60+ unsigned long retbuf[PLPAR_HCALL9_BUFSIZE];
61+
62+ rc = plpar_hcall9(H_SEND_LOGICAL_LAN, retbuf, unit_address, desc1,
63+ desc2, desc3, desc4, desc5, desc6, corellator_in);
64+
65+ *corellator_out = retbuf[0];
66+
67+ return rc;
68+}
6669
6770 #define h_multicast_ctrl(ua, cmd, mac) \
6871 plpar_hcall_norets(H_MULTICAST_CTRL, ua, cmd, mac)
drivers/net/mace.c+1−1
@@ -113,7 +113,7 @@ static int __devinit mace_probe(struct macio_dev *mdev, const struct of_device_i · 112 unmodified lines
113113 struct device_node *mace = macio_get_of_node(mdev);
114114 struct net_device *dev;
115115 struct mace_data *mp;
116− unsigned char *addr;
116+ const unsigned char *addr;
117117 int j, rev, rc = -EBUSY;
118118
119119 if (macio_resource_count(mdev) != 3 || macio_irq_count(mdev) != 3) {
drivers/net/spider_net.c+6−6
@@ -1697,10 +1697,10 @@ spider_net_setup_phy(struct spider_net_card *card) · 1696 unmodified lines
16971697 */
16981698 static int
16991699 spider_net_download_firmware(struct spider_net_card *card,
1700− u8 *firmware_ptr)
1700+ const void *firmware_ptr)
17011701 {
17021702 int sequencer, i;
1703− u32 *fw_ptr = (u32 *)firmware_ptr;
1703+ const u32 *fw_ptr = firmware_ptr;
17041704
17051705 /* stop sequencers */
17061706 spider_net_write_reg(card, SPIDER_NET_GSINIT,
@@ -1757,7 +1757,7 @@ spider_net_init_firmware(struct spider_net_card *card) · 50 unmodified lines
17571757 {
17581758 struct firmware *firmware = NULL;
17591759 struct device_node *dn;
1760− u8 *fw_prop = NULL;
1760+ const u8 *fw_prop = NULL;
17611761 int err = -ENOENT;
17621762 int fw_size;
17631763
@@ -1783,7 +1783,7 @@ try_host_fw: · 19 unmodified lines
17831783 if (!dn)
17841784 goto out_err;
17851785
1786− fw_prop = (u8 *)get_property(dn, "firmware", &fw_size);
1786+ fw_prop = get_property(dn, "firmware", &fw_size);
17871787 if (!fw_prop)
17881788 goto out_err;
17891789
@@ -1986,7 +1986,7 @@ spider_net_setup_netdev(struct spider_net_card *card) · 196 unmodified lines
19861986 struct net_device *netdev = card->netdev;
19871987 struct device_node *dn;
19881988 struct sockaddr addr;
1989− u8 *mac;
1989+ const u8 *mac;
19901990
19911991 SET_MODULE_OWNER(netdev);
19921992 SET_NETDEV_DEV(netdev, &card->pdev->dev);
@@ -2019,7 +2019,7 @@ spider_net_setup_netdev(struct spider_net_card *card) · 26 unmodified lines
20192019 if (!dn)
20202020 return -EIO;
20212021
2022− mac = (u8 *)get_property(dn, "local-mac-address", NULL);
2022+ mac = get_property(dn, "local-mac-address", NULL);
20232023 if (!mac)
20242024 return -EIO;
20252025 memcpy(addr.sa_data, mac, ETH_ALEN);
drivers/net/sungem.c+1−1
@@ -2896,7 +2896,7 @@ static int __devinit gem_get_device_address(struct gem *gp) · 2895 unmodified lines
28962896 if (use_idprom)
28972897 memcpy(dev->dev_addr, idprom->id_ethaddr, 6);
28982898 #elif defined(CONFIG_PPC_PMAC)
2899− unsigned char *addr;
2899+ const unsigned char *addr;
29002900
29012901 addr = get_property(gp->of_node, "local-mac-address", NULL);
29022902 if (addr == NULL) {
drivers/pci/hotplug/rpaphp_core.c+16−16
@@ -176,16 +176,16 @@ static int get_max_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_spe · 175 unmodified lines
176176 return 0;
177177 }
178178
179−static int get_children_props(struct device_node *dn, int **drc_indexes,
180− int **drc_names, int **drc_types, int **drc_power_domains)
179+static int get_children_props(struct device_node *dn, const int **drc_indexes,
180+ const int **drc_names, const int **drc_types,
181+ const int **drc_power_domains)
181182 {
182− int *indexes, *names;
183− int *types, *domains;
183+ const int *indexes, *names, *types, *domains;
184184
185− indexes = (int *) get_property(dn, "ibm,drc-indexes", NULL);
186− names = (int *) get_property(dn, "ibm,drc-names", NULL);
187− types = (int *) get_property(dn, "ibm,drc-types", NULL);
188− domains = (int *) get_property(dn, "ibm,drc-power-domains", NULL);
185+ indexes = get_property(dn, "ibm,drc-indexes", NULL);
186+ names = get_property(dn, "ibm,drc-names", NULL);
187+ types = get_property(dn, "ibm,drc-types", NULL);
188+ domains = get_property(dn, "ibm,drc-power-domains", NULL);
189189
190190 if (!indexes || !names || !types || !domains) {
191191 /* Slot does not have dynamically-removable children */
@@ -212,13 +212,13 @@ static int get_children_props(struct device_node *dn, int **drc_indexes, · 20 unmodified lines
212212 int rpaphp_get_drc_props(struct device_node *dn, int *drc_index,
213213 char **drc_name, char **drc_type, int *drc_power_domain)
214214 {
215− int *indexes, *names;
216− int *types, *domains;
217− unsigned int *my_index;
215+ const int *indexes, *names;
216+ const int *types, *domains;
217+ const unsigned int *my_index;
218218 char *name_tmp, *type_tmp;
219219 int i, rc;
220220
221− my_index = (int *) get_property(dn, "ibm,my-drc-index", NULL);
221+ my_index = get_property(dn, "ibm,my-drc-index", NULL);
222222 if (!my_index) {
223223 /* Node isn't DLPAR/hotplug capable */
224224 return -EINVAL;
@@ -265,10 +265,10 @@ static int is_php_type(char *drc_type) · 40 unmodified lines
265265 return 1;
266266 }
267267
268−static int is_php_dn(struct device_node *dn, int **indexes, int **names,
269− int **types, int **power_domains)
268+static int is_php_dn(struct device_node *dn, const int **indexes,
269+ const int **names, const int **types, const int **power_domains)
270270 {
271− int *drc_types;
271+ const int *drc_types;
272272 int rc;
273273
274274 rc = get_children_props(dn, indexes, names, &drc_types, power_domains);
@@ -296,7 +296,7 @@ int rpaphp_add_slot(struct device_node *dn) · 21 unmodified lines
296296 struct slot *slot;
297297 int retval = 0;
298298 int i;
299− int *indexes, *names, *types, *power_domains;
299+ const int *indexes, *names, *types, *power_domains;
300300 char *name, *type;
301301
302302 dbg("Entry %s: dn->full_name=%s\n", __FUNCTION__, dn->full_name);
drivers/scsi/ibmvscsi/rpa_vscsi.c+4−7
@@ -156,8 +156,8 @@ static void gather_partition_info(void) · 155 unmodified lines
156156 {
157157 struct device_node *rootdn;
158158
159− char *ppartition_name;
160− unsigned int *p_number_ptr;
159+ const char *ppartition_name;
160+ const unsigned int *p_number_ptr;
161161
162162 /* Retrieve information about this partition */
163163 rootdn = find_path_device("/");
@@ -165,14 +165,11 @@ static void gather_partition_info(void) · 1 unmodified line
165165 return;
166166 }
167167
168− ppartition_name =
169− get_property(rootdn, "ibm,partition-name", NULL);
168+ ppartition_name = get_property(rootdn, "ibm,partition-name", NULL);
170169 if (ppartition_name)
171170 strncpy(partition_name, ppartition_name,
172171 sizeof(partition_name));
173− p_number_ptr =
174− (unsigned int *)get_property(rootdn, "ibm,partition-no",
175− NULL);
172+ p_number_ptr = get_property(rootdn, "ibm,partition-no", NULL);
176173 if (p_number_ptr)
177174 partition_number = *p_number_ptr;
178175 }
drivers/scsi/mac53c94.c+1−1
@@ -431,7 +431,7 @@ static int mac53c94_probe(struct macio_dev *mdev, const struct of_device_id *mat · 430 unmodified lines
431431 struct fsc_state *state;
432432 struct Scsi_Host *host;
433433 void *dma_cmd_space;
434− unsigned char *clkprop;
434+ const unsigned char *clkprop;
435435 int proplen, rc = -ENODEV;
436436
437437 if (macio_resource_count(mdev) != 2 || macio_irq_count(mdev) != 2) {
drivers/scsi/mesh.c+3−2
@@ -1850,7 +1850,8 @@ static int mesh_probe(struct macio_dev *mdev, const struct of_device_id *match) · 1849 unmodified lines
18501850 {
18511851 struct device_node *mesh = macio_get_of_node(mdev);
18521852 struct pci_dev* pdev = macio_get_pci_dev(mdev);
1853− int tgt, *cfp, minper;
1853+ int tgt, minper;
1854+ const int *cfp;
18541855 struct mesh_state *ms;
18551856 struct Scsi_Host *mesh_host;
18561857 void *dma_cmd_space;
@@ -1939,7 +1940,7 @@ static int mesh_probe(struct macio_dev *mdev, const struct of_device_id *match) · 82 unmodified lines
19391940 ms->tgts[tgt].current_req = NULL;
19401941 }
19411942
1942− if ((cfp = (int *) get_property(mesh, "clock-frequency", NULL)))
1943+ if ((cfp = get_property(mesh, "clock-frequency", NULL)))
19431944 ms->clk_freq = *cfp;
19441945 else {
19451946 printk(KERN_INFO "mesh: assuming 50MHz clock frequency\n");
drivers/scsi/sata_svw.c+1−1
@@ -268,7 +268,7 @@ static int k2_sata_proc_info(struct Scsi_Host *shost, char *page, char **start, · 267 unmodified lines
268268 /* Match it to a port node */
269269 index = (ap == ap->host_set->ports[0]) ? 0 : 1;
270270 for (np = np->child; np != NULL; np = np->sibling) {
271− u32 *reg = (u32 *)get_property(np, "reg", NULL);
271+ const u32 *reg = get_property(np, "reg", NULL);
272272 if (!reg)
273273 continue;
274274 if (index == *reg)
drivers/serial/pmac_zilog.c+5−4
@@ -1400,8 +1400,8 @@ static struct uart_ops pmz_pops = { · 1399 unmodified lines
14001400 static int __init pmz_init_port(struct uart_pmac_port *uap)
14011401 {
14021402 struct device_node *np = uap->node;
1403− char *conn;
1404− struct slot_names_prop {
1403+ const char *conn;
1404+ const struct slot_names_prop {
14051405 int count;
14061406 char name[1];
14071407 } *slots;
@@ -1458,7 +1458,7 @@ no_dma: · 50 unmodified lines
14581458 uap->flags |= PMACZILOG_FLAG_IS_IRDA;
14591459 uap->port_type = PMAC_SCC_ASYNC;
14601460 /* 1999 Powerbook G3 has slot-names property instead */
1461− slots = (struct slot_names_prop *)get_property(np, "slot-names", &len);
1461+ slots = get_property(np, "slot-names", &len);
14621462 if (slots && slots->count > 0) {
14631463 if (strcmp(slots->name, "IrDA") == 0)
14641464 uap->flags |= PMACZILOG_FLAG_IS_IRDA;
@@ -1470,7 +1470,8 @@ no_dma: · 5 unmodified lines
14701470 if (ZS_IS_INTMODEM(uap)) {
14711471 struct device_node* i2c_modem = find_devices("i2c-modem");
14721472 if (i2c_modem) {
1473− char* mid = get_property(i2c_modem, "modem-id", NULL);
1473+ const char* mid =
1474+ get_property(i2c_modem, "modem-id", NULL);
14741475 if (mid) switch(*mid) {
14751476 case 0x04 :
14761477 case 0x05 :
drivers/video/S3triofb.c+6−6
@@ -349,30 +349,30 @@ static void __init s3triofb_of_init(struct device_node *dp) · 348 unmodified lines
349349 s3trio_name[sizeof(s3trio_name)-1] = '\0';
350350 strcpy(fb_fix.id, s3trio_name);
351351
352− if((pp = (int *)get_property(dp, "vendor-id", &len)) != NULL
352+ if((pp = get_property(dp, "vendor-id", &len)) != NULL
353353 && *pp!=PCI_VENDOR_ID_S3) {
354354 printk("%s: can't find S3 Trio board\n", dp->full_name);
355355 return;
356356 }
357357
358− if((pp = (int *)get_property(dp, "device-id", &len)) != NULL
358+ if((pp = get_property(dp, "device-id", &len)) != NULL
359359 && *pp!=PCI_DEVICE_ID_S3_TRIO) {
360360 printk("%s: can't find S3 Trio board\n", dp->full_name);
361361 return;
362362 }
363363
364− if ((pp = (int *)get_property(dp, "depth", &len)) != NULL
364+ if ((pp = get_property(dp, "depth", &len)) != NULL
365365 && len == sizeof(int) && *pp != 8) {
366366 printk("%s: can't use depth = %d\n", dp->full_name, *pp);
367367 return;
368368 }
369− if ((pp = (int *)get_property(dp, "width", &len)) != NULL
369+ if ((pp = get_property(dp, "width", &len)) != NULL
370370 && len == sizeof(int))
371371 fb_var.xres = fb_var.xres_virtual = *pp;
372− if ((pp = (int *)get_property(dp, "height", &len)) != NULL
372+ if ((pp = get_property(dp, "height", &len)) != NULL
373373 && len == sizeof(int))
374374 fb_var.yres = fb_var.yres_virtual = *pp;
375− if ((pp = (int *)get_property(dp, "linebytes", &len)) != NULL
375+ if ((pp = get_property(dp, "linebytes", &len)) != NULL
376376 && len == sizeof(int))
377377 fb_fix.line_length = *pp;
378378 else
drivers/video/aty/radeon_base.c+4−4
@@ -413,11 +413,11 @@ static int __devinit radeon_find_mem_vbios(struct radeonfb_info *rinfo) · 412 unmodified lines
413413 static int __devinit radeon_read_xtal_OF (struct radeonfb_info *rinfo)
414414 {
415415 struct device_node *dp = rinfo->of_node;
416− u32 *val;
416+ const u32 *val;
417417
418418 if (dp == NULL)
419419 return -ENODEV;
420− val = (u32 *) get_property(dp, "ATY,RefCLK", NULL);
420+ val = get_property(dp, "ATY,RefCLK", NULL);
421421 if (!val || !*val) {
422422 printk(KERN_WARNING "radeonfb: No ATY,RefCLK property !\n");
423423 return -EINVAL;
@@ -425,11 +425,11 @@ static int __devinit radeon_read_xtal_OF (struct radeonfb_info *rinfo) · 1 unmodified line
425425
426426 rinfo->pll.ref_clk = (*val) / 10;
427427
428− val = (u32 *) get_property(dp, "ATY,SCLK", NULL);
428+ val = get_property(dp, "ATY,SCLK", NULL);
429429 if (val && *val)
430430 rinfo->pll.sclk = (*val) / 10;
431431
432− val = (u32 *) get_property(dp, "ATY,MCLK", NULL);
432+ val = get_property(dp, "ATY,MCLK", NULL);
433433 if (val && *val)
434434 rinfo->pll.mclk = (*val) / 10;
435435
drivers/video/aty/radeon_monitor.c+6−6
@@ -64,13 +64,13 @@ static int __devinit radeon_parse_montype_prop(struct device_node *dp, u8 **out_ · 63 unmodified lines
6464 {
6565 static char *propnames[] = { "DFP,EDID", "LCD,EDID", "EDID",
6666 "EDID1", "EDID2", NULL };
67− u8 *pedid = NULL;
68− u8 *pmt = NULL;
67+ const u8 *pedid = NULL;
68+ const u8 *pmt = NULL;
6969 u8 *tmp;
7070 int i, mt = MT_NONE;
7171
7272 RTRACE("analyzing OF properties...\n");
73− pmt = (u8 *)get_property(dp, "display-type", NULL);
73+ pmt = get_property(dp, "display-type", NULL);
7474 if (!pmt)
7575 return MT_NONE;
7676 RTRACE("display-type: %s\n", pmt);
@@ -89,7 +89,7 @@ static int __devinit radeon_parse_montype_prop(struct device_node *dp, u8 **out_ · 12 unmodified lines
8989 }
9090
9191 for (i = 0; propnames[i] != NULL; ++i) {
92− pedid = (u8 *)get_property(dp, propnames[i], NULL);
92+ pedid = get_property(dp, propnames[i], NULL);
9393 if (pedid != NULL)
9494 break;
9595 }
@@ -124,14 +124,14 @@ static int __devinit radeon_probe_OF_head(struct radeonfb_info *rinfo, int head_ · 28 unmodified lines
124124 return MT_NONE;
125125
126126 if (rinfo->has_CRTC2) {
127− char *pname;
127+ const char *pname;
128128 int len, second = 0;
129129
130130 dp = dp->child;
131131 do {
132132 if (!dp)
133133 return MT_NONE;
134− pname = (char *)get_property(dp, "name", NULL);
134+ pname = get_property(dp, "name", NULL);
135135 if (!pname)
136136 return MT_NONE;
137137 len = strlen(pname);
drivers/video/aty/radeon_pm.c+2−2
@@ -1268,7 +1268,7 @@ static void radeon_pm_full_reset_sdram(struct radeonfb_info *rinfo) · 1267 unmodified lines
12681268 0x21320032, 0xa1320032, 0x21320032, 0xffffffff,
12691269 0x31320032 };
12701270
1271− u32 *mrtable = default_mrtable;
1271+ const u32 *mrtable = default_mrtable;
12721272 int i, mrtable_size = ARRAY_SIZE(default_mrtable);
12731273
12741274 mdelay(30);
@@ -1287,7 +1287,7 @@ static void radeon_pm_full_reset_sdram(struct radeonfb_info *rinfo) · 12 unmodified lines
12871287 if (rinfo->of_node != NULL) {
12881288 int size;
12891289
1290− mrtable = (u32 *)get_property(rinfo->of_node, "ATY,MRT", &size);
1290+ mrtable = get_property(rinfo->of_node, "ATY,MRT", &size);
12911291 if (mrtable)
12921292 mrtable_size = size >> 2;
12931293 else
drivers/video/nvidia/nv_of.c+5−7
@@ -32,7 +32,7 @@ int nvidia_probe_of_connector(struct fb_info *info, int conn, u8 **out_edid) · 31 unmodified lines
3232 {
3333 struct nvidia_par *par = info->par;
3434 struct device_node *parent, *dp;
35− unsigned char *pedid = NULL;
35+ const unsigned char *pedid = NULL;
3636 static char *propnames[] = {
3737 "DFP,EDID", "LCD,EDID", "EDID", "EDID1",
3838 "EDID,B", "EDID,A", NULL };
@@ -42,20 +42,19 @@ int nvidia_probe_of_connector(struct fb_info *info, int conn, u8 **out_edid) · 3 unmodified lines
4242 if (parent == NULL)
4343 return -1;
4444 if (par->twoHeads) {
45− char *pname;
45+ const char *pname;
4646 int len;
4747
4848 for (dp = NULL;
4949 (dp = of_get_next_child(parent, dp)) != NULL;) {
50− pname = (char *)get_property(dp, "name", NULL);
50+ pname = get_property(dp, "name", NULL);
5151 if (!pname)
5252 continue;
5353 len = strlen(pname);
5454 if ((pname[len-1] == 'A' && conn == 1) ||
5555 (pname[len-1] == 'B' && conn == 2)) {
5656 for (i = 0; propnames[i] != NULL; ++i) {
57− pedid = (unsigned char *)
58− get_property(dp, propnames[i],
57+ pedid = get_property(dp, propnames[i],
5958 NULL);
6059 if (pedid != NULL)
6160 break;
@@ -67,8 +66,7 @@ int nvidia_probe_of_connector(struct fb_info *info, int conn, u8 **out_edid) · 5 unmodified lines
6766 }
6867 if (pedid == NULL) {
6968 for (i = 0; propnames[i] != NULL; ++i) {
70− pedid = (unsigned char *)
71− get_property(parent, propnames[i], NULL);
69+ pedid = get_property(parent, propnames[i], NULL);
7270 if (pedid != NULL)
7371 break;
7472 }
drivers/video/offb.c+11−11
@@ -409,30 +409,30 @@ static void __init offb_init_nodriver(struct device_node *dp, int no_real_node) · 408 unmodified lines
409409 unsigned int flags, rsize, addr_prop = 0;
410410 unsigned long max_size = 0;
411411 u64 rstart, address = OF_BAD_ADDR;
412− u32 *pp, *addrp, *up;
412+ const u32 *pp, *addrp, *up;
413413 u64 asize;
414414
415− pp = (u32 *)get_property(dp, "linux,bootx-depth", &len);
415+ pp = get_property(dp, "linux,bootx-depth", &len);
416416 if (pp == NULL)
417− pp = (u32 *)get_property(dp, "depth", &len);
417+ pp = get_property(dp, "depth", &len);
418418 if (pp && len == sizeof(u32))
419419 depth = *pp;
420420
421− pp = (u32 *)get_property(dp, "linux,bootx-width", &len);
421+ pp = get_property(dp, "linux,bootx-width", &len);
422422 if (pp == NULL)
423− pp = (u32 *)get_property(dp, "width", &len);
423+ pp = get_property(dp, "width", &len);
424424 if (pp && len == sizeof(u32))
425425 width = *pp;
426426
427− pp = (u32 *)get_property(dp, "linux,bootx-height", &len);
427+ pp = get_property(dp, "linux,bootx-height", &len);
428428 if (pp == NULL)
429− pp = (u32 *)get_property(dp, "height", &len);
429+ pp = get_property(dp, "height", &len);
430430 if (pp && len == sizeof(u32))
431431 height = *pp;
432432
433− pp = (u32 *)get_property(dp, "linux,bootx-linebytes", &len);
433+ pp = get_property(dp, "linux,bootx-linebytes", &len);
434434 if (pp == NULL)
435− pp = (u32 *)get_property(dp, "linebytes", &len);
435+ pp = get_property(dp, "linebytes", &len);
436436 if (pp && len == sizeof(u32))
437437 pitch = *pp;
438438 else
@@ -450,9 +450,9 @@ static void __init offb_init_nodriver(struct device_node *dp, int no_real_node) · 11 unmodified lines
450450 * ranges and pick one that is both big enough and if possible encloses
451451 * the "address" property. If none match, we pick the biggest
452452 */
453− up = (u32 *)get_property(dp, "linux,bootx-addr", &len);
453+ up = get_property(dp, "linux,bootx-addr", &len);
454454 if (up == NULL)
455− up = (u32 *)get_property(dp, "address", &len);
455+ up = get_property(dp, "address", &len);
456456 if (up && len == sizeof(u32))
457457 addr_prop = *up;
458458
drivers/video/riva/fbdev.c+2−3
@@ -1835,14 +1835,13 @@ static int __devinit riva_get_EDID_OF(struct fb_info *info, struct pci_dev *pd) · 1834 unmodified lines
18351835 NVTRACE_ENTER();
18361836 dp = pci_device_to_OF_node(pd);
18371837 for (; dp != NULL; dp = dp->child) {
1838− disptype = (unsigned char *)get_property(dp, "display-type", NULL);
1838+ disptype = get_property(dp, "display-type", NULL);
18391839 if (disptype == NULL)
18401840 continue;
18411841 if (strncmp(disptype, "LCD", 3) != 0)
18421842 continue;
18431843 for (i = 0; propnames[i] != NULL; ++i) {
1844− pedid = (unsigned char *)
1845− get_property(dp, propnames[i], NULL);
1844+ pedid = get_property(dp, propnames[i], NULL);
18461845 if (pedid != NULL) {
18471846 par->EDID = pedid;
18481847 NVTRACE("LCD found.\n");
include/asm-powerpc/cputable.h+18−9
@@ -23,6 +23,7 @@ · 22 unmodified lines
2323 #define PPC_FEATURE_SMT 0x00004000
2424 #define PPC_FEATURE_ICACHE_SNOOP 0x00002000
2525 #define PPC_FEATURE_ARCH_2_05 0x00001000
26+#define PPC_FEATURE_PA6T 0x00000800
2627
2728 #define PPC_FEATURE_TRUE_LE 0x00000002
2829 #define PPC_FEATURE_PPC_LE 0x00000001
@@ -36,6 +37,7 @@ · 7 unmodified lines
3637 struct cpu_spec;
3738
3839 typedef void (*cpu_setup_t)(unsigned long offset, struct cpu_spec* spec);
40+typedef void (*cpu_restore_t)(void);
3941
4042 enum powerpc_oprofile_type {
4143 PPC_OPROFILE_INVALID = 0,
@@ -65,6 +67,8 @@ struct cpu_spec { · 23 unmodified lines
6567 * BHT, SPD, etc... from head.S before branching to identify_machine
6668 */
6769 cpu_setup_t cpu_setup;
70+ /* Used to restore cpu setup on secondary processors and at resume */
71+ cpu_restore_t cpu_restore;
6872
6973 /* Used by oprofile userspace to select the right counters */
7074 char *oprofile_cpu_type;
@@ -145,7 +149,7 @@ extern void do_cpu_ftr_fixups(unsigned long offset); · 74 unmodified lines
145149
146150 #define CPU_FTR_PPCAS_ARCH_V2_BASE (CPU_FTR_SLB | \
147151 CPU_FTR_TLBIEL | CPU_FTR_NOEXECUTE | \
148− CPU_FTR_NODSISRALIGN | CPU_FTR_CTRL)
152+ CPU_FTR_NODSISRALIGN)
149153
150154 /* iSeries doesn't support large pages */
151155 #ifdef CONFIG_PPC_ISERIES
@@ -310,24 +314,29 @@ extern void do_cpu_ftr_fixups(unsigned long offset); · 158 unmodified lines
310314 CPU_FTR_HPTE_TABLE | CPU_FTR_IABR | \
311315 CPU_FTR_MMCRA | CPU_FTR_CTRL)
312316 #define CPU_FTRS_POWER4 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
313− CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_MMCRA)
317+ CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
318+ CPU_FTR_MMCRA)
314319 #define CPU_FTRS_PPC970 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
315− CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \
320+ CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
316321 CPU_FTR_ALTIVEC_COMP | CPU_FTR_CAN_NAP | CPU_FTR_MMCRA)
317322 #define CPU_FTRS_POWER5 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
318− CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \
323+ CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
319324 CPU_FTR_MMCRA | CPU_FTR_SMT | \
320325 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \
321326 CPU_FTR_PURR)
322327 #define CPU_FTRS_POWER6 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
323− CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \
328+ CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
324329 CPU_FTR_MMCRA | CPU_FTR_SMT | \
325330 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \
326331 CPU_FTR_PURR | CPU_FTR_CI_LARGE_PAGE | CPU_FTR_REAL_LE)
327332 #define CPU_FTRS_CELL (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
328− CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \
333+ CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
329334 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
330− CPU_FTR_CTRL | CPU_FTR_PAUSE_ZERO | CPU_FTR_CI_LARGE_PAGE)
335+ CPU_FTR_PAUSE_ZERO | CPU_FTR_CI_LARGE_PAGE)
336+#define CPU_FTRS_PA6T (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
337+ CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \
338+ CPU_FTR_ALTIVEC_COMP | CPU_FTR_CI_LARGE_PAGE | \
339+ CPU_FTR_PURR | CPU_FTR_REAL_LE)
331340 #define CPU_FTRS_COMPATIBLE (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
332341 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2)
333342 #endif
@@ -336,7 +345,7 @@ extern void do_cpu_ftr_fixups(unsigned long offset); · 2 unmodified lines
336345 #define CPU_FTRS_POSSIBLE \
337346 (CPU_FTRS_POWER3 | CPU_FTRS_RS64 | CPU_FTRS_POWER4 | \
338347 CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | CPU_FTRS_POWER6 | \
339− CPU_FTRS_CELL | CPU_FTR_CI_LARGE_PAGE)
348+ CPU_FTRS_CELL | CPU_FTRS_PA6T)
340349 #else
341350 enum {
342351 CPU_FTRS_POSSIBLE =
@@ -375,7 +384,7 @@ enum { · 32 unmodified lines
375384 #define CPU_FTRS_ALWAYS \
376385 (CPU_FTRS_POWER3 & CPU_FTRS_RS64 & CPU_FTRS_POWER4 & \
377386 CPU_FTRS_PPC970 & CPU_FTRS_POWER5 & CPU_FTRS_POWER6 & \
378− CPU_FTRS_CELL & CPU_FTRS_POSSIBLE)
387+ CPU_FTRS_CELL & CPU_FTRS_PA6T & CPU_FTRS_POSSIBLE)
379388 #else
380389 enum {
381390 CPU_FTRS_ALWAYS =
include/asm-powerpc/hvcall.h+42−79
@@ -164,9 +164,15 @@ · 163 unmodified lines
164164 #define H_VIO_SIGNAL 0x104
165165 #define H_SEND_CRQ 0x108
166166 #define H_COPY_RDMA 0x110
167+#define H_REGISTER_LOGICAL_LAN 0x114
168+#define H_FREE_LOGICAL_LAN 0x118
169+#define H_ADD_LOGICAL_LAN_BUFFER 0x11C
170+#define H_SEND_LOGICAL_LAN 0x120
171+#define H_MULTICAST_CTRL 0x130
167172 #define H_SET_XDABR 0x134
168173 #define H_STUFF_TCE 0x138
169174 #define H_PUT_TCE_INDIRECT 0x13C
175+#define H_CHANGE_LOGICAL_LAN_MAC 0x14C
170176 #define H_VTERM_PARTNER_INFO 0x150
171177 #define H_REGISTER_VTERM 0x154
172178 #define H_FREE_VTERM 0x158
@@ -196,102 +202,59 @@ · 23 unmodified lines
196202 #define H_GET_HCA_INFO 0x1B8
197203 #define H_GET_PERF_COUNT 0x1BC
198204 #define H_MANAGE_TRACE 0x1C0
205+#define H_FREE_LOGICAL_LAN_BUFFER 0x1D4
199206 #define H_QUERY_INT_STATE 0x1E4
200207 #define H_POLL_PENDING 0x1D8
201208 #define H_JOIN 0x298
202209 #define H_VASI_STATE 0x2A4
203210 #define H_ENABLE_CRQ 0x2B0
211+#define MAX_HCALL_OPCODE H_ENABLE_CRQ
204212
205213 #ifndef __ASSEMBLY__
206214
207−/* plpar_hcall() -- Generic call interface using above opcodes
215+/**
216+ * plpar_hcall_norets: - Make a pseries hypervisor call with no return arguments
217+ * @opcode: The hypervisor call to make.
208218 *
209− * The actual call interface is a hypervisor call instruction with
210− * the opcode in R3 and input args in R4-R7.
211− * Status is returned in R3 with variable output values in R4-R11.
212− * Only H_PTE_READ with H_READ_4 uses R6-R11 so we ignore it for now
213− * and return only two out args which MUST ALWAYS BE PROVIDED.
214− */
215−long plpar_hcall(unsigned long opcode,
216− unsigned long arg1,
217− unsigned long arg2,
218− unsigned long arg3,
219− unsigned long arg4,
220− unsigned long *out1,
221− unsigned long *out2,
222− unsigned long *out3);
223−
224−/* Same as plpar_hcall but for those opcodes that return no values
225− * other than status. Slightly more efficient.
219+ * This call supports up to 7 arguments and only returns the status of
220+ * the hcall. Use this version where possible, its slightly faster than
221+ * the other plpar_hcalls.
226222 */
227223 long plpar_hcall_norets(unsigned long opcode, ...);
228224
229−/*
230− * Special hcall interface for ibmveth support.
231− * Takes 8 input parms. Returns a rc and stores the
232− * R4 return value in *out1.
233− */
234−long plpar_hcall_8arg_2ret(unsigned long opcode,
235− unsigned long arg1,
236− unsigned long arg2,
237− unsigned long arg3,
238− unsigned long arg4,
239− unsigned long arg5,
240− unsigned long arg6,
241− unsigned long arg7,
242− unsigned long arg8,
243− unsigned long *out1);
244−
245−/* plpar_hcall_4out()
225+/**
226+ * plpar_hcall: - Make a pseries hypervisor call
227+ * @opcode: The hypervisor call to make.
228+ * @retbuf: Buffer to store up to 4 return arguments in.
246229 *
247− * same as plpar_hcall except with 4 output arguments.
230+ * This call supports up to 6 arguments and 4 return arguments. Use
231+ * PLPAR_HCALL_BUFSIZE to size the return argument buffer.
248232 *
233+ * Used for all but the craziest of phyp interfaces (see plpar_hcall9)
249234 */
250−long plpar_hcall_4out(unsigned long opcode,
251− unsigned long arg1,
252− unsigned long arg2,
253− unsigned long arg3,
254− unsigned long arg4,
255− unsigned long *out1,
256− unsigned long *out2,
257− unsigned long *out3,
258− unsigned long *out4);
235+#define PLPAR_HCALL_BUFSIZE 4
236+long plpar_hcall(unsigned long opcode, unsigned long *retbuf, ...);
259237
260−long plpar_hcall_7arg_7ret(unsigned long opcode,
261− unsigned long arg1,
262− unsigned long arg2,
263− unsigned long arg3,
264− unsigned long arg4,
265− unsigned long arg5,
266− unsigned long arg6,
267− unsigned long arg7,
268− unsigned long *out1,
269− unsigned long *out2,
270− unsigned long *out3,
271− unsigned long *out4,
272− unsigned long *out5,
273− unsigned long *out6,
274− unsigned long *out7);
238+/**
239+ * plpar_hcall9: - Make a pseries hypervisor call with up to 9 return arguments
240+ * @opcode: The hypervisor call to make.
241+ * @retbuf: Buffer to store up to 9 return arguments in.
242+ *
243+ * This call supports up to 9 arguments and 9 return arguments. Use
244+ * PLPAR_HCALL9_BUFSIZE to size the return argument buffer.
245+ */
246+#define PLPAR_HCALL9_BUFSIZE 9
247+long plpar_hcall9(unsigned long opcode, unsigned long *retbuf, ...);
275248
276−long plpar_hcall_9arg_9ret(unsigned long opcode,
277− unsigned long arg1,
278− unsigned long arg2,
279− unsigned long arg3,
280− unsigned long arg4,
281− unsigned long arg5,
282− unsigned long arg6,
283− unsigned long arg7,
284− unsigned long arg8,
285− unsigned long arg9,
286− unsigned long *out1,
287− unsigned long *out2,
288− unsigned long *out3,
289− unsigned long *out4,
290− unsigned long *out5,
291− unsigned long *out6,
292− unsigned long *out7,
293− unsigned long *out8,
294− unsigned long *out9);
249+/* For hcall instrumentation. One structure per-hcall, per-CPU */
250+struct hcall_stats {
251+ unsigned long num_calls; /* number of calls (on this CPU) */
252+ unsigned long tb_total; /* total wall time (mftb) of calls. */
253+ unsigned long purr_total; /* total cpu time (PURR) of calls. */
254+};
255+void update_hcall_stats(unsigned long opcode, unsigned long tb_delta,
256+ unsigned long purr_delta);
257+#define HCALL_STAT_ARRAY_SIZE ((MAX_HCALL_OPCODE >> 2) + 1)
295258
296259 #endif /* __ASSEMBLY__ */
297260 #endif /* __KERNEL__ */
include/asm-powerpc/ibmebus.h+1−1
@@ -48,7 +48,7 @@ extern struct dma_mapping_ops ibmebus_dma_ops; · 47 unmodified lines
4848 extern struct bus_type ibmebus_bus_type;
4949
5050 struct ibmebus_dev {
51− char *name;
51+ const char *name;
5252 struct of_device ofdev;
5353 };
5454
include/asm-powerpc/ide.h+6−6
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 #include <linux/sched.h>
1313 #include <asm/mpc8xx.h>
1414 #endif
15+#include <asm/io.h>
1516
1617 #ifndef MAX_HWIFS
1718 #ifdef __powerpc64__
@@ -21,15 +22,14 @@ · 3 unmodified lines
2122 #endif
2223 #endif
2324
25+#define __ide_mm_insw(p, a, c) _insw_ns((volatile u16 __iomem *)(p), (a), (c))
26+#define __ide_mm_insl(p, a, c) _insl_ns((volatile u32 __iomem *)(p), (a), (c))
27+#define __ide_mm_outsw(p, a, c) _outsw_ns((volatile u16 __iomem *)(p), (a), (c))
28+#define __ide_mm_outsl(p, a, c) _outsl_ns((volatile u32 __iomem *)(p), (a), (c))
29+
2430 #ifndef __powerpc64__
2531 #include <linux/hdreg.h>
2632 #include <linux/ioport.h>
27−#include <asm/io.h>
28−
29−extern void __ide_mm_insw(void __iomem *port, void *addr, u32 count);
30−extern void __ide_mm_outsw(void __iomem *port, void *addr, u32 count);
31−extern void __ide_mm_insl(void __iomem *port, void *addr, u32 count);
32−extern void __ide_mm_outsl(void __iomem *port, void *addr, u32 count);
3333
3434 struct ide_machdep_calls {
3535 int (*default_irq)(unsigned long base);
include/asm-powerpc/io.h+84−99
@@ -20,20 +20,11 @@ extern int check_legacy_ioport(unsigned long base_port); · 19 unmodified lines
2020 #include <asm/page.h>
2121 #include <asm/byteorder.h>
2222 #include <asm/paca.h>
23−#ifdef CONFIG_PPC_ISERIES
24−#include <asm/iseries/iseries_io.h>
25−#endif
2623 #include <asm/synch.h>
2724 #include <asm/delay.h>
2825
2926 #include <asm-generic/iomap.h>
3027
31−#define __ide_mm_insw(p, a, c) _insw_ns((volatile u16 __iomem *)(p), (a), (c))
32−#define __ide_mm_insl(p, a, c) _insl_ns((volatile u32 __iomem *)(p), (a), (c))
33−#define __ide_mm_outsw(p, a, c) _outsw_ns((volatile u16 __iomem *)(p), (a), (c))
34−#define __ide_mm_outsl(p, a, c) _outsl_ns((volatile u32 __iomem *)(p), (a), (c))
35−
36−
3728 #define SIO_CONFIG_RA 0x398
3829 #define SIO_CONFIG_RD 0x399
3930
@@ -43,42 +34,53 @@ extern unsigned long isa_io_base; · 3 unmodified lines
4334 extern unsigned long pci_io_base;
4435
4536 #ifdef CONFIG_PPC_ISERIES
46−/* __raw_* accessors aren't supported on iSeries */
47−#define __raw_readb(addr) { BUG(); 0; }
48−#define __raw_readw(addr) { BUG(); 0; }
49−#define __raw_readl(addr) { BUG(); 0; }
50−#define __raw_readq(addr) { BUG(); 0; }
51−#define __raw_writeb(v, addr) { BUG(); 0; }
52−#define __raw_writew(v, addr) { BUG(); 0; }
53−#define __raw_writel(v, addr) { BUG(); 0; }
54−#define __raw_writeq(v, addr) { BUG(); 0; }
55−#define readb(addr) iSeries_Read_Byte(addr)
56−#define readw(addr) iSeries_Read_Word(addr)
57−#define readl(addr) iSeries_Read_Long(addr)
58−#define writeb(data, addr) iSeries_Write_Byte((data),(addr))
59−#define writew(data, addr) iSeries_Write_Word((data),(addr))
60−#define writel(data, addr) iSeries_Write_Long((data),(addr))
61−#define memset_io(a,b,c) iSeries_memset_io((a),(b),(c))
62−#define memcpy_fromio(a,b,c) iSeries_memcpy_fromio((a), (b), (c))
63−#define memcpy_toio(a,b,c) iSeries_memcpy_toio((a), (b), (c))
64−
65−#define inb(addr) readb(((void __iomem *)(long)(addr)))
66−#define inw(addr) readw(((void __iomem *)(long)(addr)))
67−#define inl(addr) readl(((void __iomem *)(long)(addr)))
68−#define outb(data,addr) writeb(data,((void __iomem *)(long)(addr)))
69−#define outw(data,addr) writew(data,((void __iomem *)(long)(addr)))
70−#define outl(data,addr) writel(data,((void __iomem *)(long)(addr)))
71−/*
72− * The *_ns versions below don't do byte-swapping.
73− * Neither do the standard versions now, these are just here
74− * for older code.
75− */
76−#define insb(port, buf, ns) _insb((u8 __iomem *)((port)+pci_io_base), (buf), (ns))
77−#define insw(port, buf, ns) _insw_ns((u8 __iomem *)((port)+pci_io_base), (buf), (ns))
78−#define insl(port, buf, nl) _insl_ns((u8 __iomem *)((port)+pci_io_base), (buf), (nl))
79−#define insw_ns(port, buf, ns) _insw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns))
80−#define insl_ns(port, buf, nl) _insl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl))
81−#else
37+
38+extern int in_8(const volatile unsigned char __iomem *addr);
39+extern void out_8(volatile unsigned char __iomem *addr, int val);
40+extern int in_le16(const volatile unsigned short __iomem *addr);
41+extern int in_be16(const volatile unsigned short __iomem *addr);
42+extern void out_le16(volatile unsigned short __iomem *addr, int val);
43+extern void out_be16(volatile unsigned short __iomem *addr, int val);
44+extern unsigned in_le32(const volatile unsigned __iomem *addr);
45+extern unsigned in_be32(const volatile unsigned __iomem *addr);
46+extern void out_le32(volatile unsigned __iomem *addr, int val);
47+extern void out_be32(volatile unsigned __iomem *addr, int val);
48+extern unsigned long in_le64(const volatile unsigned long __iomem *addr);
49+extern unsigned long in_be64(const volatile unsigned long __iomem *addr);
50+extern void out_le64(volatile unsigned long __iomem *addr, unsigned long val);
51+extern void out_be64(volatile unsigned long __iomem *addr, unsigned long val);
52+
53+extern unsigned char __raw_readb(const volatile void __iomem *addr);
54+extern unsigned short __raw_readw(const volatile void __iomem *addr);
55+extern unsigned int __raw_readl(const volatile void __iomem *addr);
56+extern unsigned long __raw_readq(const volatile void __iomem *addr);
57+extern void __raw_writeb(unsigned char v, volatile void __iomem *addr);
58+extern void __raw_writew(unsigned short v, volatile void __iomem *addr);
59+extern void __raw_writel(unsigned int v, volatile void __iomem *addr);
60+extern void __raw_writeq(unsigned long v, volatile void __iomem *addr);
61+
62+extern void memset_io(volatile void __iomem *addr, int c, unsigned long n);
63+extern void memcpy_fromio(void *dest, const volatile void __iomem *src,
64+ unsigned long n);
65+extern void memcpy_toio(volatile void __iomem *dest, const void *src,
66+ unsigned long n);
67+
68+#else /* CONFIG_PPC_ISERIES */
69+
70+#define in_8(addr) __in_8((addr))
71+#define out_8(addr, val) __out_8((addr), (val))
72+#define in_le16(addr) __in_le16((addr))
73+#define in_be16(addr) __in_be16((addr))
74+#define out_le16(addr, val) __out_le16((addr), (val))
75+#define out_be16(addr, val) __out_be16((addr), (val))
76+#define in_le32(addr) __in_le32((addr))
77+#define in_be32(addr) __in_be32((addr))
78+#define out_le32(addr, val) __out_le32((addr), (val))
79+#define out_be32(addr, val) __out_be32((addr), (val))
80+#define in_le64(addr) __in_le64((addr))
81+#define in_be64(addr) __in_be64((addr))
82+#define out_le64(addr, val) __out_le64((addr), (val))
83+#define out_be64(addr, val) __out_be64((addr), (val))
8284
8385 static inline unsigned char __raw_readb(const volatile void __iomem *addr)
8486 {
@@ -112,23 +114,11 @@ static inline void __raw_writeq(unsigned long v, volatile void __iomem *addr) · 27 unmodified lines
112114 {
113115 *(volatile unsigned long __force *)addr = v;
114116 }
115−#define readb(addr) eeh_readb(addr)
116−#define readw(addr) eeh_readw(addr)
117−#define readl(addr) eeh_readl(addr)
118−#define readq(addr) eeh_readq(addr)
119−#define writeb(data, addr) eeh_writeb((data), (addr))
120−#define writew(data, addr) eeh_writew((data), (addr))
121−#define writel(data, addr) eeh_writel((data), (addr))
122−#define writeq(data, addr) eeh_writeq((data), (addr))
123117 #define memset_io(a,b,c) eeh_memset_io((a),(b),(c))
124118 #define memcpy_fromio(a,b,c) eeh_memcpy_fromio((a),(b),(c))
125119 #define memcpy_toio(a,b,c) eeh_memcpy_toio((a),(b),(c))
126−#define inb(port) eeh_inb((unsigned long)port)
127−#define outb(val, port) eeh_outb(val, (unsigned long)port)
128−#define inw(port) eeh_inw((unsigned long)port)
129−#define outw(val, port) eeh_outw(val, (unsigned long)port)
130−#define inl(port) eeh_inl((unsigned long)port)
131−#define outl(val, port) eeh_outl(val, (unsigned long)port)
120+
121+#endif /* CONFIG_PPC_ISERIES */
132122
133123 /*
134124 * The insw/outsw/insl/outsl macros don't do byte-swapping.
@@ -138,30 +128,37 @@ static inline void __raw_writeq(unsigned long v, volatile void __iomem *addr) · 3 unmodified lines
138128 #define insb(port, buf, ns) eeh_insb((port), (buf), (ns))
139129 #define insw(port, buf, ns) eeh_insw_ns((port), (buf), (ns))
140130 #define insl(port, buf, nl) eeh_insl_ns((port), (buf), (nl))
141−#define insw_ns(port, buf, ns) eeh_insw_ns((port), (buf), (ns))
142−#define insl_ns(port, buf, nl) eeh_insl_ns((port), (buf), (nl))
143−
144−#endif
145131
146132 #define outsb(port, buf, ns) _outsb((u8 __iomem *)((port)+pci_io_base), (buf), (ns))
147133 #define outsw(port, buf, ns) _outsw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns))
148134 #define outsl(port, buf, nl) _outsl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl))
149135
136+#define readb(addr) eeh_readb(addr)
137+#define readw(addr) eeh_readw(addr)
138+#define readl(addr) eeh_readl(addr)
139+#define readq(addr) eeh_readq(addr)
140+#define writeb(data, addr) eeh_writeb((data), (addr))
141+#define writew(data, addr) eeh_writew((data), (addr))
142+#define writel(data, addr) eeh_writel((data), (addr))
143+#define writeq(data, addr) eeh_writeq((data), (addr))
144+#define inb(port) eeh_inb((unsigned long)port)
145+#define outb(val, port) eeh_outb(val, (unsigned long)port)
146+#define inw(port) eeh_inw((unsigned long)port)
147+#define outw(val, port) eeh_outw(val, (unsigned long)port)
148+#define inl(port) eeh_inl((unsigned long)port)
149+#define outl(val, port) eeh_outl(val, (unsigned long)port)
150+
150151 #define readb_relaxed(addr) readb(addr)
151152 #define readw_relaxed(addr) readw(addr)
152153 #define readl_relaxed(addr) readl(addr)
153154 #define readq_relaxed(addr) readq(addr)
154155
155−extern void _insb(volatile u8 __iomem *port, void *buf, int ns);
156−extern void _outsb(volatile u8 __iomem *port, const void *buf, int ns);
157−extern void _insw(volatile u16 __iomem *port, void *buf, int ns);
158−extern void _outsw(volatile u16 __iomem *port, const void *buf, int ns);
159−extern void _insl(volatile u32 __iomem *port, void *buf, int nl);
160−extern void _outsl(volatile u32 __iomem *port, const void *buf, int nl);
161−extern void _insw_ns(volatile u16 __iomem *port, void *buf, int ns);
162−extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, int ns);
163−extern void _insl_ns(volatile u32 __iomem *port, void *buf, int nl);
164−extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, int nl);
156+extern void _insb(volatile u8 __iomem *port, void *buf, long count);
157+extern void _outsb(volatile u8 __iomem *port, const void *buf, long count);
158+extern void _insw_ns(volatile u16 __iomem *port, void *buf, long count);
159+extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, long count);
160+extern void _insl_ns(volatile u32 __iomem *port, void *buf, long count);
161+extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, long count);
165162
166163 static inline void mmiowb(void)
167164 {
@@ -180,14 +177,6 @@ static inline void mmiowb(void) · 12 unmodified lines
180177 #define inl_p(port) inl(port)
181178 #define outl_p(val, port) (udelay(1), outl((val), (port)))
182179
183−/*
184− * The *_ns versions below don't do byte-swapping.
185− * Neither do the standard versions now, these are just here
186− * for older code.
187− */
188−#define outsw_ns(port, buf, ns) _outsw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns))
189−#define outsl_ns(port, buf, nl) _outsl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl))
190−
191180
192181 #define IO_SPACE_LIMIT ~(0UL)
193182
@@ -279,7 +268,7 @@ static inline void iosync(void) · 85 unmodified lines
279268 * and should not be used directly by device drivers. Use inb/readb
280269 * instead.
281270 */
282−static inline int in_8(const volatile unsigned char __iomem *addr)
271+static inline int __in_8(const volatile unsigned char __iomem *addr)
283272 {
284273 int ret;
285274
@@ -288,14 +277,14 @@ static inline int in_8(const volatile unsigned char __iomem *addr) · 2 unmodified lines
288277 return ret;
289278 }
290279
291−static inline void out_8(volatile unsigned char __iomem *addr, int val)
280+static inline void __out_8(volatile unsigned char __iomem *addr, int val)
292281 {
293282 __asm__ __volatile__("sync; stb%U0%X0 %1,%0"
294283 : "=m" (*addr) : "r" (val));
295284 get_paca()->io_sync = 1;
296285 }
297286
298−static inline int in_le16(const volatile unsigned short __iomem *addr)
287+static inline int __in_le16(const volatile unsigned short __iomem *addr)
299288 {
300289 int ret;
301290
@@ -304,7 +293,7 @@ static inline int in_le16(const volatile unsigned short __iomem *addr) · 2 unmodified lines
304293 return ret;
305294 }
306295
307−static inline int in_be16(const volatile unsigned short __iomem *addr)
296+static inline int __in_be16(const volatile unsigned short __iomem *addr)
308297 {
309298 int ret;
310299
@@ -313,21 +302,21 @@ static inline int in_be16(const volatile unsigned short __iomem *addr) · 2 unmodified lines
313302 return ret;
314303 }
315304
316−static inline void out_le16(volatile unsigned short __iomem *addr, int val)
305+static inline void __out_le16(volatile unsigned short __iomem *addr, int val)
317306 {
318307 __asm__ __volatile__("sync; sthbrx %1,0,%2"
319308 : "=m" (*addr) : "r" (val), "r" (addr));
320309 get_paca()->io_sync = 1;
321310 }
322311
323−static inline void out_be16(volatile unsigned short __iomem *addr, int val)
312+static inline void __out_be16(volatile unsigned short __iomem *addr, int val)
324313 {
325314 __asm__ __volatile__("sync; sth%U0%X0 %1,%0"
326315 : "=m" (*addr) : "r" (val));
327316 get_paca()->io_sync = 1;
328317 }
329318
330−static inline unsigned in_le32(const volatile unsigned __iomem *addr)
319+static inline unsigned __in_le32(const volatile unsigned __iomem *addr)
331320 {
332321 unsigned ret;
333322
@@ -336,7 +325,7 @@ static inline unsigned in_le32(const volatile unsigned __iomem *addr) · 2 unmodified lines
336325 return ret;
337326 }
338327
339−static inline unsigned in_be32(const volatile unsigned __iomem *addr)
328+static inline unsigned __in_be32(const volatile unsigned __iomem *addr)
340329 {
341330 unsigned ret;
342331
@@ -345,21 +334,21 @@ static inline unsigned in_be32(const volatile unsigned __iomem *addr) · 2 unmodified lines
345334 return ret;
346335 }
347336
348−static inline void out_le32(volatile unsigned __iomem *addr, int val)
337+static inline void __out_le32(volatile unsigned __iomem *addr, int val)
349338 {
350339 __asm__ __volatile__("sync; stwbrx %1,0,%2" : "=m" (*addr)
351340 : "r" (val), "r" (addr));
352341 get_paca()->io_sync = 1;
353342 }
354343
355−static inline void out_be32(volatile unsigned __iomem *addr, int val)
344+static inline void __out_be32(volatile unsigned __iomem *addr, int val)
356345 {
357346 __asm__ __volatile__("sync; stw%U0%X0 %1,%0"
358347 : "=m" (*addr) : "r" (val));
359348 get_paca()->io_sync = 1;
360349 }
361350
362−static inline unsigned long in_le64(const volatile unsigned long __iomem *addr)
351+static inline unsigned long __in_le64(const volatile unsigned long __iomem *addr)
363352 {
364353 unsigned long tmp, ret;
365354
@@ -379,7 +368,7 @@ static inline unsigned long in_le64(const volatile unsigned long __iomem *addr) · 13 unmodified lines
379368 return ret;
380369 }
381370
382−static inline unsigned long in_be64(const volatile unsigned long __iomem *addr)
371+static inline unsigned long __in_be64(const volatile unsigned long __iomem *addr)
383372 {
384373 unsigned long ret;
385374
@@ -388,7 +377,7 @@ static inline unsigned long in_be64(const volatile unsigned long __iomem *addr) · 2 unmodified lines
388377 return ret;
389378 }
390379
391−static inline void out_le64(volatile unsigned long __iomem *addr, unsigned long val)
380+static inline void __out_le64(volatile unsigned long __iomem *addr, unsigned long val)
392381 {
393382 unsigned long tmp;
394383
@@ -406,15 +395,13 @@ static inline void out_le64(volatile unsigned long __iomem *addr, unsigned long · 11 unmodified lines
406395 get_paca()->io_sync = 1;
407396 }
408397
409−static inline void out_be64(volatile unsigned long __iomem *addr, unsigned long val)
398+static inline void __out_be64(volatile unsigned long __iomem *addr, unsigned long val)
410399 {
411400 __asm__ __volatile__("sync; std%U0%X0 %1,%0" : "=m" (*addr) : "r" (val));
412401 get_paca()->io_sync = 1;
413402 }
414403
415−#ifndef CONFIG_PPC_ISERIES
416404 #include <asm/eeh.h>
417−#endif
418405
419406 /**
420407 * check_signature - find BIOS signatures
@@ -430,7 +417,6 @@ static inline int check_signature(const volatile void __iomem * io_addr, · 9 unmodified lines
430417 const unsigned char *signature, int length)
431418 {
432419 int retval = 0;
433−#ifndef CONFIG_PPC_ISERIES
434420 do {
435421 if (readb(io_addr) != *signature)
436422 goto out;
@@ -440,7 +426,6 @@ static inline int check_signature(const volatile void __iomem * io_addr, · 3 unmodified lines
440426 } while (length);
441427 retval = 1;
442428 out:
443−#endif
444429 return retval;
445430 }
446431
include/asm-powerpc/irq.h+12−12
@@ -137,7 +137,7 @@ struct irq_map_entry { · 136 unmodified lines
137137 extern struct irq_map_entry irq_map[NR_IRQS];
138138
139139
140−/***
140+/**
141141 * irq_alloc_host - Allocate a new irq_host data structure
142142 * @node: device-tree node of the interrupt controller
143143 * @revmap_type: type of reverse mapping to use
@@ -159,14 +159,14 @@ extern struct irq_host *irq_alloc_host(unsigned int revmap_type, · 15 unmodified lines
159159 irq_hw_number_t inval_irq);
160160
161161
162−/***
162+/**
163163 * irq_find_host - Locates a host for a given device node
164164 * @node: device-tree node of the interrupt controller
165165 */
166166 extern struct irq_host *irq_find_host(struct device_node *node);
167167
168168
169−/***
169+/**
170170 * irq_set_default_host - Set a "default" host
171171 * @host: default host pointer
172172 *
@@ -178,7 +178,7 @@ extern struct irq_host *irq_find_host(struct device_node *node); · 5 unmodified lines
178178 extern void irq_set_default_host(struct irq_host *host);
179179
180180
181−/***
181+/**
182182 * irq_set_virq_count - Set the maximum number of virt irqs
183183 * @count: number of linux virtual irqs, capped with NR_IRQS
184184 *
@@ -188,7 +188,7 @@ extern void irq_set_default_host(struct irq_host *host); · 3 unmodified lines
188188 extern void irq_set_virq_count(unsigned int count);
189189
190190
191−/***
191+/**
192192 * irq_create_mapping - Map a hardware interrupt into linux virq space
193193 * @host: host owning this hardware interrupt or NULL for default host
194194 * @hwirq: hardware irq number in that host space
@@ -202,13 +202,13 @@ extern unsigned int irq_create_mapping(struct irq_host *host, · 7 unmodified lines
202202 irq_hw_number_t hwirq);
203203
204204
205−/***
205+/**
206206 * irq_dispose_mapping - Unmap an interrupt
207207 * @virq: linux virq number of the interrupt to unmap
208208 */
209209 extern void irq_dispose_mapping(unsigned int virq);
210210
211−/***
211+/**
212212 * irq_find_mapping - Find a linux virq from an hw irq number.
213213 * @host: host owning this hardware interrupt
214214 * @hwirq: hardware irq number in that host space
@@ -221,7 +221,7 @@ extern unsigned int irq_find_mapping(struct irq_host *host, · 6 unmodified lines
221221 irq_hw_number_t hwirq);
222222
223223
224−/***
224+/**
225225 * irq_radix_revmap - Find a linux virq from a hw irq number.
226226 * @host: host owning this hardware interrupt
227227 * @hwirq: hardware irq number in that host space
@@ -232,7 +232,7 @@ extern unsigned int irq_find_mapping(struct irq_host *host, · 4 unmodified lines
232232 extern unsigned int irq_radix_revmap(struct irq_host *host,
233233 irq_hw_number_t hwirq);
234234
235−/***
235+/**
236236 * irq_linear_revmap - Find a linux virq from a hw irq number.
237237 * @host: host owning this hardware interrupt
238238 * @hwirq: hardware irq number in that host space
@@ -247,7 +247,7 @@ extern unsigned int irq_linear_revmap(struct irq_host *host, · 8 unmodified lines
247247
248248
249249
250−/***
250+/**
251251 * irq_alloc_virt - Allocate virtual irq numbers
252252 * @host: host owning these new virtual irqs
253253 * @count: number of consecutive numbers to allocate
@@ -261,7 +261,7 @@ extern unsigned int irq_alloc_virt(struct irq_host *host, · 7 unmodified lines
261261 unsigned int count,
262262 unsigned int hint);
263263
264−/***
264+/**
265265 * irq_free_virt - Free virtual irq numbers
266266 * @virq: virtual irq number of the first interrupt to free
267267 * @count: number of interrupts to free
@@ -300,7 +300,7 @@ extern unsigned int irq_of_parse_and_map(struct device_node *dev, int index); · 32 unmodified lines
300300
301301 /* -- End OF helpers -- */
302302
303−/***
303+/**
304304 * irq_early_init - Init irq remapping subsystem
305305 */
306306 extern void irq_early_init(void);
include/asm-powerpc/iseries/hv_call_xm.h+0−17
@@ -16,23 +16,6 @@ · 15 unmodified lines
1616 #define HvCallXmSetTce HvCallXm + 11
1717 #define HvCallXmSetTces HvCallXm + 13
1818
19−/*
20− * Structure passed to HvCallXm_getTceTableParms
21− */
22−struct iommu_table_cb {
23− unsigned long itc_busno; /* Bus number for this tce table */
24− unsigned long itc_start; /* Will be NULL for secondary */
25− unsigned long itc_totalsize; /* Size (in pages) of whole table */
26− unsigned long itc_offset; /* Index into real tce table of the
27− start of our section */
28− unsigned long itc_size; /* Size (in pages) of our section */
29− unsigned long itc_index; /* Index of this tce table */
30− unsigned short itc_maxtables; /* Max num of tables for partition */
31− unsigned char itc_virtbus; /* Flag to indicate virtual bus */
32− unsigned char itc_slotno; /* IOA Tce Slot Index */
33− unsigned char itc_rsvd[4];
34−};
35−
3619 static inline void HvCallXm_getTceTableParms(u64 cb)
3720 {
3821 HvCall1(HvCallXmGetTceTableParms, cb);
include/asm-powerpc/iseries/hv_lp_config.h+2−11
@@ -25,7 +25,6 @@ · 24 unmodified lines
2525
2626 #include <asm/iseries/hv_call_sc.h>
2727 #include <asm/iseries/hv_types.h>
28−#include <asm/iseries/it_lp_naca.h>
2928
3029 enum {
3130 HvCallCfg_Cur = 0,
@@ -44,16 +43,8 @@ enum { · 12 unmodified lines
4443 #define HvCallCfgGetHostingLpIndex HvCallCfg + 32
4544
4645 extern HvLpIndex HvLpConfig_getLpIndex_outline(void);
47−
48−static inline HvLpIndex HvLpConfig_getLpIndex(void)
49−{
50− return itLpNaca.xLpIndex;
51−}
52−
53−static inline HvLpIndex HvLpConfig_getPrimaryLpIndex(void)
54−{
55− return itLpNaca.xPrimaryLpIndex;
56−}
46+extern HvLpIndex HvLpConfig_getLpIndex(void);
47+extern HvLpIndex HvLpConfig_getPrimaryLpIndex(void);
5748
5849 static inline u64 HvLpConfig_getMsChunks(void)
5950 {
include/asm-powerpc/iseries/iseries_io.h+0−60
@@ -1,60 +0,0 @@
1−#ifndef _ASM_POWERPC_ISERIES_ISERIES_IO_H
2−#define _ASM_POWERPC_ISERIES_ISERIES_IO_H
3−
4−
5−#ifdef CONFIG_PPC_ISERIES
6−#include <linux/types.h>
7−/*
8− * Created by Allan Trautman on Thu Dec 28 2000.
9− *
10− * Remaps the io.h for the iSeries Io
11− * Copyright (C) 2000 Allan H Trautman, IBM Corporation
12− *
13− * This program is free software; you can redistribute it and/or modify
14− * it under the terms of the GNU General Public License as published by
15− * the Free Software Foundation; either version 2 of the License, or
16− * (at your option) any later version.
17− *
18− * This program is distributed in the hope that it will be useful,
19− * but WITHOUT ANY WARRANTY; without even the implied warranty of
20− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21− * GNU General Public License for more details.
22− *
23− * You should have received a copy of the GNU General Public License
24− * along with this program; if not, write to the:
25− * Free Software Foundation, Inc.,
26− * 59 Temple Place, Suite 330,
27− * Boston, MA 02111-1307 USA
28− *
29− * Change Activity:
30− * Created December 28, 2000
31− * End Change Activity
32− */
33−
34−#ifdef CONFIG_PCI
35−extern u8 iSeries_Read_Byte(const volatile void __iomem * IoAddress);
36−extern u16 iSeries_Read_Word(const volatile void __iomem * IoAddress);
37−extern u32 iSeries_Read_Long(const volatile void __iomem * IoAddress);
38−extern void iSeries_Write_Byte(u8 IoData, volatile void __iomem * IoAddress);
39−extern void iSeries_Write_Word(u16 IoData, volatile void __iomem * IoAddress);
40−extern void iSeries_Write_Long(u32 IoData, volatile void __iomem * IoAddress);
41−
42−extern void iSeries_memset_io(volatile void __iomem *dest, char x, size_t n);
43−extern void iSeries_memcpy_toio(volatile void __iomem *dest, void *source,
44− size_t n);
45−extern void iSeries_memcpy_fromio(void *dest,
46− const volatile void __iomem *source, size_t n);
47−#else
48−static inline u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress)
49−{
50− return 0xff;
51−}
52−
53−static inline void iSeries_Write_Byte(u8 IoData,
54− volatile void __iomem *IoAddress)
55−{
56−}
57−#endif /* CONFIG_PCI */
58−
59−#endif /* CONFIG_PPC_ISERIES */
60−#endif /* _ASM_POWERPC_ISERIES_ISERIES_IO_H */
include/asm-powerpc/iseries/it_lp_queue.h+0−2
@@ -27,8 +27,6 @@ · 26 unmodified lines
2727 #include <asm/types.h>
2828 #include <asm/ptrace.h>
2929
30−struct HvLpEvent;
31−
3230 #define IT_LP_MAX_QUEUES 8
3331
3432 #define IT_LP_NOT_USED 0 /* Queue will not be used by PLIC */
include/asm-powerpc/iseries/vio.h+28−0
@@ -122,6 +122,34 @@ enum viorc { · 121 unmodified lines
122122 viorc_openRejected = 0x0301
123123 };
124124
125+/*
126+ * The structure of the events that flow between us and OS/400 for chario
127+ * events. You can't mess with this unless the OS/400 side changes too.
128+ */
129+struct viocharlpevent {
130+ struct HvLpEvent event;
131+ u32 reserved;
132+ u16 version;
133+ u16 subtype_result_code;
134+ u8 virtual_device;
135+ u8 len;
136+ u8 data[VIOCHAR_MAX_DATA];
137+};
138+
139+#define VIOCHAR_WINDOW 10
140+
141+enum viocharsubtype {
142+ viocharopen = 0x0001,
143+ viocharclose = 0x0002,
144+ viochardata = 0x0003,
145+ viocharack = 0x0004,
146+ viocharconfig = 0x0005
147+};
148+
149+enum viochar_rc {
150+ viochar_rc_ebusy = 1
151+};
152+
125153 struct device;
126154
127155 extern struct device *iSeries_vio_dev;
include/asm-powerpc/lppaca.h+21−2
@@ -27,7 +27,9 @@ · 26 unmodified lines
2727 //
2828 //
2929 //----------------------------------------------------------------------------
30+#include <linux/cache.h>
3031 #include <asm/types.h>
32+#include <asm/mmu.h>
3133
3234 /* The Hypervisor barfs if the lppaca crosses a page boundary. A 1k
3335 * alignment is sufficient to prevent this */
@@ -114,7 +116,7 @@ struct lppaca { · 80 unmodified lines
114116
115117
116118 //=============================================================================
117−// CACHE_LINE_3 0x0100 - 0x007F: This line is shared with other processors
119+// CACHE_LINE_3 0x0100 - 0x017F: This line is shared with other processors
118120 //=============================================================================
119121 // This is the yield_count. An "odd" value (low bit on) means that
120122 // the processor is yielded (either because of an OS yield or a PLIC
@@ -126,12 +128,29 @@ struct lppaca { · 5 unmodified lines
126128 u8 reserved6[124]; // Reserved x04-x7F
127129
128130 //=============================================================================
129−// CACHE_LINE_4-5 0x0100 - 0x01FF Contains PMC interrupt data
131+// CACHE_LINE_4-5 0x0180 - 0x027F Contains PMC interrupt data
130132 //=============================================================================
131133 u8 pmc_save_area[256]; // PMC interrupt Area x00-xFF
132134 } __attribute__((__aligned__(0x400)));
133135
134136 extern struct lppaca lppaca[];
135137
138+/*
139+ * SLB shadow buffer structure as defined in the PAPR. The save_area
140+ * contains adjacent ESID and VSID pairs for each shadowed SLB. The
141+ * ESID is stored in the lower 64bits, then the VSID.
142+ */
143+struct slb_shadow {
144+ u32 persistent; // Number of persistent SLBs x00-x03
145+ u32 buffer_length; // Total shadow buffer length x04-x07
146+ u64 reserved; // Alignment x08-x0f
147+ struct {
148+ u64 esid;
149+ u64 vsid;
150+ } save_area[SLB_NUM_BOLTED]; // x10-x40
151+} ____cacheline_aligned;
152+
153+extern struct slb_shadow slb_shadow[];
154+
136155 #endif /* __KERNEL__ */
137156 #endif /* _ASM_POWERPC_LPPACA_H */
include/asm-powerpc/paca.h+3−0
@@ -23,6 +23,7 @@ · 22 unmodified lines
2323 register struct paca_struct *local_paca asm("r13");
2424 #define get_paca() local_paca
2525 #define get_lppaca() (get_paca()->lppaca_ptr)
26+#define get_slb_shadow() (get_paca()->slb_shadow_ptr)
2627
2728 struct task_struct;
2829
@@ -99,6 +100,8 @@ struct paca_struct { · 70 unmodified lines
99100 u64 user_time; /* accumulated usermode TB ticks */
100101 u64 system_time; /* accumulated system TB ticks */
101102 u64 startpurr; /* PURR/TB value snapshot */
103+
104+ struct slb_shadow *slb_shadow_ptr;
102105 };
103106
104107 extern struct paca_struct paca[];
include/asm-powerpc/page.h+0−6
@@ -55,12 +55,6 @@ · 54 unmodified lines
5555 #define PAGE_OFFSET ASM_CONST(CONFIG_KERNEL_START)
5656 #define KERNELBASE (PAGE_OFFSET + PHYSICAL_START)
5757
58−#ifdef CONFIG_DISCONTIGMEM
59−#define page_to_pfn(page) discontigmem_page_to_pfn(page)
60−#define pfn_to_page(pfn) discontigmem_pfn_to_page(pfn)
61−#define pfn_valid(pfn) discontigmem_pfn_valid(pfn)
62−#endif
63−
6458 #ifdef CONFIG_FLATMEM
6559 #define pfn_valid(pfn) ((pfn) < max_mapnr)
6660 #endif
include/asm-powerpc/ppc-pci.h+11−0
@@ -68,6 +68,17 @@ struct pci_dev *pci_get_device_by_addr(unsigned long addr); · 67 unmodified lines
6868 */
6969 void eeh_slot_error_detail (struct pci_dn *pdn, int severity);
7070
71+/**
72+ * rtas_pci_enableo - enable IO transfers for this slot
73+ * @pdn: pci device node
74+ * @function: either EEH_THAW_MMIO or EEH_THAW_DMA
75+ *
76+ * Enable I/O transfers to this slot
77+ */
78+#define EEH_THAW_MMIO 2
79+#define EEH_THAW_DMA 3
80+int rtas_pci_enable(struct pci_dn *pdn, int function);
81+
7182 /**
7283 * rtas_set_slot_reset -- unfreeze a frozen slot
7384 *
include/asm-powerpc/processor.h+1−0
@@ -32,6 +32,7 @@ · 31 unmodified lines
3232 #define _CHRP_Motorola 0x04 /* motorola chrp, the cobra */
3333 #define _CHRP_IBM 0x05 /* IBM chrp, the longtrail and longtrail 2 */
3434 #define _CHRP_Pegasos 0x06 /* Genesi/bplan's Pegasos and Pegasos2 */
35+#define _CHRP_briq 0x07 /* TotalImpact's briQ */
3536
3637 #if defined(__KERNEL__) && defined(CONFIG_PPC32)
3738
include/asm-powerpc/prom.h+25−15
@@ -72,8 +72,8 @@ struct property { · 71 unmodified lines
7272 };
7373
7474 struct device_node {
75− char *name;
76− char *type;
75+ const char *name;
76+ const char *type;
7777 phandle node;
7878 phandle linux_phandle;
7979 char *full_name;
@@ -160,7 +160,7 @@ extern void unflatten_device_tree(void); · 80 unmodified lines
160160 extern void early_init_devtree(void *);
161161 extern int device_is_compatible(struct device_node *device, const char *);
162162 extern int machine_is_compatible(const char *compat);
163−extern void *get_property(struct device_node *node, const char *name,
163+extern const void *get_property(struct device_node *node, const char *name,
164164 int *lenp);
165165 extern void print_properties(struct device_node *node);
166166 extern int prom_n_addr_cells(struct device_node* np);
@@ -197,8 +197,8 @@ extern int release_OF_resource(struct device_node* node, int index); · 30 unmodified lines
197197 */
198198
199199
200−/* Helper to read a big number */
201−static inline u64 of_read_number(u32 *cell, int size)
200+/* Helper to read a big number; size is in cells (not bytes) */
201+static inline u64 of_read_number(const u32 *cell, int size)
202202 {
203203 u64 r = 0;
204204 while (size--)
@@ -206,18 +206,28 @@ static inline u64 of_read_number(u32 *cell, int size) · 1 unmodified line
206206 return r;
207207 }
208208
209+/* Like of_read_number, but we want an unsigned long result */
210+#ifdef CONFIG_PPC32
211+static inline unsigned long of_read_ulong(const u32 *cell, int size)
212+{
213+ return cell[size-1];
214+}
215+#else
216+#define of_read_ulong(cell, size) of_read_number(cell, size)
217+#endif
218+
209219 /* Translate an OF address block into a CPU physical address
210220 */
211221 #define OF_BAD_ADDR ((u64)-1)
212−extern u64 of_translate_address(struct device_node *np, u32 *addr);
222+extern u64 of_translate_address(struct device_node *np, const u32 *addr);
213223
214224 /* Extract an address from a device, returns the region size and
215225 * the address space flags too. The PCI version uses a BAR number
216226 * instead of an absolute index
217227 */
218−extern u32 *of_get_address(struct device_node *dev, int index,
228+extern const u32 *of_get_address(struct device_node *dev, int index,
219229 u64 *size, unsigned int *flags);
220−extern u32 *of_get_pci_address(struct device_node *dev, int bar_no,
230+extern const u32 *of_get_pci_address(struct device_node *dev, int bar_no,
221231 u64 *size, unsigned int *flags);
222232
223233 /* Get an address as a resource. Note that if your address is
@@ -234,7 +244,7 @@ extern int of_pci_address_to_resource(struct device_node *dev, int bar, · 10 unmodified lines
234244 /* Parse the ibm,dma-window property of an OF node into the busno, phys and
235245 * size parameters.
236246 */
237−void of_parse_dma_window(struct device_node *dn, unsigned char *dma_window_prop,
247+void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop,
238248 unsigned long *busno, unsigned long *phys, unsigned long *size);
239249
240250 extern void kdump_move_device_tree(void);
@@ -259,7 +269,7 @@ struct of_irq { · 18 unmodified lines
259269 u32 specifier[OF_MAX_IRQ_SPEC]; /* Specifier copy */
260270 };
261271
262−/***
272+/**
263273 * of_irq_map_init - Initialize the irq remapper
264274 * @flags: flags defining workarounds to enable
265275 *
@@ -272,7 +282,7 @@ struct of_irq { · 6 unmodified lines
272282
273283 extern void of_irq_map_init(unsigned int flags);
274284
275−/***
285+/**
276286 * of_irq_map_raw - Low level interrupt tree parsing
277287 * @parent: the device interrupt parent
278288 * @intspec: interrupt specifier ("interrupts" property of the device)
@@ -289,12 +299,12 @@ extern void of_irq_map_init(unsigned int flags); · 10 unmodified lines
289299 *
290300 */
291301
292−extern int of_irq_map_raw(struct device_node *parent, u32 *intspec,
293− u32 ointsize, u32 *addr,
302+extern int of_irq_map_raw(struct device_node *parent, const u32 *intspec,
303+ u32 ointsize, const u32 *addr,
294304 struct of_irq *out_irq);
295305
296306
297−/***
307+/**
298308 * of_irq_map_one - Resolve an interrupt for a device
299309 * @device: the device whose interrupt is to be resolved
300310 * @index: index of the interrupt to resolve
@@ -307,7 +317,7 @@ extern int of_irq_map_raw(struct device_node *parent, u32 *intspec, · 6 unmodified lines
307317 extern int of_irq_map_one(struct device_node *device, int index,
308318 struct of_irq *out_irq);
309319
310−/***
320+/**
311321 * of_irq_map_pci - Resolve the interrupt for a PCI device
312322 * @pdev: the device whose interrupt is to be resolved
313323 * @out_irq: structure of_irq filled by this function
include/asm-powerpc/ptrace.h+0−4
@@ -215,12 +215,10 @@ do { \ · 214 unmodified lines
215215 #define PTRACE_GETVRREGS 18
216216 #define PTRACE_SETVRREGS 19
217217
218−#ifndef __powerpc64__
219218 /* Get/set all the upper 32-bits of the SPE registers, accumulator, and
220219 * spefscr, in one go */
221220 #define PTRACE_GETEVRREGS 20
222221 #define PTRACE_SETEVRREGS 21
223−#endif /* __powerpc64__ */
224222
225223 /*
226224 * Get or set a debug register. The first 16 are DABR registers and the
@@ -235,7 +233,6 @@ do { \ · 8 unmodified lines
235233 #define PPC_PTRACE_GETFPREGS 0x97 /* Get FPRs 0 - 31 */
236234 #define PPC_PTRACE_SETFPREGS 0x96 /* Set FPRs 0 - 31 */
237235
238−#ifdef __powerpc64__
239236 /* Calls to trace a 64bit program from a 32bit program */
240237 #define PPC_PTRACE_PEEKTEXT_3264 0x95
241238 #define PPC_PTRACE_PEEKDATA_3264 0x94
@@ -243,6 +240,5 @@ do { \ · 1 unmodified line
243240 #define PPC_PTRACE_POKEDATA_3264 0x92
244241 #define PPC_PTRACE_PEEKUSR_3264 0x91
245242 #define PPC_PTRACE_POKEUSR_3264 0x90
246−#endif /* __powerpc64__ */
247243
248244 #endif /* _ASM_POWERPC_PTRACE_H */
include/asm-powerpc/reg.h+1−0
@@ -592,6 +592,7 @@ · 591 unmodified lines
592592 #define PV_630p 0x0041
593593 #define PV_970MP 0x0044
594594 #define PV_BE 0x0070
595+#define PV_PA6T 0x0090
595596
596597 /*
597598 * Number of entries in the SLB. If this ever changes we should handle
include/asm-powerpc/rtas.h+16−0
@@ -230,5 +230,21 @@ extern unsigned long rtas_rmo_buf; · 229 unmodified lines
230230
231231 #define GLOBAL_INTERRUPT_QUEUE 9005
232232
233+/**
234+ * rtas_config_addr - Format a busno, devfn and reg for RTAS.
235+ * @busno: The bus number.
236+ * @devfn: The device and function number as encoded by PCI_DEVFN().
237+ * @reg: The register number.
238+ *
239+ * This function encodes the given busno, devfn and register number as
240+ * required for RTAS calls that take a "config_addr" parameter.
241+ * See PAPR requirement 7.3.4-1 for more info.
242+ */
243+static inline u32 rtas_config_addr(int busno, int devfn, int reg)
244+{
245+ return ((reg & 0xf00) << 20) | ((busno & 0xff) << 16) |
246+ (devfn << 8) | (reg & 0xff);
247+}
248+
233249 #endif /* __KERNEL__ */
234250 #endif /* _POWERPC_RTAS_H */
include/asm-powerpc/smu.h+1−1
@@ -517,7 +517,7 @@ struct smu_sdbp_cpupiddata { · 516 unmodified lines
517517 * This returns the pointer to an SMU "sdb" partition data or NULL
518518 * if not found. The data format is described below
519519 */
520−extern struct smu_sdbp_header *smu_get_sdb_partition(int id,
520+extern const struct smu_sdbp_header *smu_get_sdb_partition(int id,
521521 unsigned int *size);
522522
523523 /* Get "sdb" partition data from an SMU satellite */
include/asm-powerpc/spu.h+1−1
@@ -106,7 +106,7 @@ struct spu_context; · 105 unmodified lines
106106 struct spu_runqueue;
107107
108108 struct spu {
109− char *name;
109+ const char *name;
110110 unsigned long local_store_phys;
111111 u8 *local_store;
112112 unsigned long problem_phys;
include/asm-powerpc/system.h+0−5
@@ -177,11 +177,6 @@ extern u32 booke_wdt_enabled; · 176 unmodified lines
177177 extern u32 booke_wdt_period;
178178 #endif /* CONFIG_BOOKE_WDT */
179179
180−/* EBCDIC -> ASCII conversion for [0-9A-Z] on iSeries */
181−extern unsigned char e2a(unsigned char);
182−extern unsigned char* strne2a(unsigned char *dest,
183− const unsigned char *src, size_t n);
184−
185180 struct device_node;
186181 extern void note_scsi_host(struct device_node *, void *);
187182
include/asm-powerpc/vio.h+2−2
@@ -46,8 +46,8 @@ struct iommu_table; · 45 unmodified lines
4646 */
4747 struct vio_dev {
4848 struct iommu_table *iommu_table; /* vio_map_* uses this */
49− char *name;
50− char *type;
49+ const char *name;
50+ const char *type;
5151 uint32_t unit_address;
5252 unsigned int irq;
5353 struct device dev;
include/asm-ppc/io.h+6−20
@@ -327,26 +327,12 @@ __do_out_asm(outl, "stwbrx") · 326 unmodified lines
327327 #define inl_p(port) inl((port))
328328 #define outl_p(val, port) outl((val), (port))
329329
330−extern void _insb(volatile u8 __iomem *port, void *buf, int ns);
331−extern void _outsb(volatile u8 __iomem *port, const void *buf, int ns);
332−extern void _insw(volatile u16 __iomem *port, void *buf, int ns);
333−extern void _outsw(volatile u16 __iomem *port, const void *buf, int ns);
334−extern void _insl(volatile u32 __iomem *port, void *buf, int nl);
335−extern void _outsl(volatile u32 __iomem *port, const void *buf, int nl);
336−extern void _insw_ns(volatile u16 __iomem *port, void *buf, int ns);
337−extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, int ns);
338−extern void _insl_ns(volatile u32 __iomem *port, void *buf, int nl);
339−extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, int nl);
340−
341−/*
342− * The *_ns versions below don't do byte-swapping.
343− * Neither do the standard versions now, these are just here
344− * for older code.
345− */
346−#define insw_ns(port, buf, ns) _insw_ns((port)+___IO_BASE, (buf), (ns))
347−#define outsw_ns(port, buf, ns) _outsw_ns((port)+___IO_BASE, (buf), (ns))
348−#define insl_ns(port, buf, nl) _insl_ns((port)+___IO_BASE, (buf), (nl))
349−#define outsl_ns(port, buf, nl) _outsl_ns((port)+___IO_BASE, (buf), (nl))
330+extern void _insb(volatile u8 __iomem *port, void *buf, long count);
331+extern void _outsb(volatile u8 __iomem *port, const void *buf, long count);
332+extern void _insw_ns(volatile u16 __iomem *port, void *buf, long count);
333+extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, long count);
334+extern void _insl_ns(volatile u32 __iomem *port, void *buf, long count);
335+extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, long count);
350336
351337
352338 #define IO_SPACE_LIMIT ~0
include/asm-ppc/mpc8260_pci9.h+0−4
@@ -30,8 +30,6 @@ · 29 unmodified lines
3030 #undef inb
3131 #undef inw
3232 #undef inl
33−#undef insw_ns
34−#undef insl_ns
3533 #undef memcpy_fromio
3634
3735 extern int readb(volatile unsigned char *addr);
@@ -43,8 +41,6 @@ extern void insl(unsigned port, void *buf, int nl); · 5 unmodified lines
4341 extern int inb(unsigned port);
4442 extern int inw(unsigned port);
4543 extern unsigned inl(unsigned port);
46−extern void insw_ns(unsigned port, void *buf, int ns);
47−extern void insl_ns(unsigned port, void *buf, int nl);
4844 extern void *memcpy_fromio(void *dest, unsigned long src, size_t count);
4945
5046 #endif /* !__CONFIG_8260_PCI9_DEFS */
include/asm-ppc/reg_booke.h+8−8
@@ -300,14 +300,14 @@ do { \ · 299 unmodified lines
300300 #define DBSR_IC 0x80000000 /* Instruction Completion */
301301 #define DBSR_BT 0x40000000 /* Branch taken */
302302 #define DBSR_TIE 0x10000000 /* Trap Instruction debug Event */
303−#define DBSR_IAC1 0x00800000 /* Instruction Address Compare 1 Event */
304−#define DBSR_IAC2 0x00400000 /* Instruction Address Compare 2 Event */
305−#define DBSR_IAC3 0x00200000 /* Instruction Address Compare 3 Event */
306−#define DBSR_IAC4 0x00100000 /* Instruction Address Compare 4 Event */
307−#define DBSR_DAC1R 0x00080000 /* Data Address Compare 1 Read Event */
308−#define DBSR_DAC1W 0x00040000 /* Data Address Compare 1 Write Event */
309−#define DBSR_DAC2R 0x00020000 /* Data Address Compare 2 Read Event */
310−#define DBSR_DAC2W 0x00010000 /* Data Address Compare 2 Write Event */
303+#define DBSR_IAC1 0x04000000 /* Instruction Address Compare 1 Event */
304+#define DBSR_IAC2 0x02000000 /* Instruction Address Compare 2 Event */
305+#define DBSR_IAC3 0x00080000 /* Instruction Address Compare 3 Event */
306+#define DBSR_IAC4 0x00040000 /* Instruction Address Compare 4 Event */
307+#define DBSR_DAC1R 0x01000000 /* Data Address Compare 1 Read Event */
308+#define DBSR_DAC1W 0x00800000 /* Data Address Compare 1 Write Event */
309+#define DBSR_DAC2R 0x00400000 /* Data Address Compare 2 Read Event */
310+#define DBSR_DAC2W 0x00200000 /* Data Address Compare 2 Write Event */
311311 #endif
312312
313313 /* Bit definitions related to the ESR. */
scripts/checkstack.pl+2−0
@@ -62,6 +62,8 @@ my (@stack, $re, $x, $xs); · 61 unmodified lines
6262 } elsif ($arch eq 'ppc64') {
6363 #XXX
6464 $re = qr/.*stdu.*r1,-($x{1,8})\(r1\)/o;
65+ } elsif ($arch eq 'powerpc') {
66+ $re = qr/.*st[dw]u.*r1,-($x{1,8})\(r1\)/o;
6567 } elsif ($arch =~ /^s390x?$/) {
6668 # 11160: a7 fb ff 60 aghi %r15,-160
6769 $re = qr/.*ag?hi.*\%r15,-(([0-9]{2}|[3-9])[0-9]{2})/o;
sound/aoa/core/snd-aoa-gpio-feature.c+1−1
@@ -56,7 +56,7 @@ static struct device_node *get_gpio(char *name, · 55 unmodified lines
5656 {
5757 struct device_node *np, *gpio;
5858 u32 *reg;
59− char *audio_gpio;
59+ const char *audio_gpio;
6060
6161 *gpioptr = -1;
6262
sound/oss/dmasound/dmasound_awacs.c+6−5
@@ -347,8 +347,8 @@ int · 346 unmodified lines
347347 setup_audio_gpio(const char *name, const char* compatible, int *gpio_addr, int* gpio_pol)
348348 {
349349 struct device_node *np;
350− u32* pp;
351−
350+ const u32* pp;
351+
352352 np = find_devices("gpio");
353353 if (!np)
354354 return -ENODEV;
@@ -356,7 +356,8 @@ setup_audio_gpio(const char *name, const char* compatible, int *gpio_addr, int* · 1 unmodified line
356356 np = np->child;
357357 while(np != 0) {
358358 if (name) {
359− char *property = get_property(np,"audio-gpio",NULL);
359+ const char *property =
360+ get_property(np,"audio-gpio",NULL);
360361 if (property != 0 && strcmp(property,name) == 0)
361362 break;
362363 } else if (compatible && device_is_compatible(np, compatible))
@@ -365,11 +366,11 @@ setup_audio_gpio(const char *name, const char* compatible, int *gpio_addr, int* · 2 unmodified lines
365366 }
366367 if (!np)
367368 return -ENODEV;
368− pp = (u32 *)get_property(np, "AAPL,address", NULL);
369+ pp = get_property(np, "AAPL,address", NULL);
369370 if (!pp)
370371 return -ENODEV;
371372 *gpio_addr = (*pp) & 0x0000ffff;
372− pp = (u32 *)get_property(np, "audio-gpio-active-state", NULL);
373+ pp = get_property(np, "audio-gpio-active-state", NULL);
373374 if (pp)
374375 *gpio_pol = *pp;
375376 else
sound/ppc/tumbler.c+8−7
@@ -1035,7 +1035,7 @@ static struct device_node *find_audio_device(const char *name) · 1034 unmodified lines
10351035 return NULL;
10361036
10371037 for (np = np->child; np; np = np->sibling) {
1038− char *property = get_property(np, "audio-gpio", NULL);
1038+ const char *property = get_property(np, "audio-gpio", NULL);
10391039 if (property && strcmp(property, name) == 0)
10401040 return np;
10411041 }
@@ -1062,7 +1062,8 @@ static long tumbler_find_device(const char *device, const char *platform, · 20 unmodified lines
10621062 struct pmac_gpio *gp, int is_compatible)
10631063 {
10641064 struct device_node *node;
1065− u32 *base, addr;
1065+ const u32 *base;
1066+ u32 addr;
10661067
10671068 if (is_compatible)
10681069 node = find_compatible_audio_device(device);
@@ -1074,9 +1075,9 @@ static long tumbler_find_device(const char *device, const char *platform, · 5 unmodified lines
10741075 return -ENODEV;
10751076 }
10761077
1077− base = (u32 *)get_property(node, "AAPL,address", NULL);
1078+ base = get_property(node, "AAPL,address", NULL);
10781079 if (! base) {
1079− base = (u32 *)get_property(node, "reg", NULL);
1080+ base = get_property(node, "reg", NULL);
10801081 if (!base) {
10811082 DBG("(E) cannot find address for device %s !\n", device);
10821083 snd_printd("cannot find address for device %s\n", device);
@@ -1090,13 +1091,13 @@ static long tumbler_find_device(const char *device, const char *platform, · 7 unmodified lines
10901091
10911092 gp->addr = addr & 0x0000ffff;
10921093 /* Try to find the active state, default to 0 ! */
1093− base = (u32 *)get_property(node, "audio-gpio-active-state", NULL);
1094+ base = get_property(node, "audio-gpio-active-state", NULL);
10941095 if (base) {
10951096 gp->active_state = *base;
10961097 gp->active_val = (*base) ? 0x5 : 0x4;
10971098 gp->inactive_val = (*base) ? 0x4 : 0x5;
10981099 } else {
1099− u32 *prop = NULL;
1100+ const u32 *prop = NULL;
11001101 gp->active_state = 0;
11011102 gp->active_val = 0x4;
11021103 gp->inactive_val = 0x5;
@@ -1105,7 +1106,7 @@ static long tumbler_find_device(const char *device, const char *platform, · 2 unmodified lines
11051106 * as we don't yet have an interpreter for these things
11061107 */
11071108 if (platform)
1108− prop = (u32 *)get_property(node, platform, NULL);
1109+ prop = get_property(node, platform, NULL);
11091110 if (prop) {
11101111 if (prop[3] == 0x9 && prop[4] == 0x9) {
11111112 gp->active_val = 0xd;