qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: BALATON Zoltan <balaton@eik.bme.hu>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: "Hervé Poussineau" <hpoussin@reactos.org>,
	qemu-devel@nongnu.org, "Peter Maydell" <peter.maydell@linaro.org>,
	qemu-ppc@nongnu.org, programmingkidx@gmail.com
Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH] adb: change handler only when recognized
Date: Tue, 9 Aug 2016 02:11:27 +0200 (CEST)	[thread overview]
Message-ID: <alpine.BSF.2.20.1608090128080.83074@zero.eik.bme.hu> (raw)
In-Reply-To: <1470698237.3015.15.camel@kernel.crashing.org>

On Tue, 9 Aug 2016, Benjamin Herrenschmidt wrote:
> On Sat, 2016-03-12 at 14:38 +0100, Hervé Poussineau wrote:
>> ADB devices must take new handler into account only when they
>> recognize it.
>> This lets operating systems probe for valid/invalid handles, to know
>> device capabilities.
>>
>> Add a FIXME in keyboard handler, which should use a different
>> translation
>> table depending of the selected handler.
>
> Ah interesting ! I was just debugging why my new via-pmu model in Qemu
> makes the ADB mouse emulation not work, while I tracked it down to
> problems in that area and started re-inventing ... your patch :-)
>
> The other issue is we shouldn't let the device change address unless
> it's one of the "special" handler IDs. MacOS 9 with a PMU tries to
> send an oddball 3-bytes write to register 3 during boot to the mouse
> (probably some Trackpad related magic) with "2" in the address field,
> if we accept the address change, things go very wrong.

I don't know much about this but I've read here 
<http://mcosre.sourceforge.net/docs/apple_io.html> that there are three 
different kind of chips: CUDA, PMU99 and PMU. Confusingly both PMU-s are 
called via-pmu by Apple. I think we want PMU99 which is found on desktop 
machines and not PMU found in Powerbooks (unless we want to emulate that) 
because PMU99 has less features and more similar to CUDA. But it has some 
differences such as a different interrupt mentioned in this page and maybe 
others. However, desktop machines have no ADB so I'm not sure why we have 
one still in QEMU. If USB is working then we don't need ADB with PMU99 and 
that could resolve all the problems with it. We can keep it to old world 
beige G3 with CUDA where it works. I think only some Powerbooks have PMU 
and ADB but we are not targeting that. Here's an (untested) patch for 
switching to using USB keyboard and mouse instead of ADB unless USB is 
disabled. (The device tree should be changed accordingly in OpenBIOS.) Not 
sure if this is helpful.

--
Regards, 
BALATON Zoltan

diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
index 7d25106..bf8ad9b 100644
--- a/hw/ppc/mac_newworld.c
+++ b/hw/ppc/mac_newworld.c
@@ -418,24 +418,21 @@ static void ppc_core99_init(MachineState *machine)
                                                          "ide[1]"));
      macio_ide_init_drives(macio_ide, &hd[MAX_IDE_DEVS]);

-    dev = DEVICE(object_resolve_path_component(OBJECT(macio), "cuda"));
-    adb_bus = qdev_get_child_bus(dev, "adb.0");
-    dev = qdev_create(adb_bus, TYPE_ADB_KEYBOARD);
-    qdev_init_nofail(dev);
-    dev = qdev_create(adb_bus, TYPE_ADB_MOUSE);
-    qdev_init_nofail(dev);
-
      if (machine->usb) {
          pci_create_simple(pci_bus, -1, "pci-ohci");

-        /* U3 needs to use USB for input because Linux doesn't support via-cuda
-        on PPC64 */
-        if (machine_arch == ARCH_MAC99_U3) {
-            USBBus *usb_bus = usb_bus_find(-1);
+        /* New world machines have USB instead of ADB */
+        USBBus *usb_bus = usb_bus_find(-1);

-            usb_create_simple(usb_bus, "usb-kbd");
-            usb_create_simple(usb_bus, "usb-mouse");
-        }
+        usb_create_simple(usb_bus, "usb-kbd");
+        usb_create_simple(usb_bus, "usb-mouse");
+    } else {
+        dev = DEVICE(object_resolve_path_component(OBJECT(macio), "cuda"));
+        adb_bus = qdev_get_child_bus(dev, "adb.0");
+        dev = qdev_create(adb_bus, TYPE_ADB_KEYBOARD);
+        qdev_init_nofail(dev);
+        dev = qdev_create(adb_bus, TYPE_ADB_MOUSE);
+        qdev_init_nofail(dev);
      }

      pci_vga_init(pci_bus);

  reply	other threads:[~2016-08-09  0:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-12 13:38 [Qemu-devel] [PATCH] adb: change handler only when recognized Hervé Poussineau
2016-03-12 14:31 ` Programmingkid
2016-03-12 15:24 ` Mark Cave-Ayland
2016-03-12 17:44   ` Hervé Poussineau
2016-03-12 18:13     ` Programmingkid
2016-03-12 20:31       ` Hervé Poussineau
2016-03-13 16:06         ` Peter Maydell
2016-08-08 23:17 ` [Qemu-devel] [Qemu-ppc] " Benjamin Herrenschmidt
2016-08-09  0:11   ` BALATON Zoltan [this message]
2016-08-09  0:29     ` Benjamin Herrenschmidt
2016-08-09  1:31       ` BALATON Zoltan
2016-08-09  4:06         ` Benjamin Herrenschmidt
2016-08-09  9:35           ` Howard Spoelstra
2016-08-09 10:26             ` BALATON Zoltan
2016-08-09 11:49               ` Benjamin Herrenschmidt

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=alpine.BSF.2.20.1608090128080.83074@zero.eik.bme.hu \
    --to=balaton@eik.bme.hu \
    --cc=benh@kernel.crashing.org \
    --cc=hpoussin@reactos.org \
    --cc=peter.maydell@linaro.org \
    --cc=programmingkidx@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.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).