HV:change the cpu state to enum type

enum cpu state is better than cpu state macro.

V1->V2:
  move enum cpu_state under #ifndef ASSEMBLER MACRO to avoid
assembler compiler scan.

Signed-off-by: Huihuang Shi <huihuang.shi@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Huihuang Shi 2018-06-29 13:35:28 +08:00 committed by lijinxia
parent eaa5418fba
commit b068959b78
3 changed files with 11 additions and 9 deletions

View File

@ -293,7 +293,7 @@ static int init_phy_cpu_storage(void)
return bsp_cpu_id;
}
static void cpu_set_current_state(uint32_t logical_id, int state)
static void cpu_set_current_state(uint32_t logical_id, enum cpu_state state)
{
spinlock_obtain(&up_count_spinlock);

View File

@ -132,13 +132,6 @@
/* Boot CPU ID */
#define CPU_BOOT_ID 0U
/* CPU states defined */
#define CPU_STATE_RESET 0
#define CPU_STATE_INITIALIZING 1
#define CPU_STATE_RUNNING 2
#define CPU_STATE_HALTED 3
#define CPU_STATE_DEAD 4
/* hypervisor stack bottom magic('intl') */
#define SP_BOTTOM_MAGIC 0x696e746cUL
@ -218,6 +211,15 @@ enum feature_word {
FEATURE_WORDS,
};
/* CPU states defined */
enum cpu_state {
CPU_STATE_RESET = 0,
CPU_STATE_INITIALIZING,
CPU_STATE_RUNNING,
CPU_STATE_HALTED,
CPU_STATE_DEAD,
};
struct cpu_state_info {
uint8_t px_cnt; /* count of all Px states */
const struct cpu_px_data *px_data;

View File

@ -32,7 +32,7 @@ struct per_cpu_region {
struct emul_cnx g_inst_ctxt;
struct host_gdt gdt;
struct tss_64 tss;
int state;
enum cpu_state state;
uint8_t mc_stack[CONFIG_STACK_SIZE] __aligned(16);
uint8_t df_stack[CONFIG_STACK_SIZE] __aligned(16);
uint8_t sf_stack[CONFIG_STACK_SIZE] __aligned(16);