summaryrefslogtreecommitdiff
path: root/src/drivers/intel/fsp2_0/header_util/fspupdvpd.spatch
blob: 502db14189a27fa316bda0c80351f9a050d43c39 (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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
/* This file is part of the coreboot project. */
/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This semantic patch is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

/* Semantic patch for fspupdvpd_sanitize.sh. Please call the script directly. */

@ kill_pragma_pack @
@@
- #pragma pack(...)

/*
 * Convert named typedef'd structs
 * Example : typedef struct name {} name_t; -> struct name {};
 */
@ named_struct @
identifier i;
type t;
@@
typedef struct i { ... } t;

/* Make typename usable as identifier */
@ script:python named_struct_type @
t << named_struct.t;
i;
@@
coccinelle.i = t.rstrip('_t')

@ convert_FSP_UPD_HEADER @
typedef FSP_UPD_HEADER;
@@
- FSP_UPD_HEADER
+ struct FSP_UPD_HEADER

@ convert_FSPM_ARCH_UPD @
typedef FSPM_ARCH_UPD;
@@
- FSPM_ARCH_UPD
+ struct FSPM_ARCH_UPD

@ convert_named_struct_decls @
type named_struct.t;
identifier named_struct_type.i;
identifier g;
@@
- typedef struct g {
+ struct i {
...
}
- t
;

/* Replace type with struct */
@ named_typedef_to_struct @
type named_struct.t;
identifier named_struct_type.i;
@@
- t
+ struct i


/*
 * Convert unnamed typedef'd structs
 * Example : typedef struct {} name_t; -> struct name {};
 */
@ unnamed_struct @
type t;
@@
typedef struct { ... } t;

/* Make typename usable as identifier */
@ script:python unnamed_struct_type @
t << unnamed_struct.t;
i;
@@
coccinelle.i = t.rstrip('_t')

@ convert_unnamed_struct_decls @
type unnamed_struct.t;
identifier unnamed_struct_type.i;
@@
-typedef struct {
+struct i {
        ...
}
- t
;

/*
 * Convert unnamed typedef'd enums
 */
@ unnamed_enum @
type t;
@@
typedef enum { ... } t;

/* Make typename usable as identifier */
@ script:python unnamed_enum_type @
t << unnamed_enum.t;
i;
@@
coccinelle.i = t.rstrip('_t')

@ convert_unnamed_enum_decls @
type unnamed_enum.t;
identifier unnamed_enum_type.i;
@@
-typedef enum {
+enum i {
        ...
}
- t
;

/* Replace type with struct */
@ unnamed_typedef_to_struct @
type unnamed_struct.t;
identifier unnamed_struct_type.i;
@@
-t
+struct i

/*
 * Pack _ALL_ structs
 */
@ pack_structs @
identifier s;
@@

struct s {
...
}
+ __attribute__((packed))
;

/*
 * BIGINT to stdint
 */
@ uint8_t @
typedef UINT8;
typedef uint8_t;
@@
- UINT8
+ uint8_t

@ uint16_t @
typedef UINT16;
typedef uint16_t;
@@
- UINT16
+ uint16_t

@ uint32_t @
typedef UINT32;
typedef uint32_t;
@@
- UINT32
+ uint32_t

@ uint64_t @
typedef UINT64;
typedef uint64_t;
@@
- UINT64
+ uint64_t

@ bool @
typedef BOOLEAN;
typedef bool;
@@
- BOOLEAN
+ bool

@ wchar_t @
typedef CHAR16;
typedef wchar_t;
@@
- CHAR16
+ wchar_t

/* This rule can't be named "void" */
@ replace_uppercase_void @
typedef VOID;
@@
- VOID
+ void