blob: 0d62cab5c2e8ce6f03a165ad0a55a6e4da7ad13d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
#ifndef _LINUX_IMMEDIATE_H
#define _LINUX_IMMEDIATE_H
/*
* Immediate values, can be updated at runtime and save cache lines.
*
* (C) Copyright 2007 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
*
* Dual BSD/GPL v2 license.
*/
#ifdef CONFIG_IMMEDIATE
struct __imv {
unsigned long var; /* Pointer to the identifier variable of the
* immediate value
*/
unsigned long imv; /*
* Pointer to the memory location of the
* immediate value within the instruction.
*/
unsigned char size; /* Type size. */
} __attribute__ ((packed));
#include <asm/immediate.h>
/**
* imv_set - set immediate variable (with locking)
* @name: immediate value name
* @i: required value
*
* Sets the value of @name, taking the module_mutex if required by
* the architecture.
*/
#define imv_set(name, i) \
do { \
name##__imv = (i); \
core_imv_update(); \
module_imv_update(); \
} while (0)
/*
* Internal update functions.
*/
extern void core_imv_update(void);
extern void imv_update_range(const struct __imv *begin,
const struct __imv *end);
#else
/*
* Generic immediate values: a simple, standard, memory load.
*/
/**
* imv_read - read immediate variable
* @name: immediate value name
*
* Reads the value of @name.
*/
#define imv_read(name) _imv_read(name)
/**
* imv_set - set immediate variable (with locking)
* @name: immediate value name
* @i: required value
*
* Sets the value of @name, taking the module_mutex if required by
* the architecture.
*/
#define imv_set(name, i) (name##__imv = (i))
static inline void core_imv_update(void) { }
static inline void module_imv_update(void) { }
#endif
#define DECLARE_IMV(type, name) extern __typeof__(type) name##__imv
#define DEFINE_IMV(type, name) __typeof__(type) name##__imv
#define EXPORT_IMV_SYMBOL(name) EXPORT_SYMBOL(name##__imv)
#define EXPORT_IMV_SYMBOL_GPL(name) EXPORT_SYMBOL_GPL(name##__imv)
/**
* _imv_read - Read immediate value with standard memory load.
* @name: immediate value name
*
* Force a data read of the immediate value instead of the immediate value
* based mechanism. Useful for __init and __exit section data read.
*/
#define _imv_read(name) (name##__imv)
#endif
|