riscv: update mtime initialization

Add a interface, which is implemented by SoC.

Change-Id: I5524732f6eb3841e43afd176644119b03b5e5e27
Signed-off-by: Xiang Wang <wxjstz@126.com>
Reviewed-on: https://review.coreboot.org/28372
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
This commit is contained in:
Xiang Wang
2018-08-28 16:34:29 +08:00
committed by Patrick Georgi
parent 0370bcf40c
commit 2e38dbe5f1
8 changed files with 73 additions and 3 deletions

View File

@@ -61,6 +61,9 @@ typedef struct {
void hls_init(uint32_t hart_id); // need to call this before launching linux
/* This function is used to initialize HLS()->time/HLS()->timecmp */
void mtime_init(void);
#endif // __ASSEMBLER__
#endif

View File

@@ -40,9 +40,7 @@ void hls_init(uint32_t hart_id)
memset(HLS(), 0, sizeof(*HLS()));
HLS()->hart_id = hart_id;
/* Initialize these pointers with dummy values, for now */
HLS()->time = NULL;
HLS()->timecmp = NULL;
mtime_init();
printk(BIOS_SPEW, "Time is %p and timecmp is %p\n",
HLS()->time, HLS()->timecmp);