qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Roy Tam <roytam@gmail.com>
To: Kevin O'Connor <kevin@koconnor.net>
Cc: seabios@seabios.org, qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: PS/2 mouse emulation problems
Date: Sun, 14 Mar 2010 10:49:00 +0800	[thread overview]
Message-ID: <473191351003131849s791cb862ud0289ac101c88763@mail.gmail.com> (raw)
In-Reply-To: <20100313202315.GA25967@morn.localdomain>

2010/3/14 Kevin O'Connor <kevin@koconnor.net>:
> On Sat, Mar 13, 2010 at 10:44:46PM +0800, Roy Tam wrote:
>> 2010/3/13 Natalia Portillo <claunia@claunia.com>:
>> > Ok so in resume we have the following PS/2 mouse bugs:
>> >
>> > NeXTStep and OpenStep PS/2 driver receives no movement at all from the mouse
>> > (Darwin PS/2 driver seems to be made from scratch so no helpful here).
>> > MS-DOS Mouse driver hangs the whole machine.
>> > Windows Me Setup mouse driver receives no movement at all from the mouse.
>> > Old XFree86 PS/2 mouse driver receives no movement at all from standard
>> > protocols (PS/2, IMPS/2) or random movements (Microsoft).
>> > Hydrogen OS mouse driver does not work.
>> >
>> > While the NeXTStep PS/2 bug is known from QEMU 0.7.0 (which used Bochs
>> > BIOS), the other ones are new (as far as I know) so they may be or may not
>> > be caused by SeaBIOS.
>> >
>>
>> for Hydrogen OS, when I use QEMU BIOS (yes with my -old-bios hack) it
>> works in git head.
>
> Can you test with:
>
> http://linuxtogo.org/~kevin/SeaBIOS/test/bios.bin-0.5.1-debug-20100313
>
> Change summary in this test image:
> * int 1601 / int 1a00 should enable irqs - fixes several boot hangs
> * Backup/restore registers on mouse/keyboard callbacks - fixes
>  d090723b.zip
> * The mouse getid command may only return 1 byte - fixes msdos mouse
>  hang
> * Always process key event in irq 09 handler - restores keyboard in
>  ghost and fdos0138.img
>
> This image is based off stable-0.5.1 (image debug-20100311 was
> mistakenly based off of git head which had an additional regression of
> enabling mouse irqs by default).
>
> Interestingly, a ghost 11.5 image I found now works with mouse where
> it used to fail with bochs bios.
>
> The code changes I've used are below.  These changes are for testing -
> I'm still looking into a full fix.
>

Tested. Results belows:
+ NeXTStep/OpenStep bootloader no longer stalls.
+ EDR-DOS 7.01.08 WIP boots.
+ Paragon PTS-DOS 6.51CD/2000 Pro, GHOST, GW-BASIC, FreeDOS/V, MS-DOS
6.22 (Korean Edition), ET3 Chinese System, KC Chinese System, CCDOS97
Chinese System, etc. keyboard works.
+ CuteMouse driver no longer waits, MS Mouse Driver no longer freezes.
+ Hydrogen OS Mouse works.
- OpenStep 4.2 installs but mouse only works for 1 second.

Natalia Portillo:
Do you have a working config switches for NeXTStep 3.3? As it don't
have (E)IDE/ATATPI driver in driver disks.

