2 * This file is part of the coreboot project.
4 * Copyright (C) 2013 The ChromiumOS Authors
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
19 // NOTE: this is the size of hls_t below. A static_assert would be
23 /* We save 37 registers, currently. */
24 #define MENTRY_FRAME_SIZE (HLS_SIZE + 37 * 8)
28 #include <arch/encoding.h>
35 unsigned long sbi_private_data
;
40 void (*fn
)(void *arg
);
46 sbi_device_message
*device_request_queue_head
;
47 unsigned long device_request_queue_size
;
48 sbi_device_message
*device_response_queue_head
;
49 sbi_device_message
*device_response_queue_tail
;
58 #define MACHINE_STACK_TOP() ({ \
59 /* coverity[uninit_use] : FALSE */ \
60 register uintptr_t sp asm ("sp"); \
61 (void*)((sp + RISCV_PGSIZE) & -RISCV_PGSIZE); })
63 // hart-local storage, at top of stack
64 #define HLS() ((hls_t*)(MACHINE_STACK_TOP() - HLS_SIZE))
65 #define OTHER_HLS(id) ((hls_t*)((void*)HLS() + RISCV_PGSIZE * ((id) - HLS()->hart_id)))
67 #define MACHINE_STACK_SIZE RISCV_PGSIZE
69 void hls_init(uint32_t hart_id
); // need to call this before launching linux
71 /* This function is used to initialize HLS()->time/HLS()->timecmp */
72 void mtime_init(void);
75 * This function needs be implement by SoC code.
76 * Although the privileged instruction set defines that MSIP will be
77 * memory-mapped, but does not define how to map. SoC can be implemented as
78 * a bit, a byte, a word, and so on.
79 * So we can't provide code that is related to implementation.
81 void set_msip(int hartid
, int val
);
83 #endif // __ASSEMBLER__