blob: f4d5411879a8b65c78804ea11517b688f68ad68b [file] [log] [blame]
Jonathan Neuschäfer857e33e2016-08-22 19:37:16 +02001/*
2 * RISC-V supervisor binary interface (SBI) trampoline page
3 *
4 * Copyright 2016 Jonathan Neuschäfer <j.neuschaefer@gmx.net>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; version 2 of
9 * the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
14 * GNU General Public License for more details.
15 */
16
17#define __ASSEMBLY__
18#include <arch/encoding.h>
19#include <arch/sbi.h>
20
21.section ".text.sbi", "ax", %progbits
22
23/* align to a page boundary */
24.align RISCV_PGSHIFT
25
26.globl sbi_page
27sbi_page:
28
29 /*
30 * None of the SBI entry points is located in the first half of the
31 * page
32 */
33 .skip 0x800
34
35 /* -2048: size_t sbi_hart_id(void); */
36 li a7, SBI_ECALL_HART_ID
37 ecall
38 jr ra
39 .align 4
40
41 /* -2032: size_t sbi_num_harts(void); */
42 li a7, SBI_ECALL_NUM_HARTS
43 ecall
44 jr ra
45 .align 4
46
47 /* -2016: unsigned long sbi_query_memory(unsigned long id,
48 memory_block_info *p); */
49 li a7, SBI_ECALL_QUERY_MEMORY
50 ecall
51 jr ra
52 .align 4
53
54 /* -2000: int sbi_console_putchar(uint8_t ch); */
55 li a7, SBI_ECALL_CONSOLE_PUT
56 ecall
57 jr ra
58 .align 4
59
60 /* -1984: int sbi_console_getchar(void); */
61 li a0, -1 /* failure: Coreboot doesn't support console input */
62 jr ra
63 .align 4
64
65 /* -1968: Not allocated */
66 ebreak
67 .align 4
68
69 /* -1952: int sbi_send_ipi(size_t hart_id); */
70 ebreak
71 .align 4
72
73 /* -1936: int bool sbi_clear_ipi(void); */
74 ebreak
75 .align 4
76
77 /* -1920: unsigned long sbi_timebase(void); */
78 li a0, 1000000000 /* I have no idea. */
79 jr ra
80 .align 4
81
82 /* -1904: void sbi_shutdown(void); */
83 li a7, SBI_ECALL_SHUTDOWN
84 ecall
85 jr ra
86 .align 4
87
88 /* -1888: void sbi_set_timer(unsigned long long stime_value); */
89 li a7, SBI_ECALL_SET_TIMER
90 ecall
91 jr ra
92 .align 4
93
94 /* -1872: int sbi_mask_interrupt(int which); */
95 ebreak
96 .align 4
97
98 /* -1856: int sbi_unmask_interrupt(int which); */
99 ebreak
100 .align 4
101
102 /* -1840: void sbi_remote_sfence_vm(const uintptr_t* harts,
103 size_t asid); */
104 ebreak
105 .align 4
106
107 /* -1824: void sbi_remote_sfence_vm_range(const uintptr_t* harts,
108 size_t asid, uintptr_t start, uintptr_t size); */
109 ebreak
110 .align 4
111
112 /* -1808: void sbi_remote_fence_i(const uintptr_t* harts); */
113 ebreak
114 .align 4
115
116/* Fill the remainder of the page */
117.align RISCV_PGSHIFT