aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2009-10-05 16:28:47 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-10-27 01:42:39 -0400
commit171fb12570b479723c49ef9f8911e40e516f3394 (patch)
tree9d1c1c2162fab3e16caa6da0700271b922dd10a5 /arch/powerpc/platforms
parent7abb840b496f834a71a8943bb189683da320f047 (diff)
powerpc/iseries: Remove compiler version dependent hack
The creation of the flattened device tree depended on the compiler putting the constant strings for an object in a section with a particular name. This was changed with recent compilers. Do this explicitly instead. Without this patch, iseries kernels may silently not boot when built with some compilers. Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r--arch/powerpc/platforms/iseries/Makefile11
-rw-r--r--arch/powerpc/platforms/iseries/dt.c56
2 files changed, 25 insertions, 42 deletions
diff --git a/arch/powerpc/platforms/iseries/Makefile b/arch/powerpc/platforms/iseries/Makefile
index cc7161ff1666..ce014928d460 100644
--- a/arch/powerpc/platforms/iseries/Makefile
+++ b/arch/powerpc/platforms/iseries/Makefile
@@ -1,18 +1,9 @@
1EXTRA_CFLAGS += -mno-minimal-toc 1EXTRA_CFLAGS += -mno-minimal-toc
2 2
3extra-y += dt.o
4
5obj-y += exception.o 3obj-y += exception.o
6obj-y += hvlog.o hvlpconfig.o lpardata.o setup.o dt_mod.o mf.o lpevents.o \ 4obj-y += hvlog.o hvlpconfig.o lpardata.o setup.o dt.o mf.o lpevents.o \
7 hvcall.o proc.o htab.o iommu.o misc.o irq.o 5 hvcall.o proc.o htab.o iommu.o misc.o irq.o
8obj-$(CONFIG_PCI) += pci.o 6obj-$(CONFIG_PCI) += pci.o
9obj-$(CONFIG_SMP) += smp.o 7obj-$(CONFIG_SMP) += smp.o
10obj-$(CONFIG_VIOPATH) += viopath.o vio.o 8obj-$(CONFIG_VIOPATH) += viopath.o vio.o
11obj-$(CONFIG_MODULES) += ksyms.o 9obj-$(CONFIG_MODULES) += ksyms.o
12
13quiet_cmd_dt_strings = DT_STR $@
14 cmd_dt_strings = $(OBJCOPY) --rename-section .rodata.str1.8=.dt_strings \
15 $< $@
16
17$(obj)/dt_mod.o: $(obj)/dt.o
18 $(call if_changed,dt_strings)
diff --git a/arch/powerpc/platforms/iseries/dt.c b/arch/powerpc/platforms/iseries/dt.c
index c5a87a72057b..7f45a51fe793 100644
--- a/arch/powerpc/platforms/iseries/dt.c
+++ b/arch/powerpc/platforms/iseries/dt.c
@@ -51,11 +51,16 @@
51 51
52/* 52/*
53 * These are created by the linker script at the start and end 53 * These are created by the linker script at the start and end
54 * of the section containing all the strings from this file. 54 * of the section containing all the strings marked with the DS macro.
55 */ 55 */
56extern char __dt_strings_start[]; 56extern char __dt_strings_start[];
57extern char __dt_strings_end[]; 57extern char __dt_strings_end[];
58 58
59#define DS(s) ({ \
60 static const char __s[] __attribute__((section(".dt_strings"))) = s; \
61 __s; \
62})
63
59struct iseries_flat_dt { 64struct iseries_flat_dt {
60 struct boot_param_header header; 65 struct boot_param_header header;
61 u64 reserve_map[2]; 66 u64 reserve_map[2];
@@ -64,9 +69,8 @@ struct iseries_flat_dt {
64static void * __initdata dt_data; 69static void * __initdata dt_data;
65 70
66/* 71/*
67 * Putting these strings here keeps them out of the section 72 * Putting these strings here keeps them out of the .dt_strings section
68 * that we rename to .dt_strings using objcopy and capture 73 * that we capture for the strings blob of the flattened device tree.
69 * for the strings blob of the flattened device tree.
70 */ 74 */
71static char __initdata device_type_cpu[] = "cpu"; 75static char __initdata device_type_cpu[] = "cpu";
72static char __initdata device_type_memory[] = "memory"; 76static char __initdata device_type_memory[] = "memory";
@@ -173,7 +177,7 @@ static void __init dt_start_node(struct iseries_flat_dt *dt, const char *name)
173 177
174#define dt_end_node(dt) dt_push_u32(dt, OF_DT_END_NODE) 178#define dt_end_node(dt) dt_push_u32(dt, OF_DT_END_NODE)
175 179
176static void __init dt_prop(struct iseries_flat_dt *dt, const char *name, 180static void __init __dt_prop(struct iseries_flat_dt *dt, const char *name,
177 const void *data, int len) 181 const void *data, int len)
178{ 182{
179 unsigned long offset; 183 unsigned long offset;
@@ -191,44 +195,32 @@ static void __init dt_prop(struct iseries_flat_dt *dt, const char *name,
191 /* The actual data. */ 195 /* The actual data. */
192 dt_push_bytes(dt, data, len); 196 dt_push_bytes(dt, data, len);
193} 197}
198#define dt_prop(dt, name, data, len) __dt_prop((dt), DS(name), (data), (len))
194 199
195static void __init dt_prop_str(struct iseries_flat_dt *dt, const char *name, 200#define dt_prop_str(dt, name, data) \
196 const char *data) 201 dt_prop((dt), name, (data), strlen((data)) + 1); /* + 1 for NULL */
197{
198 dt_prop(dt, name, data, strlen(data) + 1); /* + 1 for NULL */
199}
200 202
201static void __init dt_prop_u32(struct iseries_flat_dt *dt, const char *name, 203static void __init __dt_prop_u32(struct iseries_flat_dt *dt, const char *name,
202 u32 data) 204 u32 data)
203{ 205{
204 dt_prop(dt, name, &data, sizeof(u32)); 206 __dt_prop(dt, name, &data, sizeof(u32));
205} 207}
208#define dt_prop_u32(dt, name, data) __dt_prop_u32((dt), DS(name), (data))
206 209
207static void __init __maybe_unused dt_prop_u64(struct iseries_flat_dt *dt, 210static void __init __maybe_unused __dt_prop_u64(struct iseries_flat_dt *dt,
208 const char *name, 211 const char *name, u64 data)
209 u64 data)
210{ 212{
211 dt_prop(dt, name, &data, sizeof(u64)); 213 __dt_prop(dt, name, &data, sizeof(u64));
212} 214}
215#define dt_prop_u64(dt, name, data) __dt_prop_u64((dt), DS(name), (data))
213 216
214static void __init dt_prop_u64_list(struct iseries_flat_dt *dt, 217#define dt_prop_u64_list(dt, name, data, n) \
215 const char *name, u64 *data, int n) 218 dt_prop((dt), name, (data), sizeof(u64) * (n))
216{
217 dt_prop(dt, name, data, sizeof(u64) * n);
218}
219 219
220static void __init dt_prop_u32_list(struct iseries_flat_dt *dt, 220#define dt_prop_u32_list(dt, name, data, n) \
221 const char *name, u32 *data, int n) 221 dt_prop((dt), name, (data), sizeof(u32) * (n))
222{
223 dt_prop(dt, name, data, sizeof(u32) * n);
224}
225 222
226#ifdef notyet 223#define dt_prop_empty(dt, name) dt_prop((dt), name, NULL, 0)
227static void __init dt_prop_empty(struct iseries_flat_dt *dt, const char *name)
228{
229 dt_prop(dt, name, NULL, 0);
230}
231#endif
232 224
233static void __init dt_cpus(struct iseries_flat_dt *dt) 225static void __init dt_cpus(struct iseries_flat_dt *dt)
234{ 226{