aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Franz <roy.franz@linaro.org>2013-09-22 18:45:41 -0400
committerMatt Fleming <matt.fleming@intel.com>2013-09-25 07:34:44 -0400
commit6a5fe770d32811ffacefaa2a430cc067ecc7336c (patch)
treedc4d4bdbae969362a4549f6761f73fbab84be2cb
parent36f8961c963683ac12282e422dfc3db806ee0c7e (diff)
efi: Fix types in EFI calls to match EFI function definitions.
EFI calls can made directly on ARM, so the function pointers are directly invoked. This allows types to be checked at compile time, so here we ensure that the parameters match the function signature. The wrappers used by x86 prevent any type checking. Correct the type of chunksize to be based on native width as specified by the EFI_FILE_PROTOCOL read() function. Signed-off-by: Roy Franz <roy.franz@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
-rw-r--r--drivers/firmware/efi/efi-stub-helper.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/firmware/efi/efi-stub-helper.c b/drivers/firmware/efi/efi-stub-helper.c
index 5cea5d5a9a1f..4252d01089b2 100644
--- a/drivers/firmware/efi/efi-stub-helper.c
+++ b/drivers/firmware/efi/efi-stub-helper.c
@@ -324,7 +324,7 @@ static efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,
324 status = efi_call_phys3(sys_table_arg->boottime->allocate_pool, 324 status = efi_call_phys3(sys_table_arg->boottime->allocate_pool,
325 EFI_LOADER_DATA, 325 EFI_LOADER_DATA,
326 nr_files * sizeof(*files), 326 nr_files * sizeof(*files),
327 &files); 327 (void **)&files);
328 if (status != EFI_SUCCESS) { 328 if (status != EFI_SUCCESS) {
329 efi_printk(sys_table_arg, "Failed to alloc mem for file handle list\n"); 329 efi_printk(sys_table_arg, "Failed to alloc mem for file handle list\n");
330 goto fail; 330 goto fail;
@@ -375,7 +375,8 @@ static efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,
375 boottime = sys_table_arg->boottime; 375 boottime = sys_table_arg->boottime;
376 376
377 status = efi_call_phys3(boottime->handle_protocol, 377 status = efi_call_phys3(boottime->handle_protocol,
378 image->device_handle, &fs_proto, &io); 378 image->device_handle, &fs_proto,
379 (void **)&io);
379 if (status != EFI_SUCCESS) { 380 if (status != EFI_SUCCESS) {
380 efi_printk(sys_table_arg, "Failed to handle fs_proto\n"); 381 efi_printk(sys_table_arg, "Failed to handle fs_proto\n");
381 goto free_files; 382 goto free_files;
@@ -409,7 +410,8 @@ static efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,
409 410
410grow: 411grow:
411 status = efi_call_phys3(sys_table_arg->boottime->allocate_pool, 412 status = efi_call_phys3(sys_table_arg->boottime->allocate_pool,
412 EFI_LOADER_DATA, info_sz, &info); 413 EFI_LOADER_DATA, info_sz,
414 (void **)&info);
413 if (status != EFI_SUCCESS) { 415 if (status != EFI_SUCCESS) {
414 efi_printk(sys_table_arg, "Failed to alloc mem for file info\n"); 416 efi_printk(sys_table_arg, "Failed to alloc mem for file info\n");
415 goto close_handles; 417 goto close_handles;
@@ -459,18 +461,19 @@ grow:
459 461
460 addr = file_addr; 462 addr = file_addr;
461 for (j = 0; j < nr_files; j++) { 463 for (j = 0; j < nr_files; j++) {
462 u64 size; 464 unsigned long size;
463 465
464 size = files[j].size; 466 size = files[j].size;
465 while (size) { 467 while (size) {
466 u64 chunksize; 468 unsigned long chunksize;
467 if (size > EFI_READ_CHUNK_SIZE) 469 if (size > EFI_READ_CHUNK_SIZE)
468 chunksize = EFI_READ_CHUNK_SIZE; 470 chunksize = EFI_READ_CHUNK_SIZE;
469 else 471 else
470 chunksize = size; 472 chunksize = size;
471 status = efi_call_phys3(fh->read, 473 status = efi_call_phys3(fh->read,
472 files[j].handle, 474 files[j].handle,
473 &chunksize, addr); 475 &chunksize,
476 (void *)addr);
474 if (status != EFI_SUCCESS) { 477 if (status != EFI_SUCCESS) {
475 efi_printk(sys_table_arg, "Failed to read file\n"); 478 efi_printk(sys_table_arg, "Failed to read file\n");
476 goto free_file_total; 479 goto free_file_total;