long atomic_sub_return(atomic_t *atom, long value);
-long arch_atomic_cmpxchg(atomic_t *atom, long oldval, long newval);
+long atomic_cmpxchg(atomic_t *atom, long oldval, long newval);
-long arch_atomic_xchg(atomic_t *atom, long newval);
+long atomic_xchg(atomic_t *atom, long newval);
unsigned int atomic_raw_xchg_uint(volatile unsigned int *ptr,
unsigned int newval);
__cmpxchg((ptr), _o_, _n_, sizeof(*(ptr))); \
})
-long arch_atomic_cmpxchg(atomic_t *atom, long oldval, long newval)
+long atomic_cmpxchg(atomic_t *atom, long oldval, long newval)
{
#ifdef __riscv_atomic
return __sync_val_compare_and_swap(&atom->counter, oldval, newval);
#endif
}
-long arch_atomic_xchg(atomic_t *atom, long newval)
+long atomic_xchg(atomic_t *atom, long newval)
{
/* Atomically set new value and return old value. */
#ifdef __riscv_atomic
struct sbi_hsm_data *hdata = sbi_scratch_offset_ptr(scratch,
hart_data_offset);
- oldstate = arch_atomic_cmpxchg(&hdata->state, SBI_HART_STARTING,
- SBI_HART_STARTED);
+ oldstate = atomic_cmpxchg(&hdata->state, SBI_HART_STARTING,
+ SBI_HART_STARTED);
if (oldstate != SBI_HART_STARTING)
sbi_hart_hang();
}
hart_data_offset);
void (*jump_warmboot)(void) = (void (*)(void))scratch->warmboot_addr;
- hstate = arch_atomic_cmpxchg(&hdata->state, SBI_HART_STOPPING,
- SBI_HART_STOPPED);
+ hstate = atomic_cmpxchg(&hdata->state, SBI_HART_STOPPING,
+ SBI_HART_STOPPED);
if (hstate != SBI_HART_STOPPING)
goto fail_exit;
if (!rscratch)
return SBI_EINVAL;
hdata = sbi_scratch_offset_ptr(rscratch, hart_data_offset);
- hstate = arch_atomic_cmpxchg(&hdata->state, SBI_HART_STOPPED,
- SBI_HART_STARTING);
+ hstate = atomic_cmpxchg(&hdata->state, SBI_HART_STOPPED,
+ SBI_HART_STARTING);
if (hstate == SBI_HART_STARTED)
return SBI_EALREADY_STARTED;
if (!sbi_hsm_hart_started(hartid))
return SBI_EINVAL;
- oldstate = arch_atomic_cmpxchg(&hdata->state, SBI_HART_STARTED,
- SBI_HART_STOPPING);
+ oldstate = atomic_cmpxchg(&hdata->state, SBI_HART_STARTED,
+ SBI_HART_STOPPING);
if (oldstate != SBI_HART_STARTED) {
sbi_printf("%s: ERR: The hart is in invalid state [%u]\n",
__func__, oldstate);