Merge tag 'sched-urgent-2020-12-27' of git://git.kernel.org/pub/scm/linux/kernel...
[linux/fpc-iii.git] / arch / powerpc / boot / xz_config.h
blobebfadd39e1924a357bdb818a5a60d3353c1dfa6c
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __XZ_CONFIG_H__
3 #define __XZ_CONFIG_H__
5 /*
6 * most of this is copied from lib/xz/xz_private.h, we can't use their defines
7 * since the boot wrapper is not built in the same environment as the rest of
8 * the kernel.
9 */
11 #include "types.h"
12 #include "swab.h"
14 static inline uint32_t swab32p(void *p)
16 uint32_t *q = p;
18 return swab32(*q);
21 #ifdef __LITTLE_ENDIAN__
22 #define get_le32(p) (*((uint32_t *) (p)))
23 #define cpu_to_be32(x) swab32(x)
24 static inline u32 be32_to_cpup(const u32 *p)
26 return swab32p((u32 *)p);
28 #else
29 #define get_le32(p) swab32p(p)
30 #define cpu_to_be32(x) (x)
31 static inline u32 be32_to_cpup(const u32 *p)
33 return *p;
35 #endif
37 static inline uint32_t get_unaligned_be32(const void *p)
39 return be32_to_cpup(p);
42 static inline void put_unaligned_be32(u32 val, void *p)
44 *((u32 *)p) = cpu_to_be32(val);
47 #define memeq(a, b, size) (memcmp(a, b, size) == 0)
48 #define memzero(buf, size) memset(buf, 0, size)
50 /* prevent the inclusion of the xz-preboot MM headers */
51 #define DECOMPR_MM_H
52 #define memmove memmove
53 #define XZ_EXTERN static
55 /* xz.h needs to be included directly since we need enum xz_mode */
56 #include "../../../include/linux/xz.h"
58 #undef XZ_EXTERN
60 #endif