From patchwork Mon Nov 23 12:03:18 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 39047 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 40A11B6F05 for ; Mon, 23 Nov 2009 23:07:25 +1100 (EST) Received: from localhost ([127.0.0.1]:38974 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NCXhS-0006Dp-2q for incoming@patchwork.ozlabs.org; Mon, 23 Nov 2009 07:07:22 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NCXdh-0005H4-UP for qemu-devel@nongnu.org; Mon, 23 Nov 2009 07:03:30 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NCXdd-0005GF-0g for qemu-devel@nongnu.org; Mon, 23 Nov 2009 07:03:29 -0500 Received: from [199.232.76.173] (port=43001 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NCXdc-0005G4-TQ for qemu-devel@nongnu.org; Mon, 23 Nov 2009 07:03:24 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44907) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NCXda-0001m9-41 for qemu-devel@nongnu.org; Mon, 23 Nov 2009 07:03:23 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nANC3JZq030029 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 23 Nov 2009 07:03:20 -0500 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nANC3Igf021241; Mon, 23 Nov 2009 07:03:19 -0500 Received: by dhcp-1-237.tlv.redhat.com (Postfix, from userid 13519) id AF8F71336CD; Mon, 23 Nov 2009 14:03:18 +0200 (IST) Date: Mon, 23 Nov 2009 14:03:18 +0200 From: Gleb Natapov To: kevin@koconnor.net Message-ID: <20091123120318.GK2999@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCHv2][SEABIOS] Make SMBIOS table pass MS SVVP test X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Microsoft SVVP (Server Virtualization Validation Program) expects arbitrary SMBIOS field to have certain values otherwise it fails. We all want to make Microsoft happy don't we? So lets put values MS expects in there. Values modified by the patch: Type 0: Bit 2 of byte 2 must be 1 Type 1: Manufacturer/product string should not be empty Type 3: Manufacturer string should not be empty Type 4: Processor manufacturer should no be empty Max/current CPU speed shouldn't be unknown Type 16: Memory should have error correction. --- v1->v2: Use CONFIG_APPNAME instead of open coding strings Use snprintf. Signed-off-by: Gleb Natapov -- Gleb. diff --git a/src/smbios.c b/src/smbios.c index f1b43f2..b812fce 100644 --- a/src/smbios.c +++ b/src/smbios.c @@ -96,7 +96,8 @@ smbios_init_type_0(void *start) memset(p->bios_characteristics, 0, 8); p->bios_characteristics[0] = 0x08; /* BIOS characteristics not supported */ p->bios_characteristics_extension_bytes[0] = 0; - p->bios_characteristics_extension_bytes[1] = 0; + /* Enable targeted content distribution. Needed for SVVP */ + p->bios_characteristics_extension_bytes[1] = 4; if (!qemu_cfg_smbios_load_field(0, offsetof(struct smbios_type_0, system_bios_major_release), @@ -130,8 +131,8 @@ smbios_init_type_1(void *start) p->header.length = sizeof(struct smbios_type_1); p->header.handle = 0x100; - load_str_field_or_skip(1, manufacturer_str); - load_str_field_or_skip(1, product_name_str); + load_str_field_with_default(1, manufacturer_str, CONFIG_APPNAME); + load_str_field_with_default(1, product_name_str, CONFIG_APPNAME); load_str_field_or_skip(1, version_str); load_str_field_or_skip(1, serial_number_str); @@ -165,7 +166,7 @@ smbios_init_type_3(void *start) p->header.length = sizeof(struct smbios_type_3); p->header.handle = 0x300; - p->manufacturer_str = 0; + p->manufacturer_str = 1; p->type = 0x01; /* other */ p->version_str = 0; p->serial_number_str = 0; @@ -180,9 +181,9 @@ smbios_init_type_3(void *start) p->contained_element_count = 0; start += sizeof(struct smbios_type_3); - *((u16 *)start) = 0; + memcpy((char *)start, CONFIG_APPNAME"\0\0", sizeof(CONFIG_APPNAME) + 1); - return start+2; + return start + sizeof(CONFIG_APPNAME) + 1; } /* Type 4 -- Processor Information */ @@ -198,7 +199,7 @@ smbios_init_type_4(void *start, unsigned int cpu_number) p->socket_designation_str = 1; p->processor_type = 0x03; /* CPU */ p->processor_family = 0x01; /* other */ - p->processor_manufacturer_str = 0; + p->processor_manufacturer_str = 2; u32 cpuid_signature, ebx, ecx, cpuid_features; cpuid(1, &cpuid_signature, &ebx, &ecx, &cpuid_features); @@ -209,8 +210,8 @@ smbios_init_type_4(void *start, unsigned int cpu_number) p->voltage = 0; p->external_clock = 0; - p->max_speed = 0; /* unknown */ - p->current_speed = 0; /* unknown */ + p->max_speed = 2000; + p->current_speed = 2000; p->status = 0x41; /* socket populated, CPU enabled */ p->processor_upgrade = 0x01; /* other */ @@ -221,10 +222,11 @@ smbios_init_type_4(void *start, unsigned int cpu_number) start += sizeof(struct smbios_type_4); - memcpy((char *)start, "CPU " "\0" "" "\0" "", 7); - ((char *)start)[4] = cpu_number + '0'; + snprintf((char*)start, 6, "CPU%2x", cpu_number); + start += 6; + memcpy((char *)start, CONFIG_APPNAME"\0\0", sizeof(CONFIG_APPNAME) + 1); - return start+7; + return start + sizeof(CONFIG_APPNAME) + 1; } /* Type 16 -- Physical Memory Array */ @@ -239,7 +241,7 @@ smbios_init_type_16(void *start, u32 memory_size_mb, int nr_mem_devs) p->location = 0x01; /* other */ p->use = 0x03; /* system memory */ - p->error_correction = 0x01; /* other */ + p->error_correction = 0x06; /* Multi-bit ECC to make Microsoft happy */ p->maximum_capacity = memory_size_mb * 1024; p->memory_error_information_handle = 0xfffe; /* none provided */ p->number_of_memory_devices = nr_mem_devs;