vatpit
static void pit_timer_start_cntr0(struct vatpit *vatpit);
vatpit_delta_ticks(struct vatpit *vatpit, struct channel *c)
vatpit_get_out(struct vatpit *vatpit, int channel)
c = &vatpit->channel[channel];
delta_ticks = vatpit_delta_ticks(vatpit, c);
struct vatpit *vatpit;
vatpit = arg->vatpit;
c = &vatpit->channel[arg->channel_num];
VATPIT_LOCK(vatpit);
pit_timer_start_cntr0(vatpit);
(void) vatpic_pulse_irq(vatpit->vm, 0);
(void) vioapic_pulse_irq(vatpit->vm, 2);
VATPIT_UNLOCK(vatpit);
vatpit_callout_reset(struct vatpit *vatpit)
struct channel *c = &vatpit->channel[0];
ASSERT(VATPIT_LOCKED(vatpit));
pit_timer_start_cntr0(struct vatpit *vatpit)
struct channel *c = &vatpit->channel[0];
vatpit_callout_reset(vatpit);
pit_update_counter(struct vatpit *vatpit, struct channel *c, bool latch)
delta_ticks = vatpit_delta_ticks(vatpit, c);
pit_readback1(struct vatpit *vatpit, int channel, uint8_t cmd)
c = &vatpit->channel[channel];
(void) pit_update_counter(vatpit, c, true);
if (c->mode == TIMER_INTTC && vatpit_get_out(vatpit, channel))
pit_readback(struct vatpit *vatpit, uint8_t cmd)
error = pit_readback1(vatpit, 0, cmd);
error = pit_readback1(vatpit, 1, cmd);
error = pit_readback1(vatpit, 2, cmd);
vatpit_update_mode(struct vatpit *vatpit, uint8_t val)
return (pit_readback(vatpit, val));
c = &vatpit->channel[sel >> 6];
(void) pit_update_counter(vatpit, c, true);
struct vatpit *vatpit = arg;
VATPIT_LOCK(vatpit);
error = vatpit_update_mode(vatpit, val);
VATPIT_UNLOCK(vatpit);
c = &vatpit->channel[port - TIMER_CNTR0];
VATPIT_LOCK(vatpit);
tmp = pit_update_counter(vatpit, c, false);
pit_timer_start_cntr0(vatpit);
VATPIT_UNLOCK(vatpit);
struct vatpit *vatpit = arg;
VATPIT_LOCK(vatpit);
if (vatpit_get_out(vatpit, 2))
VATPIT_UNLOCK(vatpit);
struct vatpit *
struct vatpit *vatpit;
vatpit = kmem_zalloc(sizeof (struct vatpit), KM_SLEEP);
vatpit->vm = vm;
mutex_init(&vatpit->lock, NULL, MUTEX_ADAPTIVE, NULL);
callout_init(&vatpit->channel[i].callout, 1);
arg = &vatpit->channel[i].callout_arg;
arg->vatpit = vatpit;
return (vatpit);
vatpit_cleanup(struct vatpit *vatpit)
callout_drain(&vatpit->channel[i].callout);
mutex_destroy(&vatpit->lock);
kmem_free(vatpit, sizeof (*vatpit));
vatpit_localize_resources(struct vatpit *vatpit)
if (vatpit->channel[i].mode != 0) {
vmm_glue_callout_localize(&vatpit->channel[i].callout);
vatpit_pause(struct vatpit *vatpit)
struct channel *c = &vatpit->channel[0];
VATPIT_LOCK(vatpit);
VATPIT_UNLOCK(vatpit);
vatpit_resume(struct vatpit *vatpit)
struct channel *c = &vatpit->channel[0];
VATPIT_LOCK(vatpit);
vatpit_callout_reset(vatpit);
VATPIT_UNLOCK(vatpit);
struct vatpit *vatpit = datap;
VATPIT_LOCK(vatpit);
const struct channel *src = &vatpit->channel[i];
vm_normalize_hrtime(vatpit->vm, src->time_target);
VATPIT_UNLOCK(vatpit);
struct vatpit *vatpit = datap;
VATPIT_LOCK(vatpit);
#define VATPIT_LOCK(vatpit) mutex_enter(&((vatpit)->lock))
struct channel *out = &vatpit->channel[i];
#define VATPIT_UNLOCK(vatpit) mutex_exit(&((vatpit)->lock))
#define VATPIT_LOCKED(vatpit) MUTEX_HELD(&((vatpit)->lock))
vm_denormalize_hrtime(vatpit->vm, chan->vac_time_target);
if (!vm_is_paused(vatpit->vm)) {
vatpit_callout_reset(vatpit);
VATPIT_UNLOCK(vatpit);
struct vatpit *vatpit;
struct vatpit *vatpit_init(struct vm *vm);
void vatpit_cleanup(struct vatpit *vatpit);
void vatpit_localize_resources(struct vatpit *);
void vatpit_pause(struct vatpit *);
void vatpit_resume(struct vatpit *);
struct vatpit *vm_atpit(struct vm *vm);
struct vatpit *vatpit; /* (i) virtual atpit */
vatpit_localize_resources(vm->vatpit);
struct vatpit *
return (vm->vatpit);
return (vm->vatpit);
vm->vatpit = vatpit_init(vm);
vatpit_cleanup(vm->vatpit);
vatpit_pause(vm->vatpit);
vatpit_resume(vm->vatpit);
struct vatpit *pit = vm_atpit(vm);