1/* 2 * Copyright 2021, Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 7#define SBI_SYSCALL(name, eid, fid) \ 8.globl name; \ 9.type name,%function; \ 10name: \ 11 li a7, eid; \ 12 li a6, fid; \ 13 ecall; \ 14 ret; \ 15.size name, .-name 16 17#define SBI_SYSCALL_LEGACY(name, eid) \ 18.globl name; \ 19.type name,%function; \ 20name: \ 21 li a7, eid; \ 22 ecall; \ 23 ret; \ 24.size name, .-name 25 26 27SBI_SYSCALL(sbi_get_spec_version, 0x10, 0) 28SBI_SYSCALL(sbi_get_impl_id, 0x10, 1) 29SBI_SYSCALL(sbi_get_impl_version, 0x10, 2) 30SBI_SYSCALL(sbi_probe_extension, 0x10, 3) 31SBI_SYSCALL(sbi_get_mvendorid, 0x10, 4) 32SBI_SYSCALL(sbi_get_marchid, 0x10, 5) 33SBI_SYSCALL(sbi_get_mimpid, 0x10, 6) 34 35SBI_SYSCALL_LEGACY(sbi_set_timer_legacy, 0) 36SBI_SYSCALL_LEGACY(sbi_console_putchar_legacy, 1) 37SBI_SYSCALL_LEGACY(sbi_console_getchar_legacy, 2) 38SBI_SYSCALL_LEGACY(sbi_clear_ipi_legacy, 3) 39SBI_SYSCALL_LEGACY(sbi_send_ipi_legacy, 4) 40SBI_SYSCALL_LEGACY(sbi_remote_fence_i_legacy, 5) 41SBI_SYSCALL_LEGACY(sbi_remote_sfence_vma_legacy, 6) 42SBI_SYSCALL_LEGACY(sbi_remote_sfence_vma_asid_legacy, 7) 43SBI_SYSCALL_LEGACY(sbi_shutdown_legacy, 8) 44 45SBI_SYSCALL(sbi_set_timer, 0x54494D45, 0) 46 47SBI_SYSCALL(sbi_send_ipi, 0x735049, 0) 48 49SBI_SYSCALL(sbi_remote_fence_i, 0x52464E43, 0) 50SBI_SYSCALL(sbi_remote_sfence_vma, 0x52464E43, 1) 51SBI_SYSCALL(sbi_remote_sfence_vma_asid, 0x52464E43, 2) 52SBI_SYSCALL(sbi_remote_hfence_gvma_vmid, 0x52464E43, 3) 53SBI_SYSCALL(sbi_remote_hfence_gvma, 0x52464E43, 4) 54SBI_SYSCALL(sbi_remote_hfence_vvma_asid, 0x52464E43, 5) 55SBI_SYSCALL(sbi_remote_hfence_vvma, 0x52464E43, 6) 56 57SBI_SYSCALL(sbi_hart_start, 0x48534D, 0) 58SBI_SYSCALL(sbi_hart_stop, 0x48534D, 1) 59SBI_SYSCALL(sbi_hart_get_status, 0x48534D, 2) 60SBI_SYSCALL(sbi_hart_suspend, 0x48534D, 3) 61 62SBI_SYSCALL(sbi_system_reset, 0x53525354, 0) 63