ia64/xen-unstable

view xen/include/xen/init.h @ 19800:78962f85c562

IOMMU: Add two generic functions to vendor neutral interface

Add 2 generic functions into the vendor neutral iommu interface, The
reason is that from changeset 19732, there is only one global flag
"iommu_enabled" that controls iommu enablement for both vtd and amd
systems, so we need different code paths for vtd and amd iommu systems
if this flag has been turned on. Also, the early checking of
"iommu_enabled" in iommu_setup() is removed to prevent iommu
functionalities from been disabled on amd systems.

Signed-off-by: Wei Wang <wei.wang2@amd.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Jun 19 08:41:50 2009 +0100 (2009-06-19)
parents 5e8eb0cf2daf
children
line source
1 #ifndef _LINUX_INIT_H
2 #define _LINUX_INIT_H
4 #include <xen/config.h>
5 #include <asm/init.h>
7 /*
8 * Mark functions and data as being only used at initialization
9 * or exit time.
10 */
11 #define __init \
12 __attribute__ ((__section__ (".init.text")))
13 #define __exit \
14 __attribute_used__ __attribute__ ((__section__(".exit.text")))
15 #define __initdata \
16 __attribute__ ((__section__ (".init.data")))
17 #define __exitdata \
18 __attribute_used__ __attribute__ ((__section__ (".exit.data")))
19 #define __initsetup \
20 __attribute_used__ __attribute__ ((__section__ (".init.setup")))
21 #define __init_call \
22 __attribute_used__ __attribute__ ((__section__ (".initcall1.init")))
23 #define __exit_call \
24 __attribute_used__ __attribute__ ((__section__ (".exitcall.exit")))
26 /* These macros are used to mark some functions or
27 * initialized data (doesn't apply to uninitialized data)
28 * as `initialization' functions. The kernel can take this
29 * as hint that the function is used only during the initialization
30 * phase and free up used memory resources after
31 *
32 * Usage:
33 * For functions:
34 *
35 * You should add __init immediately before the function name, like:
36 *
37 * static void __init initme(int x, int y)
38 * {
39 * extern int z; z = x * y;
40 * }
41 *
42 * If the function has a prototype somewhere, you can also add
43 * __init between closing brace of the prototype and semicolon:
44 *
45 * extern int initialize_foobar_device(int, int, int) __init;
46 *
47 * For initialized data:
48 * You should insert __initdata between the variable name and equal
49 * sign followed by value, e.g.:
50 *
51 * static int init_variable __initdata = 0;
52 * static char linux_logo[] __initdata = { 0x32, 0x36, ... };
53 *
54 * Don't forget to initialize data not at file scope, i.e. within a function,
55 * as gcc otherwise puts the data into the bss section and not into the init
56 * section.
57 *
58 * Also note, that this data cannot be "const".
59 */
61 #ifndef __ASSEMBLY__
63 /*
64 * Used for initialization calls..
65 */
66 typedef int (*initcall_t)(void);
67 typedef void (*exitcall_t)(void);
69 extern initcall_t __initcall_start, __initcall_end;
71 #define __initcall(fn) \
72 static initcall_t __initcall_##fn __init_call = fn
73 #define __exitcall(fn) \
74 static exitcall_t __exitcall_##fn __exit_call = fn
76 /*
77 * Used for kernel command line parameter setup
78 */
79 struct kernel_param {
80 const char *name;
81 enum { OPT_STR, OPT_UINT, OPT_BOOL, OPT_INVBOOL, OPT_CUSTOM } type;
82 void *var;
83 unsigned int len;
84 };
86 extern struct kernel_param __setup_start, __setup_end;
88 #define custom_param(_name, _var) \
89 static char __setup_str_##_var[] __initdata = _name; \
90 static struct kernel_param __setup_##_var __attribute_used__ \
91 __initsetup = { __setup_str_##_var, OPT_CUSTOM, &_var, 0 }
92 #define boolean_param(_name, _var) \
93 static char __setup_str_##_var[] __initdata = _name; \
94 static struct kernel_param __setup_##_var __attribute_used__ \
95 __initsetup = { __setup_str_##_var, OPT_BOOL, &_var, sizeof(_var) }
96 #define invbool_param(_name, _var) \
97 static char __setup_str_##_var[] __initdata = _name; \
98 static struct kernel_param __setup_##_var __attribute_used__ \
99 __initsetup = { __setup_str_##_var, OPT_INVBOOL, &_var, sizeof(_var) }
100 #define integer_param(_name, _var) \
101 static char __setup_str_##_var[] __initdata = _name; \
102 static struct kernel_param __setup_##_var __attribute_used__ \
103 __initsetup = { __setup_str_##_var, OPT_UINT, &_var, sizeof(_var) }
104 #define string_param(_name, _var) \
105 static char __setup_str_##_var[] __initdata = _name; \
106 static struct kernel_param __setup_##_var __attribute_used__ \
107 __initsetup = { __setup_str_##_var, OPT_STR, &_var, sizeof(_var) }
109 /* Make sure obsolete cmdline params don't break the build. */
110 #define __setup(_name, _fn) static void * __attribute_used__ _dummy_##_fn = _fn
112 #endif /* __ASSEMBLY__ */
114 #ifdef CONFIG_HOTPLUG
115 #define __devinit
116 #define __devinitdata
117 #define __devexit
118 #define __devexitdata
119 #else
120 #define __devinit __init
121 #define __devinitdata __initdata
122 #define __devexit __exit
123 #define __devexitdata __exitdata
124 #endif
126 #endif /* _LINUX_INIT_H */