diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2008-05-20 14:17:15 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2008-05-20 14:17:15 +0100 |
commit | 509529e99148111a429d9ec39d524e462b80332a (patch) | |
tree | 3296cf1ed09add9ff8031cd7a4c52b5a855936ff /xen/arch/x86/hvm/i8254.c | |
parent | cc62c82dd2086625d42e0cacd2901ab686b23922 (diff) | |
download | xen-509529e99148111a429d9ec39d524e462b80332a.tar.gz xen-509529e99148111a429d9ec39d524e462b80332a.tar.bz2 xen-509529e99148111a429d9ec39d524e462b80332a.zip |
x86 hvm: Xen interface and implementation for virtual S3
Signed-off-by: Tian Kevin <kevin.tian@intel.com>
Signed-off-by: Yu Ke <ke.yu@intel.com>
Signed-off-by: Ke Liping <liping.ke@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Diffstat (limited to 'xen/arch/x86/hvm/i8254.c')
-rw-r--r-- | xen/arch/x86/hvm/i8254.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/xen/arch/x86/hvm/i8254.c b/xen/arch/x86/hvm/i8254.c index c41783feb0..ea6d1f11fc 100644 --- a/xen/arch/x86/hvm/i8254.c +++ b/xen/arch/x86/hvm/i8254.c @@ -446,22 +446,16 @@ static int pit_load(struct domain *d, hvm_domain_context_t *h) HVM_REGISTER_SAVE_RESTORE(PIT, pit_save, pit_load, 1, HVMSR_PER_DOM); -void pit_init(struct vcpu *v, unsigned long cpu_khz) +void pit_reset(struct domain *d) { - PITState *pit = vcpu_vpit(v); + PITState *pit = domain_vpit(d); struct hvm_hw_pit_channel *s; int i; - spin_lock_init(&pit->lock); - - /* Some sub-functions assert that they are called with the lock held. */ - spin_lock(&pit->lock); - + destroy_periodic_time(&pit->pt0); pit->pt0.source = PTSRC_isa; - register_portio_handler(v->domain, PIT_BASE, 4, handle_pit_io); - register_portio_handler(v->domain, 0x61, 1, handle_speaker_io); - ticks_per_sec(v) = cpu_khz * (int64_t)1000; + spin_lock(&pit->lock); for ( i = 0; i < 3; i++ ) { @@ -474,6 +468,20 @@ void pit_init(struct vcpu *v, unsigned long cpu_khz) spin_unlock(&pit->lock); } +void pit_init(struct vcpu *v, unsigned long cpu_khz) +{ + PITState *pit = vcpu_vpit(v); + + spin_lock_init(&pit->lock); + + register_portio_handler(v->domain, PIT_BASE, 4, handle_pit_io); + register_portio_handler(v->domain, 0x61, 1, handle_speaker_io); + + ticks_per_sec(v) = cpu_khz * (int64_t)1000; + + pit_reset(v->domain); +} + void pit_deinit(struct domain *d) { PITState *pit = domain_vpit(d); |