Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f966ea02 authored by Roy Franz's avatar Roy Franz Committed by Matt Fleming
Browse files

efi: Add shared printk wrapper for consistent prefixing



Add a wrapper for printk to standardize the prefix for informational and
error messages from the EFI stub.

Signed-off-by: default avatarRoy Franz <roy.franz@linaro.org>
Signed-off-by: default avatarLeif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
parent e885cd80
Loading
Loading
Loading
Loading
+8 −5
Original line number Original line Diff line number Diff line
@@ -33,6 +33,9 @@ static void efi_printk(efi_system_table_t *sys_table_arg, char *str)
	}
	}
}
}


#define pr_efi(sys_table, msg)     efi_printk(sys_table, "EFI stub: "msg)
#define pr_efi_err(sys_table, msg) efi_printk(sys_table, "EFI stub: ERROR: "msg)



static efi_status_t efi_get_memory_map(efi_system_table_t *sys_table_arg,
static efi_status_t efi_get_memory_map(efi_system_table_t *sys_table_arg,
				       efi_memory_desc_t **map,
				       efi_memory_desc_t **map,
@@ -310,7 +313,7 @@ static efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,
	status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
	status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
				nr_files * sizeof(*files), (void **)&files);
				nr_files * sizeof(*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");
		pr_efi_err(sys_table_arg, "Failed to alloc mem for file handle list\n");
		goto fail;
		goto fail;
	}
	}


@@ -374,13 +377,13 @@ static efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,
		status = efi_high_alloc(sys_table_arg, file_size_total, 0x1000,
		status = efi_high_alloc(sys_table_arg, file_size_total, 0x1000,
				    &file_addr, max_addr);
				    &file_addr, max_addr);
		if (status != EFI_SUCCESS) {
		if (status != EFI_SUCCESS) {
			efi_printk(sys_table_arg, "Failed to alloc highmem for files\n");
			pr_efi_err(sys_table_arg, "Failed to alloc highmem for files\n");
			goto close_handles;
			goto close_handles;
		}
		}


		/* We've run out of free low memory. */
		/* We've run out of free low memory. */
		if (file_addr > max_addr) {
		if (file_addr > max_addr) {
			efi_printk(sys_table_arg, "We've run out of free low memory\n");
			pr_efi_err(sys_table_arg, "We've run out of free low memory\n");
			status = EFI_INVALID_PARAMETER;
			status = EFI_INVALID_PARAMETER;
			goto free_file_total;
			goto free_file_total;
		}
		}
@@ -401,7 +404,7 @@ static efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,
						       &chunksize,
						       &chunksize,
						       (void *)addr);
						       (void *)addr);
				if (status != EFI_SUCCESS) {
				if (status != EFI_SUCCESS) {
					efi_printk(sys_table_arg, "Failed to read file\n");
					pr_efi_err(sys_table_arg, "Failed to read file\n");
					goto free_file_total;
					goto free_file_total;
				}
				}
				addr += chunksize;
				addr += chunksize;
@@ -486,7 +489,7 @@ static efi_status_t efi_relocate_kernel(efi_system_table_t *sys_table_arg,
				       &new_addr);
				       &new_addr);
	}
	}
	if (status != EFI_SUCCESS) {
	if (status != EFI_SUCCESS) {
		efi_printk(sys_table_arg, "ERROR: Failed to allocate usable memory for kernel.\n");
		pr_efi_err(sys_table_arg, "Failed to allocate usable memory for kernel.\n");
		return status;
		return status;
	}
	}