summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Mustacchi <rm@joyent.com>2011-06-03 11:52:04 -0700
committerRobert Mustacchi <rm@joyent.com>2011-06-03 11:52:04 -0700
commit45ba741822f49e8a3d8e871429559deb15478647 (patch)
tree15fe4baf309a4ffc56f366102cbdb495f62e88ea
parent9f278f28f5b52770a3a5b8ecfe727e650e2b6797 (diff)
downloadillumos-kvm-45ba741822f49e8a3d8e871429559deb15478647.tar.gz
HVM-284 kvm_i8254.h should contain all definitions for the i8254.
-rw-r--r--kvm.c2
-rw-r--r--kvm.h46
-rw-r--r--kvm_i8254.c1
-rw-r--r--kvm_i8254.h58
4 files changed, 54 insertions, 53 deletions
diff --git a/kvm.c b/kvm.c
index 58e3ab5..c2f570b 100644
--- a/kvm.c
+++ b/kvm.c
@@ -40,7 +40,6 @@
#include "irqflags.h"
#include "kvm_host.h"
#include "kvm_x86host.h"
-#include "kvm_i8254.h"
#include "kvm_lapic.h"
#include "processor-flags.h"
#include "hyperv.h"
@@ -51,6 +50,7 @@
#include "tss.h"
#include "kvm_ioapic.h"
#include "kvm_coalesced_mmio.h"
+#include "kvm_i8254.h"
#include "kvm_mmu.h"
#undef DEBUG
diff --git a/kvm.h b/kvm.h
index 1a46ed7..d4988ec 100644
--- a/kvm.h
+++ b/kvm.h
@@ -1783,52 +1783,6 @@ static void kvm_free_irq_routing(struct kvm *kvm) {}
#define KVM_USERSPACE_IRQ_SOURCE_ID 0
-typedef struct kvm_kpit_channel_state {
- uint32_t count; /* can be 65536 */
- uint16_t latched_count;
- uint8_t count_latched;
- uint8_t status_latched;
- uint8_t status;
- uint8_t read_state;
- uint8_t write_state;
- uint8_t write_latch;
- uint8_t rw_mode;
- uint8_t mode;
- uint8_t bcd; /* not supported */
- uint8_t gate; /* timer start */
- hrtime_t count_load_time;
-} kvm_kpit_channel_state_t;
-
-typedef struct kvm_kpit_state {
- struct kvm_kpit_channel_state channels[3];
- uint32_t flags;
- struct kvm_timer pit_timer;
- int is_periodic;
- uint32_t speaker_data_on;
- kmutex_t lock;
- struct kvm_pit *pit;
- kmutex_t inject_lock;
- unsigned long irq_ack;
- struct kvm_irq_ack_notifier irq_ack_notifier;
-} kvm_kpit_state_t;
-
-typedef struct kvm_pit {
- unsigned long base_addresss;
- struct kvm_io_device dev;
- struct kvm_io_device speaker_dev;
- struct kvm *kvm;
- struct kvm_kpit_state pit_state;
- int irq_source_id;
- struct kvm_irq_mask_notifier mask_notifier;
-} kvm_pit_t;
-
-#define KVM_PIT_BASE_ADDRESS 0x40
-#define KVM_SPEAKER_BASE_ADDRESS 0x61
-#define KVM_PIT_MEM_LENGTH 4
-#define KVM_PIT_FREQ 1193181
-#define KVM_MAX_PIT_INTR_INTERVAL HZ / 100
-#define KVM_PIT_CHANNEL_MASK 0x3
-
#define RW_STATE_LSB 1
#define RW_STATE_MSB 2
#define RW_STATE_WORD0 3
diff --git a/kvm_i8254.c b/kvm_i8254.c
index 6e9fe34..b6d2991 100644
--- a/kvm_i8254.c
+++ b/kvm_i8254.c
@@ -41,6 +41,7 @@
#include "kvm_x86host.h"
#include "kvm_iodev.h"
#include "kvm.h"
+#include "kvm_i8254.h"
#include "irq.h"
extern int kvm_vcpu_is_bsp(struct kvm_vcpu *vcpu);
diff --git a/kvm_i8254.h b/kvm_i8254.h
index 2eda80f..92e842a 100644
--- a/kvm_i8254.h
+++ b/kvm_i8254.h
@@ -1,12 +1,58 @@
#ifndef __KVM_I8254_H
#define __KVM_I8254_H
-/* XXX Our header files suck */
-struct kvm;
+#include "kvm_iodev.h"
-void kvm_free_pit(struct kvm *);
-struct kvm_pit *kvm_create_pit(struct kvm *kvm, uint32_t flags);
-void kvm_pit_load_count(struct kvm *kvm, int channel, uint32_t val,
- boolean_t hpet_legacy_start);
+typedef struct kvm_kpit_channel_state {
+ uint32_t count; /* can be 65536 */
+ uint16_t latched_count;
+ uint8_t count_latched;
+ uint8_t status_latched;
+ uint8_t status;
+ uint8_t read_state;
+ uint8_t write_state;
+ uint8_t write_latch;
+ uint8_t rw_mode;
+ uint8_t mode;
+ uint8_t bcd; /* not supported */
+ uint8_t gate; /* timer start */
+ hrtime_t count_load_time;
+} kvm_kpit_channel_state_t;
+
+typedef struct kvm_kpit_state {
+ struct kvm_kpit_channel_state channels[3];
+ uint32_t flags;
+ struct kvm_timer pit_timer;
+ int is_periodic;
+ uint32_t speaker_data_on;
+ kmutex_t lock;
+ struct kvm_pit *pit;
+ kmutex_t inject_lock;
+ unsigned long irq_ack;
+ struct kvm_irq_ack_notifier irq_ack_notifier;
+} kvm_kpit_state_t;
+
+typedef struct kvm_pit {
+ unsigned long base_addresss;
+ struct kvm_io_device dev;
+ struct kvm_io_device speaker_dev;
+ struct kvm *kvm;
+ struct kvm_kpit_state pit_state;
+ int irq_source_id;
+ struct kvm_irq_mask_notifier mask_notifier;
+} kvm_pit_t;
+
+#define KVM_PIT_BASE_ADDRESS 0x40
+#define KVM_SPEAKER_BASE_ADDRESS 0x61
+#define KVM_PIT_MEM_LENGTH 4
+#define KVM_PIT_FREQ 1193181
+#define KVM_MAX_PIT_INTR_INTERVAL HZ / 100
+#define KVM_PIT_CHANNEL_MASK 0x3
+
+extern void kvm_inject_pit_timer_irqs(struct kvm_vcpu *);
+extern void kvm_pit_load_count(struct kvm *, int, uint32_t, boolean_t);
+extern struct kvm_pit *kvm_create_pit(struct kvm *, uint32_t);
+extern void kvm_free_pit(struct kvm *);
+extern void kvm_pit_reset(struct kvm_pit *);
#endif