qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 00/13] cuda: misc fixes and cleanups
@ 2016-02-07 20:34 Hervé Poussineau
  2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 01/13] cuda: add a framework to handle commands Hervé Poussineau
                   ` (13 more replies)
  0 siblings, 14 replies; 17+ messages in thread
From: Hervé Poussineau @ 2016-02-07 20:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, Alyssa Milburn, Mark Cave-Ayland, Alexander Graf,
	Hervé Poussineau

Hi,

This patchset cleans up a little bit the Apple CUDA emulation:
- correctly reject commands with wrong parameters
- support changing the frequency of auto-polling
- support changing device list probed in auto-poll
- add logs when using FILE_SERVER_FLAG/SET_POWER_MESSAGE
- remove unused commands (GET/SET_6805_ADDR)
- remove unimplemented GET_SET_IIC/COMBINED_FORMAT_IIC

GET_SET_IIC/COMBINED_FORMAT_IIC commands should be added again once
we implement the I2C bus provided by CUDA.

Hervé

Hervé Poussineau (13):
  cuda: add a framework to handle commands
  cuda: move unknown commands reject out of switch
  cuda: port AUTOPOLL command to new framework
  cuda: port SET_AUTO_RATE command to new framework
  cuda: port SET_DEVICE_LIST command to new framework
  cuda: port POWERDOWN command to new framework
  cuda: port RESET_SYSTEM command to new framework
  cuda: port FILE_SERVER_FLAG command to new framework
  cuda: port SET_POWER_MESSAGES command to new framework
  cuda: port GET_TIME command to new framework
  cuda: port SET_TIME command to new framework
  cuda: remove GET_6805_ADDR command
  cuda: remove CUDA_GET_SET_IIC/CUDA_COMBINED_FORMAT_IIC commands

 hw/input/adb.c         |  18 ++--
 hw/misc/macio/cuda.c   | 279 ++++++++++++++++++++++++++++++++++++-------------
 hw/ppc/mac.h           |   2 +
 include/hw/input/adb.h |   2 +-
 4 files changed, 217 insertions(+), 84 deletions(-)

-- 
2.1.4

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH v2 01/13] cuda: add a framework to handle commands
  2016-02-07 20:34 [Qemu-devel] [PATCH v2 00/13] cuda: misc fixes and cleanups Hervé Poussineau
@ 2016-02-07 20:34 ` Hervé Poussineau
  2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 02/13] cuda: move unknown commands reject out of switch Hervé Poussineau
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Hervé Poussineau @ 2016-02-07 20:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, Alyssa Milburn, Mark Cave-Ayland, Alexander Graf,
	Hervé Poussineau

Next commits will port existing CUDA commands to this framework.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/misc/macio/cuda.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index 316c1ac..8659dc3 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -535,13 +535,47 @@ static void cuda_adb_poll(void *opaque)
                    (get_ticks_per_sec() / CUDA_ADB_POLL_FREQ));
 }
 
+/* description of commands */
+typedef struct CudaCommand {
+    uint8_t command;
+    const char *name;
+    bool (*handler)(CUDAState *s,
+                    const uint8_t *in_args, int in_len,
+                    uint8_t *out_args, int *out_len);
+} CudaCommand;
+
+static const CudaCommand handlers[] = {
+};
+
 static void cuda_receive_packet(CUDAState *s,
                                 const uint8_t *data, int len)
 {
     uint8_t obuf[16] = { CUDA_PACKET, 0, data[0] };
     int autopoll;
+    int i, out_len = 0;
     uint32_t ti;
 
+    for (i = 0; i < ARRAY_SIZE(handlers); i++) {
+        const CudaCommand *desc = &handlers[i];
+        if (desc->command == data[0]) {
+            CUDA_DPRINTF("handling command %s\n", desc->name);
+            out_len = 0;
+            if (desc->handler(s, data + 1, len - 1, obuf + 3, &out_len)) {
+                cuda_send_packet_to_host(s, obuf, 3 + out_len);
+            } else {
+                qemu_log_mask(LOG_GUEST_ERROR,
+                              "CUDA: %s: wrong parameters %d\n",
+                              desc->name, len);
+                obuf[0] = ERROR_PACKET;
+                obuf[1] = 0x5; /* bad parameters */
+                obuf[2] = CUDA_PACKET;
+                obuf[3] = data[0];
+                cuda_send_packet_to_host(s, obuf, 4);
+            }
+            return;
+        }
+    }
+
     switch(data[0]) {
     case CUDA_AUTOPOLL:
         autopoll = (data[1] != 0);
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH v2 02/13] cuda: move unknown commands reject out of switch
  2016-02-07 20:34 [Qemu-devel] [PATCH v2 00/13] cuda: misc fixes and cleanups Hervé Poussineau
  2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 01/13] cuda: add a framework to handle commands Hervé Poussineau
