2018-12-11 21:54:06 +08:00
|
|
|
/*
|
2019-01-24 14:11:10 +08:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*
|
|
|
|
* Copyright (c) 2019 Western Digital Corporation or its affiliates.
|
2018-12-11 21:54:06 +08:00
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Anup Patel <anup.patel@wdc.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __SBI_ECALL_H__
|
|
|
|
#define __SBI_ECALL_H__
|
|
|
|
|
|
|
|
#include <sbi/sbi_types.h>
|
2020-01-16 14:08:49 +08:00
|
|
|
#include <sbi/sbi_list.h>
|
2018-12-11 21:54:06 +08:00
|
|
|
|
2020-01-17 21:55:24 +08:00
|
|
|
#define SBI_ECALL_VERSION_MAJOR 0
|
|
|
|
#define SBI_ECALL_VERSION_MINOR 2
|
|
|
|
#define SBI_OPENSBI_IMPID 1
|
|
|
|
|
2018-12-11 21:54:06 +08:00
|
|
|
struct sbi_trap_regs;
|
2020-01-16 14:08:49 +08:00
|
|
|
struct sbi_trap_info;
|
2018-12-11 21:54:06 +08:00
|
|
|
struct sbi_scratch;
|
|
|
|
|
2020-01-16 14:08:49 +08:00
|
|
|
struct sbi_ecall_extension {
|
|
|
|
struct sbi_dlist head;
|
|
|
|
unsigned long extid_start;
|
|
|
|
unsigned long extid_end;
|
|
|
|
int (* probe)(struct sbi_scratch *scratch,
|
|
|
|
unsigned long extid, unsigned long *out_val);
|
|
|
|
int (* handle)(struct sbi_scratch *scratch,
|
|
|
|
unsigned long extid, unsigned long funcid,
|
|
|
|
unsigned long *args, unsigned long *out_val,
|
|
|
|
struct sbi_trap_info *out_trap);
|
|
|
|
};
|
|
|
|
|
2020-01-17 21:55:24 +08:00
|
|
|
extern struct sbi_ecall_extension ecall_base;
|
2020-01-17 20:39:49 +08:00
|
|
|
extern struct sbi_ecall_extension ecall_legacy;
|
2020-01-17 21:02:07 +08:00
|
|
|
extern struct sbi_ecall_extension ecall_time;
|
|
|
|
extern struct sbi_ecall_extension ecall_rfence;
|
|
|
|
extern struct sbi_ecall_extension ecall_ipi;
|
2020-01-17 21:42:52 +08:00
|
|
|
extern struct sbi_ecall_extension ecall_vendor;
|
2020-02-12 09:32:39 +08:00
|
|
|
extern struct sbi_ecall_extension ecall_hsm;
|
2020-01-17 20:39:49 +08:00
|
|
|
|
2018-12-11 21:54:06 +08:00
|
|
|
u16 sbi_ecall_version_major(void);
|
|
|
|
|
|
|
|
u16 sbi_ecall_version_minor(void);
|
|
|
|
|
2020-01-16 14:08:49 +08:00
|
|
|
struct sbi_ecall_extension *sbi_ecall_find_extension(unsigned long extid);
|
|
|
|
|
|
|
|
int sbi_ecall_register_extension(struct sbi_ecall_extension *ext);
|
|
|
|
|
|
|
|
void sbi_ecall_unregister_extension(struct sbi_ecall_extension *ext);
|
|
|
|
|
2019-04-11 08:41:52 +08:00
|
|
|
int sbi_ecall_handler(u32 hartid, ulong mcause, struct sbi_trap_regs *regs,
|
2018-12-11 21:54:06 +08:00
|
|
|
struct sbi_scratch *scratch);
|
|
|
|
|
2020-01-16 14:08:49 +08:00
|
|
|
int sbi_ecall_init(void);
|
|
|
|
|
2018-12-11 21:54:06 +08:00
|
|
|
#endif
|