Introduce sbi_current_hartid()

Use this helper instead of hardcoding csr_read(mhartid).

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
This commit is contained in:
Damien Le Moal
2018-12-21 17:06:59 +09:00
parent 426adf9f60
commit 5563a03354
4 changed files with 15 additions and 4 deletions

View File

@@ -163,7 +163,7 @@ static atomic_t coldboot_lottery = ATOMIC_INITIALIZER(0);
void __attribute__((noreturn)) sbi_init(struct sbi_scratch *scratch)
{
bool coldboot = FALSE;
u32 hartid = csr_read(mhartid);
u32 hartid = sbi_current_hartid();
if (atomic_add_return(&coldboot_lottery, 1) == 1)
coldboot = TRUE;