u-boot/lib/efi_loader/efi_riscv.c
Heinrich Schuchardt 851456693a efi_loader: use EFI_EXIT in efi_riscv_get_boot_hartid
After calling EFI_ENTRY we have to call EFI_EXIT before returning.

Add a missing EFI_EXIT().

Fixes: 1ccf87165e ("efi_loader: Enable RISCV_EFI_BOOT_PROTOCOL support")
Reported-by: Dave Jones <dave.jones@canonical.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
2023-01-13 09:09:07 +01:00

60 lines
1.5 KiB
C

// SPDX-License-Identifier: GPL-2.0+
/*
* Defines APIs that allow an OS to interact with UEFI firmware to query
* information about the boot hart ID.
*
* Copyright (c) 2022, Ventana Micro Systems Inc
*/
#define LOG_CATEGORY LOGC_EFI
#include <common.h>
#include <efi_loader.h>
#include <efi_variable.h>
#include <log.h>
#include <asm/global_data.h>
#include <efi_riscv.h>
DECLARE_GLOBAL_DATA_PTR;
static const efi_guid_t efi_guid_riscv_boot_protocol = RISCV_EFI_BOOT_PROTOCOL_GUID;
/**
* efi_riscv_get_boot_hartid() - return boot hart ID
* @this: RISCV_EFI_BOOT_PROTOCOL instance
* @boot_hartid: caller allocated memory to return boot hart id
* Return: status code
*/
static efi_status_t EFIAPI
efi_riscv_get_boot_hartid(struct riscv_efi_boot_protocol *this,
efi_uintn_t *boot_hartid)
{
EFI_ENTRY("%p, %p", this, boot_hartid);
if (this != &riscv_efi_boot_prot || !boot_hartid)
return EFI_EXIT(EFI_INVALID_PARAMETER);
*boot_hartid = gd->arch.boot_hart;
return EFI_EXIT(EFI_SUCCESS);
}
struct riscv_efi_boot_protocol riscv_efi_boot_prot = {
.revision = RISCV_EFI_BOOT_PROTOCOL_REVISION,
.get_boot_hartid = efi_riscv_get_boot_hartid
};
/**
* efi_riscv_register() - register RISCV_EFI_BOOT_PROTOCOL
*
* Return: status code
*/
efi_status_t efi_riscv_register(void)
{
efi_status_t ret = EFI_SUCCESS;
ret = efi_add_protocol(efi_root, &efi_guid_riscv_boot_protocol,
(void *)&riscv_efi_boot_prot);
if (ret != EFI_SUCCESS)
log_err("Cannot install RISCV_EFI_BOOT_PROTOCOL\n");
return ret;
}