[SerialICE] New patch to review for serialice: 932d3eb Log filtered IO reads

Kyösti Mälkki (kyosti.malkki@gmail.com) gerrit at coreboot.org
Sun Apr 22 17:47:28 CEST 2012


Kyösti Mälkki (kyosti.malkki at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/919

-gerrit

commit 932d3eb861928b40e2950385f3ffdabe159c0c13
Author: Kyösti Mälkki <kyosti.malkki at gmail.com>
Date:   Sun Apr 22 16:26:38 2012 +0300

    Log filtered IO reads
    
    With inb/inw/inl instructions, read_log() was not called if
    the IO was filtered and did not reach the target HW.
    QEMU will still receive some input value, so log it.
    
    Change-Id: Iccf635938322177c88664e55ca9f36197fcfd92e
    Signed-off-by: Kyösti Mälkki <kyosti.malkki at gmail.com>
---
 qemu-0.15.x/serialice.c |   51 +++++++++++++++++++++++++++-------------------
 1 files changed, 30 insertions(+), 21 deletions(-)

diff --git a/qemu-0.15.x/serialice.c b/qemu-0.15.x/serialice.c
index 4ad082b..9963c7d 100644
--- a/qemu-0.15.x/serialice.c
+++ b/qemu-0.15.x/serialice.c
@@ -711,15 +711,18 @@ uint8_t serialice_inb(uint16_t port)
 {
     uint8_t ret;
     uint32_t data;
+    int filtered;
 
-    if (serialice_io_read_filter(&data, port, 1)) {
-        return data & 0xff;
-    }
+    filtered = serialice_io_read_filter(&data, port, 1);
 
-    sprintf(s->command, "*ri%04x.b", port);
-    // command read back: "\n00" (3 characters)
-    serialice_command(s->command, 3);
-    ret = (uint8_t) strtoul(s->buffer + 1, (char **)NULL, 16);
+    if (filtered) {
+        ret = data & 0xff;
+    } else {
+        sprintf(s->command, "*ri%04x.b", port);
+        // command read back: "\n00" (3 characters)
+        serialice_command(s->command, 3);
+        ret = (uint8_t) strtoul(s->buffer + 1, (char **)NULL, 16);
+    }
 
     serialice_log(LOG_READ | LOG_IO, ret, port, 1);
 
@@ -730,15 +733,18 @@ uint16_t serialice_inw(uint16_t port)
 {
     uint16_t ret;
     uint32_t data;
+    int filtered;
 
-    if (serialice_io_read_filter(&data, port, 2)) {
-        return data & 0xffff;
-    }
+    filtered = serialice_io_read_filter(&data, port, 2);
 
-    sprintf(s->command, "*ri%04x.w", port);
-    // command read back: "\n0000" (5 characters)
-    serialice_command(s->command, 5);
-    ret = (uint16_t) strtoul(s->buffer + 1, (char **)NULL, 16);
+    if (filtered) {
+        ret = data & 0xffff;
+    } else {
+        sprintf(s->command, "*ri%04x.w", port);
+        // command read back: "\n0000" (5 characters)
+        serialice_command(s->command, 5);
+        ret = (uint16_t) strtoul(s->buffer + 1, (char **)NULL, 16);
+    }
 
     serialice_log(LOG_READ | LOG_IO, ret, port, 2);
 
@@ -749,15 +755,18 @@ uint32_t serialice_inl(uint16_t port)
 {
     uint32_t ret;
     uint32_t data;
+    int filtered;
 
-    if (serialice_io_read_filter(&data, port, 4)) {
-        return data;
-    }
+    filtered = serialice_io_read_filter(&data, port, 4);
 
-    sprintf(s->command, "*ri%04x.l", port);
-    // command read back: "\n00000000" (9 characters)
-    serialice_command(s->command, 9);
-    ret = (uint32_t) strtoul(s->buffer + 1, (char **)NULL, 16);
+    if (filtered) {
+        ret = data;
+    } else {
+        sprintf(s->command, "*ri%04x.l", port);
+        // command read back: "\n00000000" (9 characters)
+        serialice_command(s->command, 9);
+        ret = (uint32_t) strtoul(s->buffer + 1, (char **)NULL, 16);
+    }
 
     serialice_log(LOG_READ | LOG_IO, ret, port, 4);
 



More information about the SerialICE mailing list