hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/xen/efi.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * EFI support for Xen.
34 *
....@@ -39,7 +40,7 @@
3940
4041 #define efi_data(op) (op.u.efi_runtime_call)
4142
42
-efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc)
43
+static efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc)
4344 {
4445 struct xen_platform_op op = INIT_EFI_OP(get_time);
4546
....@@ -60,9 +61,8 @@
6061
6162 return efi_data(op).status;
6263 }
63
-EXPORT_SYMBOL_GPL(xen_efi_get_time);
6464
65
-efi_status_t xen_efi_set_time(efi_time_t *tm)
65
+static efi_status_t xen_efi_set_time(efi_time_t *tm)
6666 {
6767 struct xen_platform_op op = INIT_EFI_OP(set_time);
6868
....@@ -74,10 +74,10 @@
7474
7575 return efi_data(op).status;
7676 }
77
-EXPORT_SYMBOL_GPL(xen_efi_set_time);
7877
79
-efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending,
80
- efi_time_t *tm)
78
+static efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled,
79
+ efi_bool_t *pending,
80
+ efi_time_t *tm)
8181 {
8282 struct xen_platform_op op = INIT_EFI_OP(get_wakeup_time);
8383
....@@ -97,9 +97,8 @@
9797
9898 return efi_data(op).status;
9999 }
100
-EXPORT_SYMBOL_GPL(xen_efi_get_wakeup_time);
101100
102
-efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm)
101
+static efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm)
103102 {
104103 struct xen_platform_op op = INIT_EFI_OP(set_wakeup_time);
105104
....@@ -116,11 +115,10 @@
116115
117116 return efi_data(op).status;
118117 }
119
-EXPORT_SYMBOL_GPL(xen_efi_set_wakeup_time);
120118
121
-efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor,
122
- u32 *attr, unsigned long *data_size,
123
- void *data)
119
+static efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor,
120
+ u32 *attr, unsigned long *data_size,
121
+ void *data)
124122 {
125123 struct xen_platform_op op = INIT_EFI_OP(get_variable);
126124
....@@ -140,11 +138,10 @@
140138
141139 return efi_data(op).status;
142140 }
143
-EXPORT_SYMBOL_GPL(xen_efi_get_variable);
144141
145
-efi_status_t xen_efi_get_next_variable(unsigned long *name_size,
146
- efi_char16_t *name,
147
- efi_guid_t *vendor)
142
+static efi_status_t xen_efi_get_next_variable(unsigned long *name_size,
143
+ efi_char16_t *name,
144
+ efi_guid_t *vendor)
148145 {
149146 struct xen_platform_op op = INIT_EFI_OP(get_next_variable_name);
150147
....@@ -164,11 +161,10 @@
164161
165162 return efi_data(op).status;
166163 }
167
-EXPORT_SYMBOL_GPL(xen_efi_get_next_variable);
168164
169
-efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor,
170
- u32 attr, unsigned long data_size,
171
- void *data)
165
+static efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor,
166
+ u32 attr, unsigned long data_size,
167
+ void *data)
172168 {
173169 struct xen_platform_op op = INIT_EFI_OP(set_variable);
174170
....@@ -185,11 +181,10 @@
185181
186182 return efi_data(op).status;
187183 }
188
-EXPORT_SYMBOL_GPL(xen_efi_set_variable);
189184
190
-efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space,
191
- u64 *remaining_space,
192
- u64 *max_variable_size)
185
+static efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space,
186
+ u64 *remaining_space,
187
+ u64 *max_variable_size)
193188 {
194189 struct xen_platform_op op = INIT_EFI_OP(query_variable_info);
195190
....@@ -207,9 +202,8 @@
207202
208203 return efi_data(op).status;
209204 }
210
-EXPORT_SYMBOL_GPL(xen_efi_query_variable_info);
211205
212
-efi_status_t xen_efi_get_next_high_mono_count(u32 *count)
206
+static efi_status_t xen_efi_get_next_high_mono_count(u32 *count)
213207 {
214208 struct xen_platform_op op = INIT_EFI_OP(get_next_high_monotonic_count);
215209
....@@ -220,10 +214,9 @@
220214
221215 return efi_data(op).status;
222216 }
223
-EXPORT_SYMBOL_GPL(xen_efi_get_next_high_mono_count);
224217
225
-efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules,
226
- unsigned long count, unsigned long sg_list)
218
+static efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules,
219
+ unsigned long count, unsigned long sg_list)
227220 {
228221 struct xen_platform_op op = INIT_EFI_OP(update_capsule);
229222
....@@ -240,11 +233,9 @@
240233
241234 return efi_data(op).status;
242235 }
243
-EXPORT_SYMBOL_GPL(xen_efi_update_capsule);
244236
245
-efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules,
246
- unsigned long count, u64 *max_size,
247
- int *reset_type)
237
+static efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules,
238
+ unsigned long count, u64 *max_size, int *reset_type)
248239 {
249240 struct xen_platform_op op = INIT_EFI_OP(query_capsule_capabilities);
250241
....@@ -263,10 +254,9 @@
263254
264255 return efi_data(op).status;
265256 }
266
-EXPORT_SYMBOL_GPL(xen_efi_query_capsule_caps);
267257
268
-void xen_efi_reset_system(int reset_type, efi_status_t status,
269
- unsigned long data_size, efi_char16_t *data)
258
+static void xen_efi_reset_system(int reset_type, efi_status_t status,
259
+ unsigned long data_size, efi_char16_t *data)
270260 {
271261 switch (reset_type) {
272262 case EFI_RESET_COLD:
....@@ -280,4 +270,25 @@
280270 BUG();
281271 }
282272 }
283
-EXPORT_SYMBOL_GPL(xen_efi_reset_system);
273
+
274
+/*
275
+ * Set XEN EFI runtime services function pointers. Other fields of struct efi,
276
+ * e.g. efi.systab, will be set like normal EFI.
277
+ */
278
+void __init xen_efi_runtime_setup(void)
279
+{
280
+ efi.get_time = xen_efi_get_time;
281
+ efi.set_time = xen_efi_set_time;
282
+ efi.get_wakeup_time = xen_efi_get_wakeup_time;
283
+ efi.set_wakeup_time = xen_efi_set_wakeup_time;
284
+ efi.get_variable = xen_efi_get_variable;
285
+ efi.get_next_variable = xen_efi_get_next_variable;
286
+ efi.set_variable = xen_efi_set_variable;
287
+ efi.set_variable_nonblocking = xen_efi_set_variable;
288
+ efi.query_variable_info = xen_efi_query_variable_info;
289
+ efi.query_variable_info_nonblocking = xen_efi_query_variable_info;
290
+ efi.update_capsule = xen_efi_update_capsule;
291
+ efi.query_capsule_caps = xen_efi_query_capsule_caps;
292
+ efi.get_next_high_mono_count = xen_efi_get_next_high_mono_count;
293
+ efi.reset_system = xen_efi_reset_system;
294
+}