Files
acrn-hypervisor/hypervisor/include/arch/riscv/asm/cpu.h
hangliu1 286c383b53 hv: multiarch: riscv: add dummy header for riscv
add dummy headrer file for early compile, should be replaced totally later.

Tracked-On: #8801
Signed-off-by: hangliu1 <hang1.liu@intel.com>
Reviewed-by: Wang, Yu1 <yu1.wang@intel.com>
Reviewed-by: Liu, Yifan1 <yifan1.liu@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2025-09-19 15:04:55 +08:00

58 lines
1.2 KiB
C

/*
* Copyright (C) 2025 Intel Corporation.
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#ifndef RISCV_CPU_H
#define RISCV_CPU_H
#include <types.h>
#include <lib/util.h>
/* CPU states defined */
enum pcpu_boot_state {
PCPU_STATE_RESET = 0U,
PCPU_STATE_INITIALIZING,
PCPU_STATE_RUNNING,
PCPU_STATE_HALTED,
PCPU_STATE_DEAD,
};
static inline void wait_sync_change(__unused volatile const uint64_t *sync, __unused uint64_t wake_sync)
{
/**
* Dummy implementation.
* Official implementations are to be provided in the platform initialization patchset (by Hang).
*/
}
static inline bool is_pcpu_active(__unused uint16_t pcpu_id)
{
/**
* Dummy implementation.
* Official implementations are to be provided in the platform initialization patchset (by Hang).
*/
return true;
}
static inline uint16_t get_pcpu_id(void)
{
/**
* Dummy implementation.
* Official implementations are to be provided in the platform initialization patchset (by Hang).
*/
return 0U;
}
/* Write CSR */
#define cpu_csr_write(reg, csr_val) \
({ \
uint64_t val = (uint64_t)csr_val; \
asm volatile (" csrw " STRINGIFY(reg) ", %0 \n\t" \
:: "r"(val): "memory"); \
})
#endif /* RISCV_CPU_H */