@ 2016-02-07 20:34 ` Hervé Poussineau
  2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 03/13] cuda: port AUTOPOLL command to new framework Hervé Poussineau
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Hervé Poussineau @ 2016-02-07 20:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, Alyssa Milburn, Mark Cave-Ayland, Alexander Graf,
	Hervé Poussineau

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/misc/macio/cuda.c | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index 8659dc3..81e34e7 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -590,15 +590,15 @@ static void cuda_receive_packet(CUDAState *s,
             }
         }
         cuda_send_packet_to_host(s, obuf, 3);
-        break;
+        return;
     case CUDA_GET_6805_ADDR:
         cuda_send_packet_to_host(s, obuf, 3);
-        break;
+        return;
     case CUDA_SET_TIME:
         ti = (((uint32_t)data[1]) << 24) + (((uint32_t)data[2]) << 16) + (((uint32_t)data[3]) << 8) + data[4];
         s->tick_offset = ti - (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) / get_ticks_per_sec());
         cuda_send_packet_to_host(s, obuf, 3);
-        break;
+        return;
     case CUDA_GET_TIME:
         ti = s->tick_offset + (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) / get_ticks_per_sec());
         obuf[3] = ti >> 24;
@@ -606,28 +606,28 @@ static void cuda_receive_packet(CUDAState *s,
         obuf[5] = ti >> 8;
         obuf[6] = ti;
         cuda_send_packet_to_host(s, obuf, 7);
-        break;
+        return;
     case CUDA_FILE_SERVER_FLAG:
     case CUDA_SET_DEVICE_LIST:
     case CUDA_SET_AUTO_RATE:
     case CUDA_SET_POWER_MESSAGES:
         cuda_send_packet_to_host(s, obuf, 3);
-        break;
+        return;
     case CUDA_POWERDOWN:
         cuda_send_packet_to_host(s, obuf, 3);
         qemu_system_shutdown_request();
-        break;
+        return;
     case CUDA_RESET_SYSTEM:
         cuda_send_packet_to_host(s, obuf, 3);
         qemu_system_reset_request();
-        break;
+        return;
     case CUDA_COMBINED_FORMAT_IIC:
         obuf[0] = ERROR_PACKET;
         obuf[1] = 0x5;
         obuf[2] = CUDA_PACKET;
         obuf[3] = data[0];
         cuda_send_packet_to_host(s, obuf, 4);
-        break;
+        return;
     case CUDA_GET_SET_IIC:
         if (len == 4) {
             cuda_send_packet_to_host(s, obuf, 3);
@@ -638,15 +638,17 @@ static void cuda_receive_packet(CUDAState *s,
             obuf[3] = data[0];
             cuda_send_packet_to_host(s, obuf, 4);
         }
-        break;
+        return;
     default:
-        obuf[0] = ERROR_PACKET;
-        obuf[1] = 0x2;
-        obuf[2] = CUDA_PACKET;
-        obuf[3] = data[0];
-        cuda_send_packet_to_host(s, obuf, 4);
         break;
     }
+
+    qemu_log_mask(LOG_GUEST_ERROR, "CUDA: unknown command 0x%02x\n", data[0]);
+    obuf[0] = ERROR_PACKET;
+    obuf[1] = 0x2; /* unknown command */
+    obuf[2] = CUDA_PACKET;
+    obuf[3] = data[0];
+    cuda_send_packet_to_host(s, obuf, 4);
 }
 
 static void cuda_receive_packet_from_host(CUDAState *s,
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH v2 03/13] cuda: port AUTOPOLL command to new framework
  2016-02-07 20:34 [Qemu-devel] [PATCH v2 00/13] cuda: misc fixes and cleanups Hervé Poussineau
  2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 01/13] cuda: add a framework to handle commands Hervé Poussineau
  2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 02/13] cuda: move unknown commands reject out of switch Hervé Poussineau
@ 2016-02-07 20:34 ` Hervé Poussineau
  2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 04/13] cuda: port SET_AUTO_RATE " Hervé Poussineau
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Hervé Poussineau @ 2016-02-07 20:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, Alyssa Milburn, Mark Cave-Ayland, Alexander Graf,
	Hervé Poussineau

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/misc/macio/cuda.c | 40 +++++++++++++++++++++++++---------------
 1 file changed, 25 insertions(+), 15 deletions(-)

diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index 81e34e7..ea4237a 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -544,14 +544,38 @@ typedef struct CudaCommand {
                     uint8_t *out_args, int *out_len);
 } CudaCommand;
 
+static bool cuda_cmd_autopoll(CUDAState *s,
+                              const uint8_t *in_data, int in_len,
+                              uint8_t *out_data, int *out_len)
+{
+    int autopoll;
+
+    if (in_len != 1) {
+        return false;
+    }
+
+    autopoll = (in_data[0] != 0);
+    if (autopoll != s->autopoll) {
+        s->autopoll = autopoll;
+        if (autopoll) {
+            timer_mod(s->adb_poll_timer,
+                      qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
+                      (get_ticks_per_sec() / CUDA_ADB_POLL_FREQ));
+        } else {
+            timer_del(s->adb_poll_timer);
+        }
+    }
+    return true;
+}
+
 static const CudaCommand handlers[] = {
+    { CUDA_AUTOPOLL, "AUTOPOLL", cuda_cmd_autopoll },
 };
 
 static void cuda_receive_packet(CUDAState *s,
                                 const uint8_t *data, int len)
 {
     uint8_t obuf[16] = { CUDA_PACKET, 0, data[0] };
-    int autopoll;
     int i, out_len = 0;
     uint32_t ti;
 
@@ -577,20 +601,6 @@ static void cuda_receive_packet(CUDAState *s,
     }
 
     switch(data[0]) {
-    case CUDA_AUTOPOLL:
-        autopoll = (data[1] != 0);
-        if (autopoll != s->autopoll) {
-            s->autopoll = autopoll;
-            if (autopoll) {
-                timer_mod(s->adb_poll_timer,
-                               qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
-                               (get_ticks_per_sec() / CUDA_ADB_POLL_FREQ));
-            } else {
-                timer_del(s->adb_poll_timer);
-            }
-        }
-        cuda_send_packet_to_host(s, obuf, 3);
-        return;
     case CUDA_GET_6805_ADDR:
         cuda_send_packet_to_host(s, obuf, 3);
         return;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH v2 04/13] cuda: port SET_AUTO_RATE command to new framework
  2016-02-07 20:34 [Qemu-devel] [PATCH v2 00/13] cuda: misc fixes and cleanups Hervé Poussineau
                   ` (2 preceding siblings ...)
  2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 03/13] cuda: port AUTOPOLL command to new framework Hervé Poussineau
@ 2016-02-07 20:34 ` Hervé Poussineau
  2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 05/13] cuda: port SET_DEVICE_LIST " Hervé Poussineau
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Hervé Poussineau @ 2016-02-07 20:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, Alyssa Milburn, Mark Cave-Ayland, Alexander Graf,
	Hervé Poussineau

Also implement the command, by removing the hardcoded period of 20 ms/50 Hz
and replacing it by the one requested by user.
Update VMState version to store this new parameter.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/misc/macio/cuda.c | 36 ++++++++++++++++++++++++++++++------
 hw/ppc/mac.h         |  1 +
 2 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index ea4237a..71fd97c 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -106,7 +106,6 @@
 #define CUDA_COMBINED_FORMAT_IIC	0x25
 
 #define CUDA_TIMER_FREQ (4700000 / 6)
-#define CUDA_ADB_POLL_FREQ 50
 
 /* CUDA returns time_t's offset from Jan 1, 1904, not 1970 */
 #define RTC_OFFSET                      2082844800
@@ -532,7 +531,7 @@ static void cuda_adb_poll(void *opaque)
     }
     timer_mod(s->adb_poll_timer,
                    qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
-                   (get_ticks_per_sec() / CUDA_ADB_POLL_FREQ));
+                   (get_ticks_per_sec() / (1000 / s->autopoll_rate_ms)));
 }
 
 /* description of commands */
@@ -560,7 +559,7 @@ static bool cuda_cmd_autopoll(CUDAState *s,
         if (autopoll) {
             timer_mod(s->adb_poll_timer,
                       qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
-                      (get_ticks_per_sec() / CUDA_ADB_POLL_FREQ));
+                      (get_ticks_per_sec() / (1000 / s->autopoll_rate_ms)));
         } else {
             timer_del(s->adb_poll_timer);
         }
