| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * EFI support for Xen. |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 39 | 40 | |
|---|
| 40 | 41 | #define efi_data(op) (op.u.efi_runtime_call) |
|---|
| 41 | 42 | |
|---|
| 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) |
|---|
| 43 | 44 | { |
|---|
| 44 | 45 | struct xen_platform_op op = INIT_EFI_OP(get_time); |
|---|
| 45 | 46 | |
|---|
| .. | .. |
|---|
| 60 | 61 | |
|---|
| 61 | 62 | return efi_data(op).status; |
|---|
| 62 | 63 | } |
|---|
| 63 | | -EXPORT_SYMBOL_GPL(xen_efi_get_time); |
|---|
| 64 | 64 | |
|---|
| 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) |
|---|
| 66 | 66 | { |
|---|
| 67 | 67 | struct xen_platform_op op = INIT_EFI_OP(set_time); |
|---|
| 68 | 68 | |
|---|
| .. | .. |
|---|
| 74 | 74 | |
|---|
| 75 | 75 | return efi_data(op).status; |
|---|
| 76 | 76 | } |
|---|
| 77 | | -EXPORT_SYMBOL_GPL(xen_efi_set_time); |
|---|
| 78 | 77 | |
|---|
| 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) |
|---|
| 81 | 81 | { |
|---|
| 82 | 82 | struct xen_platform_op op = INIT_EFI_OP(get_wakeup_time); |
|---|
| 83 | 83 | |
|---|
| .. | .. |
|---|
| 97 | 97 | |
|---|
| 98 | 98 | return efi_data(op).status; |
|---|
| 99 | 99 | } |
|---|
| 100 | | -EXPORT_SYMBOL_GPL(xen_efi_get_wakeup_time); |
|---|
| 101 | 100 | |
|---|
| 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) |
|---|
| 103 | 102 | { |
|---|
| 104 | 103 | struct xen_platform_op op = INIT_EFI_OP(set_wakeup_time); |
|---|
| 105 | 104 | |
|---|
| .. | .. |
|---|
| 116 | 115 | |
|---|
| 117 | 116 | return efi_data(op).status; |
|---|
| 118 | 117 | } |
|---|
| 119 | | -EXPORT_SYMBOL_GPL(xen_efi_set_wakeup_time); |
|---|
| 120 | 118 | |
|---|
| 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) |
|---|
| 124 | 122 | { |
|---|
| 125 | 123 | struct xen_platform_op op = INIT_EFI_OP(get_variable); |
|---|
| 126 | 124 | |
|---|
| .. | .. |
|---|
| 140 | 138 | |
|---|
| 141 | 139 | return efi_data(op).status; |
|---|
| 142 | 140 | } |
|---|
| 143 | | -EXPORT_SYMBOL_GPL(xen_efi_get_variable); |
|---|
| 144 | 141 | |
|---|
| 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) |
|---|
| 148 | 145 | { |
|---|
| 149 | 146 | struct xen_platform_op op = INIT_EFI_OP(get_next_variable_name); |
|---|
| 150 | 147 | |
|---|
| .. | .. |
|---|
| 164 | 161 | |
|---|
| 165 | 162 | return efi_data(op).status; |
|---|
| 166 | 163 | } |
|---|
| 167 | | -EXPORT_SYMBOL_GPL(xen_efi_get_next_variable); |
|---|
| 168 | 164 | |
|---|
| 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) |
|---|
| 172 | 168 | { |
|---|
| 173 | 169 | struct xen_platform_op op = INIT_EFI_OP(set_variable); |
|---|
| 174 | 170 | |
|---|
| .. | .. |
|---|
| 185 | 181 | |
|---|
| 186 | 182 | return efi_data(op).status; |
|---|
| 187 | 183 | } |
|---|
| 188 | | -EXPORT_SYMBOL_GPL(xen_efi_set_variable); |
|---|
| 189 | 184 | |
|---|
| 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) |
|---|
| 193 | 188 | { |
|---|
| 194 | 189 | struct xen_platform_op op = INIT_EFI_OP(query_variable_info); |
|---|
| 195 | 190 | |
|---|
| .. | .. |
|---|
| 207 | 202 | |
|---|
| 208 | 203 | return efi_data(op).status; |
|---|
| 209 | 204 | } |
|---|
| 210 | | -EXPORT_SYMBOL_GPL(xen_efi_query_variable_info); |
|---|
| 211 | 205 | |
|---|
| 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) |
|---|
| 213 | 207 | { |
|---|
| 214 | 208 | struct xen_platform_op op = INIT_EFI_OP(get_next_high_monotonic_count); |
|---|
| 215 | 209 | |
|---|
| .. | .. |
|---|
| 220 | 214 | |
|---|
| 221 | 215 | return efi_data(op).status; |
|---|
| 222 | 216 | } |
|---|
| 223 | | -EXPORT_SYMBOL_GPL(xen_efi_get_next_high_mono_count); |
|---|
| 224 | 217 | |
|---|
| 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) |
|---|
| 227 | 220 | { |
|---|
| 228 | 221 | struct xen_platform_op op = INIT_EFI_OP(update_capsule); |
|---|
| 229 | 222 | |
|---|
| .. | .. |
|---|
| 240 | 233 | |
|---|
| 241 | 234 | return efi_data(op).status; |
|---|
| 242 | 235 | } |
|---|
| 243 | | -EXPORT_SYMBOL_GPL(xen_efi_update_capsule); |
|---|
| 244 | 236 | |
|---|
| 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) |
|---|
| 248 | 239 | { |
|---|
| 249 | 240 | struct xen_platform_op op = INIT_EFI_OP(query_capsule_capabilities); |
|---|
| 250 | 241 | |
|---|
| .. | .. |
|---|
| 263 | 254 | |
|---|
| 264 | 255 | return efi_data(op).status; |
|---|
| 265 | 256 | } |
|---|
| 266 | | -EXPORT_SYMBOL_GPL(xen_efi_query_capsule_caps); |
|---|
| 267 | 257 | |
|---|
| 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) |
|---|
| 270 | 260 | { |
|---|
| 271 | 261 | switch (reset_type) { |
|---|
| 272 | 262 | case EFI_RESET_COLD: |
|---|
| .. | .. |
|---|
| 280 | 270 | BUG(); |
|---|
| 281 | 271 | } |
|---|
| 282 | 272 | } |
|---|
| 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 | +} |
|---|