Patrick Georgi (patrick@georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1064
-gerrit
commit 7ab505f6044619879f13c373987a953cdf93ecc7 Author: Patrick Georgi patrick@georgi-clan.de Date: Wed May 30 00:34:48 2012 +0200
Isolate SerialICE protocol for CPUID
Move the serial protocol handling to a separate function.
Change-Id: I1510a1e48026a30a2b76a2faf726af07191d346d Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com [pg: Reorganized Kyösti's patch set] Signed-off-by: Patrick Georgi patrick@georgi-clan.de --- qemu-0.15.x/serialice.c | 28 +++++++++++++--------------- 1 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/qemu-0.15.x/serialice.c b/qemu-0.15.x/serialice.c index 5f58e5d..59e01a6 100644 --- a/qemu-0.15.x/serialice.c +++ b/qemu-0.15.x/serialice.c @@ -905,29 +905,27 @@ void serialice_wrmsr(uint64_t data, uint32_t addr, uint32_t key) serialice_msr_log(LOG_WRITE, addr, hi, lo, filtered); }
-cpuid_regs_t serialice_cpuid(uint32_t eax, uint32_t ecx) +static void serialice_cpuid_wrapper(uint32_t eax, uint32_t ecx, cpuid_regs_t * ret) { - cpuid_regs_t ret; - int filtered; - - ret.eax = eax; - ret.ebx = 0; // either set by filter or by target - ret.ecx = ecx; - ret.edx = 0; // either set by filter or by target - sprintf(s->command, "*ci%08x.%08x", eax, ecx); - // command read back: "\n000006f2.00000000.00001234.12340324" // (36 characters) serialice_command(s->command, 36); - s->buffer[9] = 0; // . -> \0 s->buffer[18] = 0; // . -> \0 s->buffer[27] = 0; // . -> \0 - ret.eax = (uint32_t) strtoul(s->buffer + 1, (char **)NULL, 16); - ret.ebx = (uint32_t) strtoul(s->buffer + 10, (char **)NULL, 16); - ret.ecx = (uint32_t) strtoul(s->buffer + 19, (char **)NULL, 16); - ret.edx = (uint32_t) strtoul(s->buffer + 28, (char **)NULL, 16); + ret->eax = (uint32_t) strtoul(s->buffer + 1, (char **)NULL, 16); + ret->ebx = (uint32_t) strtoul(s->buffer + 10, (char **)NULL, 16); + ret->ecx = (uint32_t) strtoul(s->buffer + 19, (char **)NULL, 16); + ret->edx = (uint32_t) strtoul(s->buffer + 28, (char **)NULL, 16); +} + +cpuid_regs_t serialice_cpuid(uint32_t eax, uint32_t ecx) +{ + cpuid_regs_t ret; + int filtered; + + serialice_cpuid_wrapper(eax, ecx, &ret);
filtered = serialice_cpuid_filter(eax, ecx, &ret);