coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
clint.c
Go to the documentation of this file.
1
/* SPDX-License-Identifier: GPL-2.0-only */
2
3
#include <
mcall.h
>
4
#include <
device/mmio.h
>
5
#include <mainboard/addressmap.h>
6
7
/* This function is used to initialize HLS()->time/HLS()->timecmp */
8
void
mtime_init
(
void
)
9
{
10
long
hart_id = read_csr(mhartid);
11
HLS
()->time = (
uint64_t
*)(
QEMU_VIRT_CLINT
+ 0xbff8);
12
HLS
()->timecmp = (
uint64_t
*)(
QEMU_VIRT_CLINT
+ 0x4000 + 8 * hart_id);
13
}
14
15
void
set_msip
(
int
hartid,
int
val
)
16
{
17
write32
((
void
*)(
QEMU_VIRT_CLINT
+ 4 * (
uintptr_t
)hartid), !!
val
);
18
}
write32
static void write32(void *addr, uint32_t val)
Definition:
mmio.h:40
mmio.h
set_msip
void set_msip(int hartid, int val)
Definition:
clint.c:15
mtime_init
void mtime_init(void)
Definition:
clint.c:8
QEMU_VIRT_CLINT
#define QEMU_VIRT_CLINT
Definition:
addressmap.h:3
mcall.h
HLS
#define HLS()
Definition:
mcall.h:63
uintptr_t
unsigned long uintptr_t
Definition:
stdint.h:21
uint64_t
unsigned long long uint64_t
Definition:
stdint.h:17
val
u8 val
Definition:
sys.c:300
src
mainboard
emulation
qemu-riscv
clint.c
Generated by
1.9.1