Commit 6a5fe770 authored by Roy Franz's avatar Roy Franz Committed by Matt Fleming

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: default avatarRoy Franz <roy.franz@linaro.org>
Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
parent 36f8961c
...@@ -324,7 +324,7 @@ static efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg, ...@@ -324,7 +324,7 @@ static efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,
status = efi_call_phys3(sys_table_arg->boottime->allocate_pool, status = efi_call_phys3(sys_table_arg->boottime->allocate_pool,
EFI_LOADER_DATA, EFI_LOADER_DATA,
nr_files * sizeof(*files), nr_files * sizeof(*files),
&files); (void **)&files);
if (status != EFI_SUCCESS) { if (status != EFI_SUCCESS) {
efi_printk(sys_table_arg, "Failed to alloc mem for file handle list\n"); efi_printk(sys_table_arg, "Failed to alloc mem for file handle list\n");
goto fail; goto fail;
...@@ -375,7 +375,8 @@ static efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg, ...@@ -375,7 +375,8 @@ static efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,
boottime = sys_table_arg->boottime; boottime = sys_table_arg->boottime;
status = efi_call_phys3(boottime->handle_protocol, status = efi_call_phys3(boottime->handle_protocol,
image->device_handle, &fs_proto, &io); image->device_handle, &fs_proto,
(void **)&io);
if (status != EFI_SUCCESS) { if (status != EFI_SUCCESS) {
efi_printk(sys_table_arg, "Failed to handle fs_proto\n"); efi_printk(sys_table_arg, "Failed to handle fs_proto\n");
goto free_files; goto free_files;
...@@ -409,7 +410,8 @@ static efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg, ...@@ -409,7 +410,8 @@ static efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,
grow: grow:
status = efi_call_phys3(sys_table_arg->boottime->allocate_pool, status = efi_call_phys3(sys_table_arg->boottime->allocate_pool,
EFI_LOADER_DATA, info_sz, &info); EFI_LOADER_DATA, info_sz,
(void **)&info);
if (status != EFI_SUCCESS) { if (status != EFI_SUCCESS) {
efi_printk(sys_table_arg, "Failed to alloc mem for file info\n"); efi_printk(sys_table_arg, "Failed to alloc mem for file info\n");
goto close_handles; goto close_handles;
...@@ -459,18 +461,19 @@ static efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg, ...@@ -459,18 +461,19 @@ static efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,
addr = file_addr; addr = file_addr;
for (j = 0; j < nr_files; j++) { for (j = 0; j < nr_files; j++) {
u64 size; unsigned long size;
size = files[j].size; size = files[j].size;
while (size) { while (size) {
u64 chunksize; unsigned long chunksize;
if (size > EFI_READ_CHUNK_SIZE) if (size > EFI_READ_CHUNK_SIZE)
chunksize = EFI_READ_CHUNK_SIZE; chunksize = EFI_READ_CHUNK_SIZE;
else else
chunksize = size; chunksize = size;
status = efi_call_phys3(fh->read, status = efi_call_phys3(fh->read,
files[j].handle, files[j].handle,
&chunksize, addr); &chunksize,
(void *)addr);
if (status != EFI_SUCCESS) { if (status != EFI_SUCCESS) {
efi_printk(sys_table_arg, "Failed to read file\n"); efi_printk(sys_table_arg, "Failed to read file\n");
goto free_file_total; goto free_file_total;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment