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 }
static void write32(void *addr, uint32_t val)
Definition: mmio.h:40
void set_msip(int hartid, int val)
Definition: clint.c:15
void mtime_init(void)
Definition: clint.c:8
#define QEMU_VIRT_CLINT
Definition: addressmap.h:3
#define HLS()
Definition: mcall.h:63
unsigned long uintptr_t
Definition: stdint.h:21
unsigned long long uint64_t
Definition: stdint.h:17
u8 val
Definition: sys.c:300