aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/boot/Makefile4
-rw-r--r--lib/zlib_inflate/inffast.c32
2 files changed, 31 insertions, 5 deletions
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 826a30a00f59..bb2465bcb327 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -20,7 +20,7 @@
20all: $(obj)/zImage 20all: $(obj)/zImage
21 21
22BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ 22BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
23 -fno-strict-aliasing -Os -msoft-float -pipe -D__KERNEL__\ 23 -fno-strict-aliasing -Os -msoft-float -pipe \
24 -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \ 24 -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
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
@@ -34,8 +34,6 @@ BOOTCFLAGS += -fno-stack-protector
34endif 34endif
35 35
36BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) 36BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj)
37BOOTCFLAGS += -include include/linux/autoconf.h -Iarch/powerpc/include
38BOOTCFLAGS += -Iinclude
39 37
40DTS_FLAGS ?= -p 1024 38DTS_FLAGS ?= -p 1024
41 39
diff --git a/lib/zlib_inflate/inffast.c b/lib/zlib_inflate/inffast.c
index 05e1559fa156..215447c55261 100644
--- a/lib/zlib_inflate/inffast.c
+++ b/lib/zlib_inflate/inffast.c
@@ -4,12 +4,25 @@
4 */ 4 */
5 5
6#include <linux/zutil.h> 6#include <linux/zutil.h>
7#include <asm/unaligned.h>
8#include <asm/byteorder.h>
9#include "inftrees.h" 7#include "inftrees.h"
10#include "inflate.h" 8#include "inflate.h"
11#include "inffast.h" 9#include "inffast.h"
12 10
11/* Only do the unaligned "Faster" variant when
12 * CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is set
13 *
14 * On powerpc, it won't be as we don't include autoconf.h
15 * automatically for the boot wrapper, which is intended as
16 * we run in an environment where we may not be able to deal
17 * with (even rare) alignment faults. In addition, we do not
18 * define __KERNEL__ for arch/powerpc/boot unlike x86
19 */
20
21#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
22#include <asm/unaligned.h>
23#include <asm/byteorder.h>
24#endif
25
13#ifndef ASMINF 26#ifndef ASMINF
14 27
15/* Allow machine dependent optimization for post-increment or pre-increment. 28/* Allow machine dependent optimization for post-increment or pre-increment.
@@ -243,6 +256,7 @@ void inflate_fast(z_streamp strm, unsigned start)
243 } 256 }
244 } 257 }
245 else { 258 else {
259#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
246 unsigned short *sout; 260 unsigned short *sout;
247 unsigned long loops; 261 unsigned long loops;
248 262
@@ -284,6 +298,20 @@ void inflate_fast(z_streamp strm, unsigned start)
284 } 298 }
285 if (len & 1) 299 if (len & 1)
286 PUP(out) = PUP(from); 300 PUP(out) = PUP(from);
301#else /* CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS */
302 from = out - dist; /* copy direct from output */
303 do { /* minimum length is three */
304 PUP(out) = PUP(from);
305 PUP(out) = PUP(from);
306 PUP(out) = PUP(from);
307 len -= 3;
308 } while (len > 2);
309 if (len) {
310 PUP(out) = PUP(from);
311 if (len > 1)
312 PUP(out) = PUP(from);
313 }
314#endif /* !CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS */
287 } 315 }
288 } 316 }
289 else if ((op & 64) == 0) { /* 2nd level distance code */ 317 else if ((op & 64) == 0) { /* 2nd level distance code */