mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-02 01:16:50 +00:00
dm: vpit: add vPIT support
vPIT is used as a source of system timer by UEFI (e.g. OVMF). This is ported from Bhyve, with a few changes: - move to user space, using POSIX timer - support timer mode 3 - improve the emulation of OUT and STATUS byte - improve the emulation of counter behavior - improve the emulation of CE update in periodic mode - treat CR == 0 as 0x10000 Origin: FreeBSD License: BSD-3-Clause URL: https://svnweb.freebsd.org/ commit: 283291 Purpose: Adding vPIT support. Maintained-by: External Tracked-On: #1392 Signed-off-by: Peter Fang <peter.fang@intel.com> Acked-by: Yin Fengwei <fengwei.yin@intel.com>
This commit is contained in:
@@ -55,6 +55,7 @@
|
||||
#include "lpc.h"
|
||||
#include "smbiostbl.h"
|
||||
#include "rtc.h"
|
||||
#include "pit.h"
|
||||
#include "version.h"
|
||||
#include "sw_load.h"
|
||||
#include "monitor.h"
|
||||
@@ -430,6 +431,10 @@ vm_init_vdevs(struct vmctx *ctx)
|
||||
if (ret < 0)
|
||||
goto vrtc_fail;
|
||||
|
||||
ret = vpit_init(ctx);
|
||||
if (ret < 0)
|
||||
goto vpit_fail;
|
||||
|
||||
sci_init(ctx);
|
||||
init_bvmcons();
|
||||
|
||||
@@ -442,10 +447,13 @@ vm_init_vdevs(struct vmctx *ctx)
|
||||
goto pci_fail;
|
||||
|
||||
return 0;
|
||||
|
||||
pci_fail:
|
||||
monitor_close();
|
||||
monitor_fail:
|
||||
deinit_bvmcons();
|
||||
vpit_deinit(ctx);
|
||||
vpit_fail:
|
||||
vrtc_deinit(ctx);
|
||||
vrtc_fail:
|
||||
ioc_deinit(ctx);
|
||||
@@ -461,6 +469,7 @@ vm_deinit_vdevs(struct vmctx *ctx)
|
||||
deinit_pci(ctx);
|
||||
monitor_close();
|
||||
deinit_bvmcons();
|
||||
vpit_deinit(ctx);
|
||||
vrtc_deinit(ctx);
|
||||
ioc_deinit(ctx);
|
||||
atkbdc_deinit(ctx);
|
||||
@@ -483,6 +492,7 @@ vm_reset_vdevs(struct vmctx *ctx)
|
||||
* could be assigned with different number after reset.
|
||||
*/
|
||||
atkbdc_deinit(ctx);
|
||||
vpit_deinit(ctx);
|
||||
vrtc_deinit(ctx);
|
||||
|
||||
deinit_pci(ctx);
|
||||
@@ -491,6 +501,7 @@ vm_reset_vdevs(struct vmctx *ctx)
|
||||
|
||||
atkbdc_init(ctx);
|
||||
vrtc_init(ctx);
|
||||
vpit_init(ctx);
|
||||
|
||||
ioapic_init(ctx);
|
||||
pci_irq_init(ctx);
|
||||
|
Reference in New Issue
Block a user