hv:Replace dynamic memory with static for port io

-- Add emulated port io index
-- Add emulated pio array in vm structure
-- Remove port list in vm structure
-- Remove free_io_emulation_resource/register_io_handler/
   create_io_handler APIs

v2-->v3:
 -- not add 'is_emulated', check len == 0U
 -- Check if io_read/io_write handler is NULL before calling
 -- Replace ENUM with MACRO for emulated pio index to avoid
    MISRA-C violations

v1-->v2:
  -- Remove EMUL_PIO_NUM in Kconfig, add emulated pio index
     for PIC/PCI/UART/RTC/PM

Tracked-On: #861
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Mingqiang Chi
2018-11-05 19:05:34 +08:00
committed by lijinxia
parent 5a1f24473d
commit 73530055b6
11 changed files with 61 additions and 130 deletions

View File

@@ -131,7 +131,7 @@ void vpci_init(struct acrn_vm *vm)
#endif
if ((vpci->ops->init != NULL) && (vpci->ops->init(vm) == 0)) {
register_io_emulation_handler(vm, &pci_cfg_range,
register_io_emulation_handler(vm, PCI_PIO_IDX, &pci_cfg_range,
&pci_cfg_io_read, &pci_cfg_io_write);
/* This is a tmp solution to avoid sos reboot failure, it need pass-thru IO port CF9 for Reset Control
* register.

View File

@@ -866,11 +866,11 @@ static void vpic_register_io_handler(struct acrn_vm *vm)
.len = 2U
};
register_io_emulation_handler(vm, &master_range,
register_io_emulation_handler(vm, PIC_MASTER_PIO_IDX, &master_range,
&vpic_master_io_read, &vpic_master_io_write);
register_io_emulation_handler(vm, &slave_range,
register_io_emulation_handler(vm, PIC_SLAVE_PIO_IDX, &slave_range,
&vpic_slave_io_read, &vpic_slave_io_write);
register_io_emulation_handler(vm, &elcr_range,
register_io_emulation_handler(vm, PIC_ELC_PIO_IDX, &elcr_range,
&vpic_elc_io_read, &vpic_elc_io_write);
}

View File

@@ -77,5 +77,5 @@ void vrtc_init(struct acrn_vm *vm)
/* Initializing the CMOS RAM offset to 0U */
vm->vrtc_offset = 0U;
register_io_emulation_handler(vm, &range, vrtc_read, vrtc_write);
register_io_emulation_handler(vm, RTC_PIO_IDX, &range, vrtc_read, vrtc_write);
}