HV: Minor refinement about RTVM pm MACRO and comments

This patch mainly does the following:
  - Replace prefix RT_VM_ with VIRTUAL_.
  - Remove the check of "addr != RT_VM_PM1A_CNT_ADDR" as the handler is specific for this addr.
  - Add comments about the meaning of return value.

Tracked-On: #2865
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Kaige Fu
2019-04-01 17:00:24 +00:00
committed by wenlingz
parent 9c5e16987a
commit 336ed72250
3 changed files with 24 additions and 20 deletions

View File

@@ -222,12 +222,16 @@ static bool rt_vm_pm1a_io_read(__unused struct acrn_vm *vm, __unused struct acrn
return false;
}
/*
* retval true means that we complete the emulation in HV and no need to re-inject the request to DM.
* retval false means that we should re-inject the request to DM.
*/
static bool rt_vm_pm1a_io_write(struct acrn_vm *vm, uint16_t addr, size_t width, uint32_t v)
{
if ((addr != RT_VM_PM1A_CNT_ADDR) || (width != 2U)) {
if (width != 2U) {
pr_dbg("Invalid address (0x%x) or width (0x%x)", addr, width);
} else {
if (((v & RT_VM_PM1A_SLP_EN) && (((v & RT_VM_PM1A_SLP_TYP) >> 10U) == 5U)) != 0U) {
if (((v & VIRTUAL_PM1A_SLP_EN) && (((v & VIRTUAL_PM1A_SLP_TYP) >> 10U) == 5U)) != 0U) {
vm->state = VM_POWERING_OFF;
}
}
@@ -240,9 +244,9 @@ void register_rt_vm_pm1a_ctl_handler(struct acrn_vm *vm)
struct vm_io_range io_range;
io_range.flags = IO_ATTR_RW;
io_range.base = RT_VM_PM1A_CNT_ADDR;
io_range.base = VIRTUAL_PM1A_CNT_ADDR;
io_range.len = 1U;
register_pio_emulation_handler(vm, RT_VM_PM1A_CNT_PIO_IDX, &io_range,
register_pio_emulation_handler(vm, VIRTUAL_PM1A_CNT_PIO_IDX, &io_range,
&rt_vm_pm1a_io_read, &rt_vm_pm1a_io_write);
}