[SerialICE] New patch to review for serialice: 58a6103 SerialICE: Add serialice-com.c to build
Kyösti Mälkki (kyosti.malkki@gmail.com)
gerrit at coreboot.org
Sun May 6 19:16:50 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/1012
-gerrit
commit 58a61035a9adfcfefd2e433c64ceb24f06543715
Author: Kyösti Mälkki <kyosti.malkki at gmail.com>
Date: Sun May 6 16:01:43 2012 +0300
SerialICE: Add serialice-com.c to build
Use memory load/store handlers from the new file and drop their
copies from serialice.c.
Change-Id: I67822a070757bb8ec514369031872ed0400f4e3d
Signed-off-by: Kyösti Mälkki <kyosti.malkki at gmail.com>
---
qemu-0.15.x/Makefile | 2 +
qemu-0.15.x/Makefile.target | 2 +-
qemu-0.15.x/serialice.c | 82 +-----------------------------------------
qemu-0.15.x/serialice.h | 20 ++++++----
4 files changed, 17 insertions(+), 89 deletions(-)
diff --git a/qemu-0.15.x/Makefile b/qemu-0.15.x/Makefile
index 076b0ec..0778994 100644
--- a/qemu-0.15.x/Makefile
+++ b/qemu-0.15.x/Makefile
@@ -121,9 +121,11 @@ version.o: $(SRC_PATH)/version.rc config-host.mak
ifdef CONFIG_SERIALICE
serialice.o: serialice.c serialice.h
+serialice-com.o: serialice-com.c serialice.h
endif
serialice.o: QEMU_CFLAGS += $(SERIALICE_CFLAGS)
+serialice-com.o: QEMU_CFLAGS += $(SERIALICE_CFLAGS)
version-obj-$(CONFIG_WIN32) += version.o
######################################################################
diff --git a/qemu-0.15.x/Makefile.target b/qemu-0.15.x/Makefile.target
index 22c8ff1..9ae7a03 100644
--- a/qemu-0.15.x/Makefile.target
+++ b/qemu-0.15.x/Makefile.target
@@ -226,7 +226,7 @@ ifdef CONFIG_SERIALICE
QEMU_CFLAGS += $(SERIALICE_CFLAGS)
LIBS+=-lm
endif
-obj-$(CONFIG_SERIALICE) += serialice.o
+obj-$(CONFIG_SERIALICE) += serialice.o serialice-com.o
# Hardware support
obj-i386-y += vga.o
diff --git a/qemu-0.15.x/serialice.c b/qemu-0.15.x/serialice.c
index a91f9c6..ca34991 100644
--- a/qemu-0.15.x/serialice.c
+++ b/qemu-0.15.x/serialice.c
@@ -76,7 +76,7 @@ typedef struct {
char *command;
} SerialICEState;
-static SerialICEState *s;
+SerialICEState *s;
int serialice_active = 0;
const char *serialice_lua_script = "serialice.lua";
@@ -636,7 +636,7 @@ static int serialice_wait_prompt(void)
return 0;
}
-static void serialice_command(const char *command, int reply_len)
+void serialice_command(const char *command, int reply_len)
{
#if SERIALICE_DEBUG > 5
int i;
@@ -827,53 +827,6 @@ void serialice_outl(uint32_t data, uint16_t port)
serialice_log(LOG_WRITE | LOG_IO, data, port, 4);
}
-uint8_t serialice_readb(uint32_t addr)
-{
- uint8_t ret;
- sprintf(s->command, "*rm%08x.b", addr);
- // command read back: "\n00" (3 characters)
- serialice_command(s->command, 3);
- ret = (uint8_t) strtoul(s->buffer + 1, (char **)NULL, 16);
- return ret;
-}
-
-uint16_t serialice_readw(uint32_t addr)
-{
- uint16_t ret;
- sprintf(s->command, "*rm%08x.w", addr);
- // command read back: "\n0000" (5 characters)
- serialice_command(s->command, 5);
- ret = (uint16_t) strtoul(s->buffer + 1, (char **)NULL, 16);
- return ret;
-}
-
-uint32_t serialice_readl(uint32_t addr)
-{
- uint32_t ret;
- sprintf(s->command, "*rm%08x.l", addr);
- // command read back: "\n00000000" (9 characters)
- serialice_command(s->command, 9);
- ret = (uint32_t) strtoul(s->buffer + 1, (char **)NULL, 16);
- return ret;
-}
-
-void serialice_writeb(uint8_t data, uint32_t addr)
-{
- sprintf(s->command, "*wm%08x.b=%02x", addr, data);
- serialice_command(s->command, 0);
-}
-
-void serialice_writew(uint16_t data, uint32_t addr)
-{
- sprintf(s->command, "*wm%08x.w=%04x", addr, data);
- serialice_command(s->command, 0);
-}
-
-void serialice_writel(uint32_t data, uint32_t addr)
-{
- sprintf(s->command, "*wm%08x.l=%08x", addr, data);
- serialice_command(s->command, 0);
-}
uint64_t serialice_rdmsr(uint32_t addr, uint32_t key)
{
@@ -954,20 +907,6 @@ cpuid_regs_t serialice_cpuid(uint32_t eax, uint32_t ecx)
// **************************************************************************
// memory load handling
-static uint32_t serialice_load_wrapper(uint32_t addr, unsigned int size)
-{
- switch (size) {
- case 1:
- return (uint32_t) serialice_readb(addr);
- case 2:
- return (uint32_t) serialice_readw(addr);
- case 4:
- return (uint32_t) serialice_readl(addr);
- default:
- printf("WARNING: unknown read access size %d @%08x\n", size, addr);
- }
- return 0;
-}
/**
* This function is called by the softmmu engine to update the status
@@ -1012,23 +951,6 @@ int serialice_handle_load(uint32_t addr, uint32_t * result,
// **************************************************************************
// memory store handling
-static void serialice_store_wrapper(uint32_t addr, unsigned int size,
- uint32_t data)
-{
- switch (size) {
- case 1:
- serialice_writeb((uint8_t) data, addr);
- break;
- case 2:
- serialice_writew((uint16_t) data, addr);
- break;
- case 4:
- serialice_writel((uint32_t) data, addr);
- break;
- default:
- printf("WARNING: unknown write access size %d @%08x\n", size, addr);
- }
-}
static void serialice_log_store(int caught, uint32_t addr, uint32_t val,
unsigned int data_size)
diff --git a/qemu-0.15.x/serialice.h b/qemu-0.15.x/serialice.h
index a651618..64ae5c5 100644
--- a/qemu-0.15.x/serialice.h
+++ b/qemu-0.15.x/serialice.h
@@ -38,6 +38,7 @@ extern int serialice_active;
void serialice_init(void);
void serialice_exit(void);
const char *serialice_lua_execute(const char *cmd);
+void serialice_command(const char *command, int reply_len);
uint8_t serialice_inb(uint16_t port);
uint16_t serialice_inw(uint16_t port);
@@ -47,14 +48,6 @@ void serialice_outb(uint8_t data, uint16_t port);
void serialice_outw(uint16_t data, uint16_t port);
void serialice_outl(uint32_t data, uint16_t port);
-uint8_t serialice_readb(uint32_t addr);
-uint16_t serialice_readw(uint32_t addr);
-uint32_t serialice_readl(uint32_t addr);
-
-void serialice_writeb(uint8_t data, uint32_t addr);
-void serialice_writew(uint16_t data, uint32_t addr);
-void serialice_writel(uint32_t data, uint32_t addr);
-
uint64_t serialice_rdmsr(uint32_t addr, uint32_t key);
void serialice_wrmsr(uint64_t data, uint32_t addr, uint32_t key);
@@ -70,4 +63,15 @@ void serialice_log_load(int caught, uint32_t addr, uint32_t result,
unsigned int data_size);
int serialice_handle_store(uint32_t addr, uint32_t val, unsigned int data_size);
+/* serialice protocol */
+uint32_t serialice_io_read_wrapper(uint16_t port, unsigned int size);
+void serialice_io_write_wrapper(uint16_t port, unsigned int size, uint32_t data);
+
+uint32_t serialice_load_wrapper(uint32_t addr, unsigned int size);
+void serialice_store_wrapper(uint32_t addr, unsigned int size, uint32_t data);
+
+void serialice_rdmsr_wrapper(uint32_t addr, uint32_t key, uint32_t *hi, uint32_t *lo);
+void serialice_wrmsr_wrapper(uint32_t addr, uint32_t key, uint32_t hi, uint32_t lo);
+void serialice_cpuid_wrapper(uint32_t eax, uint32_t ecx, cpuid_regs_t * ret);
+
#endif
More information about the SerialICE
mailing list