Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __XZ_CONFIG_H__
0003 #define __XZ_CONFIG_H__
0004 
0005 /*
0006  * most of this is copied from lib/xz/xz_private.h, we can't use their defines
0007  * since the boot wrapper is not built in the same environment as the rest of
0008  * the kernel.
0009  */
0010 
0011 #include "types.h"
0012 #include "swab.h"
0013 
0014 static inline uint32_t swab32p(void *p)
0015 {
0016     uint32_t *q = p;
0017 
0018     return swab32(*q);
0019 }
0020 
0021 #ifdef __LITTLE_ENDIAN__
0022 #define get_le32(p) (*((uint32_t *) (p)))
0023 #define cpu_to_be32(x) swab32(x)
0024 static inline u32 be32_to_cpup(const u32 *p)
0025 {
0026     return swab32p((u32 *)p);
0027 }
0028 #else
0029 #define get_le32(p) swab32p(p)
0030 #define cpu_to_be32(x) (x)
0031 static inline u32 be32_to_cpup(const u32 *p)
0032 {
0033     return *p;
0034 }
0035 #endif
0036 
0037 static inline uint32_t get_unaligned_be32(const void *p)
0038 {
0039     return be32_to_cpup(p);
0040 }
0041 
0042 static inline void put_unaligned_be32(u32 val, void *p)
0043 {
0044     *((u32 *)p) = cpu_to_be32(val);
0045 }
0046 
0047 #define memeq(a, b, size) (memcmp(a, b, size) == 0)
0048 #define memzero(buf, size) memset(buf, 0, size)
0049 
0050 /* prevent the inclusion of the xz-preboot MM headers */
0051 #define DECOMPR_MM_H
0052 #define memmove memmove
0053 #define XZ_EXTERN static
0054 
0055 /* xz.h needs to be included directly since we need enum xz_mode */
0056 #include "../../../include/linux/xz.h"
0057 
0058 #undef XZ_EXTERN
0059 
0060 #endif