From 8e0d71ecfc96331d870def4eeb582ae785904abe Mon Sep 17 00:00:00 2001
From: Jes Sorensen <Jes.Sorensen@redhat.com>
Date: Wed, 14 Jul 2010 11:36:49 -0300
Subject: [PATCH 5/9] Set SMBIOS vendor to QEMU for RHEL5 machine types.

RH-Author: Jes Sorensen <Jes.Sorensen@redhat.com>
Message-id: <1279107409-7667-2-git-send-email-Jes.Sorensen@redhat.com>
Patchwork-id: 10715
O-Subject: [PATCH 1/1] Set SMBIOS vendor to QEMU for RHEL5 machine types.
Bugzilla: 614377
RH-Acked-by: Gleb Natapov <gleb@redhat.com>
RH-Acked-by: Alex Williamson <alex.williamson@redhat.com>
RH-Acked-by: Markus Armbruster <armbru@redhat.com>

From: Jes Sorensen <Jes.Sorensen@redhat.com>

This prevents Windows 7, and possibly other versions from requiring
re-activation after moving the guest from a RHEL5 host to a RHEL6
host.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 hw/pc.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/pc.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/hw/pc.c b/hw/pc.c
index 81e1a2c..cf294c9 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1474,10 +1474,16 @@ machine_init(pc_machine_init);
 
 /* RHEL machine types */
 
-static void rhel_common_init(const char *type1_version)
+static void rhel_common_init(const char *type1_version,
+                             int legacy_smbios_vendor)
 {
     char buf[32];
 
+    if (legacy_smbios_vendor) {
+        snprintf(buf, sizeof(buf), "QEMU");
+        smbios_add_field(0, offsetof(struct smbios_type_0, vendor_str),
+                         strlen(buf) + 1, buf);
+    }
     snprintf(buf, sizeof(buf), "Red Hat");
     smbios_add_field(1, offsetof(struct smbios_type_1, manufacturer_str),
                      strlen(buf) + 1, buf);
@@ -1499,7 +1505,7 @@ static void pc_init_rhel600(ram_addr_t ram_size,
                             const char *initrd_filename,
                             const char *cpu_model)
 {
-    rhel_common_init("RHEL 6.0.0 PC");
+    rhel_common_init("RHEL 6.0.0 PC", 0);
     pc_init_pci(ram_size, boot_device, kernel_filename, kernel_cmdline,
                 initrd_filename, cpu_model);
 }
@@ -1556,7 +1562,7 @@ static void pc_init_rhel550(ram_addr_t ram_size,
                             const char *initrd_filename,
                             const char *cpu_model)
 {
-    rhel_common_init("RHEL 5.5.0 PC");
+    rhel_common_init("RHEL 5.5.0 PC", 1);
     pc_init_pci(ram_size, boot_device, kernel_filename, kernel_cmdline,
                 initrd_filename, cpu_model);
 }
@@ -1576,7 +1582,7 @@ static void pc_init_rhel544(ram_addr_t ram_size,
                             const char *initrd_filename,
                             const char *cpu_model)
 {
-    rhel_common_init("RHEL 5.4.4 PC");
+    rhel_common_init("RHEL 5.4.4 PC", 1);
     pc_init_pci(ram_size, boot_device, kernel_filename, kernel_cmdline,
                 initrd_filename, cpu_model);
 }
@@ -1596,7 +1602,7 @@ static void pc_init_rhel540(ram_addr_t ram_size,
                             const char *initrd_filename,
                             const char *cpu_model)
 {
-    rhel_common_init("RHEL 5.4.0 PC");
+    rhel_common_init("RHEL 5.4.0 PC", 1);
     pc_init_pci(ram_size, boot_device, kernel_filename, kernel_cmdline,
                 initrd_filename, cpu_model);
 }
-- 
1.7.0.3

