[PATCH 1/2] platform: add a vendor_ext_provider override
Xiang W
wxjstz at 126.com
Fri Apr 1 06:09:21 PDT 2022
在 2022-04-01星期五的 03:08 +0200,Heiko Stuebner写道:
> The vendor_ext_provider is already meant to allow
> vendor extensions to ecalls, so allow fdt-matched
> platforms to define their own override.
>
> Signed-off-by: Heiko Stuebner <heiko at sntech.de>
> ---
> platform/generic/include/platform_override.h | 5 +++++
> platform/generic/platform.c | 13 +++++++++++++
> 2 files changed, 18 insertions(+)
>
> diff --git a/platform/generic/include/platform_override.h
> b/platform/generic/include/platform_override.h
> index 4af8754..3d41a19 100644
> --- a/platform/generic/include/platform_override.h
> +++ b/platform/generic/include/platform_override.h
> @@ -10,6 +10,7 @@
> #ifndef __PLATFORM_OVERRIDE_H__
> #define __PLATFORM_OVERRIDE_H__
>
> +#include <sbi/sbi_trap.h>
> #include <sbi/sbi_types.h>
>
> struct platform_override {
> @@ -21,6 +22,10 @@ struct platform_override {
> void (*early_exit)(const struct fdt_match *match);
> void (*final_exit)(const struct fdt_match *match);
> int (*fdt_fixup)(void *fdt, const struct fdt_match *match);
> + int (*vendor_ext_provider)(long extid, long funcid,
> + const struct sbi_trap_regs *regs,
> + unsigned long *out_value,
> + struct sbi_trap_info *out_trap);
Need add vendor_ext_check function?
int (*vendor_ext_check)(long extid);
Regards,
Xiang W
> };
>
> #endif
> diff --git a/platform/generic/platform.c b/platform/generic/platform.c
> index bc6e761..f05da8e 100644
> --- a/platform/generic/platform.c
> +++ b/platform/generic/platform.c
> @@ -209,6 +209,18 @@ static uint64_t
> generic_pmu_xlate_to_mhpmevent(uint32_t event_idx,
> return evt_val;
> }
>
> +static int generic_vendor_ext_provider(long extid, long funcid,
> + const struct sbi_trap_regs
> *regs,
> + unsigned long *out_value,
> + struct sbi_trap_info *out_trap)
> +{
> + if (generic_plat && generic_plat->vendor_ext_provider)
> + return generic_plat->vendor_ext_provider(extid,
> funcid, regs,
> + out_value,
> out_trap);
> +
> + return SBI_ENOTSUPP;
> +}
> +
> const struct sbi_platform_operations platform_ops = {
> .nascent_init = generic_nascent_init,
> .early_init = generic_early_init,
> @@ -225,6 +237,7 @@ const struct sbi_platform_operations platform_ops
> = {
> .get_tlbr_flush_limit = generic_tlbr_flush_limit,
> .timer_init = fdt_timer_init,
> .timer_exit = fdt_timer_exit,
> + .vendor_ext_provider = generic_vendor_ext_provider,
> };
>
> struct sbi_platform platform = {
> --
> 2.35.1
>
>
More information about the opensbi
mailing list