sbi_ipi.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * SPDX-License-Identifier: BSD-2-Clause
  3. *
  4. * Copyright (c) 2019 Western Digital Corporation or its affiliates.
  5. *
  6. * Authors:
  7. * Anup Patel <anup.patel@wdc.com>
  8. */
  9. #ifndef __SBI_IPI_H__
  10. #define __SBI_IPI_H__
  11. #include <sbi/sbi_types.h>
  12. /* clang-format off */
  13. #define SBI_IPI_EVENT_MAX __riscv_xlen
  14. /* clang-format on */
  15. struct sbi_scratch;
  16. /** IPI event operations or callbacks */
  17. struct sbi_ipi_event_ops {
  18. /** Name of the IPI event operations */
  19. char name[32];
  20. /**
  21. * Update callback to save/enqueue data for remote HART
  22. * Note: This is an optional callback and it is called just before
  23. * triggering IPI to remote HART.
  24. */
  25. int (* update)(struct sbi_scratch *scratch,
  26. struct sbi_scratch *remote_scratch,
  27. u32 remote_hartid, void *data);
  28. /**
  29. * Sync callback to wait for remote HART
  30. * Note: This is an optional callback and it is called just after
  31. * triggering IPI to remote HART.
  32. */
  33. void (* sync)(struct sbi_scratch *scratch);
  34. /**
  35. * Process callback to handle IPI event
  36. * Note: This is a mandatory callback and it is called on the
  37. * remote HART after IPI is triggered.
  38. */
  39. void (* process)(struct sbi_scratch *scratch);
  40. };
  41. int sbi_ipi_send_many(ulong hmask, ulong hbase, u32 event, void *data);
  42. int sbi_ipi_event_create(const struct sbi_ipi_event_ops *ops);
  43. void sbi_ipi_event_destroy(u32 event);
  44. int sbi_ipi_send_smode(ulong hmask, ulong hbase);
  45. void sbi_ipi_clear_smode(void);
  46. int sbi_ipi_send_halt(ulong hmask, ulong hbase);
  47. void sbi_ipi_process(void);
  48. int sbi_ipi_init(struct sbi_scratch *scratch, bool cold_boot);
  49. void sbi_ipi_exit(struct sbi_scratch *scratch);
  50. #endif