qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Re: [Bochs-developers] [PATCH] BIOS delay_ms optimized away


From: Volker Ruppert
Subject: [Qemu-devel] Re: [Bochs-developers] [PATCH] BIOS delay_ms optimized away with BX_QEMU enabled
Date: Sun, 30 Mar 2008 18:48:29 +0200
User-agent: KMail/1.9.5

Hi,

> On Thu, Mar 27, 2008 at 10:12:43PM -0400, David Wentzlaff wrote:
> > When performing SMP probing, smp_probe() waits for 10ms by executing
> > delay_ms(10).  When compiling the BIOS for QEMU (BX_QEMU defined),
> > delay_ms() simply spins with a 'for' loop.
>
> Hi David,
>
> Do you know why QEMU uses different code for the delay?  What's wrong
> with using inb(0x61) for both bochs and qemu?

Bochs really supports the refresh toggle bit of port 0x61, but Qemu toggles on 
every read access. I have created a patch for Qemu that implements the 15 
usec toggle, but the Qemu developers haven't accepted it. They are not sure 
whether the refresh toggle bit exists on modern hardware.

--- /home/volker/qemu/hw/pcspk.c        2006-07-05 01:20:54.000000000 +0200
+++ ./hw/pcspk.c        2006-10-01 19:28:43.952247192 +0200
@@ -38,7 +38,7 @@
     unsigned int samples;
     unsigned int play_pos;
     int data_on;
-    int dummy_refresh_clock;
+    int refresh_clock;
 } PCSpkState;
 
 static const char *s_spk = "pcspk";
@@ -117,10 +117,10 @@
     PCSpkState *s = opaque;
     int out;
 
-    s->dummy_refresh_clock ^= (1 << 4);
+    s->refresh_clock = (((qemu_get_clock(vm_clock) / 15000) & 1) << 4);
     out = pit_get_out(s->pit, 2, qemu_get_clock(vm_clock)) << 5;
 
-    return pit_get_gate(s->pit, 2) | (s->data_on << 1) | 
s->dummy_refresh_clock | out;
+    return pit_get_gate(s->pit, 2) | (s->data_on << 1) | s->refresh_clock | 
out;
 }
 
 static void pcspk_ioport_write(void *opaque, uint32_t addr, uint32_t val)

--
Bye

Volker




reply via email to

[Prev in Thread] Current Thread [Next in Thread]