forked from Mirrors/opensbi
lib: sbi: Update sbi_{entry,init}_count() to take a hart index
All callers already have the hartindex available, so this removes a hartid to hartindex conversion. Signed-off-by: Samuel Holland <samuel.holland@sifive.com> Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:

committed by
Anup Patel

parent
9f86524b58
commit
3962be84d4
@@ -16,9 +16,9 @@ struct sbi_scratch;
|
|||||||
|
|
||||||
void __noreturn sbi_init(struct sbi_scratch *scratch);
|
void __noreturn sbi_init(struct sbi_scratch *scratch);
|
||||||
|
|
||||||
unsigned long sbi_entry_count(u32 hartid);
|
unsigned long sbi_entry_count(u32 hartindex);
|
||||||
|
|
||||||
unsigned long sbi_init_count(u32 hartid);
|
unsigned long sbi_init_count(u32 hartindex);
|
||||||
|
|
||||||
void __noreturn sbi_exit(struct sbi_scratch *scratch);
|
void __noreturn sbi_exit(struct sbi_scratch *scratch);
|
||||||
|
|
||||||
|
@@ -324,8 +324,8 @@ int sbi_hsm_hart_start(struct sbi_scratch *scratch,
|
|||||||
if (!hsm_start_ticket_acquire(hdata))
|
if (!hsm_start_ticket_acquire(hdata))
|
||||||
return SBI_EINVAL;
|
return SBI_EINVAL;
|
||||||
|
|
||||||
init_count = sbi_init_count(hartid);
|
init_count = sbi_init_count(hartindex);
|
||||||
entry_count = sbi_entry_count(hartid);
|
entry_count = sbi_entry_count(hartindex);
|
||||||
|
|
||||||
rscratch->next_arg1 = arg1;
|
rscratch->next_arg1 = arg1;
|
||||||
rscratch->next_addr = saddr;
|
rscratch->next_addr = saddr;
|
||||||
|
@@ -551,7 +551,7 @@ void __noreturn sbi_init(struct sbi_scratch *scratch)
|
|||||||
init_warmboot(scratch, hartid);
|
init_warmboot(scratch, hartid);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long sbi_entry_count(u32 hartid)
|
unsigned long sbi_entry_count(u32 hartindex)
|
||||||
{
|
{
|
||||||
struct sbi_scratch *scratch;
|
struct sbi_scratch *scratch;
|
||||||
unsigned long *entry_count;
|
unsigned long *entry_count;
|
||||||
@@ -559,7 +559,7 @@ unsigned long sbi_entry_count(u32 hartid)
|
|||||||
if (!entry_count_offset)
|
if (!entry_count_offset)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
scratch = sbi_hartid_to_scratch(hartid);
|
scratch = sbi_hartindex_to_scratch(hartindex);
|
||||||
if (!scratch)
|
if (!scratch)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -568,7 +568,7 @@ unsigned long sbi_entry_count(u32 hartid)
|
|||||||
return *entry_count;
|
return *entry_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long sbi_init_count(u32 hartid)
|
unsigned long sbi_init_count(u32 hartindex)
|
||||||
{
|
{
|
||||||
struct sbi_scratch *scratch;
|
struct sbi_scratch *scratch;
|
||||||
unsigned long *init_count;
|
unsigned long *init_count;
|
||||||
@@ -576,7 +576,7 @@ unsigned long sbi_init_count(u32 hartid)
|
|||||||
if (!init_count_offset)
|
if (!init_count_offset)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
scratch = sbi_hartid_to_scratch(hartid);
|
scratch = sbi_hartindex_to_scratch(hartindex);
|
||||||
if (!scratch)
|
if (!scratch)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@@ -27,13 +27,15 @@ extern void __ae350_disable_coherency(void);
|
|||||||
|
|
||||||
static int ae350_hart_start(u32 hartid, ulong saddr)
|
static int ae350_hart_start(u32 hartid, ulong saddr)
|
||||||
{
|
{
|
||||||
|
u32 hartindex = sbi_hartid_to_hartindex(hartid);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Don't send wakeup command when:
|
* Don't send wakeup command when:
|
||||||
* 1) boot-time
|
* 1) boot-time
|
||||||
* 2) the target hart is non-sleepable 25-series hart0
|
* 2) the target hart is non-sleepable 25-series hart0
|
||||||
*/
|
*/
|
||||||
if (!sbi_init_count(hartid) || (is_andes(25) && hartid == 0))
|
if (!sbi_init_count(hartindex) || (is_andes(25) && hartid == 0))
|
||||||
return sbi_ipi_raw_send(sbi_hartid_to_hartindex(hartid));
|
return sbi_ipi_raw_send(hartindex);
|
||||||
|
|
||||||
/* Write wakeup command to the sleep hart */
|
/* Write wakeup command to the sleep hart */
|
||||||
smu_set_command(&smu, WAKEUP_CMD, hartid);
|
smu_set_command(&smu, WAKEUP_CMD, hartid);
|
||||||
|
Reference in New Issue
Block a user