qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [Qemu-ppc] [PATCH] adb: change handler only when recogn


From: BALATON Zoltan
Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH] adb: change handler only when recognized
Date: Tue, 9 Aug 2016 02:11:27 +0200 (CEST)
User-agent: Alpine 2.20 (BSF 67 2015-01-07)

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 via email to

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