From: David Gibson <david@gibson.dropbear.id.au>
To: peter.maydell@linaro.org
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, groug@kaod.org,
clg@kaod.org, agraf@suse.de, aik@ozlabs.ru,
Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
David Gibson <david@gibson.dropbear.id.au>
Subject: [Qemu-devel] [PULL 10/28] adb: add property to disable direct reg 3 writes
Date: Mon, 18 Jun 2018 13:53:06 +1000 [thread overview]
Message-ID: <20180618035324.19907-11-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <20180618035324.19907-1-david@gibson.dropbear.id.au>
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
MacOS 9 has a bug in its PMU driver whereby after configuring the ADB bus
devices it sends another write to reg 3 on both devices resetting them
both back to the same address.
Add a new disable_direct_reg3_writes property to ADBDevice to disable these
direct writes which can enabled just for the upcoming pmu-adb support.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
hw/input/adb-kbd.c | 25 ++++++++++++++-----------
hw/input/adb-mouse.c | 37 ++++++++++++++++++++-----------------
hw/input/adb.c | 7 +++++++
include/hw/input/adb.h | 1 +
4 files changed, 42 insertions(+), 28 deletions(-)
diff --git a/hw/input/adb-kbd.c b/hw/input/adb-kbd.c
index 0ad384dc89..b026e9d49f 100644
--- a/hw/input/adb-kbd.c
+++ b/hw/input/adb-kbd.c
@@ -261,18 +261,21 @@ static int adb_kbd_request(ADBDevice *d, uint8_t *obuf,
trace_adb_kbd_request_change_addr(d->devaddr);
break;
default:
- d->devaddr = buf[1] & 0xf;
- /* we support handlers:
- * 1: Apple Standard Keyboard
- * 2: Apple Extended Keyboard (LShift = RShift)
- * 3: Apple Extended Keyboard (LShift != RShift)
- */
- if (buf[2] == 1 || buf[2] == 2 || buf[2] == 3) {
- d->handler = buf[2];
+ if (!d->disable_direct_reg3_writes) {
+ d->devaddr = buf[1] & 0xf;
+
+ /* we support handlers:
+ * 1: Apple Standard Keyboard
+ * 2: Apple Extended Keyboard (LShift = RShift)
+ * 3: Apple Extended Keyboard (LShift != RShift)
+ */
+ if (buf[2] == 1 || buf[2] == 2 || buf[2] == 3) {
+ d->handler = buf[2];
+ }
+
+ trace_adb_kbd_request_change_addr_and_handler(d->devaddr,
+ d->handler);
}
-
- trace_adb_kbd_request_change_addr_and_handler(d->devaddr,
- d->handler);
break;
}
}
diff --git a/hw/input/adb-mouse.c b/hw/input/adb-mouse.c
index 473045fbac..83833b0035 100644
--- a/hw/input/adb-mouse.c
+++ b/hw/input/adb-mouse.c
@@ -142,24 +142,27 @@ static int adb_mouse_request(ADBDevice *d, uint8_t *obuf,
trace_adb_mouse_request_change_addr(d->devaddr);
break;
default:
- d->devaddr = buf[1] & 0xf;
- /* we support handlers:
- * 0x01: Classic Apple Mouse Protocol / 100 cpi operations
- * 0x02: Classic Apple Mouse Protocol / 200 cpi operations
- * we don't support handlers (at least):
- * 0x03: Mouse systems A3 trackball
- * 0x04: Extended Apple Mouse Protocol
- * 0x2f: Microspeed mouse
- * 0x42: Macally
- * 0x5f: Microspeed mouse
- * 0x66: Microspeed mouse
- */
- if (buf[2] == 1 || buf[2] == 2) {
- d->handler = buf[2];
+ if (!d->disable_direct_reg3_writes) {
+ d->devaddr = buf[1] & 0xf;
+
+ /* we support handlers:
+ * 0x01: Classic Apple Mouse Protocol / 100 cpi operations
+ * 0x02: Classic Apple Mouse Protocol / 200 cpi operations
+ * we don't support handlers (at least):
+ * 0x03: Mouse systems A3 trackball
+ * 0x04: Extended Apple Mouse Protocol
+ * 0x2f: Microspeed mouse
+ * 0x42: Macally
+ * 0x5f: Microspeed mouse
+ * 0x66: Microspeed mouse
+ */
+ if (buf[2] == 1 || buf[2] == 2) {
+ d->handler = buf[2];
+ }
+
+ trace_adb_mouse_request_change_addr_and_handler(
+ d->devaddr, d->handler);
}
-
- trace_adb_mouse_request_change_addr_and_handler(d->devaddr,
- d->handler);
break;
}
}
diff --git a/hw/input/adb.c b/hw/input/adb.c
index 23ae6f0d75..bbb40aeef1 100644
--- a/hw/input/adb.c
+++ b/hw/input/adb.c
@@ -113,11 +113,18 @@ static void adb_device_realizefn(DeviceState *dev, Error **errp)
bus->devices[bus->nb_devices++] = d;
}
+static Property adb_device_properties[] = {
+ DEFINE_PROP_BOOL("disable-direct-reg3-writes", ADBDevice,
+ disable_direct_reg3_writes, false),
+ DEFINE_PROP_END_OF_LIST(),
+};
+
static void adb_device_class_init(ObjectClass *oc, void *data)
{
DeviceClass *dc = DEVICE_CLASS(oc);
dc->realize = adb_device_realizefn;
+ dc->props = adb_device_properties;
dc->bus_type = TYPE_ADB_BUS;
}
diff --git a/include/hw/input/adb.h b/include/hw/input/adb.h
index 3ae8445e95..f99d478252 100644
--- a/include/hw/input/adb.h
+++ b/include/hw/input/adb.h
@@ -49,6 +49,7 @@ struct ADBDevice {
int devaddr;
int handler;
+ bool disable_direct_reg3_writes;
};
#define ADB_DEVICE_CLASS(cls) \
--
2.17.1
next prev parent reply other threads:[~2018-06-18 3:53 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-18 3:52 [Qemu-devel] [PULL 00/28] ppc-for-3.0 queue 20180618 David Gibson
2018-06-18 3:52 ` [Qemu-devel] [PULL 01/28] target/ppc: Don't require private l1d cache on POWER8 for cap_ppc_safe_cache David Gibson
2018-06-18 3:52 ` [Qemu-devel] [PULL 02/28] ppc/spapr_caps: Don't disable cap_cfpc on POWER8 by default David Gibson
2018-06-18 3:52 ` [Qemu-devel] [PULL 03/28] target/ppc: drop empty #if/#endif block David Gibson
2018-06-18 3:53 ` [Qemu-devel] [PULL 04/28] spapr: fix leak in h_client_architecture_support() David Gibson
2018-06-18 3:53 ` [Qemu-devel] [PULL 05/28] ppc: introduce Core99MachinesState for the mac99 machine David Gibson
2018-06-18 3:53 ` [Qemu-devel] [PULL 06/28] mac_newworld: add via machine option to control mac99 VIA/ADB configuration David Gibson
2018-06-18 3:53 ` [Qemu-devel] [PULL 07/28] mac_newworld: add gpios to macio devices with PMU enabled David Gibson
2018-06-18 3:53 ` [Qemu-devel] [PULL 08/28] mac_newworld: wire up programmer switch to NMI handler David Gibson
2018-06-18 3:53 ` [Qemu-devel] [PULL 09/28] adb: fix read reg 3 byte ordering David Gibson
2018-06-18 3:53 ` David Gibson [this message]
2018-06-18 3:53 ` [Qemu-devel] [PULL 11/28] mac_newworld: add PMU device David Gibson
2018-06-18 3:53 ` [Qemu-devel] [PULL 12/28] xics_kvm: fix a build break David Gibson
2018-06-18 3:53 ` [Qemu-devel] [PULL 13/28] mos6522: only clear the shift register interrupt upon write David Gibson
2018-06-18 3:53 ` [Qemu-devel] [PULL 14/28] mos6522: remove additional interrupt flag filter from mos6522_update_irq() David Gibson
2018-06-18 3:53 ` [Qemu-devel] [PULL 15/28] mos6522: expose mos6522_update_irq() through MOS6522DeviceClass David Gibson
2018-06-18 3:53 ` [Qemu-devel] [PULL 16/28] sm501: Do not clear read only bits when writing registers David Gibson
2018-06-18 3:53 ` [Qemu-devel] [PULL 17/28] spapr: Clean up cpu realize/unrealize paths David Gibson
2018-06-18 3:53 ` [Qemu-devel] [PULL 18/28] pnv: Fix some error handling cpu realize() David Gibson
2018-06-18 3:53 ` [Qemu-devel] [PULL 19/28] pnv_core: Allocate cpu thread objects individually David Gibson
2018-06-18 3:53 ` [Qemu-devel] [PULL 20/28] pnv: Clean up cpu realize path David Gibson
2018-06-18 3:53 ` [Qemu-devel] [PULL 21/28] pnv: Add cpu unrealize path David Gibson
2018-06-18 3:53 ` [Qemu-devel] [PULL 22/28] spapr_cpu_core: convert last snprintf() to g_strdup_printf() David Gibson
2018-06-18 3:53 ` [Qemu-devel] [PULL 23/28] spapr_cpu_core: fix potential leak in spapr_cpu_core_realize() David Gibson
2018-06-18 3:53 ` [Qemu-devel] [PULL 24/28] spapr_cpu_core: add missing rollback on realization path David Gibson
2018-06-18 3:53 ` [Qemu-devel] [PULL 25/28] spapr_cpu_core: introduce spapr_create_vcpu() David Gibson
2018-06-18 3:53 ` [Qemu-devel] [PULL 26/28] ppc/pnv: introduce a pnv_chip_core_realize() routine David Gibson
2018-06-18 3:53 ` [Qemu-devel] [PULL 27/28] target/ppc, spapr: Move VPA information to machine_data David Gibson
2018-06-18 3:53 ` [Qemu-devel] [PULL 28/28] spapr: fix xics_system_init() error path David Gibson
2018-06-19 11:57 ` [Qemu-devel] [PULL 00/28] ppc-for-3.0 queue 20180618 Peter Maydell
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=20180618035324.19907-11-david@gibson.dropbear.id.au \
--to=david@gibson.dropbear.id.au \
--cc=agraf@suse.de \
--cc=aik@ozlabs.ru \
--cc=clg@kaod.org \
--cc=groug@kaod.org \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=peter.maydell@linaro.org \
--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).