efi_loader: Make calculate_paths() static

Update this function and adjust arguments to match us/next

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2025-05-16 14:59:39 +02:00
parent 5e5a823aa4
commit 6ce4b85cbb

View File

@@ -48,10 +48,20 @@ void efi_clear_bootdev(void)
image_size = 0;
}
efi_status_t calculate_paths(const char *dev, const char *devnr, const char *path,
struct efi_device_path **device_pathp,
struct efi_device_path **image_pathp)
/**
* calculate_paths() - Calculate the device and image patch from strings
*
* @dev: device, e.g. "MMC"
* @devnr: number of the device, e.g. "1:2"
* @path: path to file loaded
* @device_pathp: returns EFI device path
* @image_pathp: returns EFI image path
* Return: EFI_SUCCESS on success, else error code
*/
static efi_status_t calculate_paths(const char *dev, const char *devnr,
const char *path,
struct efi_device_path **device_pathp,
struct efi_device_path **image_pathp)
{
struct efi_device_path *image, *device;
efi_status_t ret;
@@ -151,21 +161,21 @@ void efi_set_bootdev(const char *dev, const char *devnr, const char *path,
*
* @source_buffer: memory address of the UEFI image
* @source_size: size of the UEFI image
* @device: EFI device-path
* @image: EFI image-path
* @dp_dev: EFI device-path
* @dp_img: EFI image-path
* Return: status code
*/
static efi_status_t efi_run_image(void *source_buffer, efi_uintn_t source_size,
struct efi_device_path *device,
struct efi_device_path *image)
struct efi_device_path *dp_dev,
struct efi_device_path *dp_img)
{
efi_handle_t handle;
struct efi_device_path *msg_path, *file_path;
efi_status_t ret;
u16 *load_options;
file_path = efi_dp_concat(device, image, 0);
msg_path = image;
file_path = efi_dp_concat(dp_dev, dp_img, 0);
msg_path = dp_img;
log_info("Booting %pD\n", msg_path);
@@ -188,9 +198,23 @@ out:
return ret;
}
static efi_status_t efi_binary_run_(void *image_ptr, size_t size, void *fdt,
struct efi_device_path *device,
struct efi_device_path *image)
/**
* efi_binary_run_dp() - run loaded UEFI image
*
* @image: memory address of the UEFI image
* @size: size of the UEFI image
* @fdt: device-tree
* @dp_dev: EFI device-path
* @dp_img: EFI image-path
*
* Execute an EFI binary image loaded at @image.
* @size may be zero if the binary is loaded with U-Boot load command.
*
* Return: status code
*/
static efi_status_t efi_binary_run_dp(void *image, size_t size, void *fdt,
struct efi_device_path *dp_dev,
struct efi_device_path *dp_img)
{
efi_status_t ret;
@@ -206,7 +230,7 @@ static efi_status_t efi_binary_run_(void *image_ptr, size_t size, void *fdt,
if (ret != EFI_SUCCESS)
return ret;
return efi_run_image(image_ptr, size, device, image);
return efi_run_image(image, size, dp_dev, dp_img);
}
/**
@@ -252,8 +276,8 @@ efi_status_t efi_binary_run(void *image, size_t size, void *fdt)
log_debug("Loaded from disk\n");
}
ret = efi_binary_run_(image, size, fdt, bootefi_device_path,
bootefi_image_path);
ret = efi_binary_run_dp(image, size, fdt, bootefi_device_path,
bootefi_image_path);
out:
if (mem_handle) {
efi_status_t r;
@@ -334,7 +358,7 @@ efi_status_t efi_bootflow_run(struct bootflow *bflow)
log_debug("Booting with external fdt\n");
fdt = map_sysmem(bflow->fdt_addr, 0);
}
ret = efi_binary_run_(bflow->buf, bflow->size, fdt, device, image);
ret = efi_binary_run_dp(bflow->buf, bflow->size, fdt, device, image);
return ret;
}