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_IPI_H__
|
|
|
|
#define __SBI_IPI_H__
|
|
|
|
|
|
|
|
#include <sbi/sbi_types.h>
|
|
|
|
|
2019-04-11 08:41:46 +08:00
|
|
|
/* clang-format off */
|
|
|
|
|
2020-01-15 15:14:10 +08:00
|
|
|
#define SBI_IPI_EVENT_MAX __riscv_xlen
|
2018-12-11 21:54:06 +08:00
|
|
|
|
2019-04-11 08:41:46 +08:00
|
|
|
/* clang-format on */
|
|
|
|
|
2018-12-11 21:54:06 +08:00
|
|
|
struct sbi_scratch;
|
2019-03-10 04:57:20 +08:00
|
|
|
|
2020-01-15 15:14:10 +08:00
|
|
|
/** IPI event operations or callbacks */
|
|
|
|
struct sbi_ipi_event_ops {
|
|
|
|
/** Name of the IPI event operations */
|
|
|
|
char name[32];
|
|
|
|
|
2020-03-09 11:52:41 +08:00
|
|
|
/**
|
|
|
|
* Update callback to save/enqueue data for remote HART
|
|
|
|
* Note: This is an optional callback and it is called just before
|
|
|
|
* triggering IPI to remote HART.
|
2020-01-15 15:14:10 +08:00
|
|
|
*/
|
|
|
|
int (* update)(struct sbi_scratch *scratch,
|
|
|
|
struct sbi_scratch *remote_scratch,
|
|
|
|
u32 remote_hartid, void *data);
|
|
|
|
|
2020-03-09 11:52:41 +08:00
|
|
|
/**
|
|
|
|
* Sync callback to wait for remote HART
|
|
|
|
* Note: This is an optional callback and it is called just after
|
|
|
|
* triggering IPI to remote HART.
|
2020-01-15 15:14:10 +08:00
|
|
|
*/
|
|
|
|
void (* sync)(struct sbi_scratch *scratch);
|
|
|
|
|
2020-03-09 11:52:41 +08:00
|
|
|
/**
|
|
|
|
* Process callback to handle IPI event
|
|
|
|
* Note: This is a mandatory callback and it is called on the
|
|
|
|
* remote HART after IPI is triggered.
|
2020-01-15 15:14:10 +08:00
|
|
|
*/
|
|
|
|
void (* process)(struct sbi_scratch *scratch);
|
|
|
|
};
|
|
|
|
|
2020-03-27 13:56:11 +08:00
|
|
|
int sbi_ipi_send_many(ulong hmask, ulong hbase, u32 event, void *data);
|
2018-12-11 21:54:06 +08:00
|
|
|
|
2020-01-15 15:14:10 +08:00
|
|
|
int sbi_ipi_event_create(const struct sbi_ipi_event_ops *ops);
|
|
|
|
|
|
|
|
void sbi_ipi_event_destroy(u32 event);
|
|
|
|
|
2020-03-27 13:56:11 +08:00
|
|
|
int sbi_ipi_send_smode(ulong hmask, ulong hbase);
|
2020-01-15 13:32:14 +08:00
|
|
|
|
2020-03-27 13:56:11 +08:00
|
|
|
void sbi_ipi_clear_smode(void);
|
2018-12-11 21:54:06 +08:00
|
|
|
|
2020-03-27 13:56:11 +08:00
|
|
|
int sbi_ipi_send_halt(ulong hmask, ulong hbase);
|
2020-01-15 13:46:54 +08:00
|
|
|
|
2020-03-27 13:56:11 +08:00
|
|
|
void sbi_ipi_process(void);
|
2018-12-11 21:54:06 +08:00
|
|
|
|
2019-01-22 16:50:59 +08:00
|
|
|
int sbi_ipi_init(struct sbi_scratch *scratch, bool cold_boot);
|
2018-12-11 21:54:06 +08:00
|
|
|
|
2020-01-03 12:09:10 +08:00
|
|
|
void sbi_ipi_exit(struct sbi_scratch *scratch);
|
|
|
|
|
2018-12-11 21:54:06 +08:00
|
|
|
#endif
|