1 /******************************************************************************
2  * config.h
3  *
4  * A Linux-style configuration list.
5  */
6 
7 #ifndef __XEN_CONFIG_H__
8 #define __XEN_CONFIG_H__
9 
10 #ifdef CPPCHECK
11 #include <generated/compiler-def.h>
12 #endif
13 
14 #include <xen/kconfig.h>
15 
16 #ifndef __ASSEMBLY__
17 #include <xen/compiler.h>
18 
19 #if defined(CONFIG_ENFORCE_UNIQUE_SYMBOLS) || defined(__clang__)
20 # define EMIT_FILE asm ( "" )
21 #else
22 # define EMIT_FILE asm ( ".file \"" __FILE__ "\"" )
23 #endif
24 
25 #endif
26 
27 #include <asm/config.h>
28 
29 #define EXPORT_SYMBOL(var)
30 
31 /*
32  * The following log levels are as follows:
33  *
34  *   XENLOG_ERR: Fatal errors, either Xen, Guest or Dom0
35  *               is about to crash.
36  *
37  *   XENLOG_WARNING: Something bad happened, but we can recover.
38  *
39  *   XENLOG_INFO: Interesting stuff, but not too noisy.
40  *
41  *   XENLOG_DEBUG: Use where ever you like. Lots of noise.
42  *
43  *
44  * Since we don't trust the guest operating system, we don't want
45  * it to allow for DoS by causing the HV to print out a lot of
46  * info, so where ever the guest has control of what is printed
47  * we use the XENLOG_GUEST to distinguish that the output is
48  * controlled by the guest.
49  *
50  * To make it easier on the typing, the above log levels all
51  * have a corresponding _G_ equivalent that appends the
52  * XENLOG_GUEST. (see the defines below).
53  *
54  */
55 #define XENLOG_ERR     "<0>"
56 #define XENLOG_WARNING "<1>"
57 #define XENLOG_INFO    "<2>"
58 #define XENLOG_DEBUG   "<3>"
59 
60 #define XENLOG_GUEST   "<G>"
61 
62 #define XENLOG_G_ERR     XENLOG_GUEST XENLOG_ERR
63 #define XENLOG_G_WARNING XENLOG_GUEST XENLOG_WARNING
64 #define XENLOG_G_INFO    XENLOG_GUEST XENLOG_INFO
65 #define XENLOG_G_DEBUG   XENLOG_GUEST XENLOG_DEBUG
66 
67 /*
68  * Some code is copied directly from Linux.
69  * Match some of the Linux log levels to Xen.
70  */
71 #define KERN_ERR       XENLOG_ERR
72 #define KERN_CRIT      XENLOG_ERR
73 #define KERN_EMERG     XENLOG_ERR
74 #define KERN_WARNING   XENLOG_WARNING
75 #define KERN_NOTICE    XENLOG_INFO
76 #define KERN_INFO      XENLOG_INFO
77 #define KERN_DEBUG     XENLOG_DEBUG
78 
79 /* Linux 'checker' project. */
80 #define __iomem
81 #define __user
82 #define __force
83 #define __bitwise
84 
85 #define KB(_kb)     (_AC(_kb, ULL) << 10)
86 #define MB(_mb)     (_AC(_mb, ULL) << 20)
87 #define GB(_gb)     (_AC(_gb, ULL) << 30)
88 
89 /* allow existing code to work with Kconfig variable */
90 #define NR_CPUS CONFIG_NR_CPUS
91 
92 #ifndef CONFIG_DEBUG
93 #define NDEBUG
94 #endif
95 
96 #ifndef ZERO_BLOCK_PTR
97 /* Return value for zero-size allocation, distinguished from NULL. */
98 #define ZERO_BLOCK_PTR ((void *)-1L)
99 #endif
100 
101 #define BYTES_PER_LONG  __SIZEOF_LONG__
102 
103 #define BITS_PER_BYTE   __CHAR_BIT__
104 #define BITS_PER_INT    (BITS_PER_BYTE * __SIZEOF_INT__)
105 #define BITS_PER_LONG   (BITS_PER_BYTE * BYTES_PER_LONG)
106 #define BITS_PER_LLONG  (BITS_PER_BYTE * __SIZEOF_LONG_LONG__)
107 
108 /* It is assumed that sizeof(void *) == __alignof(void *) */
109 #define POINTER_ALIGN   __SIZEOF_POINTER__
110 
111 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
112 # define __LITTLE_ENDIAN
113 # define __LITTLE_ENDIAN_BITFIELD
114 #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
115 # define __BIG_ENDIAN
116 # define __BIG_ENDIAN_BITFIELD
117 #endif
118 
119 #endif /* __XEN_CONFIG_H__ */
120