aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MAINTAINERS2
-rw-r--r--arch/powerpc/boot/Makefile4
-rw-r--r--arch/powerpc/boot/dts/kilauea.dts252
-rw-r--r--arch/powerpc/boot/uartlite.c4
-rw-r--r--arch/powerpc/configs/kilauea_defconfig768
-rw-r--r--arch/powerpc/kernel/cputable.c56
-rw-r--r--arch/powerpc/kernel/of_platform.c17
-rw-r--r--arch/powerpc/kernel/prom.c3
-rw-r--r--arch/powerpc/kernel/setup_32.c3
-rw-r--r--arch/powerpc/kernel/setup_64.c3
-rw-r--r--arch/powerpc/kernel/systbl.S2
-rw-r--r--arch/powerpc/kernel/time.c16
-rw-r--r--arch/powerpc/kernel/vdso.c2
-rw-r--r--arch/powerpc/kernel/vio.c95
-rw-r--r--arch/powerpc/oprofile/cell/pr_util.h3
-rw-r--r--arch/powerpc/oprofile/op_model_cell.c2
-rw-r--r--arch/powerpc/platforms/40x/Kconfig7
-rw-r--r--arch/powerpc/platforms/40x/Makefile5
-rw-r--r--arch/powerpc/platforms/40x/kilauea.c58
-rw-r--r--arch/powerpc/platforms/40x/virtex.c5
-rw-r--r--arch/powerpc/platforms/40x/walnut.c5
-rw-r--r--arch/powerpc/platforms/44x/bamboo.c5
-rw-r--r--arch/powerpc/platforms/44x/ebony.c5
-rw-r--r--arch/powerpc/platforms/44x/sequoia.c5
-rw-r--r--arch/powerpc/platforms/52xx/efika.c9
-rw-r--r--arch/powerpc/platforms/cell/cbe_cpufreq.c2
-rw-r--r--arch/powerpc/platforms/cell/cbe_cpufreq_pervasive.c2
-rw-r--r--arch/powerpc/platforms/cell/cbe_cpufreq_pmi.c2
-rw-r--r--arch/powerpc/platforms/cell/cbe_regs.c3
-rw-r--r--arch/powerpc/platforms/cell/cbe_thermal.c2
-rw-r--r--arch/powerpc/platforms/cell/interrupt.c2
-rw-r--r--arch/powerpc/platforms/cell/iommu.c2
-rw-r--r--arch/powerpc/platforms/cell/pervasive.c2
-rw-r--r--arch/powerpc/platforms/cell/pmu.c2
-rw-r--r--arch/powerpc/platforms/cell/ras.c2
-rw-r--r--arch/powerpc/platforms/cell/setup.c17
-rw-r--r--arch/powerpc/platforms/celleb/setup.c5
-rw-r--r--arch/powerpc/platforms/chrp/setup.c10
-rw-r--r--arch/powerpc/platforms/iseries/Makefile2
-rw-r--r--arch/powerpc/platforms/iseries/dt.c17
-rw-r--r--arch/powerpc/platforms/iseries/iommu.c52
-rw-r--r--arch/powerpc/platforms/iseries/mf.c23
-rw-r--r--arch/powerpc/platforms/iseries/vio.c553
-rw-r--r--arch/powerpc/platforms/iseries/viopath.c8
-rw-r--r--arch/powerpc/platforms/pasemi/gpio_mdio.c4
-rw-r--r--arch/powerpc/platforms/powermac/setup.c77
-rw-r--r--arch/powerpc/platforms/ps3/os-area.c646
-rw-r--r--arch/powerpc/platforms/ps3/platform.h6
-rw-r--r--arch/powerpc/platforms/ps3/setup.c3
-rw-r--r--arch/powerpc/platforms/ps3/time.c14
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-cpu.c14
-rw-r--r--arch/powerpc/platforms/pseries/setup.c5
-rw-r--r--arch/powerpc/sysdev/Makefile2
-rw-r--r--arch/powerpc/sysdev/axonram.c8
-rw-r--r--arch/powerpc/sysdev/pmi.c6
-rw-r--r--arch/ppc/platforms/ev64360.c3
-rw-r--r--arch/ppc/platforms/katana.c3
-rw-r--r--drivers/block/viodasd.c77
-rw-r--r--drivers/cdrom/viocd.c128
-rw-r--r--drivers/char/viotape.c125
-rw-r--r--drivers/video/xilinxfb.c279
-rw-r--r--include/asm-powerpc/cell-regs.h (renamed from arch/powerpc/platforms/cell/cbe_regs.h)48
-rw-r--r--include/asm-powerpc/cputable.h1
-rw-r--r--include/asm-powerpc/iseries/hv_call_event.h10
-rw-r--r--include/asm-powerpc/iseries/iommu.h4
-rw-r--r--include/asm-powerpc/iseries/vio.h116
-rw-r--r--include/asm-powerpc/machdep.h2
-rw-r--r--include/asm-powerpc/vio.h5
68 files changed, 2908 insertions, 722 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 146d0c6291d5..559c5fc8645c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2308,7 +2308,7 @@ S: Maintained
2308LINUX FOR POWERPC EMBEDDED XILINX VIRTEX 2308LINUX FOR POWERPC EMBEDDED XILINX VIRTEX
2309P: Grant Likely 2309P: Grant Likely
2310M: grant.likely@secretlab.ca 2310M: grant.likely@secretlab.ca
2311W: http://www.secretlab.ca/ 2311W: http://wiki.secretlab.ca/index.php/Linux_on_Xilinx_Virtex
2312L: linuxppc-dev@ozlabs.org 2312L: linuxppc-dev@ozlabs.org
2313S: Maintained 2313S: Maintained
2314 2314
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index f3f7ce3d79a5..18e32719d0ed 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -25,6 +25,10 @@ BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
25 -isystem $(shell $(CROSS32CC) -print-file-name=include) 25 -isystem $(shell $(CROSS32CC) -print-file-name=include)
26BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc 26BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
27 27
28ifdef CONFIG_DEBUG_INFO
29BOOTCFLAGS += -g
30endif
31
28ifeq ($(call cc-option-yn, -fstack-protector),y) 32ifeq ($(call cc-option-yn, -fstack-protector),y)
29BOOTCFLAGS += -fno-stack-protector 33BOOTCFLAGS += -fno-stack-protector
30endif 34endif
diff --git a/arch/powerpc/boot/dts/kilauea.dts b/arch/powerpc/boot/dts/kilauea.dts
new file mode 100644
index 000000000000..c824e8f06454
--- /dev/null
+++ b/arch/powerpc/boot/dts/kilauea.dts
@@ -0,0 +1,252 @@
1/*
2 * Device Tree Source for AMCC Kilauea (405EX)
3 *
4 * Copyright 2007 DENX Software Engineering, Stefan Roese <sr@denx.de>
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without
8 * any warranty of any kind, whether express or implied.
9 */
10
11/ {
12 #address-cells = <1>;
13 #size-cells = <1>;
14 model = "amcc,kilauea";
15 compatible = "amcc,kilauea";
16 dcr-parent = <&/cpus/PowerPC,405EX@0>;
17
18 cpus {
19 #address-cells = <1>;
20 #size-cells = <0>;
21
22 PowerPC,405EX@0 {
23 device_type = "cpu";
24 reg = <0>;
25 clock-frequency = <0>; /* Filled in by U-Boot */
26 timebase-frequency = <0>; /* Filled in by U-Boot */
27 i-cache-line-size = <20>;
28 d-cache-line-size = <20>;
29 i-cache-size = <4000>; /* 16 kB */
30 d-cache-size = <4000>; /* 16 kB */
31 dcr-controller;
32 dcr-access-method = "native";
33 };
34 };
35
36 memory {
37 device_type = "memory";
38 reg = <0 0>; /* Filled in by U-Boot */
39 };
40
41 UIC0: interrupt-controller {
42 compatible = "ibm,uic-405ex", "ibm,uic";
43 interrupt-controller;
44 cell-index = <0>;
45 dcr-reg = <0c0 009>;
46 #address-cells = <0>;
47 #size-cells = <0>;
48 #interrupt-cells = <2>;
49 };
50
51 UIC1: interrupt-controller1 {
52 compatible = "ibm,uic-405ex","ibm,uic";
53 interrupt-controller;
54 cell-index = <1>;
55 dcr-reg = <0d0 009>;
56 #address-cells = <0>;
57 #size-cells = <0>;
58 #interrupt-cells = <2>;
59 interrupts = <1e 4 1f 4>; /* cascade */
60 interrupt-parent = <&UIC0>;
61 };
62
63 UIC2: interrupt-controller2 {
64 compatible = "ibm,uic-405ex","ibm,uic";
65 interrupt-controller;
66 cell-index = <2>;
67 dcr-reg = <0e0 009>;
68 #address-cells = <0>;
69 #size-cells = <0>;
70 #interrupt-cells = <2>;
71 interrupts = <1c 4 1d 4>; /* cascade */
72 interrupt-parent = <&UIC0>;
73 };
74
75 plb {
76 compatible = "ibm,plb-405ex", "ibm,plb4";
77 #address-cells = <1>;
78 #size-cells = <1>;
79 ranges;
80 clock-frequency = <0>; /* Filled in by U-Boot */
81
82 SDRAM0: memory-controller {
83 compatible = "ibm,sdram-405ex";
84 dcr-reg = <010 2>;
85 };
86
87 MAL0: mcmal {
88 compatible = "ibm,mcmal-405ex", "ibm,mcmal2";
89 dcr-reg = <180 62>;
90 num-tx-chans = <2>;
91 num-rx-chans = <2>;
92 interrupt-parent = <&MAL0>;
93 interrupts = <0 1 2 3 4>;
94 #interrupt-cells = <1>;
95 #address-cells = <0>;
96 #size-cells = <0>;
97 interrupt-map = </*TXEOB*/ 0 &UIC0 a 4
98 /*RXEOB*/ 1 &UIC0 b 4
99 /*SERR*/ 2 &UIC1 0 4
100 /*TXDE*/ 3 &UIC1 1 4
101 /*RXDE*/ 4 &UIC1 2 4>;
102 interrupt-map-mask = <ffffffff>;
103 };
104
105 POB0: opb {
106 compatible = "ibm,opb-405ex", "ibm,opb";
107 #address-cells = <1>;
108 #size-cells = <1>;
109 ranges = <80000000 80000000 10000000
110 ef600000 ef600000 a00000
111 f0000000 f0000000 10000000>;
112 dcr-reg = <0a0 5>;
113 clock-frequency = <0>; /* Filled in by U-Boot */
114
115 EBC0: ebc {
116 compatible = "ibm,ebc-405ex", "ibm,ebc";
117 dcr-reg = <012 2>;
118 #address-cells = <2>;
119 #size-cells = <1>;
120 clock-frequency = <0>; /* Filled in by U-Boot */
121 /* ranges property is supplied by U-Boot */
122 interrupts = <5 1>;
123 interrupt-parent = <&UIC1>;
124
125 nor_flash@0,0 {
126 compatible = "amd,s29gl512n", "cfi-flash";
127 bank-width = <2>;
128 reg = <0 000000 4000000>;
129 #address-cells = <1>;
130 #size-cells = <1>;
131 partition@0 {
132 label = "kernel";
133 reg = <0 200000>;
134 };
135 partition@200000 {
136 label = "root";
137 reg = <200000 200000>;
138 };
139 partition@400000 {
140 label = "user";
141 reg = <400000 3b60000>;
142 };
143 partition@3f60000 {
144 label = "env";
145 reg = <3f60000 40000>;
146 };
147 partition@3fa0000 {
148 label = "u-boot";
149 reg = <3fa0000 60000>;
150 };
151 };
152 };
153
154 UART0: serial@ef600200 {
155 device_type = "serial";
156 compatible = "ns16550";
157 reg = <ef600200 8>;
158 virtual-reg = <ef600200>;
159 clock-frequency = <0>; /* Filled in by U-Boot */
160 current-speed = <0>;
161 interrupt-parent = <&UIC0>;
162 interrupts = <1a 4>;
163 };
164
165 UART1: serial@ef600300 {
166 device_type = "serial";
167 compatible = "ns16550";
168 reg = <ef600300 8>;
169 virtual-reg = <ef600300>;
170 clock-frequency = <0>; /* Filled in by U-Boot */
171 current-speed = <0>;
172 interrupt-parent = <&UIC0>;
173 interrupts = <1 4>;
174 };
175
176 IIC0: i2c@ef600400 {
177 device_type = "i2c";
178 compatible = "ibm,iic-405ex", "ibm,iic";
179 reg = <ef600400 14>;
180 interrupt-parent = <&UIC0>;
181 interrupts = <2 4>;
182 };
183
184 IIC1: i2c@ef600500 {
185 device_type = "i2c";
186 compatible = "ibm,iic-405ex", "ibm,iic";
187 reg = <ef600500 14>;
188 interrupt-parent = <&UIC0>;
189 interrupts = <7 4>;
190 };
191
192
193 RGMII0: emac-rgmii@ef600b00 {
194 device_type = "rgmii-interface";
195 compatible = "ibm,rgmii-405ex", "ibm,rgmii";
196 reg = <ef600b00 104>;
197 };
198
199 EMAC0: ethernet@ef600900 {
200 linux,network-index = <0>;
201 device_type = "network";
202 compatible = "ibm,emac-405ex", "ibm,emac4";
203 interrupt-parent = <&EMAC0>;
204 interrupts = <0 1>;
205 #interrupt-cells = <1>;
206 #address-cells = <0>;
207 #size-cells = <0>;
208 interrupt-map = </*Status*/ 0 &UIC0 18 4
209 /*Wake*/ 1 &UIC1 1d 4>;
210 reg = <ef600900 70>;
211 local-mac-address = [000000000000]; /* Filled in by U-Boot */
212 mal-device = <&MAL0>;
213 mal-tx-channel = <0>;
214 mal-rx-channel = <0>;
215 cell-index = <0>;
216 max-frame-size = <5dc>;
217 rx-fifo-size = <1000>;
218 tx-fifo-size = <800>;
219 phy-mode = "rgmii";
220 phy-map = <00000000>;
221 rgmii-device = <&RGMII0>;
222 rgmii-channel = <0>;
223 };
224
225 EMAC1: ethernet@ef600a00 {
226 linux,network-index = <1>;
227 device_type = "network";
228 compatible = "ibm,emac-405ex", "ibm,emac4";
229 interrupt-parent = <&EMAC1>;
230 interrupts = <0 1>;
231 #interrupt-cells = <1>;
232 #address-cells = <0>;
233 #size-cells = <0>;
234 interrupt-map = </*Status*/ 0 &UIC0 19 4
235 /*Wake*/ 1 &UIC1 1f 4>;
236 reg = <ef600a00 70>;
237 local-mac-address = [000000000000]; /* Filled in by U-Boot */
238 mal-device = <&MAL0>;
239 mal-tx-channel = <1>;
240 mal-rx-channel = <1>;
241 cell-index = <1>;
242 max-frame-size = <5dc>;
243 rx-fifo-size = <1000>;
244 tx-fifo-size = <800>;
245 phy-mode = "rgmii";
246 phy-map = <00000000>;
247 rgmii-device = <&RGMII0>;
248 rgmii-channel = <1>;
249 };
250 };
251 };
252};
diff --git a/arch/powerpc/boot/uartlite.c b/arch/powerpc/boot/uartlite.c
index 38a470b329e3..46bed69b4169 100644
--- a/arch/powerpc/boot/uartlite.c
+++ b/arch/powerpc/boot/uartlite.c
@@ -45,8 +45,8 @@ static void uartlite_putc(unsigned char c)
45 45
46static unsigned char uartlite_getc(void) 46static unsigned char uartlite_getc(void)
47{ 47{
48 u32 reg = ULITE_STATUS_RXVALID; 48 u32 reg = 0;
49 while (reg & ULITE_STATUS_RXVALID) /* spin on RXVALID bit */ 49 while (!(reg & ULITE_STATUS_RXVALID)) /* spin waiting for RXVALID bit */
50 reg = in_be32(reg_base + ULITE_STATUS); 50 reg = in_be32(reg_base + ULITE_STATUS);
51 return in_be32(reg_base + ULITE_RX); 51 return in_be32(reg_base + ULITE_RX);
52} 52}
diff --git a/arch/powerpc/configs/kilauea_defconfig b/arch/powerpc/configs/kilauea_defconfig
new file mode 100644
index 000000000000..31790d329269
--- /dev/null
+++ b/arch/powerpc/configs/kilauea_defconfig
@@ -0,0 +1,768 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.23-rc9
4# Thu Oct 11 19:05:15 2007
5#
6# CONFIG_PPC64 is not set
7
8#
9# Processor support
10#
11# CONFIG_6xx is not set
12# CONFIG_PPC_85xx is not set
13# CONFIG_PPC_8xx is not set
14CONFIG_40x=y
15# CONFIG_44x is not set
16# CONFIG_E200 is not set
17CONFIG_4xx=y
18# CONFIG_PPC_MM_SLICES is not set
19CONFIG_NOT_COHERENT_CACHE=y
20CONFIG_PPC32=y
21CONFIG_WORD_SIZE=32
22CONFIG_PPC_MERGE=y
23CONFIG_MMU=y
24CONFIG_GENERIC_CMOS_UPDATE=y
25CONFIG_GENERIC_TIME=y
26CONFIG_GENERIC_TIME_VSYSCALL=y
27CONFIG_GENERIC_CLOCKEVENTS=y
28CONFIG_GENERIC_HARDIRQS=y
29CONFIG_IRQ_PER_CPU=y
30CONFIG_RWSEM_XCHGADD_ALGORITHM=y
31CONFIG_ARCH_HAS_ILOG2_U32=y
32CONFIG_GENERIC_HWEIGHT=y
33CONFIG_GENERIC_CALIBRATE_DELAY=y
34CONFIG_GENERIC_FIND_NEXT_BIT=y
35# CONFIG_ARCH_NO_VIRT_TO_BUS is not set
36CONFIG_PPC=y
37CONFIG_EARLY_PRINTK=y
38CONFIG_GENERIC_NVRAM=y
39CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
40CONFIG_ARCH_MAY_HAVE_PC_FDC=y
41CONFIG_PPC_OF=y
42CONFIG_OF=y
43# CONFIG_PPC_UDBG_16550 is not set
44# CONFIG_GENERIC_TBSYNC is not set
45CONFIG_AUDIT_ARCH=y
46CONFIG_GENERIC_BUG=y
47# CONFIG_DEFAULT_UIMAGE is not set
48CONFIG_PPC_DCR_NATIVE=y
49# CONFIG_PPC_DCR_MMIO is not set
50CONFIG_PPC_DCR=y
51CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
52
53#
54# General setup
55#
56CONFIG_EXPERIMENTAL=y
57CONFIG_BROKEN_ON_SMP=y
58CONFIG_INIT_ENV_ARG_LIMIT=32
59CONFIG_LOCALVERSION=""
60CONFIG_LOCALVERSION_AUTO=y
61CONFIG_SWAP=y
62CONFIG_SYSVIPC=y
63CONFIG_SYSVIPC_SYSCTL=y
64CONFIG_POSIX_MQUEUE=y
65# CONFIG_BSD_PROCESS_ACCT is not set
66# CONFIG_TASKSTATS is not set
67# CONFIG_USER_NS is not set
68# CONFIG_AUDIT is not set
69# CONFIG_IKCONFIG is not set
70CONFIG_LOG_BUF_SHIFT=14
71CONFIG_SYSFS_DEPRECATED=y
72# CONFIG_RELAY is not set
73CONFIG_BLK_DEV_INITRD=y
74CONFIG_INITRAMFS_SOURCE=""
75# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
76CONFIG_SYSCTL=y
77CONFIG_EMBEDDED=y
78CONFIG_SYSCTL_SYSCALL=y
79CONFIG_KALLSYMS=y
80CONFIG_KALLSYMS_ALL=y
81CONFIG_KALLSYMS_EXTRA_PASS=y
82CONFIG_HOTPLUG=y
83CONFIG_PRINTK=y
84CONFIG_BUG=y
85CONFIG_ELF_CORE=y
86CONFIG_BASE_FULL=y
87CONFIG_FUTEX=y
88CONFIG_ANON_INODES=y
89CONFIG_EPOLL=y
90CONFIG_SIGNALFD=y
91CONFIG_EVENTFD=y
92CONFIG_SHMEM=y
93CONFIG_VM_EVENT_COUNTERS=y
94CONFIG_SLAB=y
95# CONFIG_SLUB is not set
96# CONFIG_SLOB is not set
97CONFIG_RT_MUTEXES=y
98# CONFIG_TINY_SHMEM is not set
99CONFIG_BASE_SMALL=0
100CONFIG_MODULES=y
101CONFIG_MODULE_UNLOAD=y
102# CONFIG_MODULE_FORCE_UNLOAD is not set
103# CONFIG_MODVERSIONS is not set
104# CONFIG_MODULE_SRCVERSION_ALL is not set
105CONFIG_KMOD=y
106CONFIG_BLOCK=y
107CONFIG_LBD=y
108# CONFIG_BLK_DEV_IO_TRACE is not set
109# CONFIG_LSF is not set
110# CONFIG_BLK_DEV_BSG is not set
111
112#
113# IO Schedulers
114#
115CONFIG_IOSCHED_NOOP=y
116CONFIG_IOSCHED_AS=y
117CONFIG_IOSCHED_DEADLINE=y
118CONFIG_IOSCHED_CFQ=y
119CONFIG_DEFAULT_AS=y
120# CONFIG_DEFAULT_DEADLINE is not set
121# CONFIG_DEFAULT_CFQ is not set
122# CONFIG_DEFAULT_NOOP is not set
123CONFIG_DEFAULT_IOSCHED="anticipatory"
124
125#
126# Platform support
127#
128# CONFIG_PPC_MPC52xx is not set
129# CONFIG_PPC_MPC5200 is not set
130# CONFIG_PPC_CELL is not set
131# CONFIG_PPC_CELL_NATIVE is not set
132# CONFIG_PQ2ADS is not set
133CONFIG_KILAUEA=y
134# CONFIG_WALNUT is not set
135# CONFIG_XILINX_VIRTEX_GENERIC_BOARD is not set
136# CONFIG_MPIC is not set
137# CONFIG_MPIC_WEIRD is not set
138# CONFIG_PPC_I8259 is not set
139# CONFIG_PPC_RTAS is not set
140# CONFIG_MMIO_NVRAM is not set
141# CONFIG_PPC_MPC106 is not set
142# CONFIG_PPC_970_NAP is not set
143# CONFIG_PPC_INDIRECT_IO is not set
144# CONFIG_GENERIC_IOMAP is not set
145# CONFIG_CPU_FREQ is not set
146# CONFIG_CPM2 is not set
147# CONFIG_FSL_ULI1575 is not set
148
149#
150# Kernel options
151#
152# CONFIG_HIGHMEM is not set
153# CONFIG_TICK_ONESHOT is not set
154# CONFIG_NO_HZ is not set
155# CONFIG_HIGH_RES_TIMERS is not set
156# CONFIG_HZ_100 is not set
157CONFIG_HZ_250=y
158# CONFIG_HZ_300 is not set
159# CONFIG_HZ_1000 is not set
160CONFIG_HZ=250
161CONFIG_PREEMPT_NONE=y
162# CONFIG_PREEMPT_VOLUNTARY is not set
163# CONFIG_PREEMPT is not set
164CONFIG_BINFMT_ELF=y
165# CONFIG_BINFMT_MISC is not set
166# CONFIG_MATH_EMULATION is not set
167CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
168CONFIG_ARCH_FLATMEM_ENABLE=y
169CONFIG_ARCH_POPULATES_NODE_MAP=y
170CONFIG_SELECT_MEMORY_MODEL=y
171CONFIG_FLATMEM_MANUAL=y
172# CONFIG_DISCONTIGMEM_MANUAL is not set
173# CONFIG_SPARSEMEM_MANUAL is not set
174CONFIG_FLATMEM=y
175CONFIG_FLAT_NODE_MEM_MAP=y
176# CONFIG_SPARSEMEM_STATIC is not set
177CONFIG_SPLIT_PTLOCK_CPUS=4
178# CONFIG_RESOURCES_64BIT is not set
179CONFIG_ZONE_DMA_FLAG=1
180CONFIG_BOUNCE=y
181CONFIG_VIRT_TO_BUS=y
182CONFIG_PROC_DEVICETREE=y
183# CONFIG_CMDLINE_BOOL is not set
184# CONFIG_PM is not set
185CONFIG_SUSPEND_UP_POSSIBLE=y
186CONFIG_HIBERNATION_UP_POSSIBLE=y
187CONFIG_SECCOMP=y
188CONFIG_WANT_DEVICE_TREE=y
189CONFIG_DEVICE_TREE="kilauea.dts"
190CONFIG_ISA_DMA_API=y
191
192#
193# Bus options
194#
195CONFIG_ZONE_DMA=y
196# CONFIG_PCI is not set
197# CONFIG_PCI_DOMAINS is not set
198# CONFIG_PCI_SYSCALL is not set
199# CONFIG_ARCH_SUPPORTS_MSI is not set
200
201#
202# PCCARD (PCMCIA/CardBus) support
203#
204# CONFIG_PCCARD is not set
205
206#
207# Advanced setup
208#
209# CONFIG_ADVANCED_OPTIONS is not set
210
211#
212# Default settings for advanced configuration options are used
213#
214CONFIG_HIGHMEM_START=0xfe000000
215CONFIG_LOWMEM_SIZE=0x30000000
216CONFIG_KERNEL_START=0xc0000000
217CONFIG_TASK_SIZE=0x80000000
218CONFIG_CONSISTENT_START=0xff100000
219CONFIG_CONSISTENT_SIZE=0x00200000
220CONFIG_BOOT_LOAD=0x00400000
221
222#
223# Networking
224#
225CONFIG_NET=y
226
227#
228# Networking options
229#
230CONFIG_PACKET=y
231# CONFIG_PACKET_MMAP is not set
232CONFIG_UNIX=y
233# CONFIG_NET_KEY is not set
234CONFIG_INET=y
235# CONFIG_IP_MULTICAST is not set
236# CONFIG_IP_ADVANCED_ROUTER is not set
237CONFIG_IP_FIB_HASH=y
238CONFIG_IP_PNP=y
239CONFIG_IP_PNP_DHCP=y
240CONFIG_IP_PNP_BOOTP=y
241# CONFIG_IP_PNP_RARP is not set
242# CONFIG_NET_IPIP is not set
243# CONFIG_NET_IPGRE is not set
244# CONFIG_ARPD is not set
245# CONFIG_SYN_COOKIES is not set
246# CONFIG_INET_AH is not set
247# CONFIG_INET_ESP is not set
248# CONFIG_INET_IPCOMP is not set
249# CONFIG_INET_XFRM_TUNNEL is not set
250# CONFIG_INET_TUNNEL is not set
251# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
252# CONFIG_INET_XFRM_MODE_TUNNEL is not set
253# CONFIG_INET_XFRM_MODE_BEET is not set
254CONFIG_INET_DIAG=y
255CONFIG_INET_TCP_DIAG=y
256# CONFIG_TCP_CONG_ADVANCED is not set
257CONFIG_TCP_CONG_CUBIC=y
258CONFIG_DEFAULT_TCP_CONG="cubic"
259# CONFIG_TCP_MD5SIG is not set
260# CONFIG_IPV6 is not set
261# CONFIG_INET6_XFRM_TUNNEL is not set
262# CONFIG_INET6_TUNNEL is not set
263# CONFIG_NETWORK_SECMARK is not set
264# CONFIG_NETFILTER is not set
265# CONFIG_IP_DCCP is not set
266# CONFIG_IP_SCTP is not set
267# CONFIG_TIPC is not set
268# CONFIG_ATM is not set
269# CONFIG_BRIDGE is not set
270# CONFIG_VLAN_8021Q is not set
271# CONFIG_DECNET is not set
272# CONFIG_LLC2 is not set
273# CONFIG_IPX is not set
274# CONFIG_ATALK is not set
275# CONFIG_X25 is not set
276# CONFIG_LAPB is not set
277# CONFIG_ECONET is not set
278# CONFIG_WAN_ROUTER is not set
279
280#
281# QoS and/or fair queueing
282#
283# CONFIG_NET_SCHED is not set
284
285#
286# Network testing
287#
288# CONFIG_NET_PKTGEN is not set
289# CONFIG_HAMRADIO is not set
290# CONFIG_IRDA is not set
291# CONFIG_BT is not set
292# CONFIG_AF_RXRPC is not set
293
294#
295# Wireless
296#
297# CONFIG_CFG80211 is not set
298# CONFIG_WIRELESS_EXT is not set
299# CONFIG_MAC80211 is not set
300# CONFIG_IEEE80211 is not set
301# CONFIG_RFKILL is not set
302# CONFIG_NET_9P is not set
303
304#
305# Device Drivers
306#
307
308#
309# Generic Driver Options
310#
311CONFIG_STANDALONE=y
312CONFIG_PREVENT_FIRMWARE_BUILD=y
313CONFIG_FW_LOADER=y
314# CONFIG_DEBUG_DRIVER is not set
315# CONFIG_DEBUG_DEVRES is not set
316# CONFIG_SYS_HYPERVISOR is not set
317CONFIG_CONNECTOR=y
318CONFIG_PROC_EVENTS=y
319CONFIG_MTD=y
320# CONFIG_MTD_DEBUG is not set
321# CONFIG_MTD_CONCAT is not set
322CONFIG_MTD_PARTITIONS=y
323# CONFIG_MTD_REDBOOT_PARTS is not set
324CONFIG_MTD_CMDLINE_PARTS=y
325
326#
327# User Modules And Translation Layers
328#
329CONFIG_MTD_CHAR=y
330CONFIG_MTD_BLKDEVS=m
331CONFIG_MTD_BLOCK=m
332# CONFIG_MTD_BLOCK_RO is not set
333# CONFIG_FTL is not set
334# CONFIG_NFTL is not set
335# CONFIG_INFTL is not set
336# CONFIG_RFD_FTL is not set
337# CONFIG_SSFDC is not set
338
339#
340# RAM/ROM/Flash chip drivers
341#
342CONFIG_MTD_CFI=y
343CONFIG_MTD_JEDECPROBE=y
344CONFIG_MTD_GEN_PROBE=y
345# CONFIG_MTD_CFI_ADV_OPTIONS is not set
346CONFIG_MTD_MAP_BANK_WIDTH_1=y
347CONFIG_MTD_MAP_BANK_WIDTH_2=y
348CONFIG_MTD_MAP_BANK_WIDTH_4=y
349# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
350# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
351# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
352CONFIG_MTD_CFI_I1=y
353CONFIG_MTD_CFI_I2=y
354# CONFIG_MTD_CFI_I4 is not set
355# CONFIG_MTD_CFI_I8 is not set
356# CONFIG_MTD_CFI_INTELEXT is not set
357CONFIG_MTD_CFI_AMDSTD=y
358# CONFIG_MTD_CFI_STAA is not set
359CONFIG_MTD_CFI_UTIL=y
360# CONFIG_MTD_RAM is not set
361# CONFIG_MTD_ROM is not set
362# CONFIG_MTD_ABSENT is not set
363
364#
365# Mapping drivers for chip access
366#
367# CONFIG_MTD_COMPLEX_MAPPINGS is not set
368# CONFIG_MTD_PHYSMAP is not set
369CONFIG_MTD_PHYSMAP_OF=y
370# CONFIG_MTD_PLATRAM is not set
371
372#
373# Self-contained MTD device drivers
374#
375# CONFIG_MTD_SLRAM is not set
376# CONFIG_MTD_PHRAM is not set
377# CONFIG_MTD_MTDRAM is not set
378# CONFIG_MTD_BLOCK2MTD is not set
379
380#
381# Disk-On-Chip Device Drivers
382#
383# CONFIG_MTD_DOC2000 is not set
384# CONFIG_MTD_DOC2001 is not set
385# CONFIG_MTD_DOC2001PLUS is not set
386# CONFIG_MTD_NAND is not set
387# CONFIG_MTD_ONENAND is not set
388
389#
390# UBI - Unsorted block images
391#
392# CONFIG_MTD_UBI is not set
393CONFIG_OF_DEVICE=y
394# CONFIG_PARPORT is not set
395CONFIG_BLK_DEV=y
396# CONFIG_BLK_DEV_FD is not set
397# CONFIG_BLK_DEV_COW_COMMON is not set
398# CONFIG_BLK_DEV_LOOP is not set
399# CONFIG_BLK_DEV_NBD is not set
400CONFIG_BLK_DEV_RAM=y
401CONFIG_BLK_DEV_RAM_COUNT=16
402CONFIG_BLK_DEV_RAM_SIZE=35000
403CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
404# CONFIG_CDROM_PKTCDVD is not set
405# CONFIG_ATA_OVER_ETH is not set
406# CONFIG_XILINX_SYSACE is not set
407# CONFIG_MISC_DEVICES is not set
408# CONFIG_IDE is not set
409
410#
411# SCSI device support
412#
413# CONFIG_RAID_ATTRS is not set
414# CONFIG_SCSI is not set
415# CONFIG_SCSI_DMA is not set
416# CONFIG_SCSI_NETLINK is not set
417# CONFIG_ATA is not set
418# CONFIG_MD is not set
419# CONFIG_MACINTOSH_DRIVERS is not set
420CONFIG_NETDEVICES=y
421# CONFIG_NETDEVICES_MULTIQUEUE is not set
422# CONFIG_DUMMY is not set
423# CONFIG_BONDING is not set
424# CONFIG_MACVLAN is not set
425# CONFIG_EQUALIZER is not set
426# CONFIG_TUN is not set
427# CONFIG_NET_ETHERNET is not set
428# CONFIG_NETDEV_1000 is not set
429# CONFIG_NETDEV_10000 is not set
430
431#
432# Wireless LAN
433#
434# CONFIG_WLAN_PRE80211 is not set
435# CONFIG_WLAN_80211 is not set
436# CONFIG_WAN is not set
437# CONFIG_PPP is not set
438# CONFIG_SLIP is not set
439# CONFIG_SHAPER is not set
440# CONFIG_NETCONSOLE is not set
441# CONFIG_NETPOLL is not set
442# CONFIG_NET_POLL_CONTROLLER is not set
443# CONFIG_ISDN is not set
444# CONFIG_PHONE is not set
445
446#
447# Input device support
448#
449# CONFIG_INPUT is not set
450
451#
452# Hardware I/O ports
453#
454# CONFIG_SERIO is not set
455# CONFIG_GAMEPORT is not set
456
457#
458# Character devices
459#
460# CONFIG_VT is not set
461# CONFIG_SERIAL_NONSTANDARD is not set
462
463#
464# Serial drivers
465#
466CONFIG_SERIAL_8250=y
467CONFIG_SERIAL_8250_CONSOLE=y
468CONFIG_SERIAL_8250_NR_UARTS=4
469CONFIG_SERIAL_8250_RUNTIME_UARTS=4
470CONFIG_SERIAL_8250_EXTENDED=y
471# CONFIG_SERIAL_8250_MANY_PORTS is not set
472CONFIG_SERIAL_8250_SHARE_IRQ=y
473# CONFIG_SERIAL_8250_DETECT_IRQ is not set
474# CONFIG_SERIAL_8250_RSA is not set
475
476#
477# Non-8250 serial port support
478#
479# CONFIG_SERIAL_UARTLITE is not set
480CONFIG_SERIAL_CORE=y
481CONFIG_SERIAL_CORE_CONSOLE=y
482CONFIG_SERIAL_OF_PLATFORM=y
483CONFIG_UNIX98_PTYS=y
484CONFIG_LEGACY_PTYS=y
485CONFIG_LEGACY_PTY_COUNT=256
486# CONFIG_IPMI_HANDLER is not set
487# CONFIG_WATCHDOG is not set
488# CONFIG_HW_RANDOM is not set
489# CONFIG_NVRAM is not set
490# CONFIG_GEN_RTC is not set
491# CONFIG_R3964 is not set
492# CONFIG_RAW_DRIVER is not set
493# CONFIG_TCG_TPM is not set
494# CONFIG_I2C is not set
495
496#
497# SPI support
498#
499# CONFIG_SPI is not set
500# CONFIG_SPI_MASTER is not set
501# CONFIG_W1 is not set
502# CONFIG_POWER_SUPPLY is not set
503# CONFIG_HWMON is not set
504
505#
506# Multifunction device drivers
507#
508# CONFIG_MFD_SM501 is not set
509
510#
511# Multimedia devices
512#
513# CONFIG_VIDEO_DEV is not set
514# CONFIG_DVB_CORE is not set
515# CONFIG_DAB is not set
516
517#
518# Graphics support
519#
520# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
521
522#
523# Display device support
524#
525# CONFIG_DISPLAY_SUPPORT is not set
526# CONFIG_VGASTATE is not set
527# CONFIG_VIDEO_OUTPUT_CONTROL is not set
528# CONFIG_FB is not set
529# CONFIG_FB_IBM_GXT4500 is not set
530
531#
532# Sound
533#
534# CONFIG_SOUND is not set
535# CONFIG_USB_SUPPORT is not set
536# CONFIG_MMC is not set
537# CONFIG_NEW_LEDS is not set
538# CONFIG_EDAC is not set
539# CONFIG_RTC_CLASS is not set
540
541#
542# DMA Engine support
543#
544# CONFIG_DMA_ENGINE is not set
545
546#
547# DMA Clients
548#
549
550#
551# DMA Devices
552#
553
554#
555# Userspace I/O
556#
557# CONFIG_UIO is not set
558
559#
560# File systems
561#
562CONFIG_EXT2_FS=y
563# CONFIG_EXT2_FS_XATTR is not set
564# CONFIG_EXT2_FS_XIP is not set
565# CONFIG_EXT3_FS is not set
566# CONFIG_EXT4DEV_FS is not set
567# CONFIG_REISERFS_FS is not set
568# CONFIG_JFS_FS is not set
569# CONFIG_FS_POSIX_ACL is not set
570# CONFIG_XFS_FS is not set
571# CONFIG_GFS2_FS is not set
572# CONFIG_OCFS2_FS is not set
573# CONFIG_MINIX_FS is not set
574# CONFIG_ROMFS_FS is not set
575CONFIG_INOTIFY=y
576CONFIG_INOTIFY_USER=y
577# CONFIG_QUOTA is not set
578CONFIG_DNOTIFY=y
579# CONFIG_AUTOFS_FS is not set
580# CONFIG_AUTOFS4_FS is not set
581# CONFIG_FUSE_FS is not set
582
583#
584# CD-ROM/DVD Filesystems
585#
586# CONFIG_ISO9660_FS is not set
587# CONFIG_UDF_FS is not set
588
589#
590# DOS/FAT/NT Filesystems
591#
592# CONFIG_MSDOS_FS is not set
593# CONFIG_VFAT_FS is not set
594# CONFIG_NTFS_FS is not set
595
596#
597# Pseudo filesystems
598#
599CONFIG_PROC_FS=y
600CONFIG_PROC_KCORE=y
601CONFIG_PROC_SYSCTL=y
602CONFIG_SYSFS=y
603CONFIG_TMPFS=y
604# CONFIG_TMPFS_POSIX_ACL is not set
605# CONFIG_HUGETLB_PAGE is not set
606CONFIG_RAMFS=y
607# CONFIG_CONFIGFS_FS is not set
608
609#
610# Miscellaneous filesystems
611#
612# CONFIG_ADFS_FS is not set
613# CONFIG_AFFS_FS is not set
614# CONFIG_HFS_FS is not set
615# CONFIG_HFSPLUS_FS is not set
616# CONFIG_BEFS_FS is not set
617# CONFIG_BFS_FS is not set
618# CONFIG_EFS_FS is not set
619# CONFIG_JFFS2_FS is not set
620CONFIG_CRAMFS=y
621# CONFIG_VXFS_FS is not set
622# CONFIG_HPFS_FS is not set
623# CONFIG_QNX4FS_FS is not set
624# CONFIG_SYSV_FS is not set
625# CONFIG_UFS_FS is not set
626
627#
628# Network File Systems
629#
630CONFIG_NFS_FS=y
631CONFIG_NFS_V3=y
632# CONFIG_NFS_V3_ACL is not set
633# CONFIG_NFS_V4 is not set
634# CONFIG_NFS_DIRECTIO is not set
635# CONFIG_NFSD is not set
636CONFIG_ROOT_NFS=y
637CONFIG_LOCKD=y
638CONFIG_LOCKD_V4=y
639CONFIG_NFS_COMMON=y
640CONFIG_SUNRPC=y
641# CONFIG_SUNRPC_BIND34 is not set
642# CONFIG_RPCSEC_GSS_KRB5 is not set
643# CONFIG_RPCSEC_GSS_SPKM3 is not set
644# CONFIG_SMB_FS is not set
645# CONFIG_CIFS is not set
646# CONFIG_NCP_FS is not set
647# CONFIG_CODA_FS is not set
648# CONFIG_AFS_FS is not set
649
650#
651# Partition Types
652#
653# CONFIG_PARTITION_ADVANCED is not set
654CONFIG_MSDOS_PARTITION=y
655
656#
657# Native Language Support
658#
659# CONFIG_NLS is not set
660
661#
662# Distributed Lock Manager
663#
664# CONFIG_DLM is not set
665# CONFIG_UCC_SLOW is not set
666
667#
668# Library routines
669#
670CONFIG_BITREVERSE=y
671# CONFIG_CRC_CCITT is not set
672# CONFIG_CRC16 is not set
673# CONFIG_CRC_ITU_T is not set
674CONFIG_CRC32=y
675# CONFIG_CRC7 is not set
676# CONFIG_LIBCRC32C is not set
677CONFIG_ZLIB_INFLATE=y
678CONFIG_PLIST=y
679CONFIG_HAS_IOMEM=y
680CONFIG_HAS_IOPORT=y
681CONFIG_HAS_DMA=y
682
683#
684# Instrumentation Support
685#
686# CONFIG_PROFILING is not set
687
688#
689# Kernel hacking
690#
691# CONFIG_PRINTK_TIME is not set
692CONFIG_ENABLE_MUST_CHECK=y
693CONFIG_MAGIC_SYSRQ=y
694# CONFIG_UNUSED_SYMBOLS is not set
695# CONFIG_DEBUG_FS is not set
696# CONFIG_HEADERS_CHECK is not set
697CONFIG_DEBUG_KERNEL=y
698# CONFIG_DEBUG_SHIRQ is not set
699CONFIG_DETECT_SOFTLOCKUP=y
700CONFIG_SCHED_DEBUG=y
701# CONFIG_SCHEDSTATS is not set
702# CONFIG_TIMER_STATS is not set
703# CONFIG_DEBUG_SLAB is not set
704# CONFIG_DEBUG_RT_MUTEXES is not set
705# CONFIG_RT_MUTEX_TESTER is not set
706# CONFIG_DEBUG_SPINLOCK is not set
707# CONFIG_DEBUG_MUTEXES is not set
708# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
709# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
710# CONFIG_DEBUG_KOBJECT is not set
711CONFIG_DEBUG_BUGVERBOSE=y
712# CONFIG_DEBUG_INFO is not set
713# CONFIG_DEBUG_VM is not set
714# CONFIG_DEBUG_LIST is not set
715CONFIG_FORCED_INLINING=y
716# CONFIG_RCU_TORTURE_TEST is not set
717# CONFIG_FAULT_INJECTION is not set
718# CONFIG_DEBUG_STACKOVERFLOW is not set
719# CONFIG_DEBUG_STACK_USAGE is not set
720# CONFIG_DEBUG_PAGEALLOC is not set
721# CONFIG_DEBUGGER is not set
722# CONFIG_BDI_SWITCH is not set
723# CONFIG_PPC_EARLY_DEBUG is not set
724
725#
726# Security options
727#
728# CONFIG_KEYS is not set
729# CONFIG_SECURITY is not set
730CONFIG_CRYPTO=y
731CONFIG_CRYPTO_ALGAPI=y
732CONFIG_CRYPTO_BLKCIPHER=y
733CONFIG_CRYPTO_MANAGER=y
734# CONFIG_CRYPTO_HMAC is not set
735# CONFIG_CRYPTO_XCBC is not set
736# CONFIG_CRYPTO_NULL is not set
737# CONFIG_CRYPTO_MD4 is not set
738CONFIG_CRYPTO_MD5=y
739# CONFIG_CRYPTO_SHA1 is not set
740# CONFIG_CRYPTO_SHA256 is not set
741# CONFIG_CRYPTO_SHA512 is not set
742# CONFIG_CRYPTO_WP512 is not set
743# CONFIG_CRYPTO_TGR192 is not set
744# CONFIG_CRYPTO_GF128MUL is not set
745CONFIG_CRYPTO_ECB=y
746CONFIG_CRYPTO_CBC=y
747CONFIG_CRYPTO_PCBC=y
748# CONFIG_CRYPTO_LRW is not set
749# CONFIG_CRYPTO_CRYPTD is not set
750CONFIG_CRYPTO_DES=y
751# CONFIG_CRYPTO_FCRYPT is not set
752# CONFIG_CRYPTO_BLOWFISH is not set
753# CONFIG_CRYPTO_TWOFISH is not set
754# CONFIG_CRYPTO_SERPENT is not set
755# CONFIG_CRYPTO_AES is not set
756# CONFIG_CRYPTO_CAST5 is not set
757# CONFIG_CRYPTO_CAST6 is not set
758# CONFIG_CRYPTO_TEA is not set
759# CONFIG_CRYPTO_ARC4 is not set
760# CONFIG_CRYPTO_KHAZAD is not set
761# CONFIG_CRYPTO_ANUBIS is not set
762# CONFIG_CRYPTO_DEFLATE is not set
763# CONFIG_CRYPTO_MICHAEL_MIC is not set
764# CONFIG_CRYPTO_CRC32C is not set
765# CONFIG_CRYPTO_CAMELLIA is not set
766# CONFIG_CRYPTO_TEST is not set
767CONFIG_CRYPTO_HW=y
768# CONFIG_PPC_CLOCK is not set
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index b03a442b7888..d3fb7d0c6c1c 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -71,7 +71,7 @@ extern void __restore_cpu_ppc970(void);
71#define COMMON_USER_BOOKE (PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU | \ 71#define COMMON_USER_BOOKE (PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU | \
72 PPC_FEATURE_BOOKE) 72 PPC_FEATURE_BOOKE)
73 73
74static struct cpu_spec cpu_specs[] = { 74static struct cpu_spec __initdata cpu_specs[] = {
75#ifdef CONFIG_PPC64 75#ifdef CONFIG_PPC64
76 { /* Power3 */ 76 { /* Power3 */
77 .pvr_mask = 0xffff0000, 77 .pvr_mask = 0xffff0000,
@@ -327,14 +327,6 @@ static struct cpu_spec cpu_specs[] = {
327 .cpu_user_features = COMMON_USER_POWER5_PLUS, 327 .cpu_user_features = COMMON_USER_POWER5_PLUS,
328 .icache_bsize = 128, 328 .icache_bsize = 128,
329 .dcache_bsize = 128, 329 .dcache_bsize = 128,
330 .num_pmcs = 6,
331 .pmc_type = PPC_PMC_IBM,
332 .oprofile_cpu_type = "ppc64/power6",
333 .oprofile_type = PPC_OPROFILE_POWER4,
334 .oprofile_mmcra_sihv = POWER6_MMCRA_SIHV,
335 .oprofile_mmcra_sipr = POWER6_MMCRA_SIPR,
336 .oprofile_mmcra_clear = POWER6_MMCRA_THRM |
337 POWER6_MMCRA_OTHER,
338 .platform = "power5+", 330 .platform = "power5+",
339 }, 331 },
340 { /* Power6 */ 332 { /* Power6 */
@@ -364,14 +356,6 @@ static struct cpu_spec cpu_specs[] = {
364 .cpu_user_features = COMMON_USER_POWER6, 356 .cpu_user_features = COMMON_USER_POWER6,
365 .icache_bsize = 128, 357 .icache_bsize = 128,
366 .dcache_bsize = 128, 358 .dcache_bsize = 128,
367 .num_pmcs = 6,
368 .pmc_type = PPC_PMC_IBM,
369 .oprofile_cpu_type = "ppc64/power6",
370 .oprofile_type = PPC_OPROFILE_POWER4,
371 .oprofile_mmcra_sihv = POWER6_MMCRA_SIHV,
372 .oprofile_mmcra_sipr = POWER6_MMCRA_SIPR,
373 .oprofile_mmcra_clear = POWER6_MMCRA_THRM |
374 POWER6_MMCRA_OTHER,
375 .platform = "power6", 359 .platform = "power6",
376 }, 360 },
377 { /* Cell Broadband Engine */ 361 { /* Cell Broadband Engine */
@@ -1103,6 +1087,17 @@ static struct cpu_spec cpu_specs[] = {
1103 .dcache_bsize = 32, 1087 .dcache_bsize = 32,
1104 .platform = "ppc405", 1088 .platform = "ppc405",
1105 }, 1089 },
1090 { /* 405EX */
1091 .pvr_mask = 0xffff0000,
1092 .pvr_value = 0x12910000,
1093 .cpu_name = "405EX",
1094 .cpu_features = CPU_FTRS_40X,
1095 .cpu_user_features = PPC_FEATURE_32 |
1096 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1097 .icache_bsize = 32,
1098 .dcache_bsize = 32,
1099 .platform = "ppc405",
1100 },
1106 1101
1107#endif /* CONFIG_40x */ 1102#endif /* CONFIG_40x */
1108#ifdef CONFIG_44x 1103#ifdef CONFIG_44x
@@ -1316,18 +1311,37 @@ static struct cpu_spec cpu_specs[] = {
1316#endif /* CONFIG_PPC32 */ 1311#endif /* CONFIG_PPC32 */
1317}; 1312};
1318 1313
1319struct cpu_spec *identify_cpu(unsigned long offset, unsigned int pvr) 1314static struct cpu_spec the_cpu_spec;
1315
1316struct cpu_spec * __init identify_cpu(unsigned long offset, unsigned int pvr)
1320{ 1317{
1321 struct cpu_spec *s = cpu_specs; 1318 struct cpu_spec *s = cpu_specs;
1322 struct cpu_spec **cur = &cur_cpu_spec; 1319 struct cpu_spec *t = &the_cpu_spec;
1323 int i; 1320 int i;
1324 1321
1325 s = PTRRELOC(s); 1322 s = PTRRELOC(s);
1326 cur = PTRRELOC(cur); 1323 t = PTRRELOC(t);
1327 1324
1328 for (i = 0; i < ARRAY_SIZE(cpu_specs); i++,s++) 1325 for (i = 0; i < ARRAY_SIZE(cpu_specs); i++,s++)
1329 if ((pvr & s->pvr_mask) == s->pvr_value) { 1326 if ((pvr & s->pvr_mask) == s->pvr_value) {
1330 *cur = cpu_specs + i; 1327 /*
1328 * If we are overriding a previous value derived
1329 * from the real PVR with a new value obtained
1330 * using a logical PVR value, don't modify the
1331 * performance monitor fields.
1332 */
1333 if (t->num_pmcs && !s->num_pmcs) {
1334 t->cpu_name = s->cpu_name;
1335 t->cpu_features = s->cpu_features;
1336 t->cpu_user_features = s->cpu_user_features;
1337 t->icache_bsize = s->icache_bsize;
1338 t->dcache_bsize = s->dcache_bsize;
1339 t->cpu_setup = s->cpu_setup;
1340 t->cpu_restore = s->cpu_restore;
1341 t->platform = s->platform;
1342 } else
1343 *t = *s;
1344 *PTRRELOC(&cur_cpu_spec) = &the_cpu_spec;
1331#if defined(CONFIG_PPC64) || defined(CONFIG_BOOKE) 1345#if defined(CONFIG_PPC64) || defined(CONFIG_BOOKE)
1332 /* ppc64 and booke expect identify_cpu to also call 1346 /* ppc64 and booke expect identify_cpu to also call
1333 * setup_cpu for that processor. I will consolidate 1347 * setup_cpu for that processor. I will consolidate
diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c
index f70e787d556f..eca8ccc3fa12 100644
--- a/arch/powerpc/kernel/of_platform.c
+++ b/arch/powerpc/kernel/of_platform.c
@@ -19,11 +19,11 @@
19#include <linux/mod_devicetable.h> 19#include <linux/mod_devicetable.h>
20#include <linux/slab.h> 20#include <linux/slab.h>
21#include <linux/pci.h> 21#include <linux/pci.h>
22#include <linux/of_device.h>
23#include <linux/of_platform.h>
22 24
23#include <asm/errno.h> 25#include <asm/errno.h>
24#include <asm/dcr.h> 26#include <asm/dcr.h>
25#include <asm/of_device.h>
26#include <asm/of_platform.h>
27#include <asm/topology.h> 27#include <asm/topology.h>
28#include <asm/pci-bridge.h> 28#include <asm/pci-bridge.h>
29#include <asm/ppc-pci.h> 29#include <asm/ppc-pci.h>
@@ -70,7 +70,10 @@ postcore_initcall(of_bus_driver_init);
70int of_register_platform_driver(struct of_platform_driver *drv) 70int of_register_platform_driver(struct of_platform_driver *drv)
71{ 71{
72 /* initialize common driver fields */ 72 /* initialize common driver fields */
73 drv->driver.name = drv->name; 73 if (!drv->driver.name)
74 drv->driver.name = drv->name;
75 if (!drv->driver.owner)
76 drv->driver.owner = drv->owner;
74 drv->driver.bus = &of_platform_bus_type; 77 drv->driver.bus = &of_platform_bus_type;
75 78
76 /* register with core */ 79 /* register with core */
@@ -385,9 +388,11 @@ static struct of_device_id of_pci_phb_ids[] = {
385}; 388};
386 389
387static struct of_platform_driver of_pci_phb_driver = { 390static struct of_platform_driver of_pci_phb_driver = {
388 .name = "of-pci", 391 .match_table = of_pci_phb_ids,
389 .match_table = of_pci_phb_ids, 392 .probe = of_pci_phb_probe,
390 .probe = of_pci_phb_probe, 393 .driver = {
394 .name = "of-pci",
395 },
391}; 396};
392 397
393static __init int of_pci_phb_init(void) 398static __init int of_pci_phb_init(void)
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 172dcc3849a0..9f329a8928ea 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -531,10 +531,7 @@ static struct ibm_pa_feature {
531 {CPU_FTR_CTRL, 0, 0, 3, 0}, 531 {CPU_FTR_CTRL, 0, 0, 3, 0},
532 {CPU_FTR_NOEXECUTE, 0, 0, 6, 0}, 532 {CPU_FTR_NOEXECUTE, 0, 0, 6, 0},
533 {CPU_FTR_NODSISRALIGN, 0, 1, 1, 1}, 533 {CPU_FTR_NODSISRALIGN, 0, 1, 1, 1},
534#if 0
535 /* put this back once we know how to test if firmware does 64k IO */
536 {CPU_FTR_CI_LARGE_PAGE, 0, 1, 2, 0}, 534 {CPU_FTR_CI_LARGE_PAGE, 0, 1, 2, 0},
537#endif
538 {CPU_FTR_REAL_LE, PPC_FEATURE_TRUE_LE, 5, 0, 0}, 535 {CPU_FTR_REAL_LE, PPC_FEATURE_TRUE_LE, 5, 0, 0},
539}; 536};
540 537
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index 7474502dace5..cd870a823d18 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -290,7 +290,8 @@ void __init setup_arch(char **cmdline_p)
290 conswitchp = &dummy_con; 290 conswitchp = &dummy_con;
291#endif 291#endif
292 292
293 ppc_md.setup_arch(); 293 if (ppc_md.setup_arch)
294 ppc_md.setup_arch();
294 if ( ppc_md.progress ) ppc_md.progress("arch: exit", 0x3eab); 295 if ( ppc_md.progress ) ppc_md.progress("arch: exit", 0x3eab);
295 296
296 paging_init(); 297 paging_init();
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 3089eaed3256..008ab6823b02 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -530,7 +530,8 @@ void __init setup_arch(char **cmdline_p)
530 conswitchp = &dummy_con; 530 conswitchp = &dummy_con;
531#endif 531#endif
532 532
533 ppc_md.setup_arch(); 533 if (ppc_md.setup_arch)
534 ppc_md.setup_arch();
534 535
535 paging_init(); 536 paging_init();
536 ppc64_boot_msg(0x15, "Setup Done"); 537 ppc64_boot_msg(0x15, "Setup Done");
diff --git a/arch/powerpc/kernel/systbl.S b/arch/powerpc/kernel/systbl.S
index 579de70e0b4d..93219c34af32 100644
--- a/arch/powerpc/kernel/systbl.S
+++ b/arch/powerpc/kernel/systbl.S
@@ -39,6 +39,8 @@
39#ifdef CONFIG_PPC64 39#ifdef CONFIG_PPC64
40#define sys_sigpending sys_ni_syscall 40#define sys_sigpending sys_ni_syscall
41#define sys_old_getrlimit sys_ni_syscall 41#define sys_old_getrlimit sys_ni_syscall
42
43 .p2align 3
42#endif 44#endif
43 45
44_GLOBAL(sys_call_table) 46_GLOBAL(sys_call_table)
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index d20947cf1735..9368da371f36 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -108,7 +108,7 @@ static void decrementer_set_mode(enum clock_event_mode mode,
108static struct clock_event_device decrementer_clockevent = { 108static struct clock_event_device decrementer_clockevent = {
109 .name = "decrementer", 109 .name = "decrementer",
110 .rating = 200, 110 .rating = 200,
111 .shift = 32, 111 .shift = 16,
112 .mult = 0, /* To be filled in */ 112 .mult = 0, /* To be filled in */
113 .irq = 0, 113 .irq = 0,
114 .set_next_event = decrementer_set_next_event, 114 .set_next_event = decrementer_set_next_event,
@@ -118,6 +118,7 @@ static struct clock_event_device decrementer_clockevent = {
118 118
119static DEFINE_PER_CPU(struct clock_event_device, decrementers); 119static DEFINE_PER_CPU(struct clock_event_device, decrementers);
120void init_decrementer_clockevent(void); 120void init_decrementer_clockevent(void);
121static DEFINE_PER_CPU(u64, decrementer_next_tb);
121 122
122#ifdef CONFIG_PPC_ISERIES 123#ifdef CONFIG_PPC_ISERIES
123static unsigned long __initdata iSeries_recal_titan; 124static unsigned long __initdata iSeries_recal_titan;
@@ -541,6 +542,7 @@ void timer_interrupt(struct pt_regs * regs)
541 struct pt_regs *old_regs; 542 struct pt_regs *old_regs;
542 int cpu = smp_processor_id(); 543 int cpu = smp_processor_id();
543 struct clock_event_device *evt = &per_cpu(decrementers, cpu); 544 struct clock_event_device *evt = &per_cpu(decrementers, cpu);
545 u64 now;
544 546
545 /* Ensure a positive value is written to the decrementer, or else 547 /* Ensure a positive value is written to the decrementer, or else
546 * some CPUs will continuue to take decrementer exceptions */ 548 * some CPUs will continuue to take decrementer exceptions */
@@ -551,6 +553,14 @@ void timer_interrupt(struct pt_regs * regs)
551 do_IRQ(regs); 553 do_IRQ(regs);
552#endif 554#endif
553 555
556 now = get_tb_or_rtc();
557 if (now < per_cpu(decrementer_next_tb, cpu)) {
558 /* not time for this event yet */
559 now = per_cpu(decrementer_next_tb, cpu) - now;
560 if (now <= DECREMENTER_MAX)
561 set_dec((unsigned int)now - 1);
562 return;
563 }
554 old_regs = set_irq_regs(regs); 564 old_regs = set_irq_regs(regs);
555 irq_enter(); 565 irq_enter();
556 566
@@ -797,6 +807,10 @@ void __init clocksource_init(void)
797static int decrementer_set_next_event(unsigned long evt, 807static int decrementer_set_next_event(unsigned long evt,
798 struct clock_event_device *dev) 808 struct clock_event_device *dev)
799{ 809{
810 __get_cpu_var(decrementer_next_tb) = get_tb_or_rtc() + evt;
811 /* The decrementer interrupts on the 0 -> -1 transition */
812 if (evt)
813 --evt;
800 set_dec(evt); 814 set_dec(evt);
801 return 0; 815 return 0;
802} 816}
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index 213fa31ac537..2322ba5cce4c 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -766,7 +766,9 @@ static int __init vdso_init(void)
766 766
767 return 0; 767 return 0;
768} 768}
769#ifdef CONFIG_PPC_MERGE
769arch_initcall(vdso_init); 770arch_initcall(vdso_init);
771#endif
770 772
771int in_gate_area_no_task(unsigned long addr) 773int in_gate_area_no_task(unsigned long addr)
772{ 774{
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index 1d7b272b3737..cb22a3557c4e 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -48,66 +48,33 @@ static struct vio_dev vio_bus_device = { /* fake "parent" device */
48 .dev.bus = &vio_bus_type, 48 .dev.bus = &vio_bus_type,
49}; 49};
50 50
51#ifdef CONFIG_PPC_ISERIES 51static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev)
52struct device *iSeries_vio_dev = &vio_bus_device.dev; 52{
53EXPORT_SYMBOL(iSeries_vio_dev); 53 const unsigned char *dma_window;
54 struct iommu_table *tbl;
55 unsigned long offset, size;
54 56
55static struct iommu_table veth_iommu_table; 57 if (firmware_has_feature(FW_FEATURE_ISERIES))
56static struct iommu_table vio_iommu_table; 58 return vio_build_iommu_table_iseries(dev);
57 59
58static void __init iommu_vio_init(void) 60 dma_window = of_get_property(dev->dev.archdata.of_node,
59{ 61 "ibm,my-dma-window", NULL);
60 iommu_table_getparms_iSeries(255, 0, 0xff, &veth_iommu_table); 62 if (!dma_window)
61 veth_iommu_table.it_size /= 2; 63 return NULL;
62 vio_iommu_table = veth_iommu_table;
63 vio_iommu_table.it_offset += veth_iommu_table.it_size;
64
65 if (!iommu_init_table(&veth_iommu_table, -1))
66 printk("Virtual Bus VETH TCE table failed.\n");
67 if (!iommu_init_table(&vio_iommu_table, -1))
68 printk("Virtual Bus VIO TCE table failed.\n");
69 vio_bus_device.dev.archdata.dma_ops = &dma_iommu_ops;
70 vio_bus_device.dev.archdata.dma_data = &vio_iommu_table;
71}
72#else
73static void __init iommu_vio_init(void)
74{
75}
76#endif
77 64
78static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev) 65 tbl = kmalloc(sizeof(*tbl), GFP_KERNEL);
79{ 66
80#ifdef CONFIG_PPC_ISERIES 67 of_parse_dma_window(dev->dev.archdata.of_node, dma_window,
81 if (firmware_has_feature(FW_FEATURE_ISERIES)) { 68 &tbl->it_index, &offset, &size);
82 if (strcmp(dev->type, "network") == 0) 69
83 return &veth_iommu_table; 70 /* TCE table size - measured in tce entries */
84 return &vio_iommu_table; 71 tbl->it_size = size >> IOMMU_PAGE_SHIFT;
85 } else 72 /* offset for VIO should always be 0 */
86#endif 73 tbl->it_offset = offset >> IOMMU_PAGE_SHIFT;
87 { 74 tbl->it_busno = 0;
88 const unsigned char *dma_window; 75 tbl->it_type = TCE_VB;
89 struct iommu_table *tbl; 76
90 unsigned long offset, size; 77 return iommu_init_table(tbl, -1);
91
92 dma_window = of_get_property(dev->dev.archdata.of_node,
93 "ibm,my-dma-window", NULL);
94 if (!dma_window)
95 return NULL;
96
97 tbl = kmalloc(sizeof(*tbl), GFP_KERNEL);
98
99 of_parse_dma_window(dev->dev.archdata.of_node, dma_window,
100 &tbl->it_index, &offset, &size);
101
102 /* TCE table size - measured in tce entries */
103 tbl->it_size = size >> IOMMU_PAGE_SHIFT;
104 /* offset for VIO should always be 0 */
105 tbl->it_offset = offset >> IOMMU_PAGE_SHIFT;
106 tbl->it_busno = 0;
107 tbl->it_type = TCE_VB;
108
109 return iommu_init_table(tbl, -1);
110 }
111} 78}
112 79
113/** 80/**
@@ -168,16 +135,6 @@ static int vio_bus_remove(struct device *dev)
168 return 1; 135 return 1;
169} 136}
170 137
171/* convert from struct device to struct vio_dev and pass to driver. */
172static void vio_bus_shutdown(struct device *dev)
173{
174 struct vio_dev *viodev = to_vio_dev(dev);
175 struct vio_driver *viodrv = to_vio_driver(dev->driver);
176
177 if (dev->driver && viodrv->shutdown)
178 viodrv->shutdown(viodev);
179}
180
181/** 138/**
182 * vio_register_driver: - Register a new vio driver 139 * vio_register_driver: - Register a new vio driver
183 * @drv: The vio_driver structure to be registered. 140 * @drv: The vio_driver structure to be registered.
@@ -290,9 +247,6 @@ static int __init vio_bus_init(void)
290 int err; 247 int err;
291 struct device_node *node_vroot; 248 struct device_node *node_vroot;
292 249
293 if (firmware_has_feature(FW_FEATURE_ISERIES))
294 iommu_vio_init();
295
296 err = bus_register(&vio_bus_type); 250 err = bus_register(&vio_bus_type);
297 if (err) { 251 if (err) {
298 printk(KERN_ERR "failed to register VIO bus\n"); 252 printk(KERN_ERR "failed to register VIO bus\n");
@@ -397,7 +351,6 @@ static struct bus_type vio_bus_type = {
397 .match = vio_bus_match, 351 .match = vio_bus_match,
398 .probe = vio_bus_probe, 352 .probe = vio_bus_probe,
399 .remove = vio_bus_remove, 353 .remove = vio_bus_remove,
400 .shutdown = vio_bus_shutdown,
401}; 354};
402 355
403/** 356/**
diff --git a/arch/powerpc/oprofile/cell/pr_util.h b/arch/powerpc/oprofile/cell/pr_util.h
index e5704f00c8b4..22e4e8d4eb2c 100644
--- a/arch/powerpc/oprofile/cell/pr_util.h
+++ b/arch/powerpc/oprofile/cell/pr_util.h
@@ -17,10 +17,9 @@
17#include <linux/cpumask.h> 17#include <linux/cpumask.h>
18#include <linux/oprofile.h> 18#include <linux/oprofile.h>
19#include <asm/cell-pmu.h> 19#include <asm/cell-pmu.h>
20#include <asm/cell-regs.h>
20#include <asm/spu.h> 21#include <asm/spu.h>
21 22
22#include "../../platforms/cell/cbe_regs.h"
23
24/* Defines used for sync_start */ 23/* Defines used for sync_start */
25#define SKIP_GENERIC_SYNC 0 24#define SKIP_GENERIC_SYNC 0
26#define SYNC_START_ERROR -1 25#define SYNC_START_ERROR -1
diff --git a/arch/powerpc/oprofile/op_model_cell.c b/arch/powerpc/oprofile/op_model_cell.c
index d928b54f3a0f..bb6bff51ce48 100644
--- a/arch/powerpc/oprofile/op_model_cell.c
+++ b/arch/powerpc/oprofile/op_model_cell.c
@@ -35,9 +35,9 @@
35#include <asm/reg.h> 35#include <asm/reg.h>
36#include <asm/rtas.h> 36#include <asm/rtas.h>
37#include <asm/system.h> 37#include <asm/system.h>
38#include <asm/cell-regs.h>
38 39
39#include "../platforms/cell/interrupt.h" 40#include "../platforms/cell/interrupt.h"
40#include "../platforms/cell/cbe_regs.h"
41#include "cell/pr_util.h" 41#include "cell/pr_util.h"
42 42
43static void cell_global_stop_spu(void); 43static void cell_global_stop_spu(void);
diff --git a/arch/powerpc/platforms/40x/Kconfig b/arch/powerpc/platforms/40x/Kconfig
index a0a50b16b8a9..47b3b0a3864a 100644
--- a/arch/powerpc/platforms/40x/Kconfig
+++ b/arch/powerpc/platforms/40x/Kconfig
@@ -29,6 +29,13 @@
29# help 29# help
30# This option enables support for the extra features of the EP405PC board. 30# This option enables support for the extra features of the EP405PC board.
31 31
32config KILAUEA
33 bool "Kilauea"
34 depends on 40x
35 default n
36 help
37 This option enables support for the AMCC PPC405EX evaluation board.
38
32#config REDWOOD_5 39#config REDWOOD_5
33# bool "Redwood-5" 40# bool "Redwood-5"
34# depends on 40x 41# depends on 40x
diff --git a/arch/powerpc/platforms/40x/Makefile b/arch/powerpc/platforms/40x/Makefile
index 0a3cfe99a7ed..51dadeee6fc6 100644
--- a/arch/powerpc/platforms/40x/Makefile
+++ b/arch/powerpc/platforms/40x/Makefile
@@ -1,2 +1,3 @@
1obj-$(CONFIG_WALNUT) += walnut.o 1obj-$(CONFIG_KILAUEA) += kilauea.o
2obj-$(CONFIG_XILINX_VIRTEX_GENERIC_BOARD) += virtex.o 2obj-$(CONFIG_WALNUT) += walnut.o
3obj-$(CONFIG_XILINX_VIRTEX_GENERIC_BOARD) += virtex.o
diff --git a/arch/powerpc/platforms/40x/kilauea.c b/arch/powerpc/platforms/40x/kilauea.c
new file mode 100644
index 000000000000..1bffdbdd21b1
--- /dev/null
+++ b/arch/powerpc/platforms/40x/kilauea.c
@@ -0,0 +1,58 @@
1/*
2 * Kilauea board specific routines
3 *
4 * Copyright 2007 DENX Software Engineering, Stefan Roese <sr@denx.de>
5 *
6 * Based on the Walnut code by
7 * Josh Boyer <jwboyer@linux.vnet.ibm.com>
8 * Copyright 2007 IBM Corporation
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15#include <linux/init.h>
16#include <linux/of_platform.h>
17#include <asm/machdep.h>
18#include <asm/prom.h>
19#include <asm/udbg.h>
20#include <asm/time.h>
21#include <asm/uic.h>
22
23static struct of_device_id kilauea_of_bus[] = {
24 { .compatible = "ibm,plb4", },
25 { .compatible = "ibm,opb", },
26 { .compatible = "ibm,ebc", },
27 {},
28};
29
30static int __init kilauea_device_probe(void)
31{
32 if (!machine_is(kilauea))
33 return 0;
34
35 of_platform_bus_probe(NULL, kilauea_of_bus, NULL);
36
37 return 0;
38}
39device_initcall(kilauea_device_probe);
40
41static int __init kilauea_probe(void)
42{
43 unsigned long root = of_get_flat_dt_root();
44
45 if (!of_flat_dt_is_compatible(root, "amcc,kilauea"))
46 return 0;
47
48 return 1;
49}
50
51define_machine(kilauea) {
52 .name = "Kilauea",
53 .probe = kilauea_probe,
54 .progress = udbg_progress,
55 .init_IRQ = uic_init_tree,
56 .get_irq = uic_get_irq,
57 .calibrate_decr = generic_calibrate_decr,
58};
diff --git a/arch/powerpc/platforms/40x/virtex.c b/arch/powerpc/platforms/40x/virtex.c
index b52aa94abd78..14bbc328170f 100644
--- a/arch/powerpc/platforms/40x/virtex.c
+++ b/arch/powerpc/platforms/40x/virtex.c
@@ -36,14 +36,9 @@ static int __init virtex_probe(void)
36 return 1; 36 return 1;
37} 37}
38 38
39static void __init virtex_setup_arch(void)
40{
41}
42
43define_machine(virtex) { 39define_machine(virtex) {
44 .name = "Xilinx Virtex", 40 .name = "Xilinx Virtex",
45 .probe = virtex_probe, 41 .probe = virtex_probe,
46 .setup_arch = virtex_setup_arch,
47 .init_IRQ = xilinx_intc_init_tree, 42 .init_IRQ = xilinx_intc_init_tree,
48 .get_irq = xilinx_intc_get_irq, 43 .get_irq = xilinx_intc_get_irq,
49 .calibrate_decr = generic_calibrate_decr, 44 .calibrate_decr = generic_calibrate_decr,
diff --git a/arch/powerpc/platforms/40x/walnut.c b/arch/powerpc/platforms/40x/walnut.c
index c17fdf23b492..eb0c136b1c44 100644
--- a/arch/powerpc/platforms/40x/walnut.c
+++ b/arch/powerpc/platforms/40x/walnut.c
@@ -53,14 +53,9 @@ static int __init walnut_probe(void)
53 return 1; 53 return 1;
54} 54}
55 55
56static void __init walnut_setup_arch(void)
57{
58}
59
60define_machine(walnut) { 56define_machine(walnut) {
61 .name = "Walnut", 57 .name = "Walnut",
62 .probe = walnut_probe, 58 .probe = walnut_probe,
63 .setup_arch = walnut_setup_arch,
64 .progress = udbg_progress, 59 .progress = udbg_progress,
65 .init_IRQ = uic_init_tree, 60 .init_IRQ = uic_init_tree,
66 .get_irq = uic_get_irq, 61 .get_irq = uic_get_irq,
diff --git a/arch/powerpc/platforms/44x/bamboo.c b/arch/powerpc/platforms/44x/bamboo.c
index 9bc45dea078f..470e1a3fd755 100644
--- a/arch/powerpc/platforms/44x/bamboo.c
+++ b/arch/powerpc/platforms/44x/bamboo.c
@@ -50,14 +50,9 @@ static int __init bamboo_probe(void)
50 return 1; 50 return 1;
51} 51}
52 52
53static void __init bamboo_setup_arch(void)
54{
55}
56
57define_machine(bamboo) { 53define_machine(bamboo) {
58 .name = "Bamboo", 54 .name = "Bamboo",
59 .probe = bamboo_probe, 55 .probe = bamboo_probe,
60 .setup_arch = bamboo_setup_arch,
61 .progress = udbg_progress, 56 .progress = udbg_progress,
62 .init_IRQ = uic_init_tree, 57 .init_IRQ = uic_init_tree,
63 .get_irq = uic_get_irq, 58 .get_irq = uic_get_irq,
diff --git a/arch/powerpc/platforms/44x/ebony.c b/arch/powerpc/platforms/44x/ebony.c
index 5a7fec8d10d3..40e18fcb666c 100644
--- a/arch/powerpc/platforms/44x/ebony.c
+++ b/arch/powerpc/platforms/44x/ebony.c
@@ -57,14 +57,9 @@ static int __init ebony_probe(void)
57 return 1; 57 return 1;
58} 58}
59 59
60static void __init ebony_setup_arch(void)
61{
62}
63
64define_machine(ebony) { 60define_machine(ebony) {
65 .name = "Ebony", 61 .name = "Ebony",
66 .probe = ebony_probe, 62 .probe = ebony_probe,
67 .setup_arch = ebony_setup_arch,
68 .progress = udbg_progress, 63 .progress = udbg_progress,
69 .init_IRQ = uic_init_tree, 64 .init_IRQ = uic_init_tree,
70 .get_irq = uic_get_irq, 65 .get_irq = uic_get_irq,
diff --git a/arch/powerpc/platforms/44x/sequoia.c b/arch/powerpc/platforms/44x/sequoia.c
index 7d0d9d567d25..30700b31d43b 100644
--- a/arch/powerpc/platforms/44x/sequoia.c
+++ b/arch/powerpc/platforms/44x/sequoia.c
@@ -50,14 +50,9 @@ static int __init sequoia_probe(void)
50 return 1; 50 return 1;
51} 51}
52 52
53static void __init sequoia_setup_arch(void)
54{
55}
56
57define_machine(sequoia) { 53define_machine(sequoia) {
58 .name = "Sequoia", 54 .name = "Sequoia",
59 .probe = sequoia_probe, 55 .probe = sequoia_probe,
60 .setup_arch = sequoia_setup_arch,
61 .progress = udbg_progress, 56 .progress = udbg_progress,
62 .init_IRQ = uic_init_tree, 57 .init_IRQ = uic_init_tree,
63 .get_irq = uic_get_irq, 58 .get_irq = uic_get_irq,
diff --git a/arch/powerpc/platforms/52xx/efika.c b/arch/powerpc/platforms/52xx/efika.c
index 6fc17faf74b9..a0da70c8b502 100644
--- a/arch/powerpc/platforms/52xx/efika.c
+++ b/arch/powerpc/platforms/52xx/efika.c
@@ -180,15 +180,6 @@ static void __init efika_setup_arch(void)
180{ 180{
181 rtas_initialize(); 181 rtas_initialize();
182 182
183#ifdef CONFIG_BLK_DEV_INITRD
184 initrd_below_start_ok = 1;
185
186 if (initrd_start)
187 ROOT_DEV = Root_RAM0;
188 else
189#endif
190 ROOT_DEV = Root_SDA2; /* sda2 (sda1 is for the kernel) */
191
192 efika_pcisetup(); 183 efika_pcisetup();
193 184
194#ifdef CONFIG_PM 185#ifdef CONFIG_PM
diff --git a/arch/powerpc/platforms/cell/cbe_cpufreq.c b/arch/powerpc/platforms/cell/cbe_cpufreq.c
index 0b6e8ee85ab1..901236fa0f07 100644
--- a/arch/powerpc/platforms/cell/cbe_cpufreq.c
+++ b/arch/powerpc/platforms/cell/cbe_cpufreq.c
@@ -24,7 +24,7 @@
24#include <asm/machdep.h> 24#include <asm/machdep.h>
25#include <asm/of_platform.h> 25#include <asm/of_platform.h>
26#include <asm/prom.h> 26#include <asm/prom.h>
27#include "cbe_regs.h" 27#include <asm/cell-regs.h>
28#include "cbe_cpufreq.h" 28#include "cbe_cpufreq.h"
29 29
30static DEFINE_MUTEX(cbe_switch_mutex); 30static DEFINE_MUTEX(cbe_switch_mutex);
diff --git a/arch/powerpc/platforms/cell/cbe_cpufreq_pervasive.c b/arch/powerpc/platforms/cell/cbe_cpufreq_pervasive.c
index 163263b3e1cd..70fa7aef5edd 100644
--- a/arch/powerpc/platforms/cell/cbe_cpufreq_pervasive.c
+++ b/arch/powerpc/platforms/cell/cbe_cpufreq_pervasive.c
@@ -28,8 +28,8 @@
28#include <linux/time.h> 28#include <linux/time.h>
29#include <asm/machdep.h> 29#include <asm/machdep.h>
30#include <asm/hw_irq.h> 30#include <asm/hw_irq.h>
31#include <asm/cell-regs.h>
31 32
32#include "cbe_regs.h"
33#include "cbe_cpufreq.h" 33#include "cbe_cpufreq.h"
34 34
35/* to write to MIC register */ 35/* to write to MIC register */
diff --git a/arch/powerpc/platforms/cell/cbe_cpufreq_pmi.c b/arch/powerpc/platforms/cell/cbe_cpufreq_pmi.c
index fc6f38982ff4..6a2c1b0a9a94 100644
--- a/arch/powerpc/platforms/cell/cbe_cpufreq_pmi.c
+++ b/arch/powerpc/platforms/cell/cbe_cpufreq_pmi.c
@@ -27,12 +27,12 @@
27#include <asm/processor.h> 27#include <asm/processor.h>
28#include <asm/prom.h> 28#include <asm/prom.h>
29#include <asm/pmi.h> 29#include <asm/pmi.h>
30#include <asm/cell-regs.h>
30 31
31#ifdef DEBUG 32#ifdef DEBUG
32#include <asm/time.h> 33#include <asm/time.h>
33#endif 34#endif
34 35
35#include "cbe_regs.h"
36#include "cbe_cpufreq.h" 36#include "cbe_cpufreq.h"
37 37
38static u8 pmi_slow_mode_limit[MAX_CBE]; 38static u8 pmi_slow_mode_limit[MAX_CBE];
diff --git a/arch/powerpc/platforms/cell/cbe_regs.c b/arch/powerpc/platforms/cell/cbe_regs.c
index c8f7f0007422..16a9b07e7b0c 100644
--- a/arch/powerpc/platforms/cell/cbe_regs.c
+++ b/arch/powerpc/platforms/cell/cbe_regs.c
@@ -16,8 +16,7 @@
16#include <asm/ptrace.h> 16#include <asm/ptrace.h>
17#include <asm/of_device.h> 17#include <asm/of_device.h>
18#include <asm/of_platform.h> 18#include <asm/of_platform.h>
19 19#include <asm/cell-regs.h>
20#include "cbe_regs.h"
21 20
22/* 21/*
23 * Current implementation uses "cpu" nodes. We build our own mapping 22 * Current implementation uses "cpu" nodes. We build our own mapping
diff --git a/arch/powerpc/platforms/cell/cbe_thermal.c b/arch/powerpc/platforms/cell/cbe_thermal.c
index fb5eda48467d..4852bf312d83 100644
--- a/arch/powerpc/platforms/cell/cbe_thermal.c
+++ b/arch/powerpc/platforms/cell/cbe_thermal.c
@@ -52,8 +52,8 @@
52#include <asm/spu.h> 52#include <asm/spu.h>
53#include <asm/io.h> 53#include <asm/io.h>
54#include <asm/prom.h> 54#include <asm/prom.h>
55#include <asm/cell-regs.h>
55 56
56#include "cbe_regs.h"
57#include "spu_priv1_mmio.h" 57#include "spu_priv1_mmio.h"
58 58
59#define TEMP_MIN 65 59#define TEMP_MIN 65
diff --git a/arch/powerpc/platforms/cell/interrupt.c b/arch/powerpc/platforms/cell/interrupt.c
index c29e634177fa..151fd8b82d63 100644
--- a/arch/powerpc/platforms/cell/interrupt.c
+++ b/arch/powerpc/platforms/cell/interrupt.c
@@ -41,9 +41,9 @@
41#include <asm/prom.h> 41#include <asm/prom.h>
42#include <asm/ptrace.h> 42#include <asm/ptrace.h>
43#include <asm/machdep.h> 43#include <asm/machdep.h>
44#include <asm/cell-regs.h>
44 45
45#include "interrupt.h" 46#include "interrupt.h"
46#include "cbe_regs.h"
47 47
48struct iic { 48struct iic {
49 struct cbe_iic_thread_regs __iomem *regs; 49 struct cbe_iic_thread_regs __iomem *regs;
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
index 760caa76841a..faabc3fdc130 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -34,8 +34,8 @@
34#include <asm/udbg.h> 34#include <asm/udbg.h>
35#include <asm/of_platform.h> 35#include <asm/of_platform.h>
36#include <asm/lmb.h> 36#include <asm/lmb.h>
37#include <asm/cell-regs.h>
37 38
38#include "cbe_regs.h"
39#include "interrupt.h" 39#include "interrupt.h"
40 40
41/* Define CELL_IOMMU_REAL_UNMAP to actually unmap non-used pages 41/* Define CELL_IOMMU_REAL_UNMAP to actually unmap non-used pages
diff --git a/arch/powerpc/platforms/cell/pervasive.c b/arch/powerpc/platforms/cell/pervasive.c
index 4ede22d363fa..0304589c0a80 100644
--- a/arch/powerpc/platforms/cell/pervasive.c
+++ b/arch/powerpc/platforms/cell/pervasive.c
@@ -34,9 +34,9 @@
34#include <asm/prom.h> 34#include <asm/prom.h>
35#include <asm/pgtable.h> 35#include <asm/pgtable.h>
36#include <asm/reg.h> 36#include <asm/reg.h>
37#include <asm/cell-regs.h>
37 38
38#include "pervasive.h" 39#include "pervasive.h"
39#include "cbe_regs.h"
40 40
41static int sysreset_hack; 41static int sysreset_hack;
42 42
diff --git a/arch/powerpc/platforms/cell/pmu.c b/arch/powerpc/platforms/cell/pmu.c
index 66ca4b5a1dbc..1ed303678887 100644
--- a/arch/powerpc/platforms/cell/pmu.c
+++ b/arch/powerpc/platforms/cell/pmu.c
@@ -30,8 +30,8 @@
30#include <asm/pmc.h> 30#include <asm/pmc.h>
31#include <asm/reg.h> 31#include <asm/reg.h>
32#include <asm/spu.h> 32#include <asm/spu.h>
33#include <asm/cell-regs.h>
33 34
34#include "cbe_regs.h"
35#include "interrupt.h" 35#include "interrupt.h"
36 36
37/* 37/*
diff --git a/arch/powerpc/platforms/cell/ras.c b/arch/powerpc/platforms/cell/ras.c
index 3961a085b432..b2494ebcdbe9 100644
--- a/arch/powerpc/platforms/cell/ras.c
+++ b/arch/powerpc/platforms/cell/ras.c
@@ -10,9 +10,9 @@
10#include <asm/prom.h> 10#include <asm/prom.h>
11#include <asm/machdep.h> 11#include <asm/machdep.h>
12#include <asm/rtas.h> 12#include <asm/rtas.h>
13#include <asm/cell-regs.h>
13 14
14#include "ras.h" 15#include "ras.h"
15#include "cbe_regs.h"
16 16
17 17
18static void dump_fir(int cpu) 18static void dump_fir(int cpu)
diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c
index db6654272e13..98e7ef8e6fc6 100644
--- a/arch/powerpc/platforms/cell/setup.c
+++ b/arch/powerpc/platforms/cell/setup.c
@@ -52,9 +52,9 @@
52#include <asm/udbg.h> 52#include <asm/udbg.h>
53#include <asm/mpic.h> 53#include <asm/mpic.h>
54#include <asm/of_platform.h> 54#include <asm/of_platform.h>
55#include <asm/cell-regs.h>
55 56
56#include "interrupt.h" 57#include "interrupt.h"
57#include "cbe_regs.h"
58#include "pervasive.h" 58#include "pervasive.h"
59#include "ras.h" 59#include "ras.h"
60 60
@@ -83,12 +83,22 @@ static void cell_progress(char *s, unsigned short hex)
83 83
84static int __init cell_publish_devices(void) 84static int __init cell_publish_devices(void)
85{ 85{
86 int node;
87
86 if (!machine_is(cell)) 88 if (!machine_is(cell))
87 return 0; 89 return 0;
88 90
89 /* Publish OF platform devices for southbridge IOs */ 91 /* Publish OF platform devices for southbridge IOs */
90 of_platform_bus_probe(NULL, NULL, NULL); 92 of_platform_bus_probe(NULL, NULL, NULL);
91 93
94 /* There is no device for the MIC memory controller, thus we create
95 * a platform device for it to attach the EDAC driver to.
96 */
97 for_each_online_node(node) {
98 if (cbe_get_cpu_mic_tm_regs(cbe_node_to_cpu(node)) == NULL)
99 continue;
100 platform_device_register_simple("cbe-mic", node, NULL, 0);
101 }
92 return 0; 102 return 0;
93} 103}
94device_initcall(cell_publish_devices); 104device_initcall(cell_publish_devices);
@@ -161,11 +171,6 @@ static void __init cell_setup_arch(void)
161 /* init to some ~sane value until calibrate_delay() runs */ 171 /* init to some ~sane value until calibrate_delay() runs */
162 loops_per_jiffy = 50000000; 172 loops_per_jiffy = 50000000;
163 173
164 if (ROOT_DEV == 0) {
165 printk("No ramdisk, default root is /dev/hda2\n");
166 ROOT_DEV = Root_HDA2;
167 }
168
169 /* Find and initialize PCI host bridges */ 174 /* Find and initialize PCI host bridges */
170 init_pci_config_tokens(); 175 init_pci_config_tokens();
171 find_and_init_phbs(); 176 find_and_init_phbs();
diff --git a/arch/powerpc/platforms/celleb/setup.c b/arch/powerpc/platforms/celleb/setup.c
index 0f1dddb81cd2..1769d755eff3 100644
--- a/arch/powerpc/platforms/celleb/setup.c
+++ b/arch/powerpc/platforms/celleb/setup.c
@@ -101,11 +101,6 @@ static void __init celleb_setup_arch(void)
101 /* init to some ~sane value until calibrate_delay() runs */ 101 /* init to some ~sane value until calibrate_delay() runs */
102 loops_per_jiffy = 50000000; 102 loops_per_jiffy = 50000000;
103 103
104 if (ROOT_DEV == 0) {
105 printk("No ramdisk, default root is /dev/hda2\n");
106 ROOT_DEV = Root_HDA2;
107 }
108
109#ifdef CONFIG_DUMMY_CONSOLE 104#ifdef CONFIG_DUMMY_CONSOLE
110 conswitchp = &dummy_con; 105 conswitchp = &dummy_con;
111#endif 106#endif
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index 96498ad7b943..59306261f5b2 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -290,16 +290,6 @@ void __init chrp_setup_arch(void)
290 ppc_md.set_rtc_time = rtas_set_rtc_time; 290 ppc_md.set_rtc_time = rtas_set_rtc_time;
291 } 291 }
292 292
293#ifdef CONFIG_BLK_DEV_INITRD
294 /* this is fine for chrp */
295 initrd_below_start_ok = 1;
296
297 if (initrd_start)
298 ROOT_DEV = Root_RAM0;
299 else
300#endif
301 ROOT_DEV = Root_SDA2; /* sda2 (sda1 is for the kernel) */
302
303 /* On pegasos, enable the L2 cache if not already done by OF */ 293 /* On pegasos, enable the L2 cache if not already done by OF */
304 pegasos_set_l2cr(); 294 pegasos_set_l2cr();
305 295
diff --git a/arch/powerpc/platforms/iseries/Makefile b/arch/powerpc/platforms/iseries/Makefile
index 60db509638f1..a65f1b44abf8 100644
--- a/arch/powerpc/platforms/iseries/Makefile
+++ b/arch/powerpc/platforms/iseries/Makefile
@@ -7,7 +7,7 @@ obj-y += hvlog.o hvlpconfig.o lpardata.o setup.o dt_mod.o mf.o lpevents.o \
7 hvcall.o proc.o htab.o iommu.o misc.o irq.o 7 hvcall.o proc.o htab.o iommu.o misc.o irq.o
8obj-$(CONFIG_PCI) += pci.o vpdinfo.o 8obj-$(CONFIG_PCI) += pci.o vpdinfo.o
9obj-$(CONFIG_SMP) += smp.o 9obj-$(CONFIG_SMP) += smp.o
10obj-$(CONFIG_VIOPATH) += viopath.o 10obj-$(CONFIG_VIOPATH) += viopath.o vio.o
11obj-$(CONFIG_MODULES) += ksyms.o 11obj-$(CONFIG_MODULES) += ksyms.o
12 12
13quiet_cmd_dt_strings = DT_STR $@ 13quiet_cmd_dt_strings = DT_STR $@
diff --git a/arch/powerpc/platforms/iseries/dt.c b/arch/powerpc/platforms/iseries/dt.c
index 9e8a334a518a..4543c4bc3a56 100644
--- a/arch/powerpc/platforms/iseries/dt.c
+++ b/arch/powerpc/platforms/iseries/dt.c
@@ -72,8 +72,6 @@ static char __initdata device_type_cpu[] = "cpu";
72static char __initdata device_type_memory[] = "memory"; 72static char __initdata device_type_memory[] = "memory";
73static char __initdata device_type_serial[] = "serial"; 73static char __initdata device_type_serial[] = "serial";
74static char __initdata device_type_network[] = "network"; 74static char __initdata device_type_network[] = "network";
75static char __initdata device_type_block[] = "block";
76static char __initdata device_type_byte[] = "byte";
77static char __initdata device_type_pci[] = "pci"; 75static char __initdata device_type_pci[] = "pci";
78static char __initdata device_type_vdevice[] = "vdevice"; 76static char __initdata device_type_vdevice[] = "vdevice";
79static char __initdata device_type_vscsi[] = "vscsi"; 77static char __initdata device_type_vscsi[] = "vscsi";
@@ -375,21 +373,6 @@ static void __init dt_vdevices(struct iseries_flat_dt *dt)
375 373
376 dt_end_node(dt); 374 dt_end_node(dt);
377 } 375 }
378 reg += HVMAXARCHITECTEDVIRTUALLANS;
379
380 for (i = 0; i < HVMAXARCHITECTEDVIRTUALDISKS; i++)
381 dt_do_vdevice(dt, "viodasd", reg, i, device_type_block,
382 "IBM,iSeries-viodasd", 1);
383 reg += HVMAXARCHITECTEDVIRTUALDISKS;
384
385 for (i = 0; i < HVMAXARCHITECTEDVIRTUALCDROMS; i++)
386 dt_do_vdevice(dt, "viocd", reg, i, device_type_block,
387 "IBM,iSeries-viocd", 1);
388 reg += HVMAXARCHITECTEDVIRTUALCDROMS;
389
390 for (i = 0; i < HVMAXARCHITECTEDVIRTUALTAPES; i++)
391 dt_do_vdevice(dt, "viotape", reg, i, device_type_byte,
392 "IBM,iSeries-viotape", 1);
393 376
394 dt_end_node(dt); 377 dt_end_node(dt);
395} 378}
diff --git a/arch/powerpc/platforms/iseries/iommu.c b/arch/powerpc/platforms/iseries/iommu.c
index 3b6a9666c2c0..49e9c664ea89 100644
--- a/arch/powerpc/platforms/iseries/iommu.c
+++ b/arch/powerpc/platforms/iseries/iommu.c
@@ -28,14 +28,17 @@
28#include <linux/dma-mapping.h> 28#include <linux/dma-mapping.h>
29#include <linux/list.h> 29#include <linux/list.h>
30#include <linux/pci.h> 30#include <linux/pci.h>
31#include <linux/module.h>
31 32
32#include <asm/iommu.h> 33#include <asm/iommu.h>
34#include <asm/vio.h>
33#include <asm/tce.h> 35#include <asm/tce.h>
34#include <asm/machdep.h> 36#include <asm/machdep.h>
35#include <asm/abs_addr.h> 37#include <asm/abs_addr.h>
36#include <asm/prom.h> 38#include <asm/prom.h>
37#include <asm/pci-bridge.h> 39#include <asm/pci-bridge.h>
38#include <asm/iseries/hv_call_xm.h> 40#include <asm/iseries/hv_call_xm.h>
41#include <asm/iseries/hv_call_event.h>
39#include <asm/iseries/iommu.h> 42#include <asm/iseries/iommu.h>
40 43
41static void tce_build_iSeries(struct iommu_table *tbl, long index, long npages, 44static void tce_build_iSeries(struct iommu_table *tbl, long index, long npages,
@@ -189,6 +192,55 @@ void iommu_devnode_init_iSeries(struct pci_dev *pdev, struct device_node *dn)
189} 192}
190#endif 193#endif
191 194
195static struct iommu_table veth_iommu_table;
196static struct iommu_table vio_iommu_table;
197
198void *iseries_hv_alloc(size_t size, dma_addr_t *dma_handle, gfp_t flag)
199{
200 return iommu_alloc_coherent(&vio_iommu_table, size, dma_handle,
201 DMA_32BIT_MASK, flag, -1);
202}
203EXPORT_SYMBOL_GPL(iseries_hv_alloc);
204
205void iseries_hv_free(size_t size, void *vaddr, dma_addr_t dma_handle)
206{
207 iommu_free_coherent(&vio_iommu_table, size, vaddr, dma_handle);
208}
209EXPORT_SYMBOL_GPL(iseries_hv_free);
210
211dma_addr_t iseries_hv_map(void *vaddr, size_t size,
212 enum dma_data_direction direction)
213{
214 return iommu_map_single(&vio_iommu_table, vaddr, size,
215 DMA_32BIT_MASK, direction);
216}
217
218void iseries_hv_unmap(dma_addr_t dma_handle, size_t size,
219 enum dma_data_direction direction)
220{
221 iommu_unmap_single(&vio_iommu_table, dma_handle, size, direction);
222}
223
224void __init iommu_vio_init(void)
225{
226 iommu_table_getparms_iSeries(255, 0, 0xff, &veth_iommu_table);
227 veth_iommu_table.it_size /= 2;
228 vio_iommu_table = veth_iommu_table;
229 vio_iommu_table.it_offset += veth_iommu_table.it_size;
230
231 if (!iommu_init_table(&veth_iommu_table, -1))
232 printk("Virtual Bus VETH TCE table failed.\n");
233 if (!iommu_init_table(&vio_iommu_table, -1))
234 printk("Virtual Bus VIO TCE table failed.\n");
235}
236
237struct iommu_table *vio_build_iommu_table_iseries(struct vio_dev *dev)
238{
239 if (strcmp(dev->type, "network") == 0)
240 return &veth_iommu_table;
241 return &vio_iommu_table;
242}
243
192void iommu_init_early_iSeries(void) 244void iommu_init_early_iSeries(void)
193{ 245{
194 ppc_md.tce_build = tce_build_iSeries; 246 ppc_md.tce_build = tce_build_iSeries;
diff --git a/arch/powerpc/platforms/iseries/mf.c b/arch/powerpc/platforms/iseries/mf.c
index b1187d95e3b2..c0f2433bc16e 100644
--- a/arch/powerpc/platforms/iseries/mf.c
+++ b/arch/powerpc/platforms/iseries/mf.c
@@ -39,9 +39,9 @@
39#include <asm/paca.h> 39#include <asm/paca.h>
40#include <asm/abs_addr.h> 40#include <asm/abs_addr.h>
41#include <asm/firmware.h> 41#include <asm/firmware.h>
42#include <asm/iseries/vio.h>
43#include <asm/iseries/mf.h> 42#include <asm/iseries/mf.h>
44#include <asm/iseries/hv_lp_config.h> 43#include <asm/iseries/hv_lp_config.h>
44#include <asm/iseries/hv_lp_event.h>
45#include <asm/iseries/it_lp_queue.h> 45#include <asm/iseries/it_lp_queue.h>
46 46
47#include "setup.h" 47#include "setup.h"
@@ -870,8 +870,7 @@ static int proc_mf_dump_cmdline(char *page, char **start, off_t off,
870 if ((off + count) > 256) 870 if ((off + count) > 256)
871 count = 256 - off; 871 count = 256 - off;
872 872
873 dma_addr = dma_map_single(iSeries_vio_dev, page, off + count, 873 dma_addr = iseries_hv_map(page, off + count, DMA_FROM_DEVICE);
874 DMA_FROM_DEVICE);
875 if (dma_mapping_error(dma_addr)) 874 if (dma_mapping_error(dma_addr))
876 return -ENOMEM; 875 return -ENOMEM;
877 memset(page, 0, off + count); 876 memset(page, 0, off + count);
@@ -883,8 +882,7 @@ static int proc_mf_dump_cmdline(char *page, char **start, off_t off,
883 vsp_cmd.sub_data.kern.length = off + count; 882 vsp_cmd.sub_data.kern.length = off + count;
884 mb(); 883 mb();
885 rc = signal_vsp_instruction(&vsp_cmd); 884 rc = signal_vsp_instruction(&vsp_cmd);
886 dma_unmap_single(iSeries_vio_dev, dma_addr, off + count, 885 iseries_hv_unmap(dma_addr, off + count, DMA_FROM_DEVICE);
887 DMA_FROM_DEVICE);
888 if (rc) 886 if (rc)
889 return rc; 887 return rc;
890 if (vsp_cmd.result_code != 0) 888 if (vsp_cmd.result_code != 0)
@@ -919,8 +917,7 @@ static int mf_getVmlinuxChunk(char *buffer, int *size, int offset, u64 side)
919 int len = *size; 917 int len = *size;
920 dma_addr_t dma_addr; 918 dma_addr_t dma_addr;
921 919
922 dma_addr = dma_map_single(iSeries_vio_dev, buffer, len, 920 dma_addr = iseries_hv_map(buffer, len, DMA_FROM_DEVICE);
923 DMA_FROM_DEVICE);
924 memset(buffer, 0, len); 921 memset(buffer, 0, len);
925 memset(&vsp_cmd, 0, sizeof(vsp_cmd)); 922 memset(&vsp_cmd, 0, sizeof(vsp_cmd));
926 vsp_cmd.cmd = 32; 923 vsp_cmd.cmd = 32;
@@ -938,7 +935,7 @@ static int mf_getVmlinuxChunk(char *buffer, int *size, int offset, u64 side)
938 rc = -ENOMEM; 935 rc = -ENOMEM;
939 } 936 }
940 937
941 dma_unmap_single(iSeries_vio_dev, dma_addr, len, DMA_FROM_DEVICE); 938 iseries_hv_unmap(dma_addr, len, DMA_FROM_DEVICE);
942 939
943 return rc; 940 return rc;
944} 941}
@@ -1149,8 +1146,7 @@ static int proc_mf_change_cmdline(struct file *file, const char __user *buffer,
1149 goto out; 1146 goto out;
1150 1147
1151 dma_addr = 0; 1148 dma_addr = 0;
1152 page = dma_alloc_coherent(iSeries_vio_dev, count, &dma_addr, 1149 page = iseries_hv_alloc(count, &dma_addr, GFP_ATOMIC);
1153 GFP_ATOMIC);
1154 ret = -ENOMEM; 1150 ret = -ENOMEM;
1155 if (page == NULL) 1151 if (page == NULL)
1156 goto out; 1152 goto out;
@@ -1170,7 +1166,7 @@ static int proc_mf_change_cmdline(struct file *file, const char __user *buffer,
1170 ret = count; 1166 ret = count;
1171 1167
1172out_free: 1168out_free:
1173 dma_free_coherent(iSeries_vio_dev, count, page, dma_addr); 1169 iseries_hv_free(count, page, dma_addr);
1174out: 1170out:
1175 return ret; 1171 return ret;
1176} 1172}
@@ -1190,8 +1186,7 @@ static ssize_t proc_mf_change_vmlinux(struct file *file,
1190 goto out; 1186 goto out;
1191 1187
1192 dma_addr = 0; 1188 dma_addr = 0;
1193 page = dma_alloc_coherent(iSeries_vio_dev, count, &dma_addr, 1189 page = iseries_hv_alloc(count, &dma_addr, GFP_ATOMIC);
1194 GFP_ATOMIC);
1195 rc = -ENOMEM; 1190 rc = -ENOMEM;
1196 if (page == NULL) { 1191 if (page == NULL) {
1197 printk(KERN_ERR "mf.c: couldn't allocate memory to set vmlinux chunk\n"); 1192 printk(KERN_ERR "mf.c: couldn't allocate memory to set vmlinux chunk\n");
@@ -1219,7 +1214,7 @@ static ssize_t proc_mf_change_vmlinux(struct file *file,
1219 *ppos += count; 1214 *ppos += count;
1220 rc = count; 1215 rc = count;
1221out_free: 1216out_free:
1222 dma_free_coherent(iSeries_vio_dev, count, page, dma_addr); 1217 iseries_hv_free(count, page, dma_addr);
1223out: 1218out:
1224 return rc; 1219 return rc;
1225} 1220}
diff --git a/arch/powerpc/platforms/iseries/vio.c b/arch/powerpc/platforms/iseries/vio.c
new file mode 100644
index 000000000000..910b00b4703e
--- /dev/null
+++ b/arch/powerpc/platforms/iseries/vio.c
@@ -0,0 +1,553 @@
1/*
2 * Legacy iSeries specific vio initialisation
3 * that needs to be built in (not a module).
4 *
5 * © Copyright 2007 IBM Corporation
6 * Author: Stephen Rothwell
7 * Some parts collected from various other files
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of the
12 * License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software Foundation,
21 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23#include <linux/of.h>
24#include <linux/init.h>
25#include <linux/gfp.h>
26#include <linux/completion.h>
27#include <linux/proc_fs.h>
28#include <linux/module.h>
29
30#include <asm/firmware.h>
31#include <asm/vio.h>
32#include <asm/iseries/vio.h>
33#include <asm/iseries/iommu.h>
34#include <asm/iseries/hv_types.h>
35#include <asm/iseries/hv_lp_event.h>
36
37#define FIRST_VTY 0
38#define NUM_VTYS 1
39#define FIRST_VSCSI (FIRST_VTY + NUM_VTYS)
40#define NUM_VSCSIS 1
41#define FIRST_VLAN (FIRST_VSCSI + NUM_VSCSIS)
42#define NUM_VLANS HVMAXARCHITECTEDVIRTUALLANS
43#define FIRST_VIODASD (FIRST_VLAN + NUM_VLANS)
44#define NUM_VIODASDS HVMAXARCHITECTEDVIRTUALDISKS
45#define FIRST_VIOCD (FIRST_VIODASD + NUM_VIODASDS)
46#define NUM_VIOCDS HVMAXARCHITECTEDVIRTUALCDROMS
47#define FIRST_VIOTAPE (FIRST_VIOCD + NUM_VIOCDS)
48#define NUM_VIOTAPES HVMAXARCHITECTEDVIRTUALTAPES
49
50struct vio_waitevent {
51 struct completion com;
52 int rc;
53 u16 sub_result;
54};
55
56struct vio_resource {
57 char rsrcname[10];
58 char type[4];
59 char model[3];
60};
61
62static struct property *new_property(const char *name, int length,
63 const void *value)
64{
65 struct property *np = kzalloc(sizeof(*np) + strlen(name) + 1 + length,
66 GFP_KERNEL);
67
68 if (!np)
69 return NULL;
70 np->name = (char *)(np + 1);
71 np->value = np->name + strlen(name) + 1;
72 strcpy(np->name, name);
73 memcpy(np->value, value, length);
74 np->length = length;
75 return np;
76}
77
78static void __init free_property(struct property *np)
79{
80 kfree(np);
81}
82
83static struct device_node *new_node(const char *path,
84 struct device_node *parent)
85{
86 struct device_node *np = kzalloc(sizeof(*np), GFP_KERNEL);
87
88 if (!np)
89 return NULL;
90 np->full_name = kmalloc(strlen(path) + 1, GFP_KERNEL);
91 if (!np->full_name) {
92 kfree(np);
93 return NULL;
94 }
95 strcpy(np->full_name, path);
96 of_node_set_flag(np, OF_DYNAMIC);
97 kref_init(&np->kref);
98 np->parent = of_node_get(parent);
99 return np;
100}
101
102static void free_node(struct device_node *np)
103{
104 struct property *next;
105 struct property *prop;
106
107 next = np->properties;
108 while (next) {
109 prop = next;
110 next = prop->next;
111 free_property(prop);
112 }
113 of_node_put(np->parent);
114 kfree(np->full_name);
115 kfree(np);
116}
117
118static int add_string_property(struct device_node *np, const char *name,
119 const char *value)
120{
121 struct property *nprop = new_property(name, strlen(value) + 1, value);
122
123 if (!nprop)
124 return 0;
125 prom_add_property(np, nprop);
126 return 1;
127}
128
129static int add_raw_property(struct device_node *np, const char *name,
130 int length, const void *value)
131{
132 struct property *nprop = new_property(name, length, value);
133
134 if (!nprop)
135 return 0;
136 prom_add_property(np, nprop);
137 return 1;
138}
139
140static struct device_node *do_device_node(struct device_node *parent,
141 const char *name, u32 reg, u32 unit, const char *type,
142 const char *compat, struct vio_resource *res)
143{
144 struct device_node *np;
145 char path[32];
146
147 snprintf(path, sizeof(path), "/vdevice/%s@%08x", name, reg);
148 np = new_node(path, parent);
149 if (!np)
150 return NULL;
151 if (!add_string_property(np, "name", name) ||
152 !add_string_property(np, "device_type", type) ||
153 !add_string_property(np, "compatible", compat) ||
154 !add_raw_property(np, "reg", sizeof(reg), &reg) ||
155 !add_raw_property(np, "linux,unit_address",
156 sizeof(unit), &unit)) {
157 goto node_free;
158 }
159 if (res) {
160 if (!add_raw_property(np, "linux,vio_rsrcname",
161 sizeof(res->rsrcname), res->rsrcname) ||
162 !add_raw_property(np, "linux,vio_type",
163 sizeof(res->type), res->type) ||
164 !add_raw_property(np, "linux,vio_model",
165 sizeof(res->model), res->model))
166 goto node_free;
167 }
168 np->name = of_get_property(np, "name", NULL);
169 np->type = of_get_property(np, "device_type", NULL);
170 of_attach_node(np);
171#ifdef CONFIG_PROC_DEVICETREE
172 if (parent->pde) {
173 struct proc_dir_entry *ent;
174
175 ent = proc_mkdir(strrchr(np->full_name, '/') + 1, parent->pde);
176 if (ent)
177 proc_device_tree_add_node(np, ent);
178 }
179#endif
180 return np;
181
182 node_free:
183 free_node(np);
184 return NULL;
185}
186
187/*
188 * This is here so that we can dynamically add viodasd
189 * devices without exposing all the above infrastructure.
190 */
191struct vio_dev *vio_create_viodasd(u32 unit)
192{
193 struct device_node *vio_root;
194 struct device_node *np;
195 struct vio_dev *vdev = NULL;
196
197 vio_root = of_find_node_by_path("/vdevice");
198 if (!vio_root)
199 return NULL;
200 np = do_device_node(vio_root, "viodasd", FIRST_VIODASD + unit, unit,
201 "block", "IBM,iSeries-viodasd", NULL);
202 of_node_put(vio_root);
203 if (np) {
204 vdev = vio_register_device_node(np);
205 if (!vdev)
206 free_node(np);
207 }
208 return vdev;
209}
210EXPORT_SYMBOL_GPL(vio_create_viodasd);
211
212static void __init handle_block_event(struct HvLpEvent *event)
213{
214 struct vioblocklpevent *bevent = (struct vioblocklpevent *)event;
215 struct vio_waitevent *pwe;
216
217 if (event == NULL)
218 /* Notification that a partition went away! */
219 return;
220 /* First, we should NEVER get an int here...only acks */
221 if (hvlpevent_is_int(event)) {
222 printk(KERN_WARNING "handle_viod_request: "
223 "Yikes! got an int in viodasd event handler!\n");
224 if (hvlpevent_need_ack(event)) {
225 event->xRc = HvLpEvent_Rc_InvalidSubtype;
226 HvCallEvent_ackLpEvent(event);
227 }
228 return;
229 }
230
231 switch (event->xSubtype & VIOMINOR_SUBTYPE_MASK) {
232 case vioblockopen:
233 /*
234 * Handle a response to an open request. We get all the
235 * disk information in the response, so update it. The
236 * correlation token contains a pointer to a waitevent
237 * structure that has a completion in it. update the
238 * return code in the waitevent structure and post the
239 * completion to wake up the guy who sent the request
240 */
241 pwe = (struct vio_waitevent *)event->xCorrelationToken;
242 pwe->rc = event->xRc;
243 pwe->sub_result = bevent->sub_result;
244 complete(&pwe->com);
245 break;
246 case vioblockclose:
247 break;
248 default:
249 printk(KERN_WARNING "handle_viod_request: unexpected subtype!");
250 if (hvlpevent_need_ack(event)) {
251 event->xRc = HvLpEvent_Rc_InvalidSubtype;
252 HvCallEvent_ackLpEvent(event);
253 }
254 }
255}
256
257static void __init probe_disk(struct device_node *vio_root, u32 unit)
258{
259 HvLpEvent_Rc hvrc;
260 struct vio_waitevent we;
261 u16 flags = 0;
262
263retry:
264 init_completion(&we.com);
265
266 /* Send the open event to OS/400 */
267 hvrc = HvCallEvent_signalLpEventFast(viopath_hostLp,
268 HvLpEvent_Type_VirtualIo,
269 viomajorsubtype_blockio | vioblockopen,
270 HvLpEvent_AckInd_DoAck, HvLpEvent_AckType_ImmediateAck,
271 viopath_sourceinst(viopath_hostLp),
272 viopath_targetinst(viopath_hostLp),
273 (u64)(unsigned long)&we, VIOVERSION << 16,
274 ((u64)unit << 48) | ((u64)flags<< 32),
275 0, 0, 0);
276 if (hvrc != 0) {
277 printk(KERN_WARNING "probe_disk: bad rc on HV open %d\n",
278 (int)hvrc);
279 return;
280 }
281
282 wait_for_completion(&we.com);
283
284 if (we.rc != 0) {
285 if (flags != 0)
286 return;
287 /* try again with read only flag set */
288 flags = vioblockflags_ro;
289 goto retry;
290 }
291
292 /* Send the close event to OS/400. We DON'T expect a response */
293 hvrc = HvCallEvent_signalLpEventFast(viopath_hostLp,
294 HvLpEvent_Type_VirtualIo,
295 viomajorsubtype_blockio | vioblockclose,
296 HvLpEvent_AckInd_NoAck, HvLpEvent_AckType_ImmediateAck,
297 viopath_sourceinst(viopath_hostLp),
298 viopath_targetinst(viopath_hostLp),
299 0, VIOVERSION << 16,
300 ((u64)unit << 48) | ((u64)flags << 32),
301 0, 0, 0);
302 if (hvrc != 0) {
303 printk(KERN_WARNING "probe_disk: "
304 "bad rc sending event to OS/400 %d\n", (int)hvrc);
305 return;
306 }
307
308 do_device_node(vio_root, "viodasd", FIRST_VIODASD + unit, unit,
309 "block", "IBM,iSeries-viodasd", NULL);
310}
311
312static void __init get_viodasd_info(struct device_node *vio_root)
313{
314 int rc;
315 u32 unit;
316
317 rc = viopath_open(viopath_hostLp, viomajorsubtype_blockio, 2);
318 if (rc) {
319 printk(KERN_WARNING "get_viodasd_info: "
320 "error opening path to host partition %d\n",
321 viopath_hostLp);
322 return;
323 }
324
325 /* Initialize our request handler */
326 vio_setHandler(viomajorsubtype_blockio, handle_block_event);
327
328 for (unit = 0; unit < HVMAXARCHITECTEDVIRTUALDISKS; unit++)
329 probe_disk(vio_root, unit);
330
331 vio_clearHandler(viomajorsubtype_blockio);
332 viopath_close(viopath_hostLp, viomajorsubtype_blockio, 2);
333}
334
335static void __init handle_cd_event(struct HvLpEvent *event)
336{
337 struct viocdlpevent *bevent;
338 struct vio_waitevent *pwe;
339
340 if (!event)
341 /* Notification that a partition went away! */
342 return;
343
344 /* First, we should NEVER get an int here...only acks */
345 if (hvlpevent_is_int(event)) {
346 printk(KERN_WARNING "handle_cd_event: got an unexpected int\n");
347 if (hvlpevent_need_ack(event)) {
348 event->xRc = HvLpEvent_Rc_InvalidSubtype;
349 HvCallEvent_ackLpEvent(event);
350 }
351 return;
352 }
353
354 bevent = (struct viocdlpevent *)event;
355
356 switch (event->xSubtype & VIOMINOR_SUBTYPE_MASK) {
357 case viocdgetinfo:
358 pwe = (struct vio_waitevent *)event->xCorrelationToken;
359 pwe->rc = event->xRc;
360 pwe->sub_result = bevent->sub_result;
361 complete(&pwe->com);
362 break;
363
364 default:
365 printk(KERN_WARNING "handle_cd_event: "
366 "message with unexpected subtype %0x04X!\n",
367 event->xSubtype & VIOMINOR_SUBTYPE_MASK);
368 if (hvlpevent_need_ack(event)) {
369 event->xRc = HvLpEvent_Rc_InvalidSubtype;
370 HvCallEvent_ackLpEvent(event);
371 }
372 }
373}
374
375static void __init get_viocd_info(struct device_node *vio_root)
376{
377 HvLpEvent_Rc hvrc;
378 u32 unit;
379 struct vio_waitevent we;
380 struct vio_resource *unitinfo;
381 dma_addr_t unitinfo_dmaaddr;
382 int ret;
383
384 ret = viopath_open(viopath_hostLp, viomajorsubtype_cdio, 2);
385 if (ret) {
386 printk(KERN_WARNING
387 "get_viocd_info: error opening path to host partition %d\n",
388 viopath_hostLp);
389 return;
390 }
391
392 /* Initialize our request handler */
393 vio_setHandler(viomajorsubtype_cdio, handle_cd_event);
394
395 unitinfo = iseries_hv_alloc(
396 sizeof(*unitinfo) * HVMAXARCHITECTEDVIRTUALCDROMS,
397 &unitinfo_dmaaddr, GFP_ATOMIC);
398 if (!unitinfo) {
399 printk(KERN_WARNING
400 "get_viocd_info: error allocating unitinfo\n");
401 goto clear_handler;
402 }
403
404 memset(unitinfo, 0, sizeof(*unitinfo) * HVMAXARCHITECTEDVIRTUALCDROMS);
405
406 init_completion(&we.com);
407
408 hvrc = HvCallEvent_signalLpEventFast(viopath_hostLp,
409 HvLpEvent_Type_VirtualIo,
410 viomajorsubtype_cdio | viocdgetinfo,
411 HvLpEvent_AckInd_DoAck, HvLpEvent_AckType_ImmediateAck,
412 viopath_sourceinst(viopath_hostLp),
413 viopath_targetinst(viopath_hostLp),
414 (u64)&we, VIOVERSION << 16, unitinfo_dmaaddr, 0,
415 sizeof(*unitinfo) * HVMAXARCHITECTEDVIRTUALCDROMS, 0);
416 if (hvrc != HvLpEvent_Rc_Good) {
417 printk(KERN_WARNING
418 "get_viocd_info: cdrom error sending event. rc %d\n",
419 (int)hvrc);
420 goto hv_free;
421 }
422
423 wait_for_completion(&we.com);
424
425 if (we.rc) {
426 printk(KERN_WARNING "get_viocd_info: bad rc %d:0x%04X\n",
427 we.rc, we.sub_result);
428 goto hv_free;
429 }
430
431 for (unit = 0; (unit < HVMAXARCHITECTEDVIRTUALCDROMS) &&
432 unitinfo[unit].rsrcname[0]; unit++) {
433 if (!do_device_node(vio_root, "viocd", FIRST_VIOCD + unit, unit,
434 "block", "IBM,iSeries-viocd", &unitinfo[unit]))
435 break;
436 }
437
438 hv_free:
439 iseries_hv_free(sizeof(*unitinfo) * HVMAXARCHITECTEDVIRTUALCDROMS,
440 unitinfo, unitinfo_dmaaddr);
441 clear_handler:
442 vio_clearHandler(viomajorsubtype_cdio);
443 viopath_close(viopath_hostLp, viomajorsubtype_cdio, 2);
444}
445
446/* Handle interrupt events for tape */
447static void __init handle_tape_event(struct HvLpEvent *event)
448{
449 struct vio_waitevent *we;
450 struct viotapelpevent *tevent = (struct viotapelpevent *)event;
451
452 if (event == NULL)
453 /* Notification that a partition went away! */
454 return;
455
456 we = (struct vio_waitevent *)event->xCorrelationToken;
457 switch (event->xSubtype & VIOMINOR_SUBTYPE_MASK) {
458 case viotapegetinfo:
459 we->rc = tevent->sub_type_result;
460 complete(&we->com);
461 break;
462 default:
463 printk(KERN_WARNING "handle_tape_event: weird ack\n");
464 }
465}
466
467static void __init get_viotape_info(struct device_node *vio_root)
468{
469 HvLpEvent_Rc hvrc;
470 u32 unit;
471 struct vio_resource *unitinfo;
472 dma_addr_t unitinfo_dmaaddr;
473 size_t len = sizeof(*unitinfo) * HVMAXARCHITECTEDVIRTUALTAPES;
474 struct vio_waitevent we;
475 int ret;
476
477 ret = viopath_open(viopath_hostLp, viomajorsubtype_tape, 2);
478 if (ret) {
479 printk(KERN_WARNING "get_viotape_info: "
480 "error on viopath_open to hostlp %d\n", ret);
481 return;
482 }
483
484 vio_setHandler(viomajorsubtype_tape, handle_tape_event);
485
486 unitinfo = iseries_hv_alloc(len, &unitinfo_dmaaddr, GFP_ATOMIC);
487 if (!unitinfo)
488 goto clear_handler;
489
490 memset(unitinfo, 0, len);
491
492 hvrc = HvCallEvent_signalLpEventFast(viopath_hostLp,
493 HvLpEvent_Type_VirtualIo,
494 viomajorsubtype_tape | viotapegetinfo,
495 HvLpEvent_AckInd_DoAck, HvLpEvent_AckType_ImmediateAck,
496 viopath_sourceinst(viopath_hostLp),
497 viopath_targetinst(viopath_hostLp),
498 (u64)(unsigned long)&we, VIOVERSION << 16,
499 unitinfo_dmaaddr, len, 0, 0);
500 if (hvrc != HvLpEvent_Rc_Good) {
501 printk(KERN_WARNING "get_viotape_info: hv error on op %d\n",
502 (int)hvrc);
503 goto hv_free;
504 }
505
506 wait_for_completion(&we.com);
507
508 for (unit = 0; (unit < HVMAXARCHITECTEDVIRTUALTAPES) &&
509 unitinfo[unit].rsrcname[0]; unit++) {
510 if (!do_device_node(vio_root, "viotape", FIRST_VIOTAPE + unit,
511 unit, "byte", "IBM,iSeries-viotape",
512 &unitinfo[unit]))
513 break;
514 }
515
516 hv_free:
517 iseries_hv_free(len, unitinfo, unitinfo_dmaaddr);
518 clear_handler:
519 vio_clearHandler(viomajorsubtype_tape);
520 viopath_close(viopath_hostLp, viomajorsubtype_tape, 2);
521}
522
523static int __init iseries_vio_init(void)
524{
525 struct device_node *vio_root;
526
527 if (!firmware_has_feature(FW_FEATURE_ISERIES))
528 return -ENODEV;
529
530 iommu_vio_init();
531
532 vio_root = of_find_node_by_path("/vdevice");
533 if (!vio_root)
534 return -ENODEV;
535
536 if (viopath_hostLp == HvLpIndexInvalid) {
537 vio_set_hostlp();
538 /* If we don't have a host, bail out */
539 if (viopath_hostLp == HvLpIndexInvalid)
540 goto put_node;
541 }
542
543 get_viodasd_info(vio_root);
544 get_viocd_info(vio_root);
545 get_viotape_info(vio_root);
546
547 return 0;
548
549 put_node:
550 of_node_put(vio_root);
551 return -ENODEV;
552}
553arch_initcall(iseries_vio_init);
diff --git a/arch/powerpc/platforms/iseries/viopath.c b/arch/powerpc/platforms/iseries/viopath.c
index 6a0060a5f2ec..df23331eb25c 100644
--- a/arch/powerpc/platforms/iseries/viopath.c
+++ b/arch/powerpc/platforms/iseries/viopath.c
@@ -124,8 +124,7 @@ static int proc_viopath_show(struct seq_file *m, void *v)
124 if (!buf) 124 if (!buf)
125 return 0; 125 return 0;
126 126
127 handle = dma_map_single(iSeries_vio_dev, buf, HW_PAGE_SIZE, 127 handle = iseries_hv_map(buf, HW_PAGE_SIZE, DMA_FROM_DEVICE);
128 DMA_FROM_DEVICE);
129 128
130 hvrc = HvCallEvent_signalLpEventFast(viopath_hostLp, 129 hvrc = HvCallEvent_signalLpEventFast(viopath_hostLp,
131 HvLpEvent_Type_VirtualIo, 130 HvLpEvent_Type_VirtualIo,
@@ -146,8 +145,7 @@ static int proc_viopath_show(struct seq_file *m, void *v)
146 buf[HW_PAGE_SIZE-1] = '\0'; 145 buf[HW_PAGE_SIZE-1] = '\0';
147 seq_printf(m, "%s", buf); 146 seq_printf(m, "%s", buf);
148 147
149 dma_unmap_single(iSeries_vio_dev, handle, HW_PAGE_SIZE, 148 iseries_hv_unmap(handle, HW_PAGE_SIZE, DMA_FROM_DEVICE);
150 DMA_FROM_DEVICE);
151 kfree(buf); 149 kfree(buf);
152 150
153 seq_printf(m, "AVAILABLE_VETH=%x\n", vlanMap); 151 seq_printf(m, "AVAILABLE_VETH=%x\n", vlanMap);
@@ -596,7 +594,7 @@ int viopath_close(HvLpIndex remoteLp, int subtype, int numReq)
596 numOpen += viopathStatus[remoteLp].users[i]; 594 numOpen += viopathStatus[remoteLp].users[i];
597 595
598 if ((viopathStatus[remoteLp].isOpen) && (numOpen == 0)) { 596 if ((viopathStatus[remoteLp].isOpen) && (numOpen == 0)) {
599 printk(VIOPATH_KERN_INFO "closing connection to partition %d", 597 printk(VIOPATH_KERN_INFO "closing connection to partition %d\n",
600 remoteLp); 598 remoteLp);
601 599
602 HvCallEvent_closeLpEventPath(remoteLp, 600 HvCallEvent_closeLpEventPath(remoteLp,
diff --git a/arch/powerpc/platforms/pasemi/gpio_mdio.c b/arch/powerpc/platforms/pasemi/gpio_mdio.c
index c91a33593bb8..dae9f658122e 100644
--- a/arch/powerpc/platforms/pasemi/gpio_mdio.c
+++ b/arch/powerpc/platforms/pasemi/gpio_mdio.c
@@ -320,10 +320,12 @@ static struct of_device_id gpio_mdio_match[] =
320 320
321static struct of_platform_driver gpio_mdio_driver = 321static struct of_platform_driver gpio_mdio_driver =
322{ 322{
323 .name = "gpio-mdio-bitbang",
324 .match_table = gpio_mdio_match, 323 .match_table = gpio_mdio_match,
325 .probe = gpio_mdio_probe, 324 .probe = gpio_mdio_probe,
326 .remove = gpio_mdio_remove, 325 .remove = gpio_mdio_remove,
326 .driver = {
327 .name = "gpio-mdio-bitbang",
328 },
327}; 329};
328 330
329int gpio_mdio_init(void) 331int gpio_mdio_init(void)
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index 7ccb9236e8b4..02c533096627 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -387,69 +387,13 @@ static void __init pmac_setup_arch(void)
387#endif /* CONFIG_ADB */ 387#endif /* CONFIG_ADB */
388} 388}
389 389
390char *bootpath;
391char *bootdevice;
392void *boot_host;
393int boot_target;
394int boot_part;
395static dev_t boot_dev;
396
397#ifdef CONFIG_SCSI 390#ifdef CONFIG_SCSI
398void note_scsi_host(struct device_node *node, void *host) 391void note_scsi_host(struct device_node *node, void *host)
399{ 392{
400 int l;
401 char *p;
402
403 l = strlen(node->full_name);
404 if (bootpath != NULL && bootdevice != NULL
405 && strncmp(node->full_name, bootdevice, l) == 0
406 && (bootdevice[l] == '/' || bootdevice[l] == 0)) {
407 boot_host = host;
408 /*
409 * There's a bug in OF 1.0.5. (Why am I not surprised.)
410 * If you pass a path like scsi/sd@1:0 to canon, it returns
411 * something like /bandit@F2000000/gc@10/53c94@10000/sd@0,0
412 * That is, the scsi target number doesn't get preserved.
413 * So we pick the target number out of bootpath and use that.
414 */
415 p = strstr(bootpath, "/sd@");
416 if (p != NULL) {
417 p += 4;
418 boot_target = simple_strtoul(p, NULL, 10);
419 p = strchr(p, ':');
420 if (p != NULL)
421 boot_part = simple_strtoul(p + 1, NULL, 10);
422 }
423 }
424} 393}
425EXPORT_SYMBOL(note_scsi_host); 394EXPORT_SYMBOL(note_scsi_host);
426#endif 395#endif
427 396
428#if defined(CONFIG_BLK_DEV_IDE) && defined(CONFIG_BLK_DEV_IDE_PMAC)
429static dev_t __init find_ide_boot(void)
430{
431 char *p;
432 int n;
433 dev_t __init pmac_find_ide_boot(char *bootdevice, int n);
434
435 if (bootdevice == NULL)
436 return 0;
437 p = strrchr(bootdevice, '/');
438 if (p == NULL)
439 return 0;
440 n = p - bootdevice;
441
442 return pmac_find_ide_boot(bootdevice, n);
443}
444#endif /* CONFIG_BLK_DEV_IDE && CONFIG_BLK_DEV_IDE_PMAC */
445
446static void __init find_boot_device(void)
447{
448#if defined(CONFIG_BLK_DEV_IDE) && defined(CONFIG_BLK_DEV_IDE_PMAC)
449 boot_dev = find_ide_boot();
450#endif
451}
452
453static int initializing = 1; 397static int initializing = 1;
454 398
455static int pmac_late_init(void) 399static int pmac_late_init(void)
@@ -466,10 +410,14 @@ static int pmac_late_init(void)
466 410
467late_initcall(pmac_late_init); 411late_initcall(pmac_late_init);
468 412
469/* can't be __init - can be called whenever a disk is first accessed */ 413/*
470void note_bootable_part(dev_t dev, int part, int goodness) 414 * This is __init_refok because we check for "initializing" before
415 * touching any of the __init sensitive things and "initializing"
416 * will be false after __init time. This can't be __init because it
417 * can be called whenever a disk is first accessed.
418 */
419void __init_refok note_bootable_part(dev_t dev, int part, int goodness)
471{ 420{
472 static int found_boot = 0;
473 char *p; 421 char *p;
474 422
475 if (!initializing) 423 if (!initializing)
@@ -481,15 +429,8 @@ void note_bootable_part(dev_t dev, int part, int goodness)
481 if (p != NULL && (p == boot_command_line || p[-1] == ' ')) 429 if (p != NULL && (p == boot_command_line || p[-1] == ' '))
482 return; 430 return;
483 431
484 if (!found_boot) { 432 ROOT_DEV = dev + part;
485 find_boot_device(); 433 current_root_goodness = goodness;
486 found_boot = 1;
487 }
488 if (!boot_dev || dev == boot_dev) {
489 ROOT_DEV = dev + part;
490 boot_dev = 0;
491 current_root_goodness = goodness;
492 }
493} 434}
494 435
495#ifdef CONFIG_ADB_CUDA 436#ifdef CONFIG_ADB_CUDA
diff --git a/arch/powerpc/platforms/ps3/os-area.c b/arch/powerpc/platforms/ps3/os-area.c
index b70e474014f0..766685ab26f8 100644
--- a/arch/powerpc/platforms/ps3/os-area.c
+++ b/arch/powerpc/platforms/ps3/os-area.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * PS3 'Other OS' area data. 2 * PS3 flash memory os area.
3 * 3 *
4 * Copyright (C) 2006 Sony Computer Entertainment Inc. 4 * Copyright (C) 2006 Sony Computer Entertainment Inc.
5 * Copyright 2006 Sony Corp. 5 * Copyright 2006 Sony Corp.
@@ -20,6 +20,9 @@
20 20
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/workqueue.h>
24#include <linux/fs.h>
25#include <linux/syscalls.h>
23 26
24#include <asm/lmb.h> 27#include <asm/lmb.h>
25 28
@@ -29,7 +32,7 @@ enum {
29 OS_AREA_SEGMENT_SIZE = 0X200, 32 OS_AREA_SEGMENT_SIZE = 0X200,
30}; 33};
31 34
32enum { 35enum os_area_ldr_format {
33 HEADER_LDR_FORMAT_RAW = 0, 36 HEADER_LDR_FORMAT_RAW = 0,
34 HEADER_LDR_FORMAT_GZIP = 1, 37 HEADER_LDR_FORMAT_GZIP = 1,
35}; 38};
@@ -38,7 +41,7 @@ enum {
38 * struct os_area_header - os area header segment. 41 * struct os_area_header - os area header segment.
39 * @magic_num: Always 'cell_ext_os_area'. 42 * @magic_num: Always 'cell_ext_os_area'.
40 * @hdr_version: Header format version number. 43 * @hdr_version: Header format version number.
41 * @os_area_offset: Starting segment number of os image area. 44 * @db_area_offset: Starting segment number of other os database area.
42 * @ldr_area_offset: Starting segment number of bootloader image area. 45 * @ldr_area_offset: Starting segment number of bootloader image area.
43 * @ldr_format: HEADER_LDR_FORMAT flag. 46 * @ldr_format: HEADER_LDR_FORMAT flag.
44 * @ldr_size: Size of bootloader image in bytes. 47 * @ldr_size: Size of bootloader image in bytes.
@@ -50,9 +53,9 @@ enum {
50 */ 53 */
51 54
52struct os_area_header { 55struct os_area_header {
53 s8 magic_num[16]; 56 u8 magic_num[16];
54 u32 hdr_version; 57 u32 hdr_version;
55 u32 os_area_offset; 58 u32 db_area_offset;
56 u32 ldr_area_offset; 59 u32 ldr_area_offset;
57 u32 _reserved_1; 60 u32 _reserved_1;
58 u32 ldr_format; 61 u32 ldr_format;
@@ -60,12 +63,12 @@ struct os_area_header {
60 u32 _reserved_2[6]; 63 u32 _reserved_2[6];
61}; 64};
62 65
63enum { 66enum os_area_boot_flag {
64 PARAM_BOOT_FLAG_GAME_OS = 0, 67 PARAM_BOOT_FLAG_GAME_OS = 0,
65 PARAM_BOOT_FLAG_OTHER_OS = 1, 68 PARAM_BOOT_FLAG_OTHER_OS = 1,
66}; 69};
67 70
68enum { 71enum os_area_ctrl_button {
69 PARAM_CTRL_BUTTON_O_IS_YES = 0, 72 PARAM_CTRL_BUTTON_O_IS_YES = 0,
70 PARAM_CTRL_BUTTON_X_IS_YES = 1, 73 PARAM_CTRL_BUTTON_X_IS_YES = 1,
71}; 74};
@@ -84,6 +87,9 @@ enum {
84 * @dns_primary: User preference of static primary dns server. 87 * @dns_primary: User preference of static primary dns server.
85 * @dns_secondary: User preference of static secondary dns server. 88 * @dns_secondary: User preference of static secondary dns server.
86 * 89 *
90 * The ps3 rtc maintains a read-only value that approximates seconds since
91 * 2000-01-01 00:00:00 UTC.
92 *
87 * User preference of zero for static_ip_addr means use dhcp. 93 * User preference of zero for static_ip_addr means use dhcp.
88 */ 94 */
89 95
@@ -108,45 +114,172 @@ struct os_area_params {
108 u8 _reserved_5[8]; 114 u8 _reserved_5[8];
109}; 115};
110 116
117enum {
118 OS_AREA_DB_MAGIC_NUM = 0x2d64622dU,
119};
120
111/** 121/**
112 * struct saved_params - Static working copies of data from the 'Other OS' area. 122 * struct os_area_db - Shared flash memory database.
123 * @magic_num: Always '-db-' = 0x2d64622d.
124 * @version: os_area_db format version number.
125 * @index_64: byte offset of the database id index for 64 bit variables.
126 * @count_64: number of usable 64 bit index entries
127 * @index_32: byte offset of the database id index for 32 bit variables.
128 * @count_32: number of usable 32 bit index entries
129 * @index_16: byte offset of the database id index for 16 bit variables.
130 * @count_16: number of usable 16 bit index entries
113 * 131 *
114 * For the convinience of the guest, the HV makes a copy of the 'Other OS' area 132 * Flash rom storage for exclusive use by guests running in the other os lpar.
115 * in flash to a high address in the boot memory region and then puts that RAM 133 * The current system configuration allocates 1K (two segments) for other os
116 * address and the byte count into the repository for retreval by the guest. 134 * use.
117 * We copy the data we want into a static variable and allow the memory setup 135 */
118 * by the HV to be claimed by the lmb manager. 136
137struct os_area_db {
138 u32 magic_num;
139 u16 version;
140 u16 _reserved_1;
141 u16 index_64;
142 u16 count_64;
143 u16 index_32;
144 u16 count_32;
145 u16 index_16;
146 u16 count_16;
147 u32 _reserved_2;
148 u8 _db_data[1000];
149};
150
151/**
152 * enum os_area_db_owner - Data owners.
153 */
154
155enum os_area_db_owner {
156 OS_AREA_DB_OWNER_ANY = -1,
157 OS_AREA_DB_OWNER_NONE = 0,
158 OS_AREA_DB_OWNER_PROTOTYPE = 1,
159 OS_AREA_DB_OWNER_LINUX = 2,
160 OS_AREA_DB_OWNER_PETITBOOT = 3,
161 OS_AREA_DB_OWNER_MAX = 32,
162};
163
164enum os_area_db_key {
165 OS_AREA_DB_KEY_ANY = -1,
166 OS_AREA_DB_KEY_NONE = 0,
167 OS_AREA_DB_KEY_RTC_DIFF = 1,
168 OS_AREA_DB_KEY_VIDEO_MODE = 2,
169 OS_AREA_DB_KEY_MAX = 8,
170};
171
172struct os_area_db_id {
173 int owner;
174 int key;
175};
176
177static const struct os_area_db_id os_area_db_id_empty = {
178 .owner = OS_AREA_DB_OWNER_NONE,
179 .key = OS_AREA_DB_KEY_NONE
180};
181
182static const struct os_area_db_id os_area_db_id_any = {
183 .owner = OS_AREA_DB_OWNER_ANY,
184 .key = OS_AREA_DB_KEY_ANY
185};
186
187static const struct os_area_db_id os_area_db_id_rtc_diff = {
188 .owner = OS_AREA_DB_OWNER_LINUX,
189 .key = OS_AREA_DB_KEY_RTC_DIFF
190};
191
192static const struct os_area_db_id os_area_db_id_video_mode = {
193 .owner = OS_AREA_DB_OWNER_LINUX,
194 .key = OS_AREA_DB_KEY_VIDEO_MODE
195};
196
197#define SECONDS_FROM_1970_TO_2000 946684800LL
198
199/**
200 * struct saved_params - Static working copies of data from the PS3 'os area'.
201 *
202 * The order of preference we use for the rtc_diff source:
203 * 1) The database value.
204 * 2) The game os value.
205 * 3) The number of seconds from 1970 to 2000.
119 */ 206 */
120 207
121struct saved_params { 208struct saved_params {
122 /* param 0 */ 209 unsigned int valid;
123 s64 rtc_diff; 210 s64 rtc_diff;
124 unsigned int av_multi_out; 211 unsigned int av_multi_out;
125 unsigned int ctrl_button;
126 /* param 1 */
127 u8 static_ip_addr[4];
128 u8 network_mask[4];
129 u8 default_gateway[4];
130 /* param 2 */
131 u8 dns_primary[4];
132 u8 dns_secondary[4];
133} static saved_params; 212} static saved_params;
134 213
214static struct property property_rtc_diff = {
215 .name = "linux,rtc_diff",
216 .length = sizeof(saved_params.rtc_diff),
217 .value = &saved_params.rtc_diff,
218};
219
220static struct property property_av_multi_out = {
221 .name = "linux,av_multi_out",
222 .length = sizeof(saved_params.av_multi_out),
223 .value = &saved_params.av_multi_out,
224};
225
226/**
227 * os_area_set_property - Add or overwrite a saved_params value to the device tree.
228 *
229 * Overwrites an existing property.
230 */
231
232static void os_area_set_property(struct device_node *node,
233 struct property *prop)
234{
235 int result;
236 struct property *tmp = of_find_property(node, prop->name, NULL);
237
238 if (tmp) {
239 pr_debug("%s:%d found %s\n", __func__, __LINE__, prop->name);
240 prom_remove_property(node, tmp);
241 }
242
243 result = prom_add_property(node, prop);
244
245 if (result)
246 pr_debug("%s:%d prom_set_property failed\n", __func__,
247 __LINE__);
248}
249
250/**
251 * os_area_get_property - Get a saved_params value from the device tree.
252 *
253 */
254
255static void __init os_area_get_property(struct device_node *node,
256 struct property *prop)
257{
258 const struct property *tmp = of_find_property(node, prop->name, NULL);
259
260 if (tmp) {
261 BUG_ON(prop->length != tmp->length);
262 memcpy(prop->value, tmp->value, prop->length);
263 } else
264 pr_debug("%s:%d not found %s\n", __func__, __LINE__,
265 prop->name);
266}
267
135#define dump_header(_a) _dump_header(_a, __func__, __LINE__) 268#define dump_header(_a) _dump_header(_a, __func__, __LINE__)
136static void _dump_header(const struct os_area_header *h, const char *func, 269static void _dump_header(const struct os_area_header *h, const char *func,
137 int line) 270 int line)
138{ 271{
139 pr_debug("%s:%d: h.magic_num: '%s'\n", func, line, 272 pr_debug("%s:%d: h.magic_num: '%s'\n", func, line,
140 h->magic_num); 273 h->magic_num);
141 pr_debug("%s:%d: h.hdr_version: %u\n", func, line, 274 pr_debug("%s:%d: h.hdr_version: %u\n", func, line,
142 h->hdr_version); 275 h->hdr_version);
143 pr_debug("%s:%d: h.os_area_offset: %u\n", func, line, 276 pr_debug("%s:%d: h.db_area_offset: %u\n", func, line,
144 h->os_area_offset); 277 h->db_area_offset);
145 pr_debug("%s:%d: h.ldr_area_offset: %u\n", func, line, 278 pr_debug("%s:%d: h.ldr_area_offset: %u\n", func, line,
146 h->ldr_area_offset); 279 h->ldr_area_offset);
147 pr_debug("%s:%d: h.ldr_format: %u\n", func, line, 280 pr_debug("%s:%d: h.ldr_format: %u\n", func, line,
148 h->ldr_format); 281 h->ldr_format);
149 pr_debug("%s:%d: h.ldr_size: %xh\n", func, line, 282 pr_debug("%s:%d: h.ldr_size: %xh\n", func, line,
150 h->ldr_size); 283 h->ldr_size);
151} 284}
152 285
@@ -176,7 +309,7 @@ static void _dump_params(const struct os_area_params *p, const char *func,
176 p->dns_secondary[2], p->dns_secondary[3]); 309 p->dns_secondary[2], p->dns_secondary[3]);
177} 310}
178 311
179static int __init verify_header(const struct os_area_header *header) 312static int verify_header(const struct os_area_header *header)
180{ 313{
181 if (memcmp(header->magic_num, "cell_ext_os_area", 16)) { 314 if (memcmp(header->magic_num, "cell_ext_os_area", 16)) {
182 pr_debug("%s:%d magic_num failed\n", __func__, __LINE__); 315 pr_debug("%s:%d magic_num failed\n", __func__, __LINE__);
@@ -188,7 +321,7 @@ static int __init verify_header(const struct os_area_header *header)
188 return -1; 321 return -1;
189 } 322 }
190 323
191 if (header->os_area_offset > header->ldr_area_offset) { 324 if (header->db_area_offset > header->ldr_area_offset) {
192 pr_debug("%s:%d offsets failed\n", __func__, __LINE__); 325 pr_debug("%s:%d offsets failed\n", __func__, __LINE__);
193 return -1; 326 return -1;
194 } 327 }
@@ -196,58 +329,477 @@ static int __init verify_header(const struct os_area_header *header)
196 return 0; 329 return 0;
197} 330}
198 331
199int __init ps3_os_area_init(void) 332static int db_verify(const struct os_area_db *db)
333{
334 if (db->magic_num != OS_AREA_DB_MAGIC_NUM) {
335 pr_debug("%s:%d magic_num failed\n", __func__, __LINE__);
336 return -1;
337 }
338
339 if (db->version != 1) {
340 pr_debug("%s:%d version failed\n", __func__, __LINE__);
341 return -1;
342 }
343
344 return 0;
345}
346
347struct db_index {
348 uint8_t owner:5;
349 uint8_t key:3;
350};
351
352struct db_iterator {
353 const struct os_area_db *db;
354 struct os_area_db_id match_id;
355 struct db_index *idx;
356 struct db_index *last_idx;
357 union {
358 uint64_t *value_64;
359 uint32_t *value_32;
360 uint16_t *value_16;
361 };
362};
363
364static unsigned int db_align_up(unsigned int val, unsigned int size)
365{
366 return (val + (size - 1)) & (~(size - 1));
367}
368
369/**
370 * db_for_each_64 - Iterator for 64 bit entries.
371 *
372 * A NULL value for id can be used to match all entries.
373 * OS_AREA_DB_OWNER_ANY and OS_AREA_DB_KEY_ANY can be used to match all.
374 */
375
376static int db_for_each_64(const struct os_area_db *db,
377 const struct os_area_db_id *match_id, struct db_iterator *i)
378{
379next:
380 if (!i->db) {
381 i->db = db;
382 i->match_id = match_id ? *match_id : os_area_db_id_any;
383 i->idx = (void *)db + db->index_64;
384 i->last_idx = i->idx + db->count_64;
385 i->value_64 = (void *)db + db->index_64
386 + db_align_up(db->count_64, 8);
387 } else {
388 i->idx++;
389 i->value_64++;
390 }
391
392 if (i->idx >= i->last_idx) {
393 pr_debug("%s:%d: reached end\n", __func__, __LINE__);
394 return 0;
395 }
396
397 if (i->match_id.owner != OS_AREA_DB_OWNER_ANY
398 && i->match_id.owner != (int)i->idx->owner)
399 goto next;
400 if (i->match_id.key != OS_AREA_DB_KEY_ANY
401 && i->match_id.key != (int)i->idx->key)
402 goto next;
403
404 return 1;
405}
406
407static int db_delete_64(struct os_area_db *db, const struct os_area_db_id *id)
408{
409 struct db_iterator i;
410
411 for (i.db = NULL; db_for_each_64(db, id, &i); ) {
412
413 pr_debug("%s:%d: got (%d:%d) %llxh\n", __func__, __LINE__,
414 i.idx->owner, i.idx->key,
415 (unsigned long long)*i.value_64);
416
417 i.idx->owner = 0;
418 i.idx->key = 0;
419 *i.value_64 = 0;
420 }
421 return 0;
422}
423
424static int db_set_64(struct os_area_db *db, const struct os_area_db_id *id,
425 uint64_t value)
426{
427 struct db_iterator i;
428
429 pr_debug("%s:%d: (%d:%d) <= %llxh\n", __func__, __LINE__,
430 id->owner, id->key, (unsigned long long)value);
431
432 if (!id->owner || id->owner == OS_AREA_DB_OWNER_ANY
433 || id->key == OS_AREA_DB_KEY_ANY) {
434 pr_debug("%s:%d: bad id: (%d:%d)\n", __func__,
435 __LINE__, id->owner, id->key);
436 return -1;
437 }
438
439 db_delete_64(db, id);
440
441 i.db = NULL;
442 if (db_for_each_64(db, &os_area_db_id_empty, &i)) {
443
444 pr_debug("%s:%d: got (%d:%d) %llxh\n", __func__, __LINE__,
445 i.idx->owner, i.idx->key,
446 (unsigned long long)*i.value_64);
447
448 i.idx->owner = id->owner;
449 i.idx->key = id->key;
450 *i.value_64 = value;
451
452 pr_debug("%s:%d: set (%d:%d) <= %llxh\n", __func__, __LINE__,
453 i.idx->owner, i.idx->key,
454 (unsigned long long)*i.value_64);
455 return 0;
456 }
457 pr_debug("%s:%d: database full.\n",
458 __func__, __LINE__);
459 return -1;
460}
461
462static int db_get_64(const struct os_area_db *db,
463 const struct os_area_db_id *id, uint64_t *value)
464{
465 struct db_iterator i;
466
467 i.db = NULL;
468 if (db_for_each_64(db, id, &i)) {
469 *value = *i.value_64;
470 pr_debug("%s:%d: found %lld\n", __func__, __LINE__,
471 (long long int)*i.value_64);
472 return 0;
473 }
474 pr_debug("%s:%d: not found\n", __func__, __LINE__);
475 return -1;
476}
477
478static int db_get_rtc_diff(const struct os_area_db *db, int64_t *rtc_diff)
479{
480 return db_get_64(db, &os_area_db_id_rtc_diff, (uint64_t*)rtc_diff);
481}
482
483#define dump_db(a) _dump_db(a, __func__, __LINE__)
484static void _dump_db(const struct os_area_db *db, const char *func,
485 int line)
486{
487 pr_debug("%s:%d: db.magic_num: '%s'\n", func, line,
488 (const char*)&db->magic_num);
489 pr_debug("%s:%d: db.version: %u\n", func, line,
490 db->version);
491 pr_debug("%s:%d: db.index_64: %u\n", func, line,
492 db->index_64);
493 pr_debug("%s:%d: db.count_64: %u\n", func, line,
494 db->count_64);
495 pr_debug("%s:%d: db.index_32: %u\n", func, line,
496 db->index_32);
497 pr_debug("%s:%d: db.count_32: %u\n", func, line,
498 db->count_32);
499 pr_debug("%s:%d: db.index_16: %u\n", func, line,
500 db->index_16);
501 pr_debug("%s:%d: db.count_16: %u\n", func, line,
502 db->count_16);
503}
504
505static void os_area_db_init(struct os_area_db *db)
506{
507 enum {
508 HEADER_SIZE = offsetof(struct os_area_db, _db_data),
509 INDEX_64_COUNT = 64,
510 VALUES_64_COUNT = 57,
511 INDEX_32_COUNT = 64,
512 VALUES_32_COUNT = 57,
513 INDEX_16_COUNT = 64,
514 VALUES_16_COUNT = 57,
515 };
516
517 memset(db, 0, sizeof(struct os_area_db));
518
519 db->magic_num = OS_AREA_DB_MAGIC_NUM;
520 db->version = 1;
521 db->index_64 = HEADER_SIZE;
522 db->count_64 = VALUES_64_COUNT;
523 db->index_32 = HEADER_SIZE
524 + INDEX_64_COUNT * sizeof(struct db_index)
525 + VALUES_64_COUNT * sizeof(u64);
526 db->count_32 = VALUES_32_COUNT;
527 db->index_16 = HEADER_SIZE
528 + INDEX_64_COUNT * sizeof(struct db_index)
529 + VALUES_64_COUNT * sizeof(u64)
530 + INDEX_32_COUNT * sizeof(struct db_index)
531 + VALUES_32_COUNT * sizeof(u32);
532 db->count_16 = VALUES_16_COUNT;
533
534 /* Rules to check db layout. */
535
536 BUILD_BUG_ON(sizeof(struct db_index) != 1);
537 BUILD_BUG_ON(sizeof(struct os_area_db) != 2 * OS_AREA_SEGMENT_SIZE);
538 BUILD_BUG_ON(INDEX_64_COUNT & 0x7);
539 BUILD_BUG_ON(VALUES_64_COUNT > INDEX_64_COUNT);
540 BUILD_BUG_ON(INDEX_32_COUNT & 0x7);
541 BUILD_BUG_ON(VALUES_32_COUNT > INDEX_32_COUNT);
542 BUILD_BUG_ON(INDEX_16_COUNT & 0x7);
543 BUILD_BUG_ON(VALUES_16_COUNT > INDEX_16_COUNT);
544 BUILD_BUG_ON(HEADER_SIZE
545 + INDEX_64_COUNT * sizeof(struct db_index)
546 + VALUES_64_COUNT * sizeof(u64)
547 + INDEX_32_COUNT * sizeof(struct db_index)
548 + VALUES_32_COUNT * sizeof(u32)
549 + INDEX_16_COUNT * sizeof(struct db_index)
550 + VALUES_16_COUNT * sizeof(u16)
551 > sizeof(struct os_area_db));
552}
553
554/**
555 * update_flash_db - Helper for os_area_queue_work_handler.
556 *
557 */
558
559static void update_flash_db(void)
560{
561 int result;
562 int file;
563 off_t offset;
564 ssize_t count;
565 static const unsigned int buf_len = 8 * OS_AREA_SEGMENT_SIZE;
566 const struct os_area_header *header;
567 struct os_area_db* db;
568
569 /* Read in header and db from flash. */
570
571 file = sys_open("/dev/ps3flash", O_RDWR, 0);
572
573 if (file < 0) {
574 pr_debug("%s:%d sys_open failed\n", __func__, __LINE__);
575 goto fail_open;
576 }
577
578 header = kmalloc(buf_len, GFP_KERNEL);
579
580 if (!header) {
581 pr_debug("%s:%d kmalloc failed\n", __func__, __LINE__);
582 goto fail_malloc;
583 }
584
585 offset = sys_lseek(file, 0, SEEK_SET);
586
587 if (offset != 0) {
588 pr_debug("%s:%d sys_lseek failed\n", __func__, __LINE__);
589 goto fail_header_seek;
590 }
591
592 count = sys_read(file, (char __user *)header, buf_len);
593
594 result = count < OS_AREA_SEGMENT_SIZE || verify_header(header)
595 || count < header->db_area_offset * OS_AREA_SEGMENT_SIZE;
596
597 if (result) {
598 pr_debug("%s:%d verify_header failed\n", __func__, __LINE__);
599 dump_header(header);
600 goto fail_header;
601 }
602
603 /* Now got a good db offset and some maybe good db data. */
604
605 db = (void*)header + header->db_area_offset * OS_AREA_SEGMENT_SIZE;
606
607 result = db_verify(db);
608
609 if (result) {
610 printk(KERN_NOTICE "%s:%d: Verify of flash database failed, "
611 "formatting.\n", __func__, __LINE__);
612 dump_db(db);
613 os_area_db_init(db);
614 }
615
616 /* Now got good db data. */
617
618 db_set_64(db, &os_area_db_id_rtc_diff, saved_params.rtc_diff);
619
620 offset = sys_lseek(file, header->db_area_offset * OS_AREA_SEGMENT_SIZE,
621 SEEK_SET);
622
623 if (offset != header->db_area_offset * OS_AREA_SEGMENT_SIZE) {
624 pr_debug("%s:%d sys_lseek failed\n", __func__, __LINE__);
625 goto fail_db_seek;
626 }
627
628 count = sys_write(file, (const char __user *)db,
629 sizeof(struct os_area_db));
630
631 if (count < sizeof(struct os_area_db)) {
632 pr_debug("%s:%d sys_write failed\n", __func__, __LINE__);
633 }
634
635fail_db_seek:
636fail_header:
637fail_header_seek:
638 kfree(header);
639fail_malloc:
640 sys_close(file);
641fail_open:
642 return;
643}
644
645/**
646 * os_area_queue_work_handler - Asynchronous write handler.
647 *
648 * An asynchronous write for flash memory and the device tree. Do not
649 * call directly, use os_area_queue_work().
650 */
651
652static void os_area_queue_work_handler(struct work_struct *work)
653{
654 struct device_node *node;
655
656 pr_debug(" -> %s:%d\n", __func__, __LINE__);
657
658 node = of_find_node_by_path("/");
659
660 if (node) {
661 os_area_set_property(node, &property_rtc_diff);
662 of_node_put(node);
663 } else
664 pr_debug("%s:%d of_find_node_by_path failed\n",
665 __func__, __LINE__);
666
667#if defined(CONFIG_PS3_FLASH) || defined(CONFIG_PS3_FLASH_MODULE)
668 update_flash_db();
669#else
670 printk(KERN_WARNING "%s:%d: No flash rom driver configured.\n",
671 __func__, __LINE__);
672#endif
673 pr_debug(" <- %s:%d\n", __func__, __LINE__);
674}
675
676static void os_area_queue_work(void)
677{
678 static DECLARE_WORK(q, os_area_queue_work_handler);
679
680 wmb();
681 schedule_work(&q);
682}
683
684/**
685 * ps3_os_area_save_params - Copy data from os area mirror to @saved_params.
686 *
687 * For the convenience of the guest the HV makes a copy of the os area in
688 * flash to a high address in the boot memory region and then puts that RAM
689 * address and the byte count into the repository for retrieval by the guest.
690 * We copy the data we want into a static variable and allow the memory setup
691 * by the HV to be claimed by the lmb manager.
692 *
693 * The os area mirror will not be available to a second stage kernel, and
694 * the header verify will fail. In this case, the saved_params values will
695 * be set from flash memory or the passed in device tree in ps3_os_area_init().
696 */
697
698void __init ps3_os_area_save_params(void)
200{ 699{
201 int result; 700 int result;
202 u64 lpar_addr; 701 u64 lpar_addr;
203 unsigned int size; 702 unsigned int size;
204 struct os_area_header *header; 703 struct os_area_header *header;
205 struct os_area_params *params; 704 struct os_area_params *params;
705 struct os_area_db *db;
706
707 pr_debug(" -> %s:%d\n", __func__, __LINE__);
206 708
207 result = ps3_repository_read_boot_dat_info(&lpar_addr, &size); 709 result = ps3_repository_read_boot_dat_info(&lpar_addr, &size);
208 710
209 if (result) { 711 if (result) {
210 pr_debug("%s:%d ps3_repository_read_boot_dat_info failed\n", 712 pr_debug("%s:%d ps3_repository_read_boot_dat_info failed\n",
211 __func__, __LINE__); 713 __func__, __LINE__);
212 return result; 714 return;
213 } 715 }
214 716
215 header = (struct os_area_header *)__va(lpar_addr); 717 header = (struct os_area_header *)__va(lpar_addr);
216 params = (struct os_area_params *)__va(lpar_addr + OS_AREA_SEGMENT_SIZE); 718 params = (struct os_area_params *)__va(lpar_addr
719 + OS_AREA_SEGMENT_SIZE);
217 720
218 result = verify_header(header); 721 result = verify_header(header);
219 722
220 if (result) { 723 if (result) {
724 /* Second stage kernels exit here. */
221 pr_debug("%s:%d verify_header failed\n", __func__, __LINE__); 725 pr_debug("%s:%d verify_header failed\n", __func__, __LINE__);
222 dump_header(header); 726 dump_header(header);
223 return -EIO; 727 return;
224 } 728 }
225 729
730 db = (struct os_area_db *)__va(lpar_addr
731 + header->db_area_offset * OS_AREA_SEGMENT_SIZE);
732
226 dump_header(header); 733 dump_header(header);
227 dump_params(params); 734 dump_params(params);
735 dump_db(db);
228 736
229 saved_params.rtc_diff = params->rtc_diff; 737 result = db_verify(db) || db_get_rtc_diff(db, &saved_params.rtc_diff);
738 if (result)
739 saved_params.rtc_diff = params->rtc_diff ? params->rtc_diff
740 : SECONDS_FROM_1970_TO_2000;
230 saved_params.av_multi_out = params->av_multi_out; 741 saved_params.av_multi_out = params->av_multi_out;
231 saved_params.ctrl_button = params->ctrl_button; 742 saved_params.valid = 1;
232 memcpy(saved_params.static_ip_addr, params->static_ip_addr, 4); 743
233 memcpy(saved_params.network_mask, params->network_mask, 4); 744 memset(header, 0, sizeof(*header));
234 memcpy(saved_params.default_gateway, params->default_gateway, 4);
235 memcpy(saved_params.dns_secondary, params->dns_secondary, 4);
236 745
237 return result; 746 pr_debug(" <- %s:%d\n", __func__, __LINE__);
238} 747}
239 748
240/** 749/**
241 * ps3_os_area_rtc_diff - Returns the ps3 rtc diff value. 750 * ps3_os_area_init - Setup os area device tree properties as needed.
751 */
752
753void __init ps3_os_area_init(void)
754{
755 struct device_node *node;
756
757 pr_debug(" -> %s:%d\n", __func__, __LINE__);
758
759 node = of_find_node_by_path("/");
760
761 if (!saved_params.valid && node) {
762 /* Second stage kernels should have a dt entry. */
763 os_area_get_property(node, &property_rtc_diff);
764 os_area_get_property(node, &property_av_multi_out);
765 }
766
767 if(!saved_params.rtc_diff)
768 saved_params.rtc_diff = SECONDS_FROM_1970_TO_2000;
769
770 if (node) {
771 os_area_set_property(node, &property_rtc_diff);
772 os_area_set_property(node, &property_av_multi_out);
773 of_node_put(node);
774 } else
775 pr_debug("%s:%d of_find_node_by_path failed\n",
776 __func__, __LINE__);
777
778 pr_debug(" <- %s:%d\n", __func__, __LINE__);
779}
780
781/**
782 * ps3_os_area_get_rtc_diff - Returns the rtc diff value.
783 */
784
785u64 ps3_os_area_get_rtc_diff(void)
786{
787 return saved_params.rtc_diff;
788}
789
790/**
791 * ps3_os_area_set_rtc_diff - Set the rtc diff value.
242 * 792 *
243 * The ps3 rtc maintains a value that approximates seconds since 793 * An asynchronous write is needed to support writing updates from
244 * 2000-01-01 00:00:00 UTC. Returns the exact number of seconds from 1970 to 794 * the timer interrupt context.
245 * 2000 when saved_params.rtc_diff has not been properly set up.
246 */ 795 */
247 796
248u64 ps3_os_area_rtc_diff(void) 797void ps3_os_area_set_rtc_diff(u64 rtc_diff)
249{ 798{
250 return saved_params.rtc_diff ? saved_params.rtc_diff : 946684800UL; 799 if (saved_params.rtc_diff != rtc_diff) {
800 saved_params.rtc_diff = rtc_diff;
801 os_area_queue_work();
802 }
251} 803}
252 804
253/** 805/**
diff --git a/arch/powerpc/platforms/ps3/platform.h b/arch/powerpc/platforms/ps3/platform.h
index 27c7d099816a..01f0c9506e11 100644
--- a/arch/powerpc/platforms/ps3/platform.h
+++ b/arch/powerpc/platforms/ps3/platform.h
@@ -62,8 +62,10 @@ int ps3_set_rtc_time(struct rtc_time *time);
62 62
63/* os area */ 63/* os area */
64 64
65int __init ps3_os_area_init(void); 65void __init ps3_os_area_save_params(void);
66u64 ps3_os_area_rtc_diff(void); 66void __init ps3_os_area_init(void);
67u64 ps3_os_area_get_rtc_diff(void);
68void ps3_os_area_set_rtc_diff(u64 rtc_diff);
67 69
68/* spu */ 70/* spu */
69 71
diff --git a/arch/powerpc/platforms/ps3/setup.c b/arch/powerpc/platforms/ps3/setup.c
index 609945dbe394..5c2cbb08eb52 100644
--- a/arch/powerpc/platforms/ps3/setup.c
+++ b/arch/powerpc/platforms/ps3/setup.c
@@ -206,6 +206,7 @@ static void __init ps3_setup_arch(void)
206 prealloc_ps3flash_bounce_buffer(); 206 prealloc_ps3flash_bounce_buffer();
207 207
208 ppc_md.power_save = ps3_power_save; 208 ppc_md.power_save = ps3_power_save;
209 ps3_os_area_init();
209 210
210 DBG(" <- %s:%d\n", __func__, __LINE__); 211 DBG(" <- %s:%d\n", __func__, __LINE__);
211} 212}
@@ -228,7 +229,7 @@ static int __init ps3_probe(void)
228 229
229 powerpc_firmware_features |= FW_FEATURE_PS3_POSSIBLE; 230 powerpc_firmware_features |= FW_FEATURE_PS3_POSSIBLE;
230 231
231 ps3_os_area_init(); 232 ps3_os_area_save_params();
232 ps3_mm_init(); 233 ps3_mm_init();
233 ps3_mm_vas_create(&htab_size); 234 ps3_mm_vas_create(&htab_size);
234 ps3_hpte_init(htab_size); 235 ps3_hpte_init(htab_size);
diff --git a/arch/powerpc/platforms/ps3/time.c b/arch/powerpc/platforms/ps3/time.c
index 802a9ccacb5e..d0daf7d6d3b2 100644
--- a/arch/powerpc/platforms/ps3/time.c
+++ b/arch/powerpc/platforms/ps3/time.c
@@ -50,12 +50,6 @@ static void __maybe_unused _dump_time(int time, const char *func,
50 _dump_tm(&tm, func, line); 50 _dump_tm(&tm, func, line);
51} 51}
52 52
53/**
54 * rtc_shift - Difference in seconds between 1970 and the ps3 rtc value.
55 */
56
57static s64 rtc_shift;
58
59void __init ps3_calibrate_decr(void) 53void __init ps3_calibrate_decr(void)
60{ 54{
61 int result; 55 int result;
@@ -66,8 +60,6 @@ void __init ps3_calibrate_decr(void)
66 60
67 ppc_tb_freq = tmp; 61 ppc_tb_freq = tmp;
68 ppc_proc_freq = ppc_tb_freq * 40; 62 ppc_proc_freq = ppc_tb_freq * 40;
69
70 rtc_shift = ps3_os_area_rtc_diff();
71} 63}
72 64
73static u64 read_rtc(void) 65static u64 read_rtc(void)
@@ -87,18 +79,18 @@ int ps3_set_rtc_time(struct rtc_time *tm)
87 u64 now = mktime(tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, 79 u64 now = mktime(tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
88 tm->tm_hour, tm->tm_min, tm->tm_sec); 80 tm->tm_hour, tm->tm_min, tm->tm_sec);
89 81
90 rtc_shift = now - read_rtc(); 82 ps3_os_area_set_rtc_diff(now - read_rtc());
91 return 0; 83 return 0;
92} 84}
93 85
94void ps3_get_rtc_time(struct rtc_time *tm) 86void ps3_get_rtc_time(struct rtc_time *tm)
95{ 87{
96 to_tm(read_rtc() + rtc_shift, tm); 88 to_tm(read_rtc() + ps3_os_area_get_rtc_diff(), tm);
97 tm->tm_year -= 1900; 89 tm->tm_year -= 1900;
98 tm->tm_mon -= 1; 90 tm->tm_mon -= 1;
99} 91}
100 92
101unsigned long __init ps3_get_boot_time(void) 93unsigned long __init ps3_get_boot_time(void)
102{ 94{
103 return read_rtc() + rtc_shift; 95 return read_rtc() + ps3_os_area_get_rtc_diff();
104} 96}
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index 9711eb0d5496..fc48b96c81bf 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -252,6 +252,20 @@ static struct notifier_block pseries_smp_nb = {
252 252
253static int __init pseries_cpu_hotplug_init(void) 253static int __init pseries_cpu_hotplug_init(void)
254{ 254{
255 struct device_node *np;
256 const char *typep;
257
258 for_each_node_by_name(np, "interrupt-controller") {
259 typep = of_get_property(np, "compatible", NULL);
260 if (strstr(typep, "open-pic")) {
261 of_node_put(np);
262
263 printk(KERN_INFO "CPU Hotplug not supported on "
264 "systems using MPIC\n");
265 return 0;
266 }
267 }
268
255 rtas_stop_self_args.token = rtas_token("stop-self"); 269 rtas_stop_self_args.token = rtas_token("stop-self");
256 qcss_tok = rtas_token("query-cpu-stopped-state"); 270 qcss_tok = rtas_token("query-cpu-stopped-state");
257 271
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index f0b7146a110f..fdb9b1c8f977 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -257,11 +257,6 @@ static void __init pSeries_setup_arch(void)
257 /* init to some ~sane value until calibrate_delay() runs */ 257 /* init to some ~sane value until calibrate_delay() runs */
258 loops_per_jiffy = 50000000; 258 loops_per_jiffy = 50000000;
259 259
260 if (ROOT_DEV == 0) {
261 printk("No ramdisk, default root is /dev/sda2\n");
262 ROOT_DEV = Root_SDA2;
263 }
264
265 fwnmi_init(); 260 fwnmi_init();
266 261
267 /* Find and initialize PCI host bridges */ 262 /* Find and initialize PCI host bridges */
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
index 52e93bca10ca..1a6f5641ebc8 100644
--- a/arch/powerpc/sysdev/Makefile
+++ b/arch/powerpc/sysdev/Makefile
@@ -6,7 +6,6 @@ mpic-msi-obj-$(CONFIG_PCI_MSI) += mpic_msi.o mpic_u3msi.o
6obj-$(CONFIG_MPIC) += mpic.o $(mpic-msi-obj-y) 6obj-$(CONFIG_MPIC) += mpic.o $(mpic-msi-obj-y)
7 7
8obj-$(CONFIG_PPC_MPC106) += grackle.o 8obj-$(CONFIG_PPC_MPC106) += grackle.o
9obj-$(CONFIG_PPC_DCR) += dcr.o
10obj-$(CONFIG_PPC_DCR_NATIVE) += dcr-low.o 9obj-$(CONFIG_PPC_DCR_NATIVE) += dcr-low.o
11obj-$(CONFIG_PPC_PMI) += pmi.o 10obj-$(CONFIG_PPC_PMI) += pmi.o
12obj-$(CONFIG_U3_DART) += dart_iommu.o 11obj-$(CONFIG_U3_DART) += dart_iommu.o
@@ -33,6 +32,7 @@ endif
33ifeq ($(ARCH),powerpc) 32ifeq ($(ARCH),powerpc)
34obj-$(CONFIG_CPM) += cpm_common.o 33obj-$(CONFIG_CPM) += cpm_common.o
35obj-$(CONFIG_CPM2) += cpm2_common.o cpm2_pic.o 34obj-$(CONFIG_CPM2) += cpm2_common.o cpm2_pic.o
35obj-$(CONFIG_PPC_DCR) += dcr.o
36obj-$(CONFIG_8xx) += mpc8xx_pic.o commproc.o 36obj-$(CONFIG_8xx) += mpc8xx_pic.o commproc.o
37obj-$(CONFIG_UCODE_PATCH) += micropatch.o 37obj-$(CONFIG_UCODE_PATCH) += micropatch.o
38endif 38endif
diff --git a/arch/powerpc/sysdev/axonram.c b/arch/powerpc/sysdev/axonram.c
index ab037a3a40db..4d3ba63bba79 100644
--- a/arch/powerpc/sysdev/axonram.c
+++ b/arch/powerpc/sysdev/axonram.c
@@ -324,11 +324,13 @@ static struct of_device_id axon_ram_device_id[] = {
324}; 324};
325 325
326static struct of_platform_driver axon_ram_driver = { 326static struct of_platform_driver axon_ram_driver = {
327 .owner = THIS_MODULE,
328 .name = AXON_RAM_MODULE_NAME,
329 .match_table = axon_ram_device_id, 327 .match_table = axon_ram_device_id,
330 .probe = axon_ram_probe, 328 .probe = axon_ram_probe,
331 .remove = axon_ram_remove 329 .remove = axon_ram_remove,
330 .driver = {
331 .owner = THIS_MODULE,
332 .name = AXON_RAM_MODULE_NAME,
333 },
332}; 334};
333 335
334/** 336/**
diff --git a/arch/powerpc/sysdev/pmi.c b/arch/powerpc/sysdev/pmi.c
index 2f91b55b7754..20edd1e94eff 100644
--- a/arch/powerpc/sysdev/pmi.c
+++ b/arch/powerpc/sysdev/pmi.c
@@ -205,10 +205,12 @@ static int pmi_of_remove(struct of_device *dev)
205} 205}
206 206
207static struct of_platform_driver pmi_of_platform_driver = { 207static struct of_platform_driver pmi_of_platform_driver = {
208 .name = "pmi",
209 .match_table = pmi_match, 208 .match_table = pmi_match,
210 .probe = pmi_of_probe, 209 .probe = pmi_of_probe,
211 .remove = pmi_of_remove 210 .remove = pmi_of_remove,
211 .driver = {
212 .name = "pmi",
213 },
212}; 214};
213 215
214static int __init pmi_module_init(void) 216static int __init pmi_module_init(void)
diff --git a/arch/ppc/platforms/ev64360.c b/arch/ppc/platforms/ev64360.c
index f8baf05f16ce..6765676a5c6b 100644
--- a/arch/ppc/platforms/ev64360.c
+++ b/arch/ppc/platforms/ev64360.c
@@ -23,9 +23,6 @@
23#include <linux/mtd/physmap.h> 23#include <linux/mtd/physmap.h>
24#include <linux/mv643xx.h> 24#include <linux/mv643xx.h>
25#include <linux/platform_device.h> 25#include <linux/platform_device.h>
26#ifdef CONFIG_BOOTIMG
27#include <linux/bootimg.h>
28#endif
29#include <asm/page.h> 26#include <asm/page.h>
30#include <asm/time.h> 27#include <asm/time.h>
31#include <asm/smp.h> 28#include <asm/smp.h>
diff --git a/arch/ppc/platforms/katana.c b/arch/ppc/platforms/katana.c
index c289e9f1b251..52f63e6f0856 100644
--- a/arch/ppc/platforms/katana.c
+++ b/arch/ppc/platforms/katana.c
@@ -27,9 +27,6 @@
27#include <linux/mtd/physmap.h> 27#include <linux/mtd/physmap.h>
28#include <linux/mv643xx.h> 28#include <linux/mv643xx.h>
29#include <linux/platform_device.h> 29#include <linux/platform_device.h>
30#ifdef CONFIG_BOOTIMG
31#include <linux/bootimg.h>
32#endif
33#include <asm/io.h> 30#include <asm/io.h>
34#include <asm/unistd.h> 31#include <asm/unistd.h>
35#include <asm/page.h> 32#include <asm/page.h>
diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c
index af3969a9c963..e824b672e05a 100644
--- a/drivers/block/viodasd.c
+++ b/drivers/block/viodasd.c
@@ -74,53 +74,9 @@ enum {
74static DEFINE_SPINLOCK(viodasd_spinlock); 74static DEFINE_SPINLOCK(viodasd_spinlock);
75 75
76#define VIOMAXREQ 16 76#define VIOMAXREQ 16
77#define VIOMAXBLOCKDMA 12
78 77
79#define DEVICE_NO(cell) ((struct viodasd_device *)(cell) - &viodasd_devices[0]) 78#define DEVICE_NO(cell) ((struct viodasd_device *)(cell) - &viodasd_devices[0])
80 79
81struct open_data {
82 u64 disk_size;
83 u16 max_disk;
84 u16 cylinders;
85 u16 tracks;
86 u16 sectors;
87 u16 bytes_per_sector;
88};
89
90struct rw_data {
91 u64 offset;
92 struct {
93 u32 token;
94 u32 reserved;
95 u64 len;
96 } dma_info[VIOMAXBLOCKDMA];
97};
98
99struct vioblocklpevent {
100 struct HvLpEvent event;
101 u32 reserved;
102 u16 version;
103 u16 sub_result;
104 u16 disk;
105 u16 flags;
106 union {
107 struct open_data open_data;
108 struct rw_data rw_data;
109 u64 changed;
110 } u;
111};
112
113#define vioblockflags_ro 0x0001
114
115enum vioblocksubtype {
116 vioblockopen = 0x0001,
117 vioblockclose = 0x0002,
118 vioblockread = 0x0003,
119 vioblockwrite = 0x0004,
120 vioblockflush = 0x0005,
121 vioblockcheck = 0x0007
122};
123
124struct viodasd_waitevent { 80struct viodasd_waitevent {
125 struct completion com; 81 struct completion com;
126 int rc; 82 int rc;
@@ -429,7 +385,7 @@ static void do_viodasd_request(struct request_queue *q)
429 * Probe a single disk and fill in the viodasd_device structure 385 * Probe a single disk and fill in the viodasd_device structure
430 * for it. 386 * for it.
431 */ 387 */
432static void probe_disk(struct viodasd_device *d) 388static int probe_disk(struct viodasd_device *d)
433{ 389{
434 HvLpEvent_Rc hvrc; 390 HvLpEvent_Rc hvrc;
435 struct viodasd_waitevent we; 391 struct viodasd_waitevent we;
@@ -453,14 +409,14 @@ retry:
453 0, 0, 0); 409 0, 0, 0);
454 if (hvrc != 0) { 410 if (hvrc != 0) {
455 printk(VIOD_KERN_WARNING "bad rc on HV open %d\n", (int)hvrc); 411 printk(VIOD_KERN_WARNING "bad rc on HV open %d\n", (int)hvrc);
456 return; 412 return 0;
457 } 413 }
458 414
459 wait_for_completion(&we.com); 415 wait_for_completion(&we.com);
460 416
461 if (we.rc != 0) { 417 if (we.rc != 0) {
462 if (flags != 0) 418 if (flags != 0)
463 return; 419 return 0;
464 /* try again with read only flag set */ 420 /* try again with read only flag set */
465 flags = vioblockflags_ro; 421 flags = vioblockflags_ro;
466 goto retry; 422 goto retry;
@@ -490,15 +446,32 @@ retry:
490 if (hvrc != 0) { 446 if (hvrc != 0) {
491 printk(VIOD_KERN_WARNING 447 printk(VIOD_KERN_WARNING
492 "bad rc sending event to OS/400 %d\n", (int)hvrc); 448 "bad rc sending event to OS/400 %d\n", (int)hvrc);
493 return; 449 return 0;
494 } 450 }
451
452 if (d->dev == NULL) {
453 /* this is when we reprobe for new disks */
454 if (vio_create_viodasd(dev_no) == NULL) {
455 printk(VIOD_KERN_WARNING
456 "cannot allocate virtual device for disk %d\n",
457 dev_no);
458 return 0;
459 }
460 /*
461 * The vio_create_viodasd will have recursed into this
462 * routine with d->dev set to the new vio device and
463 * will finish the setup of the disk below.
464 */
465 return 1;
466 }
467
495 /* create the request queue for the disk */ 468 /* create the request queue for the disk */
496 spin_lock_init(&d->q_lock); 469 spin_lock_init(&d->q_lock);
497 q = blk_init_queue(do_viodasd_request, &d->q_lock); 470 q = blk_init_queue(do_viodasd_request, &d->q_lock);
498 if (q == NULL) { 471 if (q == NULL) {
499 printk(VIOD_KERN_WARNING "cannot allocate queue for disk %d\n", 472 printk(VIOD_KERN_WARNING "cannot allocate queue for disk %d\n",
500 dev_no); 473 dev_no);
501 return; 474 return 0;
502 } 475 }
503 g = alloc_disk(1 << PARTITION_SHIFT); 476 g = alloc_disk(1 << PARTITION_SHIFT);
504 if (g == NULL) { 477 if (g == NULL) {
@@ -506,7 +479,7 @@ retry:
506 "cannot allocate disk structure for disk %d\n", 479 "cannot allocate disk structure for disk %d\n",
507 dev_no); 480 dev_no);
508 blk_cleanup_queue(q); 481 blk_cleanup_queue(q);
509 return; 482 return 0;
510 } 483 }
511 484
512 d->disk = g; 485 d->disk = g;
@@ -538,6 +511,7 @@ retry:
538 511
539 /* register us in the global list */ 512 /* register us in the global list */
540 add_disk(g); 513 add_disk(g);
514 return 1;
541} 515}
542 516
543/* returns the total number of scatterlist elements converted */ 517/* returns the total number of scatterlist elements converted */
@@ -718,8 +692,7 @@ static int viodasd_probe(struct vio_dev *vdev, const struct vio_device_id *id)
718 struct viodasd_device *d = &viodasd_devices[vdev->unit_address]; 692 struct viodasd_device *d = &viodasd_devices[vdev->unit_address];
719 693
720 d->dev = &vdev->dev; 694 d->dev = &vdev->dev;
721 probe_disk(d); 695 if (!probe_disk(d))
722 if (d->disk == NULL)
723 return -ENODEV; 696 return -ENODEV;
724 return 0; 697 return 0;
725} 698}
diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c
index e51550db1575..880b5dce3a62 100644
--- a/drivers/cdrom/viocd.c
+++ b/drivers/cdrom/viocd.c
@@ -56,30 +56,6 @@
56#define VIOCD_KERN_WARNING KERN_WARNING "viocd: " 56#define VIOCD_KERN_WARNING KERN_WARNING "viocd: "
57#define VIOCD_KERN_INFO KERN_INFO "viocd: " 57#define VIOCD_KERN_INFO KERN_INFO "viocd: "
58 58
59struct viocdlpevent {
60 struct HvLpEvent event;
61 u32 reserved;
62 u16 version;
63 u16 sub_result;
64 u16 disk;
65 u16 flags;
66 u32 token;
67 u64 offset; /* On open, max number of disks */
68 u64 len; /* On open, size of the disk */
69 u32 block_size; /* Only set on open */
70 u32 media_size; /* Only set on open */
71};
72
73enum viocdsubtype {
74 viocdopen = 0x0001,
75 viocdclose = 0x0002,
76 viocdread = 0x0003,
77 viocdwrite = 0x0004,
78 viocdlockdoor = 0x0005,
79 viocdgetinfo = 0x0006,
80 viocdcheck = 0x0007
81};
82
83/* 59/*
84 * Should probably make this a module parameter....sigh 60 * Should probably make this a module parameter....sigh
85 */ 61 */
@@ -131,22 +107,13 @@ static struct capability_entry capability_table[] __initdata = {
131/* These are our internal structures for keeping track of devices */ 107/* These are our internal structures for keeping track of devices */
132static int viocd_numdev; 108static int viocd_numdev;
133 109
134struct cdrom_info {
135 char rsrcname[10];
136 char type[4];
137 char model[3];
138};
139/*
140 * This needs to be allocated since it is passed to the
141 * Hypervisor and we may be a module.
142 */
143static struct cdrom_info *viocd_unitinfo;
144static dma_addr_t unitinfo_dmaaddr;
145
146struct disk_info { 110struct disk_info {
147 struct gendisk *viocd_disk; 111 struct gendisk *viocd_disk;
148 struct cdrom_device_info viocd_info; 112 struct cdrom_device_info viocd_info;
149 struct device *dev; 113 struct device *dev;
114 const char *rsrcname;
115 const char *type;
116 const char *model;
150}; 117};
151static struct disk_info viocd_diskinfo[VIOCD_MAX_CD]; 118static struct disk_info viocd_diskinfo[VIOCD_MAX_CD];
152 119
@@ -164,9 +131,9 @@ static int proc_viocd_show(struct seq_file *m, void *v)
164 for (i = 0; i < viocd_numdev; i++) { 131 for (i = 0; i < viocd_numdev; i++) {
165 seq_printf(m, "viocd device %d is iSeries resource %10.10s" 132 seq_printf(m, "viocd device %d is iSeries resource %10.10s"
166 "type %4.4s, model %3.3s\n", 133 "type %4.4s, model %3.3s\n",
167 i, viocd_unitinfo[i].rsrcname, 134 i, viocd_diskinfo[i].rsrcname,
168 viocd_unitinfo[i].type, 135 viocd_diskinfo[i].type,
169 viocd_unitinfo[i].model); 136 viocd_diskinfo[i].model);
170 } 137 }
171 return 0; 138 return 0;
172} 139}
@@ -216,61 +183,6 @@ struct block_device_operations viocd_fops = {
216 .media_changed = viocd_blk_media_changed, 183 .media_changed = viocd_blk_media_changed,
217}; 184};
218 185
219/* Get info on CD devices from OS/400 */
220static void __init get_viocd_info(void)
221{
222 HvLpEvent_Rc hvrc;
223 int i;
224 struct viocd_waitevent we;
225
226 viocd_unitinfo = dma_alloc_coherent(iSeries_vio_dev,
227 sizeof(*viocd_unitinfo) * VIOCD_MAX_CD,
228 &unitinfo_dmaaddr, GFP_ATOMIC);
229 if (viocd_unitinfo == NULL) {
230 printk(VIOCD_KERN_WARNING "error allocating unitinfo\n");
231 return;
232 }
233
234 memset(viocd_unitinfo, 0, sizeof(*viocd_unitinfo) * VIOCD_MAX_CD);
235
236 init_completion(&we.com);
237
238 hvrc = HvCallEvent_signalLpEventFast(viopath_hostLp,
239 HvLpEvent_Type_VirtualIo,
240 viomajorsubtype_cdio | viocdgetinfo,
241 HvLpEvent_AckInd_DoAck, HvLpEvent_AckType_ImmediateAck,
242 viopath_sourceinst(viopath_hostLp),
243 viopath_targetinst(viopath_hostLp),
244 (u64)&we, VIOVERSION << 16, unitinfo_dmaaddr, 0,
245 sizeof(*viocd_unitinfo) * VIOCD_MAX_CD, 0);
246 if (hvrc != HvLpEvent_Rc_Good) {
247 printk(VIOCD_KERN_WARNING "cdrom error sending event. rc %d\n",
248 (int)hvrc);
249 goto error_ret;
250 }
251
252 wait_for_completion(&we.com);
253
254 if (we.rc) {
255 const struct vio_error_entry *err =
256 vio_lookup_rc(viocd_err_table, we.sub_result);
257 printk(VIOCD_KERN_WARNING "bad rc %d:0x%04X on getinfo: %s\n",
258 we.rc, we.sub_result, err->msg);
259 goto error_ret;
260 }
261
262 for (i = 0; (i < VIOCD_MAX_CD) && viocd_unitinfo[i].rsrcname[0]; i++)
263 viocd_numdev++;
264
265error_ret:
266 if (viocd_numdev == 0) {
267 dma_free_coherent(iSeries_vio_dev,
268 sizeof(*viocd_unitinfo) * VIOCD_MAX_CD,
269 viocd_unitinfo, unitinfo_dmaaddr);
270 viocd_unitinfo = NULL;
271 }
272}
273
274static int viocd_open(struct cdrom_device_info *cdi, int purpose) 186static int viocd_open(struct cdrom_device_info *cdi, int purpose)
275{ 187{
276 struct disk_info *diskinfo = cdi->handle; 188 struct disk_info *diskinfo = cdi->handle;
@@ -581,7 +493,6 @@ static void vio_handle_cd_event(struct HvLpEvent *event)
581 bevent->block_size / 512); 493 bevent->block_size / 512);
582 } 494 }
583 /* FALLTHROUGH !! */ 495 /* FALLTHROUGH !! */
584 case viocdgetinfo:
585 case viocdlockdoor: 496 case viocdlockdoor:
586 pwe = (struct viocd_waitevent *)event->xCorrelationToken; 497 pwe = (struct viocd_waitevent *)event->xCorrelationToken;
587return_complete: 498return_complete:
@@ -665,22 +576,30 @@ static int viocd_probe(struct vio_dev *vdev, const struct vio_device_id *id)
665 int deviceno; 576 int deviceno;
666 struct disk_info *d; 577 struct disk_info *d;
667 struct cdrom_device_info *c; 578 struct cdrom_device_info *c;
668 struct cdrom_info *ci;
669 struct request_queue *q; 579 struct request_queue *q;
580 struct device_node *node = vdev->dev.archdata.of_node;
670 581
671 deviceno = vdev->unit_address; 582 deviceno = vdev->unit_address;
672 if (deviceno >= viocd_numdev) 583 if (deviceno > VIOCD_MAX_CD)
673 return -ENODEV; 584 return -ENODEV;
585 if (!node)
586 return -ENODEV;
587
588 if (deviceno >= viocd_numdev)
589 viocd_numdev = deviceno + 1;
674 590
675 d = &viocd_diskinfo[deviceno]; 591 d = &viocd_diskinfo[deviceno];
592 d->rsrcname = of_get_property(node, "linux,vio_rsrcname", NULL);
593 d->type = of_get_property(node, "linux,vio_type", NULL);
594 d->model = of_get_property(node, "linux,vio_model", NULL);
595
676 c = &d->viocd_info; 596 c = &d->viocd_info;
677 ci = &viocd_unitinfo[deviceno];
678 597
679 c->ops = &viocd_dops; 598 c->ops = &viocd_dops;
680 c->speed = 4; 599 c->speed = 4;
681 c->capacity = 1; 600 c->capacity = 1;
682 c->handle = d; 601 c->handle = d;
683 c->mask = ~find_capability(ci->type); 602 c->mask = ~find_capability(d->type);
684 sprintf(c->name, VIOCD_DEVICE "%c", 'a' + deviceno); 603 sprintf(c->name, VIOCD_DEVICE "%c", 'a' + deviceno);
685 604
686 if (register_cdrom(c) != 0) { 605 if (register_cdrom(c) != 0) {
@@ -690,7 +609,7 @@ static int viocd_probe(struct vio_dev *vdev, const struct vio_device_id *id)
690 } 609 }
691 printk(VIOCD_KERN_INFO "cd %s is iSeries resource %10.10s " 610 printk(VIOCD_KERN_INFO "cd %s is iSeries resource %10.10s "
692 "type %4.4s, model %3.3s\n", 611 "type %4.4s, model %3.3s\n",
693 c->name, ci->rsrcname, ci->type, ci->model); 612 c->name, d->rsrcname, d->type, d->model);
694 q = blk_init_queue(do_viocd_request, &viocd_reqlock); 613 q = blk_init_queue(do_viocd_request, &viocd_reqlock);
695 if (q == NULL) { 614 if (q == NULL) {
696 printk(VIOCD_KERN_WARNING "Cannot allocate queue for %s!\n", 615 printk(VIOCD_KERN_WARNING "Cannot allocate queue for %s!\n",
@@ -799,8 +718,6 @@ static int __init viocd_init(void)
799 /* Initialize our request handler */ 718 /* Initialize our request handler */
800 vio_setHandler(viomajorsubtype_cdio, vio_handle_cd_event); 719 vio_setHandler(viomajorsubtype_cdio, vio_handle_cd_event);
801 720
802 get_viocd_info();
803
804 spin_lock_init(&viocd_reqlock); 721 spin_lock_init(&viocd_reqlock);
805 722
806 ret = vio_register_driver(&viocd_driver); 723 ret = vio_register_driver(&viocd_driver);
@@ -816,9 +733,6 @@ static int __init viocd_init(void)
816 return 0; 733 return 0;
817 734
818out_free_info: 735out_free_info:
819 dma_free_coherent(iSeries_vio_dev,
820 sizeof(*viocd_unitinfo) * VIOCD_MAX_CD,
821 viocd_unitinfo, unitinfo_dmaaddr);
822 vio_clearHandler(viomajorsubtype_cdio); 736 vio_clearHandler(viomajorsubtype_cdio);
823 viopath_close(viopath_hostLp, viomajorsubtype_cdio, MAX_CD_REQ + 2); 737 viopath_close(viopath_hostLp, viomajorsubtype_cdio, MAX_CD_REQ + 2);
824out_unregister: 738out_unregister:
@@ -830,10 +744,6 @@ static void __exit viocd_exit(void)
830{ 744{
831 remove_proc_entry("iSeries/viocd", NULL); 745 remove_proc_entry("iSeries/viocd", NULL);
832 vio_unregister_driver(&viocd_driver); 746 vio_unregister_driver(&viocd_driver);
833 if (viocd_unitinfo != NULL)
834 dma_free_coherent(iSeries_vio_dev,
835 sizeof(*viocd_unitinfo) * VIOCD_MAX_CD,
836 viocd_unitinfo, unitinfo_dmaaddr);
837 viopath_close(viopath_hostLp, viomajorsubtype_cdio, MAX_CD_REQ + 2); 747 viopath_close(viopath_hostLp, viomajorsubtype_cdio, MAX_CD_REQ + 2);
838 vio_clearHandler(viomajorsubtype_cdio); 748 vio_clearHandler(viomajorsubtype_cdio);
839 unregister_blkdev(VIOCD_MAJOR, VIOCD_DEVICE); 749 unregister_blkdev(VIOCD_MAJOR, VIOCD_DEVICE);
diff --git a/drivers/char/viotape.c b/drivers/char/viotape.c
index e12275df6ea2..f1d60f0cef8f 100644
--- a/drivers/char/viotape.c
+++ b/drivers/char/viotape.c
@@ -92,47 +92,6 @@ struct viot_devinfo_struct {
92#define VIOTAPOP_SETPART 14 92#define VIOTAPOP_SETPART 14
93#define VIOTAPOP_UNLOAD 15 93#define VIOTAPOP_UNLOAD 15
94 94
95struct viotapelpevent {
96 struct HvLpEvent event;
97 u32 reserved;
98 u16 version;
99 u16 sub_type_result;
100 u16 tape;
101 u16 flags;
102 u32 token;
103 u64 len;
104 union {
105 struct {
106 u32 tape_op;
107 u32 count;
108 } op;
109 struct {
110 u32 type;
111 u32 resid;
112 u32 dsreg;
113 u32 gstat;
114 u32 erreg;
115 u32 file_no;
116 u32 block_no;
117 } get_status;
118 struct {
119 u32 block_no;
120 } get_pos;
121 } u;
122};
123
124enum viotapesubtype {
125 viotapeopen = 0x0001,
126 viotapeclose = 0x0002,
127 viotaperead = 0x0003,
128 viotapewrite = 0x0004,
129 viotapegetinfo = 0x0005,
130 viotapeop = 0x0006,
131 viotapegetpos = 0x0007,
132 viotapesetpos = 0x0008,
133 viotapegetstatus = 0x0009
134};
135
136enum viotaperc { 95enum viotaperc {
137 viotape_InvalidRange = 0x0601, 96 viotape_InvalidRange = 0x0601,
138 viotape_InvalidToken = 0x0602, 97 viotape_InvalidToken = 0x0602,
@@ -223,14 +182,11 @@ static const struct vio_error_entry viotape_err_table[] = {
223#define VIOT_WRITING 2 182#define VIOT_WRITING 2
224 183
225/* Our info on the tapes */ 184/* Our info on the tapes */
226struct tape_descr { 185static struct {
227 char rsrcname[10]; 186 const char *rsrcname;
228 char type[4]; 187 const char *type;
229 char model[3]; 188 const char *model;
230}; 189} viotape_unitinfo[VIOTAPE_MAX_TAPE];
231
232static struct tape_descr *viotape_unitinfo;
233static dma_addr_t viotape_unitinfo_token;
234 190
235static struct mtget viomtget[VIOTAPE_MAX_TAPE]; 191static struct mtget viomtget[VIOTAPE_MAX_TAPE];
236 192
@@ -381,53 +337,6 @@ int tape_rc_to_errno(int tape_rc, char *operation, int tapeno)
381 return -err->errno; 337 return -err->errno;
382} 338}
383 339
384/* Get info on all tapes from OS/400 */
385static int get_viotape_info(void)
386{
387 HvLpEvent_Rc hvrc;
388 int i;
389 size_t len = sizeof(*viotape_unitinfo) * VIOTAPE_MAX_TAPE;
390 struct op_struct *op = get_op_struct();
391
392 if (op == NULL)
393 return -ENOMEM;
394
395 viotape_unitinfo = dma_alloc_coherent(iSeries_vio_dev, len,
396 &viotape_unitinfo_token, GFP_ATOMIC);
397 if (viotape_unitinfo == NULL) {
398 free_op_struct(op);
399 return -ENOMEM;
400 }
401
402 memset(viotape_unitinfo, 0, len);
403
404 hvrc = HvCallEvent_signalLpEventFast(viopath_hostLp,
405 HvLpEvent_Type_VirtualIo,
406 viomajorsubtype_tape | viotapegetinfo,
407 HvLpEvent_AckInd_DoAck, HvLpEvent_AckType_ImmediateAck,
408 viopath_sourceinst(viopath_hostLp),
409 viopath_targetinst(viopath_hostLp),
410 (u64) (unsigned long) op, VIOVERSION << 16,
411 viotape_unitinfo_token, len, 0, 0);
412 if (hvrc != HvLpEvent_Rc_Good) {
413 printk(VIOTAPE_KERN_WARN "hv error on op %d\n",
414 (int)hvrc);
415 free_op_struct(op);
416 return -EIO;
417 }
418
419 wait_for_completion(&op->com);
420
421 free_op_struct(op);
422
423 for (i = 0;
424 ((i < VIOTAPE_MAX_TAPE) && (viotape_unitinfo[i].rsrcname[0]));
425 i++)
426 viotape_numdev++;
427 return 0;
428}
429
430
431/* Write */ 340/* Write */
432static ssize_t viotap_write(struct file *file, const char *buf, 341static ssize_t viotap_write(struct file *file, const char *buf,
433 size_t count, loff_t * ppos) 342 size_t count, loff_t * ppos)
@@ -899,7 +808,6 @@ static void vioHandleTapeEvent(struct HvLpEvent *event)
899 tapeminor = event->xSubtype & VIOMINOR_SUBTYPE_MASK; 808 tapeminor = event->xSubtype & VIOMINOR_SUBTYPE_MASK;
900 op = (struct op_struct *)event->xCorrelationToken; 809 op = (struct op_struct *)event->xCorrelationToken;
901 switch (tapeminor) { 810 switch (tapeminor) {
902 case viotapegetinfo:
903 case viotapeopen: 811 case viotapeopen:
904 case viotapeclose: 812 case viotapeclose:
905 op->rc = tevent->sub_type_result; 813 op->rc = tevent->sub_type_result;
@@ -942,11 +850,23 @@ static int viotape_probe(struct vio_dev *vdev, const struct vio_device_id *id)
942{ 850{
943 int i = vdev->unit_address; 851 int i = vdev->unit_address;
944 int j; 852 int j;
853 struct device_node *node = vdev->dev.archdata.of_node;
945 854
946 if (i >= viotape_numdev) 855 if (i > VIOTAPE_MAX_TAPE)
856 return -ENODEV;
857 if (!node)
947 return -ENODEV; 858 return -ENODEV;
948 859
860 if (i >= viotape_numdev)
861 viotape_numdev = i + 1;
862
949 tape_device[i] = &vdev->dev; 863 tape_device[i] = &vdev->dev;
864 viotape_unitinfo[i].rsrcname = of_get_property(node,
865 "linux,vio_rsrcname", NULL);
866 viotape_unitinfo[i].type = of_get_property(node, "linux,vio_type",
867 NULL);
868 viotape_unitinfo[i].model = of_get_property(node, "linux,vio_model",
869 NULL);
950 870
951 state[i].cur_part = 0; 871 state[i].cur_part = 0;
952 for (j = 0; j < MAX_PARTITIONS; ++j) 872 for (j = 0; j < MAX_PARTITIONS; ++j)
@@ -1044,11 +964,6 @@ int __init viotap_init(void)
1044 goto unreg_chrdev; 964 goto unreg_chrdev;
1045 } 965 }
1046 966
1047 if ((ret = get_viotape_info()) < 0) {
1048 printk(VIOTAPE_KERN_WARN "Unable to obtain virtual device information");
1049 goto unreg_class;
1050 }
1051
1052 ret = vio_register_driver(&viotape_driver); 967 ret = vio_register_driver(&viotape_driver);
1053 if (ret) 968 if (ret)
1054 goto unreg_class; 969 goto unreg_class;
@@ -1102,10 +1017,6 @@ static void __exit viotap_exit(void)
1102 vio_unregister_driver(&viotape_driver); 1017 vio_unregister_driver(&viotape_driver);
1103 class_destroy(tape_class); 1018 class_destroy(tape_class);
1104 unregister_chrdev(VIOTAPE_MAJOR, "viotape"); 1019 unregister_chrdev(VIOTAPE_MAJOR, "viotape");
1105 if (viotape_unitinfo)
1106 dma_free_coherent(iSeries_vio_dev,
1107 sizeof(viotape_unitinfo[0]) * VIOTAPE_MAX_TAPE,
1108 viotape_unitinfo, viotape_unitinfo_token);
1109 viopath_close(viopath_hostLp, viomajorsubtype_tape, VIOTAPE_MAXREQ + 2); 1020 viopath_close(viopath_hostLp, viomajorsubtype_tape, VIOTAPE_MAXREQ + 2);
1110 vio_clearHandler(viomajorsubtype_tape); 1021 vio_clearHandler(viomajorsubtype_tape);
1111 clear_op_struct_pool(); 1022 clear_op_struct_pool();
diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c
index 4bc67ab56afa..dec602c23075 100644
--- a/drivers/video/xilinxfb.c
+++ b/drivers/video/xilinxfb.c
@@ -6,9 +6,12 @@
6 * Author: MontaVista Software, Inc. 6 * Author: MontaVista Software, Inc.
7 * source@mvista.com 7 * source@mvista.com
8 * 8 *
9 * 2002-2007 (c) MontaVista Software, Inc. This file is licensed under the 9 * 2002-2007 (c) MontaVista Software, Inc.
10 * terms of the GNU General Public License version 2. This program is licensed 10 * 2007 (c) Secret Lab Technologies, Ltd.
11 * "as is" without any warranty of any kind, whether express or implied. 11 *
12 * This file is licensed under the terms of the GNU General Public License
13 * version 2. This program is licensed "as is" without any warranty of any
14 * kind, whether express or implied.
12 */ 15 */
13 16
14/* 17/*
@@ -18,6 +21,7 @@
18 * Geert Uytterhoeven. 21 * Geert Uytterhoeven.
19 */ 22 */
20 23
24#include <linux/device.h>
21#include <linux/module.h> 25#include <linux/module.h>
22#include <linux/kernel.h> 26#include <linux/kernel.h>
23#include <linux/version.h> 27#include <linux/version.h>
@@ -28,7 +32,10 @@
28#include <linux/init.h> 32#include <linux/init.h>
29#include <linux/dma-mapping.h> 33#include <linux/dma-mapping.h>
30#include <linux/platform_device.h> 34#include <linux/platform_device.h>
31 35#if defined(CONFIG_OF)
36#include <linux/of_device.h>
37#include <linux/of_platform.h>
38#endif
32#include <asm/io.h> 39#include <asm/io.h>
33#include <linux/xilinxfb.h> 40#include <linux/xilinxfb.h>
34 41
@@ -111,7 +118,7 @@ struct xilinxfb_drvdata {
111 u32 regs_phys; /* phys. address of the control registers */ 118 u32 regs_phys; /* phys. address of the control registers */
112 u32 __iomem *regs; /* virt. address of the control registers */ 119 u32 __iomem *regs; /* virt. address of the control registers */
113 120
114 unsigned char __iomem *fb_virt; /* virt. address of the frame buffer */ 121 void *fb_virt; /* virt. address of the frame buffer */
115 dma_addr_t fb_phys; /* phys. address of the frame buffer */ 122 dma_addr_t fb_phys; /* phys. address of the frame buffer */
116 123
117 u32 reg_ctrl_default; 124 u32 reg_ctrl_default;
@@ -195,130 +202,120 @@ static struct fb_ops xilinxfb_ops =
195 .fb_imageblit = cfb_imageblit, 202 .fb_imageblit = cfb_imageblit,
196}; 203};
197 204
198/* === The device driver === */ 205/* ---------------------------------------------------------------------
206 * Bus independent setup/teardown
207 */
199 208
200static int 209static int xilinxfb_assign(struct device *dev, unsigned long physaddr,
201xilinxfb_drv_probe(struct device *dev) 210 int width_mm, int height_mm, int rotate)
202{ 211{
203 struct platform_device *pdev;
204 struct xilinxfb_platform_data *pdata;
205 struct xilinxfb_drvdata *drvdata; 212 struct xilinxfb_drvdata *drvdata;
206 struct resource *regs_res; 213 int rc;
207 int retval;
208
209 if (!dev)
210 return -EINVAL;
211
212 pdev = to_platform_device(dev);
213 pdata = pdev->dev.platform_data;
214 214
215 /* Allocate the driver data region */
215 drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL); 216 drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL);
216 if (!drvdata) { 217 if (!drvdata) {
217 printk(KERN_ERR "Couldn't allocate device private record\n"); 218 dev_err(dev, "Couldn't allocate device private record\n");
218 return -ENOMEM; 219 return -ENOMEM;
219 } 220 }
220 dev_set_drvdata(dev, drvdata); 221 dev_set_drvdata(dev, drvdata);
221 222
222 /* Map the control registers in */ 223 /* Map the control registers in */
223 regs_res = platform_get_resource(pdev, IORESOURCE_IO, 0); 224 if (!request_mem_region(physaddr, 8, DRIVER_NAME)) {
224 if (!regs_res || (regs_res->end - regs_res->start + 1 < 8)) { 225 dev_err(dev, "Couldn't lock memory region at 0x%08lX\n",
225 printk(KERN_ERR "Couldn't get registers resource\n"); 226 physaddr);
226 retval = -EFAULT; 227 rc = -ENODEV;
227 goto failed1; 228 goto err_region;
228 } 229 }
229 230 drvdata->regs_phys = physaddr;
230 if (!request_mem_region(regs_res->start, 8, DRIVER_NAME)) { 231 drvdata->regs = ioremap(physaddr, 8);
231 printk(KERN_ERR 232 if (!drvdata->regs) {
232 "Couldn't lock memory region at 0x%08X\n", 233 dev_err(dev, "Couldn't lock memory region at 0x%08lX\n",
233 regs_res->start); 234 physaddr);
234 retval = -EBUSY; 235 rc = -ENODEV;
235 goto failed1; 236 goto err_map;
236 } 237 }
237 drvdata->regs = (u32 __iomem*) ioremap(regs_res->start, 8);
238 drvdata->regs_phys = regs_res->start;
239 238
240 /* Allocate the framebuffer memory */ 239 /* Allocate the framebuffer memory */
241 drvdata->fb_virt = dma_alloc_coherent(dev, PAGE_ALIGN(FB_SIZE), 240 drvdata->fb_virt = dma_alloc_coherent(dev, PAGE_ALIGN(FB_SIZE),
242 &drvdata->fb_phys, GFP_KERNEL); 241 &drvdata->fb_phys, GFP_KERNEL);
243 if (!drvdata->fb_virt) { 242 if (!drvdata->fb_virt) {
244 printk(KERN_ERR "Could not allocate frame buffer memory\n"); 243 dev_err(dev, "Could not allocate frame buffer memory\n");
245 retval = -ENOMEM; 244 rc = -ENOMEM;
246 goto failed2; 245 goto err_fbmem;
247 } 246 }
248 247
249 /* Clear (turn to black) the framebuffer */ 248 /* Clear (turn to black) the framebuffer */
250 memset_io((void *) drvdata->fb_virt, 0, FB_SIZE); 249 memset_io((void __iomem *)drvdata->fb_virt, 0, FB_SIZE);
251 250
252 /* Tell the hardware where the frame buffer is */ 251 /* Tell the hardware where the frame buffer is */
253 xilinx_fb_out_be32(drvdata, REG_FB_ADDR, drvdata->fb_phys); 252 xilinx_fb_out_be32(drvdata, REG_FB_ADDR, drvdata->fb_phys);
254 253
255 /* Turn on the display */ 254 /* Turn on the display */
256 drvdata->reg_ctrl_default = REG_CTRL_ENABLE; 255 drvdata->reg_ctrl_default = REG_CTRL_ENABLE;
257 if (pdata && pdata->rotate_screen) 256 if (rotate)
258 drvdata->reg_ctrl_default |= REG_CTRL_ROTATE; 257 drvdata->reg_ctrl_default |= REG_CTRL_ROTATE;
259 xilinx_fb_out_be32(drvdata, REG_CTRL, drvdata->reg_ctrl_default); 258 xilinx_fb_out_be32(drvdata, REG_CTRL, drvdata->reg_ctrl_default);
260 259
261 /* Fill struct fb_info */ 260 /* Fill struct fb_info */
262 drvdata->info.device = dev; 261 drvdata->info.device = dev;
263 drvdata->info.screen_base = drvdata->fb_virt; 262 drvdata->info.screen_base = (void __iomem *)drvdata->fb_virt;
264 drvdata->info.fbops = &xilinxfb_ops; 263 drvdata->info.fbops = &xilinxfb_ops;
265 drvdata->info.fix = xilinx_fb_fix; 264 drvdata->info.fix = xilinx_fb_fix;
266 drvdata->info.fix.smem_start = drvdata->fb_phys; 265 drvdata->info.fix.smem_start = drvdata->fb_phys;
267 drvdata->info.pseudo_palette = drvdata->pseudo_palette; 266 drvdata->info.pseudo_palette = drvdata->pseudo_palette;
267 drvdata->info.flags = FBINFO_DEFAULT;
268 drvdata->info.var = xilinx_fb_var;
269
270 xilinx_fb_var.height = height_mm;
271 xilinx_fb_var.width = width_mm;
268 272
269 if (fb_alloc_cmap(&drvdata->info.cmap, PALETTE_ENTRIES_NO, 0) < 0) { 273 /* Allocate a colour map */
270 printk(KERN_ERR "Fail to allocate colormap (%d entries)\n", 274 rc = fb_alloc_cmap(&drvdata->info.cmap, PALETTE_ENTRIES_NO, 0);
275 if (rc) {
276 dev_err(dev, "Fail to allocate colormap (%d entries)\n",
271 PALETTE_ENTRIES_NO); 277 PALETTE_ENTRIES_NO);
272 retval = -EFAULT; 278 goto err_cmap;
273 goto failed3;
274 } 279 }
275 280
276 drvdata->info.flags = FBINFO_DEFAULT;
277 if (pdata) {
278 xilinx_fb_var.height = pdata->screen_height_mm;
279 xilinx_fb_var.width = pdata->screen_width_mm;
280 }
281 drvdata->info.var = xilinx_fb_var;
282
283 /* Register new frame buffer */ 281 /* Register new frame buffer */
284 if (register_framebuffer(&drvdata->info) < 0) { 282 rc = register_framebuffer(&drvdata->info);
285 printk(KERN_ERR "Could not register frame buffer\n"); 283 if (rc) {
286 retval = -EINVAL; 284 dev_err(dev, "Could not register frame buffer\n");
287 goto failed4; 285 goto err_regfb;
288 } 286 }
289 287
288 /* Put a banner in the log (for DEBUG) */
289 dev_dbg(dev, "regs: phys=%lx, virt=%p\n", physaddr, drvdata->regs);
290 dev_dbg(dev, "fb: phys=%p, virt=%p, size=%x\n",
291 (void*)drvdata->fb_phys, drvdata->fb_virt, FB_SIZE);
290 return 0; /* success */ 292 return 0; /* success */
291 293
292failed4: 294err_regfb:
293 fb_dealloc_cmap(&drvdata->info.cmap); 295 fb_dealloc_cmap(&drvdata->info.cmap);
294 296
295failed3: 297err_cmap:
296 dma_free_coherent(dev, PAGE_ALIGN(FB_SIZE), drvdata->fb_virt, 298 dma_free_coherent(dev, PAGE_ALIGN(FB_SIZE), drvdata->fb_virt,
297 drvdata->fb_phys); 299 drvdata->fb_phys);
298
299 /* Turn off the display */ 300 /* Turn off the display */
300 xilinx_fb_out_be32(drvdata, REG_CTRL, 0); 301 xilinx_fb_out_be32(drvdata, REG_CTRL, 0);
302
303err_fbmem:
301 iounmap(drvdata->regs); 304 iounmap(drvdata->regs);
302 305
303failed2: 306err_map:
304 release_mem_region(regs_res->start, 8); 307 release_mem_region(physaddr, 8);
305 308
306failed1: 309err_region:
307 kfree(drvdata); 310 kfree(drvdata);
308 dev_set_drvdata(dev, NULL); 311 dev_set_drvdata(dev, NULL);
309 312
310 return retval; 313 return rc;
311} 314}
312 315
313static int 316static int xilinxfb_release(struct device *dev)
314xilinxfb_drv_remove(struct device *dev)
315{ 317{
316 struct xilinxfb_drvdata *drvdata; 318 struct xilinxfb_drvdata *drvdata = dev_get_drvdata(dev);
317
318 if (!dev)
319 return -ENODEV;
320
321 drvdata = (struct xilinxfb_drvdata *) dev_get_drvdata(dev);
322 319
323#if !defined(CONFIG_FRAMEBUFFER_CONSOLE) && defined(CONFIG_LOGO) 320#if !defined(CONFIG_FRAMEBUFFER_CONSOLE) && defined(CONFIG_LOGO)
324 xilinx_fb_blank(VESA_POWERDOWN, &drvdata->info); 321 xilinx_fb_blank(VESA_POWERDOWN, &drvdata->info);
@@ -343,29 +340,151 @@ xilinxfb_drv_remove(struct device *dev)
343 return 0; 340 return 0;
344} 341}
345 342
343/* ---------------------------------------------------------------------
344 * Platform bus binding
345 */
346
347static int
348xilinxfb_platform_probe(struct platform_device *pdev)
349{
350 struct xilinxfb_platform_data *pdata;
351 struct resource *res;
352 int width_mm = 0;
353 int height_mm = 0;
354 int rotate = 0;
355
356 /* Find the registers address */
357 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
358 if (!res) {
359 dev_err(&pdev->dev, "Couldn't get registers resource\n");
360 return -ENODEV;
361 }
362
363 /* If a pdata structure is provided, then extract the parameters */
364 pdata = pdev->dev.platform_data;
365 if (pdata) {
366 height_mm = pdata->screen_height_mm;
367 width_mm = pdata->screen_width_mm;
368 rotate = pdata->rotate_screen ? 1 : 0;
369 }
370
371 return xilinxfb_assign(&pdev->dev, res->start, width_mm, height_mm,
372 rotate);
373}
374
375static int
376xilinxfb_platform_remove(struct platform_device *pdev)
377{
378 return xilinxfb_release(&pdev->dev);
379}
346 380
347static struct device_driver xilinxfb_driver = {
348 .name = DRIVER_NAME,
349 .bus = &platform_bus_type,
350 381
351 .probe = xilinxfb_drv_probe, 382static struct platform_driver xilinxfb_platform_driver = {
352 .remove = xilinxfb_drv_remove 383 .probe = xilinxfb_platform_probe,
384 .remove = xilinxfb_platform_remove,
385 .driver = {
386 .owner = THIS_MODULE,
387 .name = DRIVER_NAME,
388 },
353}; 389};
354 390
391/* ---------------------------------------------------------------------
392 * OF bus binding
393 */
394
395#if defined(CONFIG_OF)
396static int __devinit
397xilinxfb_of_probe(struct of_device *op, const struct of_device_id *match)
398{
399 struct resource res;
400 const u32 *prop;
401 int width = 0, height = 0, rotate = 0;
402 int size, rc;
403
404 dev_dbg(&op->dev, "xilinxfb_of_probe(%p, %p)\n", op, match);
405
406 rc = of_address_to_resource(op->node, 0, &res);
407 if (rc) {
408 dev_err(&op->dev, "invalid address\n");
409 return rc;
410 }
411
412 prop = of_get_property(op->node, "display-number", &size);
413 if ((prop) && (size >= sizeof(u32)*2)) {
414 width = prop[0];
415 height = prop[1];
416 }
417
418 if (of_find_property(op->node, "rotate-display", NULL))
419 rotate = 1;
420
421 return xilinxfb_assign(&op->dev, res.start, width, height, rotate);
422}
423
424static int __devexit xilinxfb_of_remove(struct of_device *op)
425{
426 return xilinxfb_release(&op->dev);
427}
428
429/* Match table for of_platform binding */
430static struct of_device_id __devinit xilinxfb_of_match[] = {
431 { .compatible = "xilinx,ml300-fb", },
432 {},
433};
434MODULE_DEVICE_TABLE(of, xilinxfb_of_match);
435
436static struct of_platform_driver xilinxfb_of_driver = {
437 .owner = THIS_MODULE,
438 .name = DRIVER_NAME,
439 .match_table = xilinxfb_of_match,
440 .probe = xilinxfb_of_probe,
441 .remove = __devexit_p(xilinxfb_of_remove),
442 .driver = {
443 .name = DRIVER_NAME,
444 },
445};
446
447/* Registration helpers to keep the number of #ifdefs to a minimum */
448static inline int __init xilinxfb_of_register(void)
449{
450 pr_debug("xilinxfb: calling of_register_platform_driver()\n");
451 return of_register_platform_driver(&xilinxfb_of_driver);
452}
453
454static inline void __exit xilinxfb_of_unregister(void)
455{
456 of_unregister_platform_driver(&xilinxfb_of_driver);
457}
458#else /* CONFIG_OF */
459/* CONFIG_OF not enabled; do nothing helpers */
460static inline int __init xilinxfb_of_register(void) { return 0; }
461static inline void __exit xilinxfb_of_unregister(void) { }
462#endif /* CONFIG_OF */
463
464/* ---------------------------------------------------------------------
465 * Module setup and teardown
466 */
467
355static int __init 468static int __init
356xilinxfb_init(void) 469xilinxfb_init(void)
357{ 470{
358 /* 471 int rc;
359 * No kernel boot options used, 472 rc = xilinxfb_of_register();
360 * so we just need to register the driver 473 if (rc)
361 */ 474 return rc;
362 return driver_register(&xilinxfb_driver); 475
476 rc = platform_driver_register(&xilinxfb_platform_driver);
477 if (rc)
478 xilinxfb_of_unregister();
479
480 return rc;
363} 481}
364 482
365static void __exit 483static void __exit
366xilinxfb_cleanup(void) 484xilinxfb_cleanup(void)
367{ 485{
368 driver_unregister(&xilinxfb_driver); 486 platform_driver_unregister(&xilinxfb_platform_driver);
487 xilinxfb_of_unregister();
369} 488}
370 489
371module_init(xilinxfb_init); 490module_init(xilinxfb_init);
diff --git a/arch/powerpc/platforms/cell/cbe_regs.h b/include/asm-powerpc/cell-regs.h
index b24025f2ac7a..fd6fd00434ef 100644
--- a/arch/powerpc/platforms/cell/cbe_regs.h
+++ b/include/asm-powerpc/cell-regs.h
@@ -244,16 +244,60 @@ struct cbe_mic_tm_regs {
244 u64 slow_fast_timer_0; /* 0x0090 */ 244 u64 slow_fast_timer_0; /* 0x0090 */
245 u64 slow_next_timer_0; /* 0x0098 */ 245 u64 slow_next_timer_0; /* 0x0098 */
246 246
247 u8 pad_0x00a0_0x01c0[0x01c0 - 0x0a0]; /* 0x00a0 */ 247 u8 pad_0x00a0_0x00f8[0x00f8 - 0x00a0]; /* 0x00a0 */
248 u64 mic_df_ecc_address_0; /* 0x00f8 */
249
250 u8 pad_0x0100_0x01b8[0x01b8 - 0x0100]; /* 0x0100 */
251 u64 mic_df_ecc_address_1; /* 0x01b8 */
248 252
249 u64 mic_ctl_cnfg_1; /* 0x01c0 */ 253 u64 mic_ctl_cnfg_1; /* 0x01c0 */
250#define CBE_MIC_DISABLE_PWR_SAV_1 0x8000000000000000LL 254#define CBE_MIC_DISABLE_PWR_SAV_1 0x8000000000000000LL
255
251 u64 pad_0x01c8; /* 0x01c8 */ 256 u64 pad_0x01c8; /* 0x01c8 */
252 257
253 u64 slow_fast_timer_1; /* 0x01d0 */ 258 u64 slow_fast_timer_1; /* 0x01d0 */
254 u64 slow_next_timer_1; /* 0x01d8 */ 259 u64 slow_next_timer_1; /* 0x01d8 */
255 260
256 u8 pad_0x01e0_0x1000[0x1000 - 0x01e0]; /* 0x01e0 */ 261 u8 pad_0x01e0_0x0208[0x0208 - 0x01e0]; /* 0x01e0 */
262 u64 mic_exc; /* 0x0208 */
263#define CBE_MIC_EXC_BLOCK_SCRUB 0x0800000000000000ULL
264#define CBE_MIC_EXC_FAST_SCRUB 0x0100000000000000ULL
265
266 u64 mic_mnt_cfg; /* 0x0210 */
267#define CBE_MIC_MNT_CFG_CHAN_0_POP 0x0002000000000000ULL
268#define CBE_MIC_MNT_CFG_CHAN_1_POP 0x0004000000000000ULL
269
270 u64 mic_df_config; /* 0x0218 */
271#define CBE_MIC_ECC_DISABLE_0 0x4000000000000000ULL
272#define CBE_MIC_ECC_REP_SINGLE_0 0x2000000000000000ULL
273#define CBE_MIC_ECC_DISABLE_1 0x0080000000000000ULL
274#define CBE_MIC_ECC_REP_SINGLE_1 0x0040000000000000ULL
275
276 u8 pad_0x0220_0x0230[0x0230 - 0x0220]; /* 0x0220 */
277 u64 mic_fir; /* 0x0230 */
278#define CBE_MIC_FIR_ECC_SINGLE_0_ERR 0x0200000000000000ULL
279#define CBE_MIC_FIR_ECC_MULTI_0_ERR 0x0100000000000000ULL
280#define CBE_MIC_FIR_ECC_SINGLE_1_ERR 0x0080000000000000ULL
281#define CBE_MIC_FIR_ECC_MULTI_1_ERR 0x0040000000000000ULL
282#define CBE_MIC_FIR_ECC_ERR_MASK 0xffff000000000000ULL
283#define CBE_MIC_FIR_ECC_SINGLE_0_CTE 0x0000020000000000ULL
284#define CBE_MIC_FIR_ECC_MULTI_0_CTE 0x0000010000000000ULL
285#define CBE_MIC_FIR_ECC_SINGLE_1_CTE 0x0000008000000000ULL
286#define CBE_MIC_FIR_ECC_MULTI_1_CTE 0x0000004000000000ULL
287#define CBE_MIC_FIR_ECC_CTE_MASK 0x0000ffff00000000ULL
288#define CBE_MIC_FIR_ECC_SINGLE_0_RESET 0x0000000002000000ULL
289#define CBE_MIC_FIR_ECC_MULTI_0_RESET 0x0000000001000000ULL
290#define CBE_MIC_FIR_ECC_SINGLE_1_RESET 0x0000000000800000ULL
291#define CBE_MIC_FIR_ECC_MULTI_1_RESET 0x0000000000400000ULL
292#define CBE_MIC_FIR_ECC_RESET_MASK 0x00000000ffff0000ULL
293#define CBE_MIC_FIR_ECC_SINGLE_0_SET 0x0000000000000200ULL
294#define CBE_MIC_FIR_ECC_MULTI_0_SET 0x0000000000000100ULL
295#define CBE_MIC_FIR_ECC_SINGLE_1_SET 0x0000000000000080ULL
296#define CBE_MIC_FIR_ECC_MULTI_1_SET 0x0000000000000040ULL
297#define CBE_MIC_FIR_ECC_SET_MASK 0x000000000000ffffULL
298 u64 mic_fir_debug; /* 0x0238 */
299
300 u8 pad_0x0240_0x1000[0x1000 - 0x0240]; /* 0x0240 */
257}; 301};
258 302
259extern struct cbe_mic_tm_regs __iomem *cbe_get_mic_tm_regs(struct device_node *np); 303extern struct cbe_mic_tm_regs __iomem *cbe_get_mic_tm_regs(struct device_node *np);
diff --git a/include/asm-powerpc/cputable.h b/include/asm-powerpc/cputable.h
index c9b8f64bbb45..d913f460e710 100644
--- a/include/asm-powerpc/cputable.h
+++ b/include/asm-powerpc/cputable.h
@@ -57,6 +57,7 @@ enum powerpc_pmc_type {
57 PPC_PMC_PA6T = 2, 57 PPC_PMC_PA6T = 2,
58}; 58};
59 59
60/* NOTE WELL: Update identify_cpu() if fields are added or removed! */
60struct cpu_spec { 61struct cpu_spec {
61 /* CPU is matched via (PVR & pvr_mask) == pvr_value */ 62 /* CPU is matched via (PVR & pvr_mask) == pvr_value */
62 unsigned int pvr_mask; 63 unsigned int pvr_mask;
diff --git a/include/asm-powerpc/iseries/hv_call_event.h b/include/asm-powerpc/iseries/hv_call_event.h
index 4cec4762076d..cc029d388e11 100644
--- a/include/asm-powerpc/iseries/hv_call_event.h
+++ b/include/asm-powerpc/iseries/hv_call_event.h
@@ -21,6 +21,9 @@
21#ifndef _ASM_POWERPC_ISERIES_HV_CALL_EVENT_H 21#ifndef _ASM_POWERPC_ISERIES_HV_CALL_EVENT_H
22#define _ASM_POWERPC_ISERIES_HV_CALL_EVENT_H 22#define _ASM_POWERPC_ISERIES_HV_CALL_EVENT_H
23 23
24#include <linux/types.h>
25#include <linux/dma-mapping.h>
26
24#include <asm/iseries/hv_call_sc.h> 27#include <asm/iseries/hv_call_sc.h>
25#include <asm/iseries/hv_types.h> 28#include <asm/iseries/hv_types.h>
26#include <asm/abs_addr.h> 29#include <asm/abs_addr.h>
@@ -113,6 +116,13 @@ static inline HvLpEvent_Rc HvCallEvent_signalLpEventFast(HvLpIndex targetLp,
113 eventData3, eventData4, eventData5); 116 eventData3, eventData4, eventData5);
114} 117}
115 118
119extern void *iseries_hv_alloc(size_t size, dma_addr_t *dma_handle, gfp_t flag);
120extern void iseries_hv_free(size_t size, void *vaddr, dma_addr_t dma_handle);
121extern dma_addr_t iseries_hv_map(void *vaddr, size_t size,
122 enum dma_data_direction direction);
123extern void iseries_hv_unmap(dma_addr_t dma_handle, size_t size,
124 enum dma_data_direction direction);
125
116static inline HvLpEvent_Rc HvCallEvent_ackLpEvent(struct HvLpEvent *event) 126static inline HvLpEvent_Rc HvCallEvent_ackLpEvent(struct HvLpEvent *event)
117{ 127{
118 return HvCall1(HvCallEventAckLpEvent, virt_to_abs(event)); 128 return HvCall1(HvCallEventAckLpEvent, virt_to_abs(event));
diff --git a/include/asm-powerpc/iseries/iommu.h b/include/asm-powerpc/iseries/iommu.h
index 6e323a13ac30..c59ee7e4bed1 100644
--- a/include/asm-powerpc/iseries/iommu.h
+++ b/include/asm-powerpc/iseries/iommu.h
@@ -22,6 +22,7 @@
22 */ 22 */
23 23
24struct pci_dev; 24struct pci_dev;
25struct vio_dev;
25struct device_node; 26struct device_node;
26struct iommu_table; 27struct iommu_table;
27 28
@@ -34,4 +35,7 @@ extern void iommu_table_getparms_iSeries(unsigned long busno,
34 unsigned char slotno, unsigned char virtbus, 35 unsigned char slotno, unsigned char virtbus,
35 struct iommu_table *tbl); 36 struct iommu_table *tbl);
36 37
38extern struct iommu_table *vio_build_iommu_table_iseries(struct vio_dev *dev);
39extern void iommu_vio_init(void);
40
37#endif /* _ASM_POWERPC_ISERIES_IOMMU_H */ 41#endif /* _ASM_POWERPC_ISERIES_IOMMU_H */
diff --git a/include/asm-powerpc/iseries/vio.h b/include/asm-powerpc/iseries/vio.h
index 7a95d296abd1..f9ac0d00b951 100644
--- a/include/asm-powerpc/iseries/vio.h
+++ b/include/asm-powerpc/iseries/vio.h
@@ -51,6 +51,116 @@
51 */ 51 */
52#define VIO_MAX_SUBTYPES 8 52#define VIO_MAX_SUBTYPES 8
53 53
54#define VIOMAXBLOCKDMA 12
55
56struct open_data {
57 u64 disk_size;
58 u16 max_disk;
59 u16 cylinders;
60 u16 tracks;
61 u16 sectors;
62 u16 bytes_per_sector;
63};
64
65struct rw_data {
66 u64 offset;
67 struct {
68 u32 token;
69 u32 reserved;
70 u64 len;
71 } dma_info[VIOMAXBLOCKDMA];
72};
73
74struct vioblocklpevent {
75 struct HvLpEvent event;
76 u32 reserved;
77 u16 version;
78 u16 sub_result;
79 u16 disk;
80 u16 flags;
81 union {
82 struct open_data open_data;
83 struct rw_data rw_data;
84 u64 changed;
85 } u;
86};
87
88#define vioblockflags_ro 0x0001
89
90enum vioblocksubtype {
91 vioblockopen = 0x0001,
92 vioblockclose = 0x0002,
93 vioblockread = 0x0003,
94 vioblockwrite = 0x0004,
95 vioblockflush = 0x0005,
96 vioblockcheck = 0x0007
97};
98
99struct viocdlpevent {
100 struct HvLpEvent event;
101 u32 reserved;
102 u16 version;
103 u16 sub_result;
104 u16 disk;
105 u16 flags;
106 u32 token;
107 u64 offset; /* On open, max number of disks */
108 u64 len; /* On open, size of the disk */
109 u32 block_size; /* Only set on open */
110 u32 media_size; /* Only set on open */
111};
112
113enum viocdsubtype {
114 viocdopen = 0x0001,
115 viocdclose = 0x0002,
116 viocdread = 0x0003,
117 viocdwrite = 0x0004,
118 viocdlockdoor = 0x0005,
119 viocdgetinfo = 0x0006,
120 viocdcheck = 0x0007
121};
122
123struct viotapelpevent {
124 struct HvLpEvent event;
125 u32 reserved;
126 u16 version;
127 u16 sub_type_result;
128 u16 tape;
129 u16 flags;
130 u32 token;
131 u64 len;
132 union {
133 struct {
134 u32 tape_op;
135 u32 count;
136 } op;
137 struct {
138 u32 type;
139 u32 resid;
140 u32 dsreg;
141 u32 gstat;
142 u32 erreg;
143 u32 file_no;
144 u32 block_no;
145 } get_status;
146 struct {
147 u32 block_no;
148 } get_pos;
149 } u;
150};
151
152enum viotapesubtype {
153 viotapeopen = 0x0001,
154 viotapeclose = 0x0002,
155 viotaperead = 0x0003,
156 viotapewrite = 0x0004,
157 viotapegetinfo = 0x0005,
158 viotapeop = 0x0006,
159 viotapegetpos = 0x0007,
160 viotapesetpos = 0x0008,
161 viotapegetstatus = 0x0009
162};
163
54/* 164/*
55 * Each subtype can register a handler to process their events. 165 * Each subtype can register a handler to process their events.
56 * The handler must have this interface. 166 * The handler must have this interface.
@@ -68,6 +178,8 @@ extern void vio_set_hostlp(void);
68extern void *vio_get_event_buffer(int subtype); 178extern void *vio_get_event_buffer(int subtype);
69extern void vio_free_event_buffer(int subtype, void *buffer); 179extern void vio_free_event_buffer(int subtype, void *buffer);
70 180
181extern struct vio_dev *vio_create_viodasd(u32 unit);
182
71extern HvLpIndex viopath_hostLp; 183extern HvLpIndex viopath_hostLp;
72extern HvLpIndex viopath_ourLp; 184extern HvLpIndex viopath_ourLp;
73 185
@@ -150,8 +262,4 @@ enum viochar_rc {
150 viochar_rc_ebusy = 1 262 viochar_rc_ebusy = 1
151}; 263};
152 264
153struct device;
154
155extern struct device *iSeries_vio_dev;
156
157#endif /* _ASM_POWERPC_ISERIES_VIO_H */ 265#endif /* _ASM_POWERPC_ISERIES_VIO_H */
diff --git a/include/asm-powerpc/machdep.h b/include/asm-powerpc/machdep.h
index 71c6e7eb2a26..cc7c17f16a9a 100644
--- a/include/asm-powerpc/machdep.h
+++ b/include/asm-powerpc/machdep.h
@@ -99,7 +99,7 @@ struct machdep_calls {
99#endif /* CONFIG_PPC64 */ 99#endif /* CONFIG_PPC64 */
100 100
101 int (*probe)(void); 101 int (*probe)(void);
102 void (*setup_arch)(void); 102 void (*setup_arch)(void); /* Optional, may be NULL */
103 void (*init_early)(void); 103 void (*init_early)(void);
104 /* Optional, may be NULL. */ 104 /* Optional, may be NULL. */
105 void (*show_cpuinfo)(struct seq_file *m); 105 void (*show_cpuinfo)(struct seq_file *m);
diff --git a/include/asm-powerpc/vio.h b/include/asm-powerpc/vio.h
index 598d111e8098..9204c15839c5 100644
--- a/include/asm-powerpc/vio.h
+++ b/include/asm-powerpc/vio.h
@@ -53,17 +53,12 @@ struct vio_dev {
53}; 53};
54 54
55struct vio_driver { 55struct vio_driver {
56 struct list_head node;
57 const struct vio_device_id *id_table; 56 const struct vio_device_id *id_table;
58 int (*probe)(struct vio_dev *dev, const struct vio_device_id *id); 57 int (*probe)(struct vio_dev *dev, const struct vio_device_id *id);
59 int (*remove)(struct vio_dev *dev); 58 int (*remove)(struct vio_dev *dev);
60 void (*shutdown)(struct vio_dev *dev);
61 unsigned long driver_data;
62 struct device_driver driver; 59 struct device_driver driver;
63}; 60};
64 61
65extern struct dma_mapping_ops vio_dma_ops;
66
67extern int vio_register_driver(struct vio_driver *drv); 62extern int vio_register_driver(struct vio_driver *drv);
68extern void vio_unregister_driver(struct vio_driver *drv); 63extern void vio_unregister_driver(struct vio_driver *drv);
69 64