Kyösti Mälkki (kyosti.malkki@gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1467
-gerrit
commit 5433e1648148ef7504b2efee523288fb1f06c10b Author: Kyösti Mälkki kyosti.malkki@gmail.com Date: Sun Aug 19 23:38:01 2012 +0300
SerialICE: Split IO and memory logging
Use of the flags parameter looked ugly and obscure to me.
Change-Id: I9f79e2bd7e738862be2ff67b925d3ecf549b4d03 Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- qemu-0.15.x/serialice-lua.c | 29 +++++++++++++++++++++++++++-- qemu-0.15.x/serialice.c | 18 ++++-------------- qemu-0.15.x/serialice.h | 14 ++++---------- 3 files changed, 35 insertions(+), 26 deletions(-)
diff --git a/qemu-0.15.x/serialice-lua.c b/qemu-0.15.x/serialice-lua.c index ba6e01e..638f1d3 100644 --- a/qemu-0.15.x/serialice-lua.c +++ b/qemu-0.15.x/serialice-lua.c @@ -41,6 +41,10 @@ #include "serialice.h" #include "sysemu.h"
+#define LOG_IO 1 +#define LOG_MEMORY 2 +#define LOG_TARGET 4 + static lua_State *L;
extern const char *serialice_mainboard; @@ -436,7 +440,7 @@ int serialice_cpuid_filter(uint32_t eax, uint32_t ecx,
/* SerialICE output loggers */
-void serialice_read_log(int flags, uint32_t data, uint32_t addr, int size) +static void __read_log(int flags, uint32_t data, uint32_t addr, int size) { int result;
@@ -459,7 +463,7 @@ void serialice_read_log(int flags, uint32_t data, uint32_t addr, int size) } }
-void serialice_write_log(int flags, uint32_t data, uint32_t addr, int size) +static void __write_log(int flags, uint32_t data, uint32_t addr, int size) { int result;
@@ -482,6 +486,27 @@ void serialice_write_log(int flags, uint32_t data, uint32_t addr, int size) } }
+void serialice_memory_read_log(int caught, uint32_t data, uint32_t addr, int size) +{ + __read_log(LOG_MEMORY | (caught ? LOG_TARGET : 0), data, addr, size); +} + +void serialice_memory_write_log(int caught, uint32_t data, uint32_t addr, int size) +{ + __write_log(LOG_MEMORY | (caught ? LOG_TARGET : 0), data, addr, size); +} + + +void serialice_io_read_log(int caught, uint32_t data, uint32_t addr, int size) +{ + __read_log(LOG_IO | (caught ? LOG_TARGET : 0), data, addr, size); +} + +void serialice_io_write_log(int caught, uint32_t data, uint32_t addr, int size) +{ + __write_log(LOG_IO | (caught ? LOG_TARGET : 0), data, addr, size); +} + void serialice_wrmsr_log(uint32_t addr, uint32_t hi, uint32_t lo, int filtered) { diff --git a/qemu-0.15.x/serialice.c b/qemu-0.15.x/serialice.c index 0e90a0d..74aa9ff 100644 --- a/qemu-0.15.x/serialice.c +++ b/qemu-0.15.x/serialice.c @@ -166,12 +166,7 @@ cpuid_regs_t serialice_cpuid(uint32_t eax, uint32_t ecx) void serialice_log_load(int caught, uint32_t addr, uint32_t result, unsigned int data_size) { - if (caught) { - serialice_read_log(LOG_MEMORY | LOG_TARGET, result, addr, - data_size); - } else { - serialice_read_log(LOG_MEMORY, result, addr, data_size); - } + serialice_memory_read_log(caught, result, addr, data_size); }
/* This function can grab Qemu load ops and forward them to the SerialICE @@ -205,12 +200,7 @@ int serialice_handle_load(uint32_t addr, uint32_t * result, static void serialice_log_store(int caught, uint32_t addr, uint32_t val, unsigned int data_size) { - if (caught) { - serialice_write_log(LOG_MEMORY | LOG_TARGET, val, addr, - data_size); - } else { - serialice_write_log(LOG_MEMORY, val, addr, data_size); - } + serialice_memory_write_log(caught, val, addr, data_size); }
/* This function can grab Qemu store ops and forward them to the SerialICE @@ -251,7 +241,7 @@ uint32_t serialice_io_read(uint16_t port, unsigned int size) }
data = mask_data(data, size); - serialice_read_log(LOG_IO, data, port, size); + serialice_io_read_log(0, data, port, size); return data; }
@@ -269,7 +259,7 @@ void serialice_io_write(uint16_t port, unsigned int size, uint32 data) serialice_io_write_wrapper(port, size, data); }
- serialice_write_log(LOG_IO, data, port, size); + serialice_io_write_log(0, data, port, size); }
// ************************************************************************** diff --git a/qemu-0.15.x/serialice.h b/qemu-0.15.x/serialice.h index c281981..4624deb 100644 --- a/qemu-0.15.x/serialice.h +++ b/qemu-0.15.x/serialice.h @@ -38,14 +38,6 @@ #define WRITE_TO_QEMU (1 << 0) #define WRITE_TO_SERIALICE (1 << 1)
-#define LOG_IO 0 -#define LOG_MEMORY 1 -#define LOG_READ 0 -#define LOG_WRITE 2 -// these two are separate -#define LOG_QEMU 4 -#define LOG_TARGET 8 - extern const char *serialice_device; extern int serialice_active;
@@ -96,8 +88,10 @@ int serialice_cpuid_filter(uint32_t eax, uint32_t ecx, cpuid_regs_t * regs); int serialice_rdmsr_filter(uint32_t addr, uint32_t * hi, uint32_t * lo); int serialice_wrmsr_filter(uint32_t addr, uint32_t * hi, uint32_t * lo);
-void serialice_read_log(int flags, uint32_t data, uint32_t addr, int size); -void serialice_write_log(int flags, uint32_t data, uint32_t addr, int size); +void serialice_io_read_log(int caught, uint32_t data, uint32_t addr, int size); +void serialice_io_write_log(int caught, uint32_t data, uint32_t addr, int size); +void serialice_memory_read_log(int caught, uint32_t data, uint32_t addr, int size); +void serialice_memory_write_log(int caught, uint32_t data, uint32_t addr, int size); void serialice_rdmsr_log(uint32_t addr, uint32_t hi, uint32_t lo, int filtered); void serialice_wrmsr_log(uint32_t addr, uint32_t hi, uint32_t lo, int filtered); void serialice_cpuid_log(uint32_t eax, uint32_t ecx, cpuid_regs_t res, int filtered);