sbi_ecall_vendor.c 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * SPDX-License-Identifier: BSD-2-Clause
  3. *
  4. * Copyright (c) 2020 Western Digital Corporation or its affiliates.
  5. *
  6. * Authors:
  7. * Anup Patel <anup.patel@wdc.com>
  8. * Atish Patra <atish.patra@wdc.com>
  9. */
  10. #include <sbi/sbi_ecall.h>
  11. #include <sbi/sbi_ecall_interface.h>
  12. #include <sbi/sbi_error.h>
  13. #include <sbi/sbi_platform.h>
  14. #include <sbi/sbi_trap.h>
  15. static int sbi_ecall_vendor_probe(unsigned long extid,
  16. unsigned long *out_val)
  17. {
  18. *out_val = sbi_platform_vendor_ext_check(sbi_platform_thishart_ptr(),
  19. extid);
  20. return 0;
  21. }
  22. static int sbi_ecall_vendor_handler(unsigned long extid, unsigned long funcid,
  23. const struct sbi_trap_regs *regs,
  24. unsigned long *out_val,
  25. struct sbi_trap_info *out_trap)
  26. {
  27. return sbi_platform_vendor_ext_provider(sbi_platform_thishart_ptr(),
  28. extid, funcid, regs,
  29. out_val, out_trap);
  30. }
  31. struct sbi_ecall_extension ecall_vendor = {
  32. .extid_start = SBI_EXT_VENDOR_START,
  33. .extid_end = SBI_EXT_VENDOR_END,
  34. .probe = sbi_ecall_vendor_probe,
  35. .handle = sbi_ecall_vendor_handler,
  36. };