@@ -568,8 +567,32 @@ static bool cuda_cmd_autopoll(CUDAState *s,
     return true;
 }
 
+static bool cuda_cmd_set_autorate(CUDAState *s,
+                                  const uint8_t *in_data, int in_len,
+                                  uint8_t *out_data, int *out_len)
+{
+    if (in_len != 1) {
+        return false;
+    }
+
+    /* we don't want a period of 0 ms */
+    /* FIXME: check what real hardware does */
+    if (in_data[0] == 0) {
+        return false;
+    }
+
+    s->autopoll_rate_ms = in_data[0];
+    if (s->autopoll) {
+        timer_mod(s->adb_poll_timer,
+                  qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
+                  (get_ticks_per_sec() / (1000 / s->autopoll_rate_ms)));
+    }
+    return true;
+}
+
 static const CudaCommand handlers[] = {
     { CUDA_AUTOPOLL, "AUTOPOLL", cuda_cmd_autopoll },
+    { CUDA_SET_AUTO_RATE, "SET_AUTO_RATE",  cuda_cmd_set_autorate },
 };
 
 static void cuda_receive_packet(CUDAState *s,
@@ -619,7 +642,6 @@ static void cuda_receive_packet(CUDAState *s,
         return;
     case CUDA_FILE_SERVER_FLAG:
     case CUDA_SET_DEVICE_LIST:
-    case CUDA_SET_AUTO_RATE:
     case CUDA_SET_POWER_MESSAGES:
         cuda_send_packet_to_host(s, obuf, 3);
         return;
@@ -756,8 +778,8 @@ static const VMStateDescription vmstate_cuda_timer = {
 
 static const VMStateDescription vmstate_cuda = {
     .name = "cuda",
-    .version_id = 3,
-    .minimum_version_id = 3,
+    .version_id = 4,
+    .minimum_version_id = 4,
     .fields = (VMStateField[]) {
         VMSTATE_UINT8(a, CUDAState),
         VMSTATE_UINT8(b, CUDAState),
@@ -775,6 +797,7 @@ static const VMStateDescription vmstate_cuda = {
         VMSTATE_INT32(data_in_index, CUDAState),
         VMSTATE_INT32(data_out_index, CUDAState),
         VMSTATE_UINT8(autopoll, CUDAState),
+        VMSTATE_UINT8(autopoll_rate_ms, CUDAState),
         VMSTATE_BUFFER(data_in, CUDAState),
         VMSTATE_BUFFER(data_out, CUDAState),
         VMSTATE_UINT32(tick_offset, CUDAState),
@@ -828,6 +851,7 @@ static void cuda_realizefn(DeviceState *dev, Error **errp)
     s->tick_offset = (uint32_t)mktimegm(&tm) + RTC_OFFSET;
 
     s->adb_poll_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, cuda_adb_poll, s);
+    s->autopoll_rate_ms = 20;
 }
 
 static void cuda_initfn(Object *obj)
diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h
index ecf7792..887c8c1 100644
--- a/hw/ppc/mac.h
+++ b/hw/ppc/mac.h
@@ -111,6 +111,7 @@ typedef struct CUDAState {
     int data_out_index;
 
     qemu_irq irq;
+    uint8_t autopoll_rate_ms;
     uint8_t autopoll;
     uint8_t data_in[128];
     uint8_t data_out[16];
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH v2 05/13] cuda: port SET_DEVICE_LIST command to new framework
  2016-02-07 20:34 [Qemu-devel] [PATCH v2 00/13] cuda: misc fixes and cleanups Hervé Poussineau
                   ` (3 preceding siblings ...)
  2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 04/13] cuda: port SET_AUTO_RATE " Hervé Poussineau
@ 2016-02-07 20:34 ` Hervé Poussineau
  2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 06/13] cuda: port POWERDOWN " Hervé Poussineau
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Hervé Poussineau @ 2016-02-07 20:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, Alyssa Milburn, Mark Cave-Ayland, Alexander Graf,
	Hervé Poussineau

Also implement the command, by taking device list mask into account
when polling ADB devices.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/input/adb.c         | 18 ++++++++++--------
 hw/misc/macio/cuda.c   | 18 ++++++++++++++++--
 hw/ppc/mac.h           |  1 +
 include/hw/input/adb.h |  2 +-
 4 files changed, 28 insertions(+), 11 deletions(-)

diff --git a/hw/input/adb.c b/hw/input/adb.c
index c384856..f0ad0d4 100644
--- a/hw/input/adb.c
+++ b/hw/input/adb.c
@@ -89,7 +89,7 @@ int adb_request(ADBBusState *s, uint8_t *obuf, const uint8_t *buf, int len)
 }
 
 /* XXX: move that to cuda ? */
-int adb_poll(ADBBusState *s, uint8_t *obuf)
+int adb_poll(ADBBusState *s, uint8_t *obuf, uint16_t poll_mask)
 {
     ADBDevice *d;
     int olen, i;
@@ -100,13 +100,15 @@ int adb_poll(ADBBusState *s, uint8_t *obuf)
         if (s->poll_index >= s->nb_devices)
             s->poll_index = 0;
         d = s->devices[s->poll_index];
-        buf[0] = ADB_READREG | (d->devaddr << 4);
-        olen = adb_request(s, obuf + 1, buf, 1);
-        /* if there is data, we poll again the same device */
-        if (olen > 0) {
-            obuf[0] = buf[0];
-            olen++;
-            break;
+        if ((1 << d->devaddr) & poll_mask) {
+            buf[0] = ADB_READREG | (d->devaddr << 4);
+            olen = adb_request(s, obuf + 1, buf, 1);
+            /* if there is data, we poll again the same device */
+            if (olen > 0) {
+                obuf[0] = buf[0];
+                olen++;
+                break;
+            }
         }
         s->poll_index++;
     }
diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index 71fd97c..a2e31d0 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -523,7 +523,7 @@ static void cuda_adb_poll(void *opaque)
     uint8_t obuf[ADB_MAX_OUT_LEN + 2];
     int olen;
 
-    olen = adb_poll(&s->adb_bus, obuf + 2);
+    olen = adb_poll(&s->adb_bus, obuf + 2, s->adb_poll_mask);
     if (olen > 0) {
         obuf[0] = ADB_PACKET;
         obuf[1] = 0x40; /* polled data */
@@ -590,9 +590,22 @@ static bool cuda_cmd_set_autorate(CUDAState *s,
     return true;
 }
 
+static bool cuda_cmd_set_device_list(CUDAState *s,
+                                     const uint8_t *in_data, int in_len,
+                                     uint8_t *out_data, int *out_len)
+{
+    if (in_len != 2) {
+        return false;
+    }
+
+    s->adb_poll_mask = (((uint16_t)in_data[0]) << 8) | in_data[1];
+    return true;
+}
+
 static const CudaCommand handlers[] = {
     { CUDA_AUTOPOLL, "AUTOPOLL", cuda_cmd_autopoll },
     { CUDA_SET_AUTO_RATE, "SET_AUTO_RATE",  cuda_cmd_set_autorate },
+    { CUDA_SET_DEVICE_LIST, "SET_DEVICE_LIST", cuda_cmd_set_device_list },
 };
 
 static void cuda_receive_packet(CUDAState *s,
@@ -641,7 +654,6 @@ static void cuda_receive_packet(CUDAState *s,
         cuda_send_packet_to_host(s, obuf, 7);
         return;
     case CUDA_FILE_SERVER_FLAG:
-    case CUDA_SET_DEVICE_LIST:
     case CUDA_SET_POWER_MESSAGES:
         cuda_send_packet_to_host(s, obuf, 3);
         return;
@@ -798,6 +810,7 @@ static const VMStateDescription vmstate_cuda = {
         VMSTATE_INT32(data_out_index, CUDAState),
         VMSTATE_UINT8(autopoll, CUDAState),
         VMSTATE_UINT8(autopoll_rate_ms, CUDAState),
+        VMSTATE_UINT16(adb_poll_mask, CUDAState),
         VMSTATE_BUFFER(data_in, CUDAState),
         VMSTATE_BUFFER(data_out, CUDAState),
         VMSTATE_UINT32(tick_offset, CUDAState),
@@ -852,6 +865,7 @@ static void cuda_realizefn(DeviceState *dev, Error **errp)
 
     s->adb_poll_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, cuda_adb_poll, s);
     s->autopoll_rate_ms = 20;
+    s->adb_poll_mask = 0xffff;
 }
 
 static void cuda_initfn(Object *obj)
diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h
index 887c8c1..5764b86 100644
--- a/hw/ppc/mac.h
+++ b/hw/ppc/mac.h
@@ -111,6 +111,7 @@ typedef struct CUDAState {
     int data_out_index;
 
     qemu_irq irq;
+    uint16_t adb_poll_mask;
     uint8_t autopoll_rate_ms;
     uint8_t autopoll;
     uint8_t data_in[128];
diff --git a/include/hw/input/adb.h b/include/hw/input/adb.h
index bdfccd4..db51d03 100644
--- a/include/hw/input/adb.h
+++ b/include/hw/input/adb.h
@@ -79,7 +79,7 @@ struct ADBBusState {
 
 int adb_request(ADBBusState *s, uint8_t *buf_out,
                 const uint8_t *buf, int len);
-int adb_poll(ADBBusState *s, uint8_t *buf_out);
+int adb_poll(ADBBusState *s, uint8_t *buf_out, uint16_t poll_mask);
 
 #define TYPE_ADB_KEYBOARD "adb-keyboard"
 #define TYPE_ADB_MOUSE "adb-mouse"
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH v2 06/13] cuda: port POWERDOWN command to new framework
  2016-02-07 20:34 [Qemu-devel] [PATCH v2 00/13] cuda: misc fixes and cleanups Hervé Poussineau
                   ` (4 preceding siblings ...)
  2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 05/13] cuda: port SET_DEVICE_LIST " Hervé Poussineau
@ 2016-02-07 20:34 ` Hervé Poussineau
  2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 07/13] cuda: port RESET_SYSTEM " Hervé Poussineau
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Hervé Poussineau @ 2016-02-07 20:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, Alyssa Milburn, Mark Cave-Ayland, Alexander Graf,
	Hervé Poussineau

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/misc/macio/cuda.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index a2e31d0..9948e18 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -602,10 +602,23 @@ static bool cuda_cmd_set_device_list(CUDAState *s,
     return true;
 }
 
+static bool cuda_cmd_powerdown(CUDAState *s,
+                               const uint8_t *in_data, int in_len,
+                               uint8_t *out_data, int *out_len)
+{
+    if (in_len != 0) {
+        return false;
+    }
+
+    qemu_system_shutdown_request();
+    return true;
+}
+
 static const CudaCommand handlers[] = {
     { CUDA_AUTOPOLL, "AUTOPOLL", cuda_cmd_autopoll },
     { CUDA_SET_AUTO_RATE, "SET_AUTO_RATE",  cuda_cmd_set_autorate },
     { CUDA_SET_DEVICE_LIST, "SET_DEVICE_LIST", cuda_cmd_set_device_list },
+    { CUDA_POWERDOWN, "POWERDOWN", cuda_cmd_powerdown },
 };
 
 static void cuda_receive_packet(CUDAState *s,
@@ -657,10 +670,6 @@ static void cuda_receive_packet(CUDAState *s,
     case CUDA_SET_POWER_MESSAGES:
         cuda_send_packet_to_host(s, obuf, 3);
         return;
-    case CUDA_POWERDOWN:
-        cuda_send_packet_to_host(s, obuf, 3);
-        qemu_system_shutdown_request();
-        return;
     case CUDA_RESET_SYSTEM:
         cuda_send_packet_to_host(s, obuf, 3);
         qemu_system_reset_request();
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH v2 07/13] cuda: port RESET_SYSTEM command to new framework
  2016-02-07 20:34 [Qemu-devel] [PATCH v2 00/13] cuda: misc fixes and cleanups Hervé Poussineau
                   ` (5 preceding siblings ...)
  2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 06/13] cuda: port POWERDOWN " Hervé Poussineau
@ 2016-02-07 20:34 ` Hervé Poussineau
  2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 08/13] cuda: port FILE_SERVER_FLAG " Hervé Poussineau
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Hervé Poussineau @ 2016-02-07 20:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, Alyssa Milburn, Mark Cave-Ayland, Alexander Graf,
	Hervé Poussineau

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/misc/macio/cuda.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index 9948e18..ca11fc8 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -614,11 +614,24 @@ static bool cuda_cmd_powerdown(CUDAState *s,
     return true;
 }
 
+static bool cuda_cmd_reset_system(CUDAState *s,
+                                  const uint8_t *in_data, int in_len,
+                                  uint8_t *out_data, int *out_len)
+{
+    if (in_len != 0) {
+        return false;
+    }
+
+    qemu_system_reset_request();
+    return true;
+}
+
 static const CudaCommand handlers[] = {
     { CUDA_AUTOPOLL, "AUTOPOLL", cuda_cmd_autopoll },
     { CUDA_SET_AUTO_RATE, "SET_AUTO_RATE",  cuda_cmd_set_autorate },
     { CUDA_SET_DEVICE_LIST, "SET_DEVICE_LIST", cuda_cmd_set_device_list },
     { CUDA_POWERDOWN, "POWERDOWN", cuda_cmd_powerdown },
+    { CUDA_RESET_SYSTEM, "RESET_SYSTEM", cuda_cmd_reset_system },
 };
 
 static void cuda_receive_packet(CUDAState *s,
@@ -670,10 +683,6 @@ static void cuda_receive_packet(CUDAState *s,
     case CUDA_SET_POWER_MESSAGES:
         cuda_send_packet_to_host(s, obuf, 3);
         return;
-    case CUDA_RESET_SYSTEM:
-        cuda_send_packet_to_host(s, obuf, 3);
-        qemu_system_reset_request();
-        return;
     case CUDA_COMBINED_FORMAT_IIC:
         obuf[0] = ERROR_PACKET;
         obuf[1] = 0x5;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH v2 08/13] cuda: port FILE_SERVER_FLAG command to new framework
  2016-02-07 20:34 [Qemu-devel] [PATCH v2 00/13] cuda: misc fixes and cleanups Hervé Poussineau
                   ` (6 preceding siblings ...)
  2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 07/13] cuda: port RESET_SYSTEM " Hervé Poussineau
@ 2016-02-07 20:34 ` Hervé Poussineau
  2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 09/13] cuda: port SET_POWER_MESSAGES " Hervé Poussineau
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Hervé Poussineau @ 2016-02-07 20:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, Alyssa Milburn, Mark Cave-Ayland, Alexander Graf,
	Hervé Poussineau

This command tells if computer should automatically wake-up after a power loss.

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/misc/macio/cuda.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index ca11fc8..4ddec34 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -626,12 +626,28 @@ static bool cuda_cmd_reset_system(CUDAState *s,
     return true;
 }
 
+static bool cuda_cmd_set_file_server_flag(CUDAState *s,
+                                          const uint8_t *in_data, int in_len,
+                                          uint8_t *out_data, int *out_len)
+{
+    if (in_len != 1) {
+        return false;
+    }
+
+    qemu_log_mask(LOG_UNIMP,
+                  "CUDA: unimplemented command FILE_SERVER_FLAG %d\n",
+                  in_data[0]);
+    return true;
+}
+
 static const CudaCommand handlers[] = {
     { CUDA_AUTOPOLL, "AUTOPOLL", cuda_cmd_autopoll },
     { CUDA_SET_AUTO_RATE, "SET_AUTO_RATE",  cuda_cmd_set_autorate },
     { CUDA_SET_DEVICE_LIST, "SET_DEVICE_LIST", cuda_cmd_set_device_list },
     { CUDA_POWERDOWN, "POWERDOWN", cuda_cmd_powerdown },
     { CUDA_RESET_SYSTEM, "RESET_SYSTEM", cuda_cmd_reset_system },
+    { CUDA_FILE_SERVER_FLAG, "FILE_SERVER_FLAG",
+      cuda_cmd_set_file_server_flag },
 };
 
 static void cuda_receive_packet(CUDAState *s,
@@ -679,7 +695,6 @@ static void cuda_receive_packet(CUDAState *s,
         obuf[6] = ti;
         cuda_send_packet_to_host(s, obuf, 7);
         return;
-    case CUDA_FILE_SERVER_FLAG:
     case CUDA_SET_POWER_MESSAGES:
         cuda_send_packet_to_host(s, obuf, 3);
         return;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH v2 09/13] cuda: port SET_POWER_MESSAGES command to new framework
  2016-02-07 20:34 [Qemu-devel] [PATCH v2 00/13] cuda: misc fixes and cleanups Hervé Poussineau
                   ` (7 preceding siblings ...)
  2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 08/13] cuda: port FILE_SERVER_FLAG " Hervé Poussineau
@ 2016-02-07 20:34 ` Hervé Poussineau
  2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 10/13] cuda: port GET_TIME " Hervé Poussineau
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Hervé Poussineau @ 2016-02-07 20:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, Alyssa Milburn, Mark Cave-Ayland, Alexander Graf,
	Hervé Poussineau

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/misc/macio/cuda.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index 4ddec34..16f9ad6 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -640,6 +640,20 @@ static bool cuda_cmd_set_file_server_flag(CUDAState *s,
     return true;
 }
 
+static bool cuda_cmd_set_power_message(CUDAState *s,
+                                       const uint8_t *in_data, int in_len,
+                                       uint8_t *out_data, int *out_len)
+{
+    if (in_len != 1) {
+        return false;
+    }
+
+    qemu_log_mask(LOG_UNIMP,
+                  "CUDA: unimplemented command SET_POWER_MESSAGE %d\n",
+                  in_data[0]);
+    return true;
+}
+
 static const CudaCommand handlers[] = {
     { CUDA_AUTOPOLL, "AUTOPOLL", cuda_cmd_autopoll },
     { CUDA_SET_AUTO_RATE, "SET_AUTO_RATE",  cuda_cmd_set_autorate },
@@ -648,6 +662,8 @@ static const CudaCommand handlers[] = {
     { CUDA_RESET_SYSTEM, "RESET_SYSTEM", cuda_cmd_reset_system },
     { CUDA_FILE_SERVER_FLAG, "FILE_SERVER_FLAG",
       cuda_cmd_set_file_server_flag },
+    { CUDA_SET_POWER_MESSAGES, "SET_POWER_MESSAGES",
+      cuda_cmd_set_power_message },
 };
 
 static void cuda_receive_packet(CUDAState *s,
@@ -695,9 +711,6 @@ static void cuda_receive_packet(CUDAState *s,
         obuf[6] = ti;
         cuda_send_packet_to_host(s, obuf, 7);
         return;
-    case CUDA_SET_POWER_MESSAGES:
-        cuda_send_packet_to_host(s, obuf, 3);
-        return;
     case CUDA_COMBINED_FORMAT_IIC:
         obuf[0] = ERROR_PACKET;
         obuf[1] = 0x5;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH v2 10/13] cuda: port GET_TIME command to new framework
  2016-02-07 20:34 [Qemu-devel] [PATCH v2 00/13] cuda: misc fixes and cleanups Hervé Poussineau
                   ` (8 preceding siblings ...)
  2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 09/13] cuda: port SET_POWER_MESSAGES " Hervé Poussineau
@ 2016-02-07 20:34 ` Hervé Poussineau
  2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 11/13] cuda: port SET_TIME " Hervé Poussineau
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Hervé Poussineau @ 2016-02-07 20:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, Alyssa Milburn, Mark Cave-Ayland, Alexander Graf,
	Hervé Poussineau

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/misc/macio/cuda.c | 29 +++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index 16f9ad6..8ee1414 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -654,6 +654,26 @@ static bool cuda_cmd_set_power_message(CUDAState *s,
     return true;
 }
 
+static bool cuda_cmd_get_time(CUDAState *s,
+                              const uint8_t *in_data, int in_len,
+                              uint8_t *out_data, int *out_len)
+{
+    uint32_t ti;
+
+    if (in_len != 0) {
+        return false;
+    }
+
+    ti = s->tick_offset + (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL)
+                           / get_ticks_per_sec());
+    out_data[0] = ti >> 24;
+    out_data[1] = ti >> 16;
+    out_data[2] = ti >> 8;
+    out_data[3] = ti;
+    *out_len = 4;
+    return true;
+}
+
 static const CudaCommand handlers[] = {
     { CUDA_AUTOPOLL, "AUTOPOLL", cuda_cmd_autopoll },
     { CUDA_SET_AUTO_RATE, "SET_AUTO_RATE",  cuda_cmd_set_autorate },
@@ -664,6 +684,7 @@ static const CudaCommand handlers[] = {
       cuda_cmd_set_file_server_flag },
     { CUDA_SET_POWER_MESSAGES, "SET_POWER_MESSAGES",
       cuda_cmd_set_power_message },
+    { CUDA_GET_TIME, "GET_TIME", cuda_cmd_get_time },
 };
 
 static void cuda_receive_packet(CUDAState *s,
@@ -703,14 +724,6 @@ static void cuda_receive_packet(CUDAState *s,
         s->tick_offset = ti - (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) / get_ticks_per_sec());
         cuda_send_packet_to_host(s, obuf, 3);
         return;
-    case CUDA_GET_TIME:
-        ti = s->tick_offset + (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) / get_ticks_per_sec());
-        obuf[3] = ti >> 24;
-        obuf[4] = ti >> 16;
-        obuf[5] = ti >> 8;
-        obuf[6] = ti;
-        cuda_send_packet_to_host(s, obuf, 7);
-        return;
     case CUDA_COMBINED_FORMAT_IIC:
         obuf[0] = ERROR_PACKET;
         obuf[1] = 0x5;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH v2 11/13] cuda: port SET_TIME command to new framework
  2016-02-07 20:34 [Qemu-devel] [PATCH v2 00/13] cuda: misc fixes and cleanups Hervé Poussineau
                   ` (9 preceding siblings ...)
  2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 10/13] cuda: port GET_TIME " Hervé Poussineau
@ 2016-02-07 20:34 ` Hervé Poussineau
  2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 12/13] cuda: remove GET_6805_ADDR command Hervé Poussineau
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Hervé Poussineau @ 2016-02-07 20:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, Alyssa Milburn, Mark Cave-Ayland, Alexander Graf,
	Hervé Poussineau

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/misc/macio/cuda.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index 8ee1414..611b414 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -674,6 +674,23 @@ static bool cuda_cmd_get_time(CUDAState *s,
     return true;
 }
 
+static bool cuda_cmd_set_time(CUDAState *s,
+                              const uint8_t *in_data, int in_len,
+                              uint8_t *out_data, int *out_len)
+{
+    uint32_t ti;
+
+    if (in_len != 4) {
+        return false;
+    }
+
+    ti = (((uint32_t)in_data[1]) << 24) + (((uint32_t)in_data[2]) << 16)
+         + (((uint32_t)in_data[3]) << 8) + in_data[4];
+    s->tick_offset = ti - (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL)
+                           / get_ticks_per_sec());
+    return true;
+}
+
 static const CudaCommand handlers[] = {
     { CUDA_AUTOPOLL, "AUTOPOLL", cuda_cmd_autopoll },
     { CUDA_SET_AUTO_RATE, "SET_AUTO_RATE",  cuda_cmd_set_autorate },
@@ -685,6 +702,7 @@ static const CudaCommand handlers[] = {
     { CUDA_SET_POWER_MESSAGES, "SET_POWER_MESSAGES",
       cuda_cmd_set_power_message },
     { CUDA_GET_TIME, "GET_TIME", cuda_cmd_get_time },
+    { CUDA_SET_TIME, "SET_TIME", cuda_cmd_set_time },
 };
 
 static void cuda_receive_packet(CUDAState *s,
@@ -692,7 +710,6 @@ static void cuda_receive_packet(CUDAState *s,
 {
     uint8_t obuf[16] = { CUDA_PACKET, 0, data[0] };
     int i, out_len = 0;
-    uint32_t ti;
 
     for (i = 0; i < ARRAY_SIZE(handlers); i++) {
         const CudaCommand *desc = &handlers[i];
@@ -719,11 +736,6 @@ static void cuda_receive_packet(CUDAState *s,
     case CUDA_GET_6805_ADDR:
         cuda_send_packet_to_host(s, obuf, 3);
         return;
-    case CUDA_SET_TIME:
-        ti = (((uint32_t)data[1]) << 24) + (((uint32_t)data[2]) << 16) + (((uint32_t)data[3]) << 8) + data[4];
-        s->tick_offset = ti - (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) / get_ticks_per_sec());
-        cuda_send_packet_to_host(s, obuf, 3);
-        return;
     case CUDA_COMBINED_FORMAT_IIC:
         obuf[0] = ERROR_PACKET;
         obuf[1] = 0x5;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH v2 12/13] cuda: remove GET_6805_ADDR command
  2016-02-07 20:34 [Qemu-devel] [PATCH v2 00/13] cuda: misc fixes and cleanups Hervé Poussineau
                   ` (10 preceding siblings ...)
  2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 11/13] cuda: port SET_TIME " Hervé Poussineau
@ 2016-02-07 20:34 ` Hervé Poussineau
  2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 13/13] cuda: remove CUDA_GET_SET_IIC/CUDA_COMBINED_FORMAT_IIC commands Hervé Poussineau
  2016-02-14 19:01 ` [Qemu-devel] [PATCH v2 00/13] cuda: misc fixes and cleanups Mark Cave-Ayland
  13 siblings, 0 replies; 17+ messages in thread
From: Hervé Poussineau @ 2016-02-07 20:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, Alyssa Milburn, Mark Cave-Ayland, Alexander Graf,
	Hervé Poussineau

It doesn't seem to be used, and operating systems should accept a 'unknown command' answer.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/misc/macio/cuda.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index 611b414..d65a36a 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -733,9 +733,6 @@ static void cuda_receive_packet(CUDAState *s,
     }
 
     switch(data[0]) {
-    case CUDA_GET_6805_ADDR:
-        cuda_send_packet_to_host(s, obuf, 3);
-        return;
     case CUDA_COMBINED_FORMAT_IIC:
         obuf[0] = ERROR_PACKET;
         obuf[1] = 0x5;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH v2 13/13] cuda: remove CUDA_GET_SET_IIC/CUDA_COMBINED_FORMAT_IIC commands
  2016-02-07 20:34 [Qemu-devel] [PATCH v2 00/13] cuda: misc fixes and cleanups Hervé Poussineau
                   ` (11 preceding siblings ...)
  2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 12/13] cuda: remove GET_6805_ADDR command Hervé Poussineau
@ 2016-02-07 20:34 ` Hervé Poussineau
  2016-02-14 19:01 ` [Qemu-devel] [PATCH v2 00/13] cuda: misc fixes and cleanups Mark Cave-Ayland
  13 siblings, 0 replies; 17+ messages in thread
From: Hervé Poussineau @ 2016-02-07 20:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-ppc, Alyssa Milburn, Mark Cave-Ayland, Alexander Graf,
	Hervé Poussineau

We currently don't emulate the I2C bus provided by CUDA.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/misc/macio/cuda.c | 23 -----------------------
 1 file changed, 23 deletions(-)

diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index d65a36a..481abdb 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -732,29 +732,6 @@ static void cuda_receive_packet(CUDAState *s,
         }
     }
 
-    switch(data[0]) {
-    case CUDA_COMBINED_FORMAT_IIC:
-        obuf[0] = ERROR_PACKET;
-        obuf[1] = 0x5;
-        obuf[2] = CUDA_PACKET;
-        obuf[3] = data[0];
-        cuda_send_packet_to_host(s, obuf, 4);
-        return;
-    case CUDA_GET_SET_IIC:
-        if (len == 4) {
-            cuda_send_packet_to_host(s, obuf, 3);
-        } else {
-            obuf[0] = ERROR_PACKET;
-            obuf[1] = 0x2;
-            obuf[2] = CUDA_PACKET;
-            obuf[3] = data[0];
-            cuda_send_packet_to_host(s, obuf, 4);
-        }
-        return;
-    default:
-        break;
-    }
-
     qemu_log_mask(LOG_GUEST_ERROR, "CUDA: unknown command 0x%02x\n", data[0]);
     obuf[0] = ERROR_PACKET;
     obuf[1] = 0x2; /* unknown command */
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PATCH v2 00/13] cuda: misc fixes and cleanups
  2016-02-07 20:34 [Qemu-devel] [PATCH v2 00/13] cuda: misc fixes and cleanups Hervé Poussineau
                   ` (12 preceding siblings ...)
  2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 13/13] cuda: remove CUDA_GET_SET_IIC/CUDA_COMBINED_FORMAT_IIC commands Hervé Poussineau
@ 2016-02-14 19:01 ` Mark Cave-Ayland
  2016-02-14 20:07   ` Hervé Poussineau
  2016-02-15  0:25   ` David Gibson
  13 siblings, 2 replies; 17+ messages in thread
From: Mark Cave-Ayland @ 2016-02-14 19:01 UTC (permalink / raw)
  To: Hervé Poussineau, qemu-devel
  Cc: Alyssa Milburn, qemu-ppc, Alexander Graf, David Gibson

On 07/02/16 20:34, Hervé Poussineau wrote:

> Hi,
> 
> This patchset cleans up a little bit the Apple CUDA emulation:
> - correctly reject commands with wrong parameters
> - support changing the frequency of auto-polling
> - support changing device list probed in auto-poll
> - add logs when using FILE_SERVER_FLAG/SET_POWER_MESSAGE
> - remove unused commands (GET/SET_6805_ADDR)
> - remove unimplemented GET_SET_IIC/COMBINED_FORMAT_IIC
> 
> GET_SET_IIC/COMBINED_FORMAT_IIC commands should be added again once
> we implement the I2C bus provided by CUDA.
> 
> Hervé
> 
> Hervé Poussineau (13):
>   cuda: add a framework to handle commands
>   cuda: move unknown commands reject out of switch
>   cuda: port AUTOPOLL command to new framework
>   cuda: port SET_AUTO_RATE command to new framework
>   cuda: port SET_DEVICE_LIST command to new framework
>   cuda: port POWERDOWN command to new framework
>   cuda: port RESET_SYSTEM command to new framework
>   cuda: port FILE_SERVER_FLAG command to new framework
>   cuda: port SET_POWER_MESSAGES command to new framework
>   cuda: port GET_TIME command to new framework
>   cuda: port SET_TIME command to new framework
>   cuda: remove GET_6805_ADDR command
>   cuda: remove CUDA_GET_SET_IIC/CUDA_COMBINED_FORMAT_IIC commands
> 
>  hw/input/adb.c         |  18 ++--
>  hw/misc/macio/cuda.c   | 279 ++++++++++++++++++++++++++++++++++++-------------
>  hw/ppc/mac.h           |   2 +
>  include/hw/input/adb.h |   2 +-
>  4 files changed, 217 insertions(+), 84 deletions(-)

Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

This looks good to me, and again passes all my local tests. The only
thing I noticed was that there were no changes related to
qemu_log_mask() as per David's comments on patch 2 but other than that I
think this patchset is fine to merge for 2.6.


ATB,

Mark.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PATCH v2 00/13] cuda: misc fixes and cleanups
  2016-02-14 19:01 ` [Qemu-devel] [PATCH v2 00/13] cuda: misc fixes and cleanups Mark Cave-Ayland
@ 2016-02-14 20:07   ` Hervé Poussineau
  2016-02-15  0:25   ` David Gibson
  1 sibling, 0 replies; 17+ messages in thread
From: Hervé Poussineau @ 2016-02-14 20:07 UTC (permalink / raw)
  To: Mark Cave-Ayland, qemu-devel
  Cc: Alyssa Milburn, qemu-ppc, Alexander Graf, David Gibson

Le 14/02/2016 20:01, Mark Cave-Ayland a écrit :
> On 07/02/16 20:34, Hervé Poussineau wrote:
>
>> Hi,
>>
>> This patchset cleans up a little bit the Apple CUDA emulation:
>> - correctly reject commands with wrong parameters
>> - support changing the frequency of auto-polling
>> - support changing device list probed in auto-poll
>> - add logs when using FILE_SERVER_FLAG/SET_POWER_MESSAGE
>> - remove unused commands (GET/SET_6805_ADDR)
>> - remove unimplemented GET_SET_IIC/COMBINED_FORMAT_IIC
>>
>> GET_SET_IIC/COMBINED_FORMAT_IIC commands should be added again once
>> we implement the I2C bus provided by CUDA.
>>
>> Hervé
>>
>> Hervé Poussineau (13):
>>    cuda: add a framework to handle commands
>>    cuda: move unknown commands reject out of switch
>>    cuda: port AUTOPOLL command to new framework
>>    cuda: port SET_AUTO_RATE command to new framework
>>    cuda: port SET_DEVICE_LIST command to new framework
>>    cuda: port POWERDOWN command to new framework
>>    cuda: port RESET_SYSTEM command to new framework
>>    cuda: port FILE_SERVER_FLAG command to new framework
>>    cuda: port SET_POWER_MESSAGES command to new framework
>>    cuda: port GET_TIME command to new framework
>>    cuda: port SET_TIME command to new framework
>>    cuda: remove GET_6805_ADDR command
>>    cuda: remove CUDA_GET_SET_IIC/CUDA_COMBINED_FORMAT_IIC commands
>>
>>   hw/input/adb.c         |  18 ++--
>>   hw/misc/macio/cuda.c   | 279 ++++++++++++++++++++++++++++++++++++-------------
>>   hw/ppc/mac.h           |   2 +
>>   include/hw/input/adb.h |   2 +-
>>   4 files changed, 217 insertions(+), 84 deletions(-)
>
> Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>
> This looks good to me, and again passes all my local tests. The only
> thing I noticed was that there were no changes related to
> qemu_log_mask() as per David's comments on patch 2 but other than that I
> think this patchset is fine to merge for 2.6.

qemu_log_mask() doesn't represent the same thing than trace events, even if they can go to the same output file.
I always run QEMU with -d guest_errors,unimp to see if something wrong happens on guest side.
I have no knowledge of all traces in all devices, to know which ones are important at first run.
However, if I want to detail one device behaviour, I can enable specific traces for this device.

Note also that new qemu_log_mask() calls are added, like in cc28296d82ce179e81ee6d0b9cfb7f6a79ffc1c6

Hervé

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PATCH v2 00/13] cuda: misc fixes and cleanups
  2016-02-14 19:01 ` [Qemu-devel] [PATCH v2 00/13] cuda: misc fixes and cleanups Mark Cave-Ayland
  2016-02-14 20:07   ` Hervé Poussineau
@ 2016-02-15  0:25   ` David Gibson
  1 sibling, 0 replies; 17+ messages in thread
From: David Gibson @ 2016-02-15  0:25 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: qemu-ppc, Alyssa Milburn, Hervé Poussineau, qemu-devel,
	Alexander Graf

[-- Attachment #1: Type: text/plain, Size: 2285 bytes --]

On Sun, Feb 14, 2016 at 07:01:48PM +0000, Mark Cave-Ayland wrote:
> On 07/02/16 20:34, Hervé Poussineau wrote:
> 
> > Hi,
> > 
> > This patchset cleans up a little bit the Apple CUDA emulation:
> > - correctly reject commands with wrong parameters
> > - support changing the frequency of auto-polling
> > - support changing device list probed in auto-poll
> > - add logs when using FILE_SERVER_FLAG/SET_POWER_MESSAGE
> > - remove unused commands (GET/SET_6805_ADDR)
> > - remove unimplemented GET_SET_IIC/COMBINED_FORMAT_IIC
> > 
> > GET_SET_IIC/COMBINED_FORMAT_IIC commands should be added again once
> > we implement the I2C bus provided by CUDA.
> > 
> > Hervé
> > 
> > Hervé Poussineau (13):
> >   cuda: add a framework to handle commands
> >   cuda: move unknown commands reject out of switch
> >   cuda: port AUTOPOLL command to new framework
> >   cuda: port SET_AUTO_RATE command to new framework
> >   cuda: port SET_DEVICE_LIST command to new framework
> >   cuda: port POWERDOWN command to new framework
> >   cuda: port RESET_SYSTEM command to new framework
> >   cuda: port FILE_SERVER_FLAG command to new framework
> >   cuda: port SET_POWER_MESSAGES command to new framework
> >   cuda: port GET_TIME command to new framework
> >   cuda: port SET_TIME command to new framework
> >   cuda: remove GET_6805_ADDR command
> >   cuda: remove CUDA_GET_SET_IIC/CUDA_COMBINED_FORMAT_IIC commands
> > 
> >  hw/input/adb.c         |  18 ++--
> >  hw/misc/macio/cuda.c   | 279 ++++++++++++++++++++++++++++++++++++-------------
> >  hw/ppc/mac.h           |   2 +
> >  include/hw/input/adb.h |   2 +-
> >  4 files changed, 217 insertions(+), 84 deletions(-)
> 
> Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> 
> This looks good to me, and again passes all my local tests. The only
> thing I noticed was that there were no changes related to
> qemu_log_mask() as per David's comments on patch 2 but other than that I
> think this patchset is fine to merge for 2.6.

Thanks for this, I've merged the series to ppc-for-2.6.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2016-02-15  0:36 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-07 20:34 [Qemu-devel] [PATCH v2 00/13] cuda: misc fixes and cleanups Hervé Poussineau
2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 01/13] cuda: add a framework to handle commands Hervé Poussineau
2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 02/13] cuda: move unknown commands reject out of switch Hervé Poussineau
2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 03/13] cuda: port AUTOPOLL command to new framework Hervé Poussineau
2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 04/13] cuda: port SET_AUTO_RATE " Hervé Poussineau
2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 05/13] cuda: port SET_DEVICE_LIST " Hervé Poussineau
2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 06/13] cuda: port POWERDOWN " Hervé Poussineau
2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 07/13] cuda: port RESET_SYSTEM " Hervé Poussineau
2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 08/13] cuda: port FILE_SERVER_FLAG " Hervé Poussineau
2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 09/13] cuda: port SET_POWER_MESSAGES " Hervé Poussineau
2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 10/13] cuda: port GET_TIME " Hervé Poussineau
2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 11/13] cuda: port SET_TIME " Hervé Poussineau
2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 12/13] cuda: remove GET_6805_ADDR command Hervé Poussineau
2016-02-07 20:34 ` [Qemu-devel] [PATCH v2 13/13] cuda: remove CUDA_GET_SET_IIC/CUDA_COMBINED_FORMAT_IIC commands Hervé Poussineau
2016-02-14 19:01 ` [Qemu-devel] [PATCH v2 00/13] cuda: misc fixes and cleanups Mark Cave-Ayland
2016-02-14 20:07   ` Hervé Poussineau
2016-02-15  0:25   ` David Gibson

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).