Received: from eggs.gnu.org ([2001:4830:134:3::10]:32786) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWudv-0003xw-JL for qemu-devel@nongnu.org; Mon, 08 Aug 2016 20:11:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bWuds-0002l1-9L for qemu-devel@nongnu.org; Mon, 08 Aug 2016 20:11:39 -0400 Date: Tue, 9 Aug 2016 02:11:27 +0200 (CEST) From: BALATON Zoltan In-Reply-To: <1470698237.3015.15.camel@kernel.crashing.org> Message-ID: References: <1457789937-30923-1-git-send-email-hpoussin@reactos.org> <1470698237.3015.15.camel@kernel.crashing.org> MIME-Version: 1.0 Content-ID: Content-Type: text/plain; CHARSET=ISO-8859-15; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH] adb: change handler only when recognized List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Benjamin Herrenschmidt Cc: =?ISO-8859-15?Q?Herv=E9_Poussineau?= , qemu-devel@nongnu.org, Peter Maydell , qemu-ppc@nongnu.org, programmingkidx@gmail.com On Tue, 9 Aug 2016, Benjamin Herrenschmidt wrote: > On Sat, 2016-03-12 at 14:38 +0100, Herv=E9 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=20 that there are three=20 different kind of chips: CUDA, PMU99 and PMU. Confusingly both PMU-s are=20 called via-pmu by Apple. I think we want PMU99 which is found on desktop=20 machines and not PMU found in Powerbooks (unless we want to emulate that)= =20 because PMU99 has less features and more similar to CUDA. But it has some= =20 differences such as a different interrupt mentioned in this page and mayb= e=20 others. However, desktop machines have no ADB so I'm not sure why we have= =20 one still in QEMU. If USB is working then we don't need ADB with PMU99 an= d=20 that could resolve all the problems with it. We can keep it to old world=20 beige G3 with CUDA where it works. I think only some Powerbooks have PMU=20 and ADB but we are not targeting that. Here's an (untested) patch for=20 switching to using USB keyboard and mouse instead of ADB unless USB is=20 disabled. (The device tree should be changed accordingly in OpenBIOS.) No= t=20 sure if this is helpful. -- Regards,=20 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 =3D DEVICE(object_resolve_path_component(OBJECT(macio), "cuda"))= ; - adb_bus =3D qdev_get_child_bus(dev, "adb.0"); - dev =3D qdev_create(adb_bus, TYPE_ADB_KEYBOARD); - qdev_init_nofail(dev); - dev =3D 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 v= ia-cuda - on PPC64 */ - if (machine_arch =3D=3D ARCH_MAC99_U3) { - USBBus *usb_bus =3D usb_bus_find(-1); + /* New world machines have USB instead of ADB */ + USBBus *usb_bus =3D 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 =3D DEVICE(object_resolve_path_component(OBJECT(macio), "cud= a")); + adb_bus =3D qdev_get_child_bus(dev, "adb.0"); + dev =3D qdev_create(adb_bus, TYPE_ADB_KEYBOARD); + qdev_init_nofail(dev); + dev =3D qdev_create(adb_bus, TYPE_ADB_MOUSE); + qdev_init_nofail(dev); } pci_vga_init(pci_bus);