summaryrefslogtreecommitdiff
path: root/lib_generic/lzo/lzodefs.h
diff options
context:
space:
mode:
authorStefan Roese <sr@denx.de>2009-03-19 15:34:56 +0100
committerWolfgang Denk <wd@denx.de>2009-03-20 22:39:15 +0100
commitb1b4e89a0f3b75854c39a62cae41bad56d210adf (patch)
tree460e7663f9d619596f29768e7296872e6dcf3001 /lib_generic/lzo/lzodefs.h
parent68d7d65100e84df00bca971c114092731b441090 (diff)
Add LZO decompressor support
This patch adds LZO decompression support to U-Boot. It is needed for the upcoming UBIFS support, since UBIFS uses LZO as default compressor/ decompressor. Since we only support read-only in UBIFS, only the decompressor is needed. All this is copied with minor changes from the current Linux kernel version (2.6.28-rc8). This patch only implements this LZO decompressor support for PPC. Other platforms using UBIFS will have to add the required "include/asm/unaligned.h" as well. It should be fairly easy to copy this from the Linux source tree as I have done it for PPC in this patch. Signed-off-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'lib_generic/lzo/lzodefs.h')
-rw-r--r--lib_generic/lzo/lzodefs.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/lib_generic/lzo/lzodefs.h b/lib_generic/lzo/lzodefs.h
new file mode 100644
index 000000000..b6d482c49
--- /dev/null
+++ b/lib_generic/lzo/lzodefs.h
@@ -0,0 +1,43 @@
+/*
+ * lzodefs.h -- architecture, OS and compiler specific defines
+ *
+ * Copyright (C) 1996-2005 Markus F.X.J. Oberhumer <markus@oberhumer.com>
+ *
+ * The full LZO package can be found at:
+ * http://www.oberhumer.com/opensource/lzo/
+ *
+ * Changed for kernel use by:
+ * Nitin Gupta <nitingupta910@gmail.com>
+ * Richard Purdie <rpurdie@openedhand.com>
+ */
+
+#define LZO_VERSION 0x2020
+#define LZO_VERSION_STRING "2.02"
+#define LZO_VERSION_DATE "Oct 17 2005"
+
+#define M1_MAX_OFFSET 0x0400
+#define M2_MAX_OFFSET 0x0800
+#define M3_MAX_OFFSET 0x4000
+#define M4_MAX_OFFSET 0xbfff
+
+#define M1_MIN_LEN 2
+#define M1_MAX_LEN 2
+#define M2_MIN_LEN 3
+#define M2_MAX_LEN 8
+#define M3_MIN_LEN 3
+#define M3_MAX_LEN 33
+#define M4_MIN_LEN 3
+#define M4_MAX_LEN 9
+
+#define M1_MARKER 0
+#define M2_MARKER 64
+#define M3_MARKER 32
+#define M4_MARKER 16
+
+#define D_BITS 14
+#define D_MASK ((1u << D_BITS) - 1)
+#define D_HIGH ((D_MASK >> 1) + 1)
+
+#define DX2(p, s1, s2) (((((size_t)((p)[2]) << (s2)) ^ (p)[1]) \
+ << (s1)) ^ (p)[0])
+#define DX3(p, s1, s2, s3) ((DX2((p)+1, s2, s3) << (s1)) ^ (p)[0])