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 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 // __ASSEMBLER__
#endif #endif

View File

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

View File

@ -1,5 +1,6 @@
ifeq ($(CONFIG_SOC_LOWRISC_LOWRISC),y) ifeq ($(CONFIG_SOC_LOWRISC_LOWRISC),y)
bootblock-y += mtime.c
romstage-y += cbmem.c romstage-y += cbmem.c
ramstage-y += cbmem.c ramstage-y += cbmem.c

View File

@ -0,0 +1,22 @@
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2018 HardenedLinux
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <mcall.h>
/* FIXME: This is an empty implementation, please improve */
/* This function is used to initialize HLS()->time/HLS()->timecmp */
void mtime_init(void)
{
}

View File

@ -14,6 +14,7 @@
ifeq ($(CONFIG_SOC_SIFIVE_FU540),y) ifeq ($(CONFIG_SOC_SIFIVE_FU540),y)
bootblock-y += uart.c bootblock-y += uart.c
bootblock-y += mtime.c
bootblock-y += media.c bootblock-y += media.c
bootblock-y += bootblock.c bootblock-y += bootblock.c

View File

@ -0,0 +1,22 @@
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2018 HardenedLinux
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <mcall.h>
/* FIXME: This is an empty implementation, please improve */
/* This function is used to initialize HLS()->time/HLS()->timecmp */
void mtime_init(void)
{
}

View File

@ -1,5 +1,6 @@
ifeq ($(CONFIG_SOC_UCB_RISCV),y) ifeq ($(CONFIG_SOC_UCB_RISCV),y)
bootblock-y += mtime.c
romstage-y += cbmem.c romstage-y += cbmem.c
ramstage-y += cbmem.c ramstage-y += cbmem.c

22
src/soc/ucb/riscv/mtime.c Normal file
View File

@ -0,0 +1,22 @@
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2018 HardenedLinux
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <mcall.h>
/* FIXME: This is an empty implementation, please improve */
/* This function is used to initialize HLS()->time/HLS()->timecmp */
void mtime_init(void)
{
}