> -Kevin
>
>
>
> diff --git a/src/clock.c b/src/clock.c
> index e32bf1b..241119e 100644
> --- a/src/clock.c
> +++ b/src/clock.c
> @@ -228,6 +228,7 @@ timer_setup(void)
>  static void
>  handle_1a00(struct bregs *regs)
>  {
> +    yield();
>     u32 ticks = GET_BDA(timer_counter);
>     regs->cx = ticks >> 16;
>     regs->dx = ticks;
> diff --git a/src/config.h b/src/config.h
> index 6297a48..9a3a165 100644
> --- a/src/config.h
> +++ b/src/config.h
> @@ -16,9 +16,9 @@
>  #define CONFIG_COREBOOT 0
>
>  // Control how verbose debug output is.
> -#define CONFIG_DEBUG_LEVEL 1
> +#define CONFIG_DEBUG_LEVEL 8
>  // Send debugging information to serial port
> -#define CONFIG_DEBUG_SERIAL 0
> +#define CONFIG_DEBUG_SERIAL 1
>  // Screen writes are also sent to debug ports.
>  #define CONFIG_SCREEN_AND_DEBUG 1
>
> diff --git a/src/kbd.c b/src/kbd.c
> index 6f3ae15..7e3434a 100644
> --- a/src/kbd.c
> +++ b/src/kbd.c
> @@ -73,6 +73,7 @@ enqueue_key(u8 scan_code, u8 ascii_code)
>  static void
>  dequeue_key(struct bregs *regs, int incr, int extended)
>  {
> +    yield();
>     u16 buffer_head;
>     u16 buffer_tail;
>     for (;;) {
> @@ -552,9 +553,19 @@ process_key(u8 key)
>         // allow for keyboard intercept
>         u32 eax = (0x4f << 8) | key;
>         u32 flags;
> +#if 0
>         call16_simpint(0x15, &eax, &flags);
>         if (!(flags & F_CF))
>             return;
> +#else
> +        struct bregs br;
> +        memset(&br, 0, sizeof(br));
> +        br.eax = eax;
> +        call16_int(0x15, &br);
> +        flags = br.flags;
> +        if (!(flags & F_CF))
> +            return;
> +#endif
>         key = eax;
>     }
>     __process_key(key);
> diff --git a/src/mouse.c b/src/mouse.c
> index 52e225c..92fb16a 100644
> --- a/src/mouse.c
> +++ b/src/mouse.c
> @@ -305,15 +305,17 @@ process_mouse(u8 data)
>         return;
>     }
>
> -    //BX_DEBUG_INT74("int74_function: make_farcall=1\n");
>     u16 status = GET_EBDA2(ebda_seg, mouse_data[0]);
>     u16 X      = GET_EBDA2(ebda_seg, mouse_data[1]);
>     u16 Y      = GET_EBDA2(ebda_seg, mouse_data[2]);
>     SET_EBDA2(ebda_seg, mouse_flag1, 0);
>
>     struct segoff_s func = GET_EBDA2(ebda_seg, far_call_pointer);
> +    dprintf(16, "mouse farcall s=%04x x=%04x y=%04x func=%04x:%04x\n"
> +            , status, X, Y, func.seg, func.offset);
>
>     asm volatile(
> +        "pusha\n"
>         "sti\n"
>
>         "pushl %0\n"
> @@ -326,6 +328,7 @@ process_mouse(u8 data)
>
>         "cli\n"
>         "cld\n"
> +        "popa\n"
>         :
>         : "r"(func.segoff), "r"(status), "r"(X), "r"(Y)
>         : "cc"
> diff --git a/src/ps2port.c b/src/ps2port.c
> index fb9d24a..759ad37 100644
> --- a/src/ps2port.c
> +++ b/src/ps2port.c
> @@ -226,8 +226,11 @@ ps2_command(int aux, int command, u8 *param)
>     if (ret)
>         return ret;
>
> +    // Flush any interrupts already pending.
> +    yield();
> +
>     if (command == ATKBD_CMD_RESET_BAT) {
> -        // Reset is special wrt timeouts.
> +        // Reset is special wrt timeouts and bytes received.
>
>         // Send command.
>         ret = ps2_sendbyte(aux, command, 1000);
> @@ -244,6 +247,29 @@ ps2_command(int aux, int command, u8 *param)
>             // Some devices only respond with one byte on reset.
>             ret = 0;
>         param[1] = ret;
> +    } else if (command == ATKBD_CMD_GETID) {
> +        // Getid is special wrt bytes received.
> +
> +        // Send command.
> +        ret = ps2_sendbyte(aux, command, 200);
> +        if (ret)
> +            goto fail;
> +
> +        // Receive parameters.
> +        ret = ps2_recvbyte(aux, 0, 500);
> +        if (ret < 0)
> +            goto fail;
> +        param[0] = ret;
> +        if (ret == 0xab || ret == 0xac || ret == 0x2b || ret == 0x5d
> +            || ret == 0x60 || ret == 0x47) {
> +            // These ids (keyboards) return two bytes.
> +            ret = ps2_recvbyte(aux, 0, 500);
> +            if (ret < 0)
> +                goto fail;
> +            param[1] = ret;
> +        } else {
> +            param[1] = 0;
> +        }
>     } else {
>         // Send command.
>         ret = ps2_sendbyte(aux, command, 200);
> @@ -336,7 +362,8 @@ handle_09(void)
>         return;
>
>     debug_isr(DEBUG_ISR_09);
> -    process_ps2irq();
> +//    process_ps2irq();
> +    process_ps2byte(inb(PORT_PS2_STATUS), inb(PORT_PS2_DATA));
>     eoi_pic1();
>  }
>
>

  reply	other threads:[~2010-03-14  2:49 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-21  0:23 [Qemu-devel] SeaBIOS error with Juniper FreeBSD kernel Brandon Bennett
2010-02-21  4:05 ` Kevin O'Connor
2010-02-21 23:04   ` Brandon Bennett
2010-02-21 23:18     ` Brandon Bennett
2010-02-22  2:56       ` [Qemu-devel] SeaBIOS error with Nextstep bootloader Natalia Portillo
2010-02-28 19:51         ` Kevin O'Connor
2010-03-01  2:00           ` Natalia Portillo
2010-03-11  9:44           ` Natalia Portillo
2010-03-12  1:59             ` Kevin O'Connor
2010-03-12  9:05               ` Natalia Portillo
2010-03-13  6:30                 ` Roy Tam
2010-03-13 14:42                   ` [Qemu-devel] PS/2 mouse emulation problems Natalia Portillo
2010-03-13 14:44                     ` [Qemu-devel] " Roy Tam
2010-03-13 20:23                       ` Kevin O'Connor
2010-03-14  2:49                         ` Roy Tam [this message]
2010-03-14  3:11                           ` Roy Tam
2010-03-14  3:43                             ` Kevin O'Connor
2010-03-14  5:28                               ` Roy Tam
2010-03-14  7:11                                 ` Kevin O'Connor
2010-03-13 16:52                   ` [Qemu-devel] SeaBIOS error with Nextstep bootloader Kevin O'Connor
2010-02-28 19:39       ` [Qemu-devel] SeaBIOS error with Juniper FreeBSD kernel Kevin O'Connor
2010-02-28 20:41         ` Gleb Natapov
2010-04-13 18:48           ` [Qemu-devel] " Bjørn Mork
2010-04-14  1:27             ` Kevin O'Connor
2010-04-14 10:51               ` Bjørn Mork
2011-07-07 15:45                 ` [Qemu-devel] " Bjørn Mork
2011-07-07 23:50                   ` Kevin O'Connor
2011-07-08  7:46                     ` Bjørn Mork
2011-07-10 20:41                       ` Kevin O'Connor
2011-07-10 21:25                         ` [Qemu-devel] [SeaBIOS] " Sebastian Herbszt
2011-07-11 23:33                           ` Brandon Bennett
2011-08-01 13:49                             ` Bjørn Mork
2011-08-02  0:36                               ` Kevin O'Connor
2011-08-02  9:33                                 ` Bjørn Mork
2011-08-02 12:41                                   ` Kevin O'Connor
2011-08-03 12:42                                     ` Bjørn Mork
2011-08-03 13:31                                       ` Avi Kivity
2011-08-03 13:48                                         ` Bjørn Mork
2011-08-03 14:03                                           ` Avi Kivity
2011-08-03 23:48                                       ` Kevin O'Connor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=473191351003131849s791cb862ud0289ac101c88763@mail.gmail.com \
    --to=roytam@gmail.com \
    --cc=kevin@koconnor.net \
    --cc=qemu-devel@nongnu.org \
    --cc=seabios@seabios.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).