* [Qemu-devel] OpenStep / Busmouse - correct patch
@ 2006-01-01 18:38 engel
2006-01-01 22:35 ` Johannes Schindelin
0 siblings, 1 reply; 8+ messages in thread
From: engel @ 2006-01-01 18:38 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 432 bytes --]
Oops,
I accidentially sent out an old version of the patch with
which the mouse button emulation doesn't work.
I attached the correct version to this mail. Sorry...
Michael
--
Dr. rer. nat. Michael Engel - engel@informatik.uni-marburg.de
University of Marburg - Dept. of Mathematics and Computer Science
Hans-Meerwein-Str. - D-35032 Marburg, Germany
Phone: +49 6421 / 28 21562 - Fax: +49 6421 / 28 21573
[-- Attachment #2: qemu-0.8.0-openstep-busmouse-2.diff.gz --]
[-- Type: application/x-gzip, Size: 2677 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] OpenStep / Busmouse - correct patch
2006-01-01 18:38 [Qemu-devel] OpenStep / Busmouse - correct patch engel
@ 2006-01-01 22:35 ` Johannes Schindelin
[not found] ` <Pine.LNX.4.63.0601012333280.32534@wbgn013.biozentrum.uni-wuerzburg.de >
0 siblings, 1 reply; 8+ messages in thread
From: Johannes Schindelin @ 2006-01-01 22:35 UTC (permalink / raw)
To: qemu-devel
Hi,
On Sun, 1 Jan 2006, engel@mathematik.uni-marburg.de wrote:
> I attached the correct version to this mail. Sorry...
Impressive! How about this on top (unfortunately untested, since I do not
have a system handy which supports a busmouse):
---
[PATCH] Add -busmouse switch
Now, you can enable the busmouse (thereby disabling the PS/2 mouse)
emulation with "qemu -busmouse".
---
hw/busmouse.c | 21 ++++++++++-----------
hw/pc.c | 7 -------
hw/ps2.c | 10 +++++++---
vl.c | 18 ++++++++++++++++++
vl.h | 8 ++------
5 files changed, 37 insertions(+), 27 deletions(-)
10fcdd858caaaec8e7deaa5d349afbb1d93c4640
diff --git a/hw/busmouse.c b/hw/busmouse.c
index b0eb0e3..a935f5c 100644
--- a/hw/busmouse.c
+++ b/hw/busmouse.c
@@ -29,7 +29,7 @@
* and internal state
*/
-struct BusmouseState {
+typedef struct BusmouseState {
uint8_t data;
uint8_t signature;
uint8_t control;
@@ -38,13 +38,12 @@ struct BusmouseState {
uint8_t command;
int irq;
int irq_pending;
- CharDriverState *chr;
int hw_driver;
uint16_t mouse_dx;
uint16_t mouse_dy;
uint16_t mouse_dz;
uint16_t mouse_buttons;
-};
+} BusmouseState;
static void busmouse_update_irq(BusmouseState *s);
@@ -139,22 +138,22 @@ static uint32_t busmouse_ioport_read(voi
return ret;
}
+#define BUSMOUSE_BASE 0x238
+#define BUSMOUSE_IRQ 5
+
/* If fd is zero, it means that the busmouse device uses the console */
-BusmouseState *busmouse_init(int base, int irq, CharDriverState *chr)
+void busmouse_init()
{
BusmouseState *s;
s = qemu_mallocz(sizeof(BusmouseState));
if (!s)
- return NULL;
- s->chr = chr;
+ return;
s->hw_driver = 0;
- s->irq = irq;
+ s->irq = BUSMOUSE_IRQ;
s->data = 0;
s->mouse_buttons = 0x0;
- register_ioport_write(base, 8, 1, busmouse_ioport_write, s);
- register_ioport_read(base, 8, 1, busmouse_ioport_read, s);
+ register_ioport_write(BUSMOUSE_BASE, 8, 1, busmouse_ioport_write, s);
+ register_ioport_read(BUSMOUSE_BASE, 8, 1, busmouse_ioport_read, s);
qemu_add_mouse_event_handler(busmouse_event, s);
-
- return s;
}
diff --git a/hw/pc.c b/hw/pc.c
index cc3ec3e..8e750b6 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -574,9 +574,6 @@ static int serial_irq[MAX_SERIAL_PORTS]
static int parallel_io[MAX_PARALLEL_PORTS] = { 0x378, 0x278, 0x3bc };
static int parallel_irq[MAX_PARALLEL_PORTS] = { 7, 7, 7 };
-static int busmouse_io[MAX_BUSMOUSE_PORTS] = { 0x238 };
-static int busmouse_irq[MAX_BUSMOUSE_PORTS] = { 5 };
-
#ifdef HAS_AUDIO
static void audio_init (PCIBus *pci_bus)
{
@@ -803,10 +800,6 @@ static void pc_init1(int ram_size, int v
}
}
- for(i = 0; i < 1; i++) {
- busmouse_init(busmouse_io[i], busmouse_irq[i], 0);
- }
-
if (pci_enabled) {
for(i = 0; i < nb_nics; i++) {
pci_ne2000_init(pci_bus, &nd_table[i]);
diff --git a/hw/ps2.c b/hw/ps2.c
index 7fbc535..500da2b 100644
--- a/hw/ps2.c
+++ b/hw/ps2.c
@@ -500,15 +500,19 @@ void *ps2_kbd_init(void (*update_irq)(vo
void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg)
{
- PS2MouseState *s = (PS2MouseState *)qemu_mallocz(sizeof(PS2MouseState));
+ PS2MouseState *s;
+
+ if (!ps2_mouse_enabled)
+ return NULL;
+
+ s = (PS2MouseState *)qemu_mallocz(sizeof(PS2MouseState));
s->common.update_irq = update_irq;
s->common.update_arg = update_arg;
ps2_reset(&s->common);
register_savevm("ps2mouse", 0, 1, ps2_mouse_save, ps2_mouse_load, s);
- /* disabled for busmouse emulation (req'd for running OpenStep) */
- /* qemu_add_mouse_event_handler(ps2_mouse_event, s); */
+ qemu_add_mouse_event_handler(ps2_mouse_event, s);
qemu_register_reset(ps2_reset, &s->common);
return s;
}
diff --git a/vl.c b/vl.c
index 794ed22..f82177b 100644
--- a/vl.c
+++ b/vl.c
@@ -144,6 +144,8 @@ int win2k_install_hack = 0;
int usb_enabled = 0;
USBPort *vm_usb_ports[MAX_VM_USB_PORTS];
USBDevice *vm_usb_hub;
+int ps2_mouse_enabled = 1;
+int busmouse_enabled = 0;
static VLANState *first_vlan;
int smp_cpus = 1;
#if defined(TARGET_SPARC)
@@ -3983,6 +3985,9 @@ void help(void)
#endif
"-usb enable the USB driver (will be the default soon)\n"
"-usbdevice name add the host or guest USB device 'name'\n"
+#ifdef TARGET_I386
+ "-busmouse emulate busmouse instead of standard PS/2\n"
+#endif
#if defined(TARGET_PPC) || defined(TARGET_SPARC)
"-g WxH[xDEPTH] Set the initial graphical resolution and depth\n"
#endif
@@ -4125,6 +4130,7 @@ enum {
QEMU_OPTION_win2k_hack,
QEMU_OPTION_usb,
QEMU_OPTION_usbdevice,
+ QEMU_OPTION_busmouse,
QEMU_OPTION_smp,
};
@@ -4191,6 +4197,7 @@ const QEMUOption qemu_options[] = {
{ "pidfile", HAS_ARG, QEMU_OPTION_pidfile },
{ "win2k-hack", 0, QEMU_OPTION_win2k_hack },
{ "usbdevice", HAS_ARG, QEMU_OPTION_usbdevice },
+ { "busmouse", 0, QEMU_OPTION_busmouse },
{ "smp", HAS_ARG, QEMU_OPTION_smp },
/* temporary options */
@@ -4766,6 +4773,12 @@ int main(int argc, char **argv)
optarg);
usb_devices_index++;
break;
+#ifdef TARGET_I386
+ case QEMU_OPTION_busmouse:
+ busmouse_enabled = 1;
+ ps2_mouse_enabled = 0;
+ break;
+#endif
case QEMU_OPTION_smp:
smp_cpus = atoi(optarg);
if (smp_cpus < 1 || smp_cpus > MAX_CPUS) {
@@ -4921,6 +4934,11 @@ int main(int argc, char **argv)
}
}
+#ifdef TARGET_I386
+ if (busmouse_enabled)
+ busmouse_init();
+#endif
+
register_savevm("timer", 0, 1, timer_save, timer_load, NULL);
register_savevm("ram", 0, 1, ram_save, ram_load, NULL);
diff --git a/vl.h b/vl.h
index c50ac5d..6d87a6e 100644
--- a/vl.h
+++ b/vl.h
@@ -137,6 +137,7 @@ extern const char *keyboard_layout;
extern int kqemu_allowed;
extern int win2k_install_hack;
extern int usb_enabled;
+extern int ps2_mouse_enabled;
extern int smp_cpus;
/* XXX: make it dynamic */
@@ -271,10 +272,6 @@ extern CharDriverState *serial_hds[MAX_S
#define MAX_PARALLEL_PORTS 3
-/* busmouse ports */
-
-#define MAX_BUSMOUSE_PORTS 1
-
extern CharDriverState *parallel_hds[MAX_PARALLEL_PORTS];
/* VLANs support */
@@ -761,8 +758,7 @@ ParallelState *parallel_init(int base, i
/* busmouse.c */
-typedef struct BusmouseState BusmouseState;
-BusmouseState *busmouse_init(int base, int irq, CharDriverState *chr);
+void busmouse_init();
/* i8259.c */
--
1.0.GIT
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] OpenStep / Busmouse - correct patch
[not found] ` <Pine.LNX.4.63.0601012333280.32534@wbgn013.biozentrum.uni-wuerzburg.de >
@ 2006-01-03 11:58 ` engel
2006-01-03 13:49 ` Johannes Schindelin
0 siblings, 1 reply; 8+ messages in thread
From: engel @ 2006-01-03 11:58 UTC (permalink / raw)
To: qemu-devel
Hi,
> On Sun, 1 Jan 2006, engel@mathematik.uni-marburg.de wrote:
>
>> I attached the correct version to this mail. Sorry...
>
> Impressive!
Thanks! The most difficult problem was actually finding documentation
on the busmouse controller ;-).
> How about this on top (unfortunately untested, since I do not
> have a system handy which supports a busmouse):
Hmm, there seems to be a problem with your patch, though I haven't quite
figured out what exactly the cause is. When using the -busmouse option,
the busmouse_init function is called and seems to register the callbacks for
the provided I/O address ranges successfully (return value is 0 from
register_
ioport_{read,write}) - but the actual callback routines are never being
executed, which results in OpenStep not recognizing the busmouse.
regards,
Michael
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] OpenStep / Busmouse - correct patch
2006-01-03 11:58 ` engel
@ 2006-01-03 13:49 ` Johannes Schindelin
2006-01-03 15:44 ` malc
2006-01-03 17:47 ` engel
0 siblings, 2 replies; 8+ messages in thread
From: Johannes Schindelin @ 2006-01-03 13:49 UTC (permalink / raw)
To: qemu-devel
Hi,
On Tue, 3 Jan 2006, engel@mathematik.uni-marburg.de wrote:
> The most difficult problem was actually finding documentation on the
> busmouse controller ;-).
That always seems to be the biggest problem...
> > How about this on top (unfortunately untested, since I do not
> > have a system handy which supports a busmouse):
>
> Hmm, there seems to be a problem with your patch, though I haven't quite
> figured out what exactly the cause is. When using the -busmouse option,
> the busmouse_init function is called and seems to register the callbacks
> for the provided I/O address ranges successfully (return value is 0 from
> register_ioport_{read,write}) - but the actual callback routines are
> never being executed, which results in OpenStep not recognizing the
> busmouse.
I'll investigate.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] OpenStep / Busmouse - correct patch
2006-01-03 13:49 ` Johannes Schindelin
@ 2006-01-03 15:44 ` malc
2006-01-03 17:47 ` engel
1 sibling, 0 replies; 8+ messages in thread
From: malc @ 2006-01-03 15:44 UTC (permalink / raw)
To: qemu-devel
On Tue, 3 Jan 2006, Johannes Schindelin wrote:
> Hi,
>
> On Tue, 3 Jan 2006, engel@mathematik.uni-marburg.de wrote:
>
>> The most difficult problem was actually finding documentation on the
>> busmouse controller ;-).
>
> That always seems to be the biggest problem...
>
>>> How about this on top (unfortunately untested, since I do not
>>> have a system handy which supports a busmouse):
>>
>> Hmm, there seems to be a problem with your patch, though I haven't quite
>> figured out what exactly the cause is. When using the -busmouse option,
>> the busmouse_init function is called and seems to register the callbacks
>> for the provided I/O address ranges successfully (return value is 0 from
>> register_ioport_{read,write}) - but the actual callback routines are
>> never being executed, which results in OpenStep not recognizing the
>> busmouse.
>
> I'll investigate.
>
FWIW. IRQ 5 is already taken by sb16.
--
mailto:malc@pulsesoft.com
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] OpenStep / Busmouse - correct patch
2006-01-03 13:49 ` Johannes Schindelin
2006-01-03 15:44 ` malc
@ 2006-01-03 17:47 ` engel
2006-05-15 13:53 ` Christian Brunschen
1 sibling, 1 reply; 8+ messages in thread
From: engel @ 2006-01-03 17:47 UTC (permalink / raw)
To: qemu-devel
Hi,
>> Hmm, there seems to be a problem with your patch, though I haven't quite
>> figured out what exactly the cause is. When using the -busmouse option,
>> the busmouse_init function is called and seems to register the callbacks
>> for the provided I/O address ranges successfully (return value is 0 from
>> register_ioport_{read,write}) - but the actual callback routines are
>> never being executed, which results in OpenStep not recognizing the
>> busmouse.
>
> I'll investigate.
Got it! Your patch calls busmouse_init() before calling init_ioports() in
vl.c.
I moved the sequence some lines down (below cpu_calibrate_ticks), and
now the mouse works as expected.
malc's remark, however, is correct - the SB16 emulation also uses IRQ 5.
I have to check if OpenStep is able to use a different IRQ for either the
Soundblaster or the busmouse driver...
Btw., networking now works fine using an open source NE2k PCI driver
for OpenStep. I'll post a unified patch later this evening and set up a web
page describing how to install OpenStep in qemu.
Michael
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] OpenStep / Busmouse - correct patch
2006-01-03 17:47 ` engel
@ 2006-05-15 13:53 ` Christian Brunschen
2006-05-15 15:26 ` Natalia Portillo
0 siblings, 1 reply; 8+ messages in thread
From: Christian Brunschen @ 2006-05-15 13:53 UTC (permalink / raw)
To: qemu-devel
Hi,
On Tue, 3 Jan 2006, engel@mathematik.uni-marburg.de wrote:
> Btw., networking now works fine using an open source NE2k PCI driver
> for OpenStep. I'll post a unified patch later this evening and set up a web
> page describing how to install OpenStep in qemu.
Did this ever come to fruition? Did the busmouse driver get incorporated
into mainline Qemu?
> Michael
Best wishes,
// Christian Brunschen
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] OpenStep / Busmouse - correct patch
2006-05-15 13:53 ` Christian Brunschen
@ 2006-05-15 15:26 ` Natalia Portillo
0 siblings, 0 replies; 8+ messages in thread
From: Natalia Portillo @ 2006-05-15 15:26 UTC (permalink / raw)
To: qemu-devel
Nope,
However is not the best solution.
OpenStep should work with PS/2 mice as real hardware and VirtualPC
works.
So there should be a problem with our PS/2 mouse emulation.
Regards
El 15/05/2006, a las 15:53, Christian Brunschen escribió:
>
> Hi,
>
> On Tue, 3 Jan 2006, engel@mathematik.uni-marburg.de wrote:
>
>> Btw., networking now works fine using an open source NE2k PCI driver
>> for OpenStep. I'll post a unified patch later this evening and set
>> up a web
>> page describing how to install OpenStep in qemu.
>
> Did this ever come to fruition? Did the busmouse driver get
> incorporated into mainline Qemu?
>
>> Michael
>
> Best wishes,
>
> // Christian Brunschen
>
>
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel
>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2006-05-15 15:27 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-01 18:38 [Qemu-devel] OpenStep / Busmouse - correct patch engel
2006-01-01 22:35 ` Johannes Schindelin
[not found] ` <Pine.LNX.4.63.0601012333280.32534@wbgn013.biozentrum.uni-wuerzburg.de >
2006-01-03 11:58 ` engel
2006-01-03 13:49 ` Johannes Schindelin
2006-01-03 15:44 ` malc
2006-01-03 17:47 ` engel
2006-05-15 13:53 ` Christian Brunschen
2006-05-15 15:26 ` Natalia Portillo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).