mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge branch 'for-anthony' of git://github.com/bonzini/qemu
* 'for-anthony' of git://github.com/bonzini/qemu: remove qemu_get_clock add a generic scaling mechanism for timers change all other clock references to use nanosecond resolution accessors change all rt_clock references to use millisecond resolution accessors add more helper functions with explicit milli/nanosecond resolution
This commit is contained in:
+2
-2
@@ -1114,7 +1114,7 @@ static int audio_is_timer_needed (void)
|
||||
static void audio_reset_timer (AudioState *s)
|
||||
{
|
||||
if (audio_is_timer_needed ()) {
|
||||
qemu_mod_timer (s->ts, qemu_get_clock (vm_clock) + 1);
|
||||
qemu_mod_timer (s->ts, qemu_get_clock_ns (vm_clock) + 1);
|
||||
}
|
||||
else {
|
||||
qemu_del_timer (s->ts);
|
||||
@@ -1820,7 +1820,7 @@ static void audio_init (void)
|
||||
QLIST_INIT (&s->cap_head);
|
||||
atexit (audio_atexit);
|
||||
|
||||
s->ts = qemu_new_timer (vm_clock, audio_timer, s);
|
||||
s->ts = qemu_new_timer_ns (vm_clock, audio_timer, s);
|
||||
if (!s->ts) {
|
||||
hw_error("Could not create audio timer\n");
|
||||
}
|
||||
|
||||
+2
-2
@@ -46,7 +46,7 @@ static int no_run_out (HWVoiceOut *hw, int live)
|
||||
int64_t ticks;
|
||||
int64_t bytes;
|
||||
|
||||
now = qemu_get_clock (vm_clock);
|
||||
now = qemu_get_clock_ns (vm_clock);
|
||||
ticks = now - no->old_ticks;
|
||||
bytes = muldiv64 (ticks, hw->info.bytes_per_second, get_ticks_per_sec ());
|
||||
bytes = audio_MIN (bytes, INT_MAX);
|
||||
@@ -102,7 +102,7 @@ static int no_run_in (HWVoiceIn *hw)
|
||||
int samples = 0;
|
||||
|
||||
if (dead) {
|
||||
int64_t now = qemu_get_clock (vm_clock);
|
||||
int64_t now = qemu_get_clock_ns (vm_clock);
|
||||
int64_t ticks = now - no->old_ticks;
|
||||
int64_t bytes =
|
||||
muldiv64 (ticks, hw->info.bytes_per_second, get_ticks_per_sec ());
|
||||
|
||||
+2
-2
@@ -81,7 +81,7 @@ static void spice_audio_fini (void *opaque)
|
||||
static void rate_start (SpiceRateCtl *rate)
|
||||
{
|
||||
memset (rate, 0, sizeof (*rate));
|
||||
rate->start_ticks = qemu_get_clock (vm_clock);
|
||||
rate->start_ticks = qemu_get_clock_ns (vm_clock);
|
||||
}
|
||||
|
||||
static int rate_get_samples (struct audio_pcm_info *info, SpiceRateCtl *rate)
|
||||
@@ -91,7 +91,7 @@ static int rate_get_samples (struct audio_pcm_info *info, SpiceRateCtl *rate)
|
||||
int64_t bytes;
|
||||
int64_t samples;
|
||||
|
||||
now = qemu_get_clock (vm_clock);
|
||||
now = qemu_get_clock_ns (vm_clock);
|
||||
ticks = now - rate->start_ticks;
|
||||
bytes = muldiv64 (ticks, info->bytes_per_second, get_ticks_per_sec ());
|
||||
samples = (bytes - rate->bytes_sent) >> info->shift;
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ static int wav_run_out (HWVoiceOut *hw, int live)
|
||||
int rpos, decr, samples;
|
||||
uint8_t *dst;
|
||||
struct st_sample *src;
|
||||
int64_t now = qemu_get_clock (vm_clock);
|
||||
int64_t now = qemu_get_clock_ns (vm_clock);
|
||||
int64_t ticks = now - wav->old_ticks;
|
||||
int64_t bytes =
|
||||
muldiv64 (ticks, hw->info.bytes_per_second, get_ticks_per_sec ());
|
||||
|
||||
+3
-3
@@ -238,7 +238,7 @@ static void buffered_rate_tick(void *opaque)
|
||||
return;
|
||||
}
|
||||
|
||||
qemu_mod_timer(s->timer, qemu_get_clock(rt_clock) + 100);
|
||||
qemu_mod_timer(s->timer, qemu_get_clock_ms(rt_clock) + 100);
|
||||
|
||||
if (s->freeze_output)
|
||||
return;
|
||||
@@ -274,9 +274,9 @@ QEMUFile *qemu_fopen_ops_buffered(void *opaque,
|
||||
buffered_set_rate_limit,
|
||||
buffered_get_rate_limit);
|
||||
|
||||
s->timer = qemu_new_timer(rt_clock, buffered_rate_tick, s);
|
||||
s->timer = qemu_new_timer_ms(rt_clock, buffered_rate_tick, s);
|
||||
|
||||
qemu_mod_timer(s->timer, qemu_get_clock(rt_clock) + 100);
|
||||
qemu_mod_timer(s->timer, qemu_get_clock_ms(rt_clock) + 100);
|
||||
|
||||
return s->file;
|
||||
}
|
||||
|
||||
@@ -1135,7 +1135,7 @@ static void kbd_send_chars(void *opaque)
|
||||
/* characters are pending: we send them a bit later (XXX:
|
||||
horrible, should change char device API) */
|
||||
if (s->out_fifo.count > 0) {
|
||||
qemu_mod_timer(s->kbd_timer, qemu_get_clock(rt_clock) + 1);
|
||||
qemu_mod_timer(s->kbd_timer, qemu_get_clock_ms(rt_clock) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1457,7 +1457,7 @@ static void text_console_do_init(CharDriverState *chr, DisplayState *ds)
|
||||
|
||||
s->out_fifo.buf = s->out_fifo_buf;
|
||||
s->out_fifo.buf_size = sizeof(s->out_fifo_buf);
|
||||
s->kbd_timer = qemu_new_timer(rt_clock, kbd_send_chars, s);
|
||||
s->kbd_timer = qemu_new_timer_ms(rt_clock, kbd_send_chars, s);
|
||||
s->ds = ds;
|
||||
|
||||
if (!color_inited) {
|
||||
|
||||
+4
-4
@@ -85,7 +85,7 @@ static void piix4_acpi_system_hot_add_init(PCIBus *bus, PIIX4PMState *s);
|
||||
static uint32_t get_pmtmr(PIIX4PMState *s)
|
||||
{
|
||||
uint32_t d;
|
||||
d = muldiv64(qemu_get_clock(vm_clock), PM_TIMER_FREQUENCY, get_ticks_per_sec());
|
||||
d = muldiv64(qemu_get_clock_ns(vm_clock), PM_TIMER_FREQUENCY, get_ticks_per_sec());
|
||||
return d & 0xffffff;
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ static int get_pmsts(PIIX4PMState *s)
|
||||
{
|
||||
int64_t d;
|
||||
|
||||
d = muldiv64(qemu_get_clock(vm_clock), PM_TIMER_FREQUENCY,
|
||||
d = muldiv64(qemu_get_clock_ns(vm_clock), PM_TIMER_FREQUENCY,
|
||||
get_ticks_per_sec());
|
||||
if (d >= s->tmr_overflow_time)
|
||||
s->pmsts |= ACPI_BITMASK_TIMER_STATUS;
|
||||
@@ -149,7 +149,7 @@ static void pm_ioport_write(IORange *ioport, uint64_t addr, unsigned width,
|
||||
pmsts = get_pmsts(s);
|
||||
if (pmsts & val & ACPI_BITMASK_TIMER_STATUS) {
|
||||
/* if TMRSTS is reset, then compute the new overflow time */
|
||||
d = muldiv64(qemu_get_clock(vm_clock), PM_TIMER_FREQUENCY,
|
||||
d = muldiv64(qemu_get_clock_ns(vm_clock), PM_TIMER_FREQUENCY,
|
||||
get_ticks_per_sec());
|
||||
s->tmr_overflow_time = (d + 0x800000LL) & ~0x7fffffLL;
|
||||
}
|
||||
@@ -413,7 +413,7 @@ static int piix4_pm_initfn(PCIDevice *dev)
|
||||
register_ioport_write(s->smb_io_base, 64, 1, smb_ioport_writeb, &s->smb);
|
||||
register_ioport_read(s->smb_io_base, 64, 1, smb_ioport_readb, &s->smb);
|
||||
|
||||
s->tmr_timer = qemu_new_timer(vm_clock, pm_tmr_timer, s);
|
||||
s->tmr_timer = qemu_new_timer_ns(vm_clock, pm_tmr_timer, s);
|
||||
|
||||
qemu_system_powerdown = *qemu_allocate_irqs(piix4_powerdown, s, 1);
|
||||
|
||||
|
||||
+1
-1
@@ -166,7 +166,7 @@ static void timer_handler (int c, double interval_Sec)
|
||||
s->ticking[n] = 1;
|
||||
#ifdef DEBUG
|
||||
interval = get_ticks_per_sec() * interval_Sec;
|
||||
exp = qemu_get_clock (vm_clock) + interval;
|
||||
exp = qemu_get_clock_ns (vm_clock) + interval;
|
||||
s->exp[n] = exp;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -641,7 +641,7 @@ static uint32_t apic_get_current_count(APICState *s)
|
||||
{
|
||||
int64_t d;
|
||||
uint32_t val;
|
||||
d = (qemu_get_clock(vm_clock) - s->initial_count_load_time) >>
|
||||
d = (qemu_get_clock_ns(vm_clock) - s->initial_count_load_time) >>
|
||||
s->count_shift;
|
||||
if (s->lvt[APIC_LVT_TIMER] & APIC_LVT_TIMER_PERIODIC) {
|
||||
/* periodic */
|
||||
@@ -865,12 +865,12 @@ static void apic_mem_writel(void *opaque, target_phys_addr_t addr, uint32_t val)
|
||||
int n = index - 0x32;
|
||||
s->lvt[n] = val;
|
||||
if (n == APIC_LVT_TIMER)
|
||||
apic_timer_update(s, qemu_get_clock(vm_clock));
|
||||
apic_timer_update(s, qemu_get_clock_ns(vm_clock));
|
||||
}
|
||||
break;
|
||||
case 0x38:
|
||||
s->initial_count = val;
|
||||
s->initial_count_load_time = qemu_get_clock(vm_clock);
|
||||
s->initial_count_load_time = qemu_get_clock_ns(vm_clock);
|
||||
apic_timer_update(s, s->initial_count_load_time);
|
||||
break;
|
||||
case 0x39:
|
||||
@@ -1005,7 +1005,7 @@ static int apic_init1(SysBusDevice *dev)
|
||||
DEVICE_NATIVE_ENDIAN);
|
||||
sysbus_init_mmio(dev, MSI_ADDR_SIZE, apic_io_memory);
|
||||
|
||||
s->timer = qemu_new_timer(vm_clock, apic_timer, s);
|
||||
s->timer = qemu_new_timer_ns(vm_clock, apic_timer, s);
|
||||
s->idx = last_apic_idx++;
|
||||
local_apics[s->idx] = s;
|
||||
return 0;
|
||||
|
||||
+1
-1
@@ -130,7 +130,7 @@ static uint32_t arm_sysctl_read(void *opaque, target_phys_addr_t offset)
|
||||
case 0x58: /* BOOTCS */
|
||||
return 0;
|
||||
case 0x5c: /* 24MHz */
|
||||
return muldiv64(qemu_get_clock(vm_clock), 24000000, get_ticks_per_sec());
|
||||
return muldiv64(qemu_get_clock_ns(vm_clock), 24000000, get_ticks_per_sec());
|
||||
case 0x60: /* MISC */
|
||||
return 0;
|
||||
case 0x84: /* PROCID0 */
|
||||
|
||||
+4
-4
@@ -64,7 +64,7 @@ static inline int64_t systick_scale(nvic_state *s)
|
||||
static void systick_reload(nvic_state *s, int reset)
|
||||
{
|
||||
if (reset)
|
||||
s->systick.tick = qemu_get_clock(vm_clock);
|
||||
s->systick.tick = qemu_get_clock_ns(vm_clock);
|
||||
s->systick.tick += (s->systick.reload + 1) * systick_scale(s);
|
||||
qemu_mod_timer(s->systick.timer, s->systick.tick);
|
||||
}
|
||||
@@ -136,7 +136,7 @@ static uint32_t nvic_readl(void *opaque, uint32_t offset)
|
||||
int64_t t;
|
||||
if ((s->systick.control & SYSTICK_ENABLE) == 0)
|
||||
return 0;
|
||||
t = qemu_get_clock(vm_clock);
|
||||
t = qemu_get_clock_ns(vm_clock);
|
||||
if (t >= s->systick.tick)
|
||||
return 0;
|
||||
val = ((s->systick.tick - (t + 1)) / systick_scale(s)) + 1;
|
||||
@@ -273,7 +273,7 @@ static void nvic_writel(void *opaque, uint32_t offset, uint32_t value)
|
||||
s->systick.control &= 0xfffffff8;
|
||||
s->systick.control |= value & 7;
|
||||
if ((oldval ^ value) & SYSTICK_ENABLE) {
|
||||
int64_t now = qemu_get_clock(vm_clock);
|
||||
int64_t now = qemu_get_clock_ns(vm_clock);
|
||||
if (value & SYSTICK_ENABLE) {
|
||||
if (s->systick.tick) {
|
||||
s->systick.tick += now;
|
||||
@@ -396,7 +396,7 @@ static int armv7m_nvic_init(SysBusDevice *dev)
|
||||
|
||||
gic_init(&s->gic);
|
||||
cpu_register_physical_memory(0xe000e000, 0x1000, s->gic.iomemtype);
|
||||
s->systick.timer = qemu_new_timer(vm_clock, systick_timer_tick, s);
|
||||
s->systick.timer = qemu_new_timer_ns(vm_clock, systick_timer_tick, s);
|
||||
register_savevm(&dev->qdev, "armv7m_nvic", -1, 1, nvic_save, nvic_load, s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -335,7 +335,7 @@ static int baum_eat_packet(BaumDriverState *baum, const uint8_t *buf, int len)
|
||||
int i;
|
||||
|
||||
/* Allow 100ms to complete the DisplayData packet */
|
||||
qemu_mod_timer(baum->cellCount_timer, qemu_get_clock(vm_clock) +
|
||||
qemu_mod_timer(baum->cellCount_timer, qemu_get_clock_ns(vm_clock) +
|
||||
get_ticks_per_sec() / 10);
|
||||
for (i = 0; i < baum->x * baum->y ; i++) {
|
||||
EAT(c);
|
||||
@@ -604,7 +604,7 @@ CharDriverState *chr_baum_init(QemuOpts *opts)
|
||||
goto fail_handle;
|
||||
}
|
||||
|
||||
baum->cellCount_timer = qemu_new_timer(vm_clock, baum_cellCount_timer_cb, baum);
|
||||
baum->cellCount_timer = qemu_new_timer_ns(vm_clock, baum_cellCount_timer_cb, baum);
|
||||
|
||||
if (brlapi__getDisplaySize(handle, &baum->x, &baum->y) == -1) {
|
||||
brlapi_perror("baum_init: brlapi_getDisplaySize");
|
||||
|
||||
+2
-2
@@ -88,7 +88,7 @@ static inline void csrhci_fifo_wake(struct csrhci_s *s)
|
||||
}
|
||||
|
||||
if (s->out_len)
|
||||
qemu_mod_timer(s->out_tm, qemu_get_clock(vm_clock) + s->baud_delay);
|
||||
qemu_mod_timer(s->out_tm, qemu_get_clock_ns(vm_clock) + s->baud_delay);
|
||||
}
|
||||
|
||||
#define csrhci_out_packetz(s, len) memset(csrhci_out_packet(s, len), 0, len)
|
||||
@@ -446,7 +446,7 @@ CharDriverState *uart_hci_init(qemu_irq wakeup)
|
||||
s->hci->evt_recv = csrhci_out_hci_packet_event;
|
||||
s->hci->acl_recv = csrhci_out_hci_packet_acl;
|
||||
|
||||
s->out_tm = qemu_new_timer(vm_clock, csrhci_out_tick, s);
|
||||
s->out_tm = qemu_new_timer_ns(vm_clock, csrhci_out_tick, s);
|
||||
s->pins = qemu_allocate_irqs(csrhci_pins, s, __csrhci_pins);
|
||||
csrhci_reset(s);
|
||||
|
||||
|
||||
+6
-6
@@ -576,7 +576,7 @@ static void bt_hci_inquiry_result(struct bt_hci_s *hci,
|
||||
|
||||
static void bt_hci_mod_timer_1280ms(QEMUTimer *timer, int period)
|
||||
{
|
||||
qemu_mod_timer(timer, qemu_get_clock(vm_clock) +
|
||||
qemu_mod_timer(timer, qemu_get_clock_ns(vm_clock) +
|
||||
muldiv64(period << 7, get_ticks_per_sec(), 100));
|
||||
}
|
||||
|
||||
@@ -657,7 +657,7 @@ static void bt_hci_lmp_link_establish(struct bt_hci_s *hci,
|
||||
if (master) {
|
||||
link->acl_mode = acl_active;
|
||||
hci->lm.handle[hci->lm.last_handle].acl_mode_timer =
|
||||
qemu_new_timer(vm_clock, bt_hci_mode_tick, link);
|
||||
qemu_new_timer_ns(vm_clock, bt_hci_mode_tick, link);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1084,7 +1084,7 @@ static int bt_hci_mode_change(struct bt_hci_s *hci, uint16_t handle,
|
||||
|
||||
bt_hci_event_status(hci, HCI_SUCCESS);
|
||||
|
||||
qemu_mod_timer(link->acl_mode_timer, qemu_get_clock(vm_clock) +
|
||||
qemu_mod_timer(link->acl_mode_timer, qemu_get_clock_ns(vm_clock) +
|
||||
muldiv64(interval * 625, get_ticks_per_sec(), 1000000));
|
||||
bt_hci_lmp_mode_change_master(hci, link->link, mode, interval);
|
||||
|
||||
@@ -2145,10 +2145,10 @@ struct HCIInfo *bt_new_hci(struct bt_scatternet_s *net)
|
||||
{
|
||||
struct bt_hci_s *s = qemu_mallocz(sizeof(struct bt_hci_s));
|
||||
|
||||
s->lm.inquiry_done = qemu_new_timer(vm_clock, bt_hci_inquiry_done, s);
|
||||
s->lm.inquiry_next = qemu_new_timer(vm_clock, bt_hci_inquiry_next, s);
|
||||
s->lm.inquiry_done = qemu_new_timer_ns(vm_clock, bt_hci_inquiry_done, s);
|
||||
s->lm.inquiry_next = qemu_new_timer_ns(vm_clock, bt_hci_inquiry_next, s);
|
||||
s->conn_accept_timer =
|
||||
qemu_new_timer(vm_clock, bt_hci_conn_accept_timeout, s);
|
||||
qemu_new_timer_ns(vm_clock, bt_hci_conn_accept_timeout, s);
|
||||
|
||||
s->evt_packet = bt_hci_evt_packet;
|
||||
s->evt_submit = bt_hci_evt_submit;
|
||||
|
||||
@@ -170,7 +170,7 @@ static unsigned int get_counter(CUDATimer *s)
|
||||
int64_t d;
|
||||
unsigned int counter;
|
||||
|
||||
d = muldiv64(qemu_get_clock(vm_clock) - s->load_time,
|
||||
d = muldiv64(qemu_get_clock_ns(vm_clock) - s->load_time,
|
||||
CUDA_TIMER_FREQ, get_ticks_per_sec());
|
||||
if (s->index == 0) {
|
||||
/* the timer goes down from latch to -1 (period of latch + 2) */
|
||||
@@ -189,7 +189,7 @@ static unsigned int get_counter(CUDATimer *s)
|
||||
static void set_counter(CUDAState *s, CUDATimer *ti, unsigned int val)
|
||||
{
|
||||
CUDA_DPRINTF("T%d.counter=%d\n", 1 + (ti->timer == NULL), val);
|
||||
ti->load_time = qemu_get_clock(vm_clock);
|
||||
ti->load_time = qemu_get_clock_ns(vm_clock);
|
||||
ti->counter_value = val;
|
||||
cuda_timer_update(s, ti, ti->load_time);
|
||||
}
|
||||
@@ -346,7 +346,7 @@ static void cuda_writeb(void *opaque, target_phys_addr_t addr, uint32_t val)
|
||||
break;
|
||||
case 4:
|
||||
s->timers[0].latch = (s->timers[0].latch & 0xff00) | val;
|
||||
cuda_timer_update(s, &s->timers[0], qemu_get_clock(vm_clock));
|
||||
cuda_timer_update(s, &s->timers[0], qemu_get_clock_ns(vm_clock));
|
||||
break;
|
||||
case 5:
|
||||
s->timers[0].latch = (s->timers[0].latch & 0xff) | (val << 8);
|
||||
@@ -355,12 +355,12 @@ static void cuda_writeb(void *opaque, target_phys_addr_t addr, uint32_t val)
|
||||
break;
|
||||
case 6:
|
||||
s->timers[0].latch = (s->timers[0].latch & 0xff00) | val;
|
||||
cuda_timer_update(s, &s->timers[0], qemu_get_clock(vm_clock));
|
||||
cuda_timer_update(s, &s->timers[0], qemu_get_clock_ns(vm_clock));
|
||||
break;
|
||||
case 7:
|
||||
s->timers[0].latch = (s->timers[0].latch & 0xff) | (val << 8);
|
||||
s->ifr &= ~T1_INT;
|
||||
cuda_timer_update(s, &s->timers[0], qemu_get_clock(vm_clock));
|
||||
cuda_timer_update(s, &s->timers[0], qemu_get_clock_ns(vm_clock));
|
||||
break;
|
||||
case 8:
|
||||
s->timers[1].latch = val;
|
||||
@@ -374,7 +374,7 @@ static void cuda_writeb(void *opaque, target_phys_addr_t addr, uint32_t val)
|
||||
break;
|
||||
case 11:
|
||||
s->acr = val;
|
||||
cuda_timer_update(s, &s->timers[0], qemu_get_clock(vm_clock));
|
||||
cuda_timer_update(s, &s->timers[0], qemu_get_clock_ns(vm_clock));
|
||||
cuda_update(s);
|
||||
break;
|
||||
case 12:
|
||||
@@ -506,7 +506,7 @@ static void cuda_adb_poll(void *opaque)
|
||||
cuda_send_packet_to_host(s, obuf, olen + 2);
|
||||
}
|
||||
qemu_mod_timer(s->adb_poll_timer,
|
||||
qemu_get_clock(vm_clock) +
|
||||
qemu_get_clock_ns(vm_clock) +
|
||||
(get_ticks_per_sec() / CUDA_ADB_POLL_FREQ));
|
||||
}
|
||||
|
||||
@@ -524,7 +524,7 @@ static void cuda_receive_packet(CUDAState *s,
|
||||
s->autopoll = autopoll;
|
||||
if (autopoll) {
|
||||
qemu_mod_timer(s->adb_poll_timer,
|
||||
qemu_get_clock(vm_clock) +
|
||||
qemu_get_clock_ns(vm_clock) +
|
||||
(get_ticks_per_sec() / CUDA_ADB_POLL_FREQ));
|
||||
} else {
|
||||
qemu_del_timer(s->adb_poll_timer);
|
||||
@@ -536,14 +536,14 @@ static void cuda_receive_packet(CUDAState *s,
|
||||
break;
|
||||
case CUDA_SET_TIME:
|
||||
ti = (((uint32_t)data[1]) << 24) + (((uint32_t)data[2]) << 16) + (((uint32_t)data[3]) << 8) + data[4];
|
||||
s->tick_offset = ti - (qemu_get_clock(vm_clock) / get_ticks_per_sec());
|
||||
s->tick_offset = ti - (qemu_get_clock_ns(vm_clock) / get_ticks_per_sec());
|
||||
obuf[0] = CUDA_PACKET;
|
||||
obuf[1] = 0;
|
||||
obuf[2] = 0;
|
||||
cuda_send_packet_to_host(s, obuf, 3);
|
||||
break;
|
||||
case CUDA_GET_TIME:
|
||||
ti = s->tick_offset + (qemu_get_clock(vm_clock) / get_ticks_per_sec());
|
||||
ti = s->tick_offset + (qemu_get_clock_ns(vm_clock) / get_ticks_per_sec());
|
||||
obuf[0] = CUDA_PACKET;
|
||||
obuf[1] = 0;
|
||||
obuf[2] = 0;
|
||||
@@ -754,14 +754,14 @@ void cuda_init (int *cuda_mem_index, qemu_irq irq)
|
||||
s->irq = irq;
|
||||
|
||||
s->timers[0].index = 0;
|
||||
s->timers[0].timer = qemu_new_timer(vm_clock, cuda_timer1, s);
|
||||
s->timers[0].timer = qemu_new_timer_ns(vm_clock, cuda_timer1, s);
|
||||
|
||||
s->timers[1].index = 1;
|
||||
|
||||
qemu_get_timedate(&tm, 0);
|
||||
s->tick_offset = (uint32_t)mktimegm(&tm) + RTC_OFFSET;
|
||||
|
||||
s->adb_poll_timer = qemu_new_timer(vm_clock, cuda_adb_poll, s);
|
||||
s->adb_poll_timer = qemu_new_timer_ns(vm_clock, cuda_adb_poll, s);
|
||||
*cuda_mem_index = cpu_register_io_memory(cuda_read, cuda_write, s,
|
||||
DEVICE_NATIVE_ENDIAN);
|
||||
register_savevm(NULL, "cuda", -1, 1, cuda_save, cuda_load, s);
|
||||
|
||||
+3
-3
@@ -290,7 +290,7 @@ static void set_next_tick(dp8393xState *s)
|
||||
}
|
||||
|
||||
ticks = s->regs[SONIC_WT1] << 16 | s->regs[SONIC_WT0];
|
||||
s->wt_last_update = qemu_get_clock(vm_clock);
|
||||
s->wt_last_update = qemu_get_clock_ns(vm_clock);
|
||||
delay = get_ticks_per_sec() * ticks / 5000000;
|
||||
qemu_mod_timer(s->watchdog, s->wt_last_update + delay);
|
||||
}
|
||||
@@ -305,7 +305,7 @@ static void update_wt_regs(dp8393xState *s)
|
||||
return;
|
||||
}
|
||||
|
||||
elapsed = s->wt_last_update - qemu_get_clock(vm_clock);
|
||||
elapsed = s->wt_last_update - qemu_get_clock_ns(vm_clock);
|
||||
val = s->regs[SONIC_WT1] << 16 | s->regs[SONIC_WT0];
|
||||
val -= elapsed / 5000000;
|
||||
s->regs[SONIC_WT1] = (val >> 16) & 0xffff;
|
||||
@@ -895,7 +895,7 @@ void dp83932_init(NICInfo *nd, target_phys_addr_t base, int it_shift,
|
||||
s->memory_rw = memory_rw;
|
||||
s->it_shift = it_shift;
|
||||
s->irq = irq;
|
||||
s->watchdog = qemu_new_timer(vm_clock, dp8393x_watchdog, s);
|
||||
s->watchdog = qemu_new_timer_ns(vm_clock, dp8393x_watchdog, s);
|
||||
s->regs[SONIC_SR] = 0x0004; /* only revision recognized by Linux */
|
||||
|
||||
memcpy(s->conf.macaddr.a, nd->macaddr, sizeof(s->conf.macaddr));
|
||||
|
||||
+1
-1
@@ -85,7 +85,7 @@ static uint32_t timer_readl (void *opaque, target_phys_addr_t addr)
|
||||
r = ptimer_get_count(t->ptimer_t1);
|
||||
break;
|
||||
case R_TIME:
|
||||
r = qemu_get_clock(vm_clock) / 10;
|
||||
r = qemu_get_clock_ns(vm_clock) / 10;
|
||||
break;
|
||||
case RW_INTR_MASK:
|
||||
r = t->rw_intr_mask;
|
||||
|
||||
@@ -1423,7 +1423,7 @@ static void fdctrl_handle_readid(FDCtrl *fdctrl, int direction)
|
||||
/* XXX: should set main status register to busy */
|
||||
cur_drv->head = (fdctrl->fifo[1] >> 2) & 1;
|
||||
qemu_mod_timer(fdctrl->result_timer,
|
||||
qemu_get_clock(vm_clock) + (get_ticks_per_sec() / 50));
|
||||
qemu_get_clock_ns(vm_clock) + (get_ticks_per_sec() / 50));
|
||||
}
|
||||
|
||||
static void fdctrl_handle_format_track(FDCtrl *fdctrl, int direction)
|
||||
@@ -1830,7 +1830,7 @@ static int fdctrl_init_common(FDCtrl *fdctrl)
|
||||
FLOPPY_DPRINTF("init controller\n");
|
||||
fdctrl->fifo = qemu_memalign(512, FD_SECTOR_LEN);
|
||||
fdctrl->fifo_size = 512;
|
||||
fdctrl->result_timer = qemu_new_timer(vm_clock,
|
||||
fdctrl->result_timer = qemu_new_timer_ns(vm_clock,
|
||||
fdctrl_result_timer, fdctrl);
|
||||
|
||||
fdctrl->version = 0x90; /* Intel 82078 controller */
|
||||
|
||||
@@ -143,7 +143,7 @@ static int deactivating_bit(uint64_t old, uint64_t new, uint64_t mask)
|
||||
|
||||
static uint64_t hpet_get_ticks(HPETState *s)
|
||||
{
|
||||
return ns_to_ticks(qemu_get_clock(vm_clock) + s->hpet_offset);
|
||||
return ns_to_ticks(qemu_get_clock_ns(vm_clock) + s->hpet_offset);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -224,7 +224,7 @@ static int hpet_post_load(void *opaque, int version_id)
|
||||
HPETState *s = opaque;
|
||||
|
||||
/* Recalculate the offset between the main counter and guest time */
|
||||
s->hpet_offset = ticks_to_ns(s->hpet_counter) - qemu_get_clock(vm_clock);
|
||||
s->hpet_offset = ticks_to_ns(s->hpet_counter) - qemu_get_clock_ns(vm_clock);
|
||||
|
||||
/* Push number of timers into capability returned via HPET_ID */
|
||||
s->capability &= ~HPET_ID_NUM_TIM_MASK;
|
||||
@@ -298,11 +298,11 @@ static void hpet_timer(void *opaque)
|
||||
}
|
||||
diff = hpet_calculate_diff(t, cur_tick);
|
||||
qemu_mod_timer(t->qemu_timer,
|
||||
qemu_get_clock(vm_clock) + (int64_t)ticks_to_ns(diff));
|
||||
qemu_get_clock_ns(vm_clock) + (int64_t)ticks_to_ns(diff));
|
||||
} else if (t->config & HPET_TN_32BIT && !timer_is_periodic(t)) {
|
||||
if (t->wrap_flag) {
|
||||
diff = hpet_calculate_diff(t, cur_tick);
|
||||
qemu_mod_timer(t->qemu_timer, qemu_get_clock(vm_clock) +
|
||||
qemu_mod_timer(t->qemu_timer, qemu_get_clock_ns(vm_clock) +
|
||||
(int64_t)ticks_to_ns(diff));
|
||||
t->wrap_flag = 0;
|
||||
}
|
||||
@@ -331,7 +331,7 @@ static void hpet_set_timer(HPETTimer *t)
|
||||
}
|
||||
}
|
||||
qemu_mod_timer(t->qemu_timer,
|
||||
qemu_get_clock(vm_clock) + (int64_t)ticks_to_ns(diff));
|
||||
qemu_get_clock_ns(vm_clock) + (int64_t)ticks_to_ns(diff));
|
||||
}
|
||||
|
||||
static void hpet_del_timer(HPETTimer *t)
|
||||
@@ -547,7 +547,7 @@ static void hpet_ram_writel(void *opaque, target_phys_addr_t addr,
|
||||
if (activating_bit(old_val, new_val, HPET_CFG_ENABLE)) {
|
||||
/* Enable main counter and interrupt generation. */
|
||||
s->hpet_offset =
|
||||
ticks_to_ns(s->hpet_counter) - qemu_get_clock(vm_clock);
|
||||
ticks_to_ns(s->hpet_counter) - qemu_get_clock_ns(vm_clock);
|
||||
for (i = 0; i < s->num_timers; i++) {
|
||||
if ((&s->timer[i])->cmp != ~0ULL) {
|
||||
hpet_set_timer(&s->timer[i]);
|
||||
@@ -703,7 +703,7 @@ static int hpet_init(SysBusDevice *dev)
|
||||
}
|
||||
for (i = 0; i < HPET_MAX_TIMERS; i++) {
|
||||
timer = &s->timer[i];
|
||||
timer->qemu_timer = qemu_new_timer(vm_clock, hpet_timer, timer);
|
||||
timer->qemu_timer = qemu_new_timer_ns(vm_clock, hpet_timer, timer);
|
||||
timer->tn = i;
|
||||
timer->state = s;
|
||||
}
|
||||
|
||||
+6
-6
@@ -69,7 +69,7 @@ static int pit_get_count(PITChannelState *s)
|
||||
uint64_t d;
|
||||
int counter;
|
||||
|
||||
d = muldiv64(qemu_get_clock(vm_clock) - s->count_load_time, PIT_FREQ,
|
||||
d = muldiv64(qemu_get_clock_ns(vm_clock) - s->count_load_time, PIT_FREQ,
|
||||
get_ticks_per_sec());
|
||||
switch(s->mode) {
|
||||
case 0:
|
||||
@@ -198,7 +198,7 @@ void pit_set_gate(ISADevice *dev, int channel, int val)
|
||||
case 5:
|
||||
if (s->gate < val) {
|
||||
/* restart counting on rising edge */
|
||||
s->count_load_time = qemu_get_clock(vm_clock);
|
||||
s->count_load_time = qemu_get_clock_ns(vm_clock);
|
||||
pit_irq_timer_update(s, s->count_load_time);
|
||||
}
|
||||
break;
|
||||
@@ -206,7 +206,7 @@ void pit_set_gate(ISADevice *dev, int channel, int val)
|
||||
case 3:
|
||||
if (s->gate < val) {
|
||||
/* restart counting on rising edge */
|
||||
s->count_load_time = qemu_get_clock(vm_clock);
|
||||
s->count_load_time = qemu_get_clock_ns(vm_clock);
|
||||
pit_irq_timer_update(s, s->count_load_time);
|
||||
}
|
||||
/* XXX: disable/enable counting */
|
||||
@@ -240,7 +240,7 @@ static inline void pit_load_count(PITChannelState *s, int val)
|
||||
{
|
||||
if (val == 0)
|
||||
val = 0x10000;
|
||||
s->count_load_time = qemu_get_clock(vm_clock);
|
||||
s->count_load_time = qemu_get_clock_ns(vm_clock);
|
||||
s->count = val;
|
||||
pit_irq_timer_update(s, s->count_load_time);
|
||||
}
|
||||
@@ -274,7 +274,7 @@ static void pit_ioport_write(void *opaque, uint32_t addr, uint32_t val)
|
||||
if (!(val & 0x10) && !s->status_latched) {
|
||||
/* status latch */
|
||||
/* XXX: add BCD and null count */
|
||||
s->status = (pit_get_out1(s, qemu_get_clock(vm_clock)) << 7) |
|
||||
s->status = (pit_get_out1(s, qemu_get_clock_ns(vm_clock)) << 7) |
|
||||
(s->rw_mode << 4) |
|
||||
(s->mode << 1) |
|
||||
s->bcd;
|
||||
@@ -513,7 +513,7 @@ static int pit_initfn(ISADevice *dev)
|
||||
|
||||
s = &pit->channels[0];
|
||||
/* the timer 0 is connected to an IRQ */
|
||||
s->irq_timer = qemu_new_timer(vm_clock, pit_irq_timer, s);
|
||||
s->irq_timer = qemu_new_timer_ns(vm_clock, pit_irq_timer, s);
|
||||
s->irq = isa_get_irq(pit->irq);
|
||||
|
||||
register_ioport_write(pit->iobase, 4, 1, pit_ioport_write, pit);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user