From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KNSkm-0007WG-6m for qemu-devel@nongnu.org; Mon, 28 Jul 2008 09:27:08 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KNSkk-0007VX-2V for qemu-devel@nongnu.org; Mon, 28 Jul 2008 09:27:07 -0400 Received: from [199.232.76.173] (port=38727 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KNSkj-0007VS-Fh for qemu-devel@nongnu.org; Mon, 28 Jul 2008 09:27:05 -0400 Received: from mx1.redhat.com ([66.187.233.31]:52532) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KNSki-0001nN-58 for qemu-devel@nongnu.org; Mon, 28 Jul 2008 09:27:05 -0400 Message-ID: <488DC8C3.4030803@redhat.com> Date: Mon, 28 Jul 2008 15:25:23 +0200 From: Chris Lalancette MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------000305070202020800070708" Subject: [Qemu-devel] [PATCH 3/3]: Plumb qemu_uuid through to the VMware back door Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: gleb@qumranet.com This is a multi-part message in MIME format. --------------000305070202020800070708 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit This patch finishes plumbing qemu_uuid through the VMware back door so that the Bochs BIOS can actually fetch the information to put in the SMBIOS tables. Signed-off-by: Chris Lalancette Cc: Gleb Natapov Cc: Anthony Liguori --------------000305070202020800070708 Content-Type: text/x-patch; name="qemu-dmi-uuid-3.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="qemu-dmi-uuid-3.patch" diff -urp qemu.patch2/hw/vmport.c qemu.patch3/hw/vmport.c --- qemu.patch2/hw/vmport.c 2008-07-28 14:16:54.000000000 +0200 +++ qemu.patch3/hw/vmport.c 2008-07-28 14:20:12.000000000 +0200 @@ -26,8 +26,17 @@ #include "pc.h" #include "sysemu.h" +#ifdef CONFIG_UUID +#include +uuid_t vmport_uuid; +extern char *qemu_uuid; +#else +const unsigned char vmport_uuid[16] = { 0 }; +#endif + #define VMPORT_CMD_GETVERSION 0x0a #define VMPORT_CMD_GETRAMSIZE 0x14 +#define VMPORT_CMD_GETBIOSUUID 0x13 #define VMPORT_ENTRIES 0x2c #define VMPORT_MAGIC 0x564D5868 @@ -93,6 +102,26 @@ static uint32_t vmport_cmd_ram_size(void return ram_size; } +static inline uint32_t uuid2reg(const unsigned char *uuid, uint32_t idx) +{ + int i; + uint32_t reg = 0; + + for (i = 0; i < 4; i++) + reg |= (uuid[(idx*4) + i] << (i*8)); + + return reg; +} + +static uint32_t vmport_cmd_bios_uuid(void *opaque, uint32_t addr) +{ + CPUState *env = cpu_single_env; + env->regs[R_EBX] = uuid2reg(vmport_uuid, 1); + env->regs[R_ECX] = uuid2reg(vmport_uuid, 2); + env->regs[R_EDX] = uuid2reg(vmport_uuid, 3); + return uuid2reg(vmport_uuid, 0); +} + void vmport_init(void) { register_ioport_read(0x5658, 1, 4, vmport_ioport_read, &port_state); @@ -101,4 +130,14 @@ void vmport_init(void) /* Register some generic port commands */ vmport_register(VMPORT_CMD_GETVERSION, vmport_cmd_get_version, NULL); vmport_register(VMPORT_CMD_GETRAMSIZE, vmport_cmd_ram_size, NULL); + vmport_register(VMPORT_CMD_GETBIOSUUID, vmport_cmd_bios_uuid, NULL); + +#ifdef CONFIG_UUID + if (qemu_uuid != NULL) { + if (uuid_parse(qemu_uuid, vmport_uuid) != 0) { + /* failed UUID parse; print a warning, but go on */ + fprintf(stderr, "Failed parsing UUID\n"); + } + } +#endif } --------------000305070202020800070708--