aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firmware
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2014-03-22 06:09:01 -0400
committerH. Peter Anvin <hpa@linux.intel.com>2014-03-26 14:30:03 -0400
commit204b0a1a4b92612c957a042df1a3be0e9cc79391 (patch)
tree71d15a5f460010bd5685272d3738fc4558046a6f /drivers/firmware
parent9a11040ff962304c1838aa9a9f33be78784eae47 (diff)
x86, efi: Abstract x86 efi_early calls
The ARM EFI boot stub doesn't need to care about the efi_early infrastructure that x86 requires in order to do mixed mode thunking. So wrap everything up in an efi_call_early() macro. This allows x86 to do the necessary indirection jumps to call whatever firmware interface is necessary (native or mixed mode), but also allows the ARM folks to mask the fact that they don't support relocation in the boot stub and need to pass 'sys_table_arg' to every function. [ hpa: there are no object code changes from this patch ] Signed-off-by: Matt Fleming <matt.fleming@intel.com> Link: http://lkml.kernel.org/r/20140326091011.GB2958@console-pimps.org Cc: Roy Franz <roy.franz@linaro.org> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'drivers/firmware')
-rw-r--r--drivers/firmware/efi/efi-stub-helper.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/drivers/firmware/efi/efi-stub-helper.c b/drivers/firmware/efi/efi-stub-helper.c
index a0282872d97d..ff50aeebf0d9 100644
--- a/drivers/firmware/efi/efi-stub-helper.c
+++ b/drivers/firmware/efi/efi-stub-helper.c
@@ -53,22 +53,22 @@ again:
53 * allocation which may be in a new descriptor region. 53 * allocation which may be in a new descriptor region.
54 */ 54 */
55 *map_size += sizeof(*m); 55 *map_size += sizeof(*m);
56 status = efi_early->call(efi_early->allocate_pool, EFI_LOADER_DATA, 56 status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
57 *map_size, (void **)&m); 57 *map_size, (void **)&m);
58 if (status != EFI_SUCCESS) 58 if (status != EFI_SUCCESS)
59 goto fail; 59 goto fail;
60 60
61 *desc_size = 0; 61 *desc_size = 0;
62 key = 0; 62 key = 0;
63 status = efi_early->call(efi_early->get_memory_map, map_size, m, 63 status = efi_call_early(get_memory_map, map_size, m,
64 &key, desc_size, &desc_version); 64 &key, desc_size, &desc_version);
65 if (status == EFI_BUFFER_TOO_SMALL) { 65 if (status == EFI_BUFFER_TOO_SMALL) {
66 efi_early->call(efi_early->free_pool, m); 66 efi_call_early(free_pool, m);
67 goto again; 67 goto again;
68 } 68 }
69 69
70 if (status != EFI_SUCCESS) 70 if (status != EFI_SUCCESS)
71 efi_early->call(efi_early->free_pool, m); 71 efi_call_early(free_pool, m);
72 72
73 if (key_ptr && status == EFI_SUCCESS) 73 if (key_ptr && status == EFI_SUCCESS)
74 *key_ptr = key; 74 *key_ptr = key;
@@ -149,9 +149,9 @@ again:
149 if (!max_addr) 149 if (!max_addr)
150 status = EFI_NOT_FOUND; 150 status = EFI_NOT_FOUND;
151 else { 151 else {
152 status = efi_early->call(efi_early->allocate_pages, 152 status = efi_call_early(allocate_pages,
153 EFI_ALLOCATE_ADDRESS, EFI_LOADER_DATA, 153 EFI_ALLOCATE_ADDRESS, EFI_LOADER_DATA,
154 nr_pages, &max_addr); 154 nr_pages, &max_addr);
155 if (status != EFI_SUCCESS) { 155 if (status != EFI_SUCCESS) {
156 max = max_addr; 156 max = max_addr;
157 max_addr = 0; 157 max_addr = 0;
@@ -161,7 +161,7 @@ again:
161 *addr = max_addr; 161 *addr = max_addr;
162 } 162 }
163 163
164 efi_early->call(efi_early->free_pool, map); 164 efi_call_early(free_pool, map);
165fail: 165fail:
166 return status; 166 return status;
167} 167}
@@ -221,9 +221,9 @@ static efi_status_t efi_low_alloc(efi_system_table_t *sys_table_arg,
221 if ((start + size) > end) 221 if ((start + size) > end)
222 continue; 222 continue;
223 223
224 status = efi_early->call(efi_early->allocate_pages, 224 status = efi_call_early(allocate_pages,
225 EFI_ALLOCATE_ADDRESS, EFI_LOADER_DATA, 225 EFI_ALLOCATE_ADDRESS, EFI_LOADER_DATA,
226 nr_pages, &start); 226 nr_pages, &start);
227 if (status == EFI_SUCCESS) { 227 if (status == EFI_SUCCESS) {
228 *addr = start; 228 *addr = start;
229 break; 229 break;
@@ -233,7 +233,7 @@ static efi_status_t efi_low_alloc(efi_system_table_t *sys_table_arg,
233 if (i == map_size / desc_size) 233 if (i == map_size / desc_size)
234 status = EFI_NOT_FOUND; 234 status = EFI_NOT_FOUND;
235 235
236 efi_early->call(efi_early->free_pool, map); 236 efi_call_early(free_pool, map);
237fail: 237fail:
238 return status; 238 return status;
239} 239}
@@ -247,7 +247,7 @@ static void efi_free(efi_system_table_t *sys_table_arg, unsigned long size,
247 return; 247 return;
248 248
249 nr_pages = round_up(size, EFI_PAGE_SIZE) / EFI_PAGE_SIZE; 249 nr_pages = round_up(size, EFI_PAGE_SIZE) / EFI_PAGE_SIZE;
250 efi_early->call(efi_early->free_pages, addr, nr_pages); 250 efi_call_early(free_pages, addr, nr_pages);
251} 251}
252 252
253 253
@@ -307,8 +307,8 @@ static efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,
307 if (!nr_files) 307 if (!nr_files)
308 return EFI_SUCCESS; 308 return EFI_SUCCESS;
309 309
310 status = efi_early->call(efi_early->allocate_pool, EFI_LOADER_DATA, 310 status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
311 nr_files * sizeof(*files), (void **)&files); 311 nr_files * sizeof(*files), (void **)&files);
312 if (status != EFI_SUCCESS) { 312 if (status != EFI_SUCCESS) {
313 efi_printk(sys_table_arg, "Failed to alloc mem for file handle list\n"); 313 efi_printk(sys_table_arg, "Failed to alloc mem for file handle list\n");
314 goto fail; 314 goto fail;
@@ -413,7 +413,7 @@ static efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,
413 413
414 } 414 }
415 415
416 efi_early->call(efi_early->free_pool, files); 416 efi_call_early(free_pool, files);
417 417
418 *load_addr = file_addr; 418 *load_addr = file_addr;
419 *load_size = file_size_total; 419 *load_size = file_size_total;
@@ -427,7 +427,7 @@ close_handles:
427 for (k = j; k < i; k++) 427 for (k = j; k < i; k++)
428 efi_file_close(fh, files[k].handle); 428 efi_file_close(fh, files[k].handle);
429free_files: 429free_files:
430 efi_early->call(efi_early->free_pool, files); 430 efi_call_early(free_pool, files);
431fail: 431fail:
432 *load_addr = 0; 432 *load_addr = 0;
433 *load_size = 0; 433 *load_size = 0;
@@ -473,9 +473,9 @@ static efi_status_t efi_relocate_kernel(efi_system_table_t *sys_table_arg,
473 * as possible while respecting the required alignment. 473 * as possible while respecting the required alignment.
474 */ 474 */
475 nr_pages = round_up(alloc_size, EFI_PAGE_SIZE) / EFI_PAGE_SIZE; 475 nr_pages = round_up(alloc_size, EFI_PAGE_SIZE) / EFI_PAGE_SIZE;
476 status = efi_early->call(efi_early->allocate_pages, 476 status = efi_call_early(allocate_pages,
477 EFI_ALLOCATE_ADDRESS, EFI_LOADER_DATA, 477 EFI_ALLOCATE_ADDRESS, EFI_LOADER_DATA,
478 nr_pages, &efi_addr); 478 nr_pages, &efi_addr);
479 new_addr = efi_addr; 479 new_addr = efi_addr;
480 /* 480 /*
481 * If preferred address allocation failed allocate as low as 481 * If preferred address allocation failed allocate as low as