WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] [HVM] [SMBIOS] Duplicate UUID into serial

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [HVM] [SMBIOS] Duplicate UUID into serial number in SMBIOS tables.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 28 Aug 2006 12:40:16 +0000
Delivery-date: Mon, 28 Aug 2006 05:40:59 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxxx
# Node ID 028862ea9c9d4f319aaad81075a3be29e0454dc8
# Parent  c61b8296b39a261dc407e9585f666cffd4064198
[HVM] [SMBIOS] Duplicate UUID into serial number in SMBIOS tables.

Windows zeroes out the UUID in the SMBIOS tables, but the identifier
is often needed by systems management code.  Duplicating the UUID
as the virtual system's serial number should help.

Signed-off-by: Andrew D. Ball <aball@xxxxxxxxxx>
---
 tools/firmware/hvmloader/smbios.c |   12 ++++++--
 tools/firmware/hvmloader/util.c   |   54 ++++++++++++++++++++++++++++++++++++++
 tools/firmware/hvmloader/util.h   |   10 +++++++
 3 files changed, 73 insertions(+), 3 deletions(-)

diff -r c61b8296b39a -r 028862ea9c9d tools/firmware/hvmloader/smbios.c
--- a/tools/firmware/hvmloader/smbios.c Mon Aug 28 12:50:55 2006 +0100
+++ b/tools/firmware/hvmloader/smbios.c Mon Aug 28 12:59:07 2006 +0100
@@ -116,8 +116,10 @@ smbios_table_size(uint32_t vcpus, const 
 
        /* type 0: "Xen", xen_version, and release_date */
        size += strlen("Xen") + strlen(xen_version) + 2;
-       /* type 1: "Xen", xen_version, "HVM domU" */
-       size += strlen("Xen") + strlen("HVM domU") + strlen(xen_version) + 3;
+       /* type 1: "Xen", xen_version, "HVM domU", UUID as string for 
+                   serial number */
+       size += strlen("Xen") + strlen("HVM domU") + strlen(xen_version) +
+                       36 + 4;
        /* type 3: "Xen" */
        size += strlen("Xen") + 1;
        /* type 4: socket designation ("CPU n"), processor_manufacturer */
@@ -371,6 +373,7 @@ smbios_type_1_init(void *start, const ch
 smbios_type_1_init(void *start, const char *xen_version, 
                   uint8_t uuid[16])
 {
+       char uuid_str[37];
        struct smbios_type_1 *p = (struct smbios_type_1 *)start;
        p->header.type = 1;
        p->header.length = sizeof(struct smbios_type_1);
@@ -379,7 +382,7 @@ smbios_type_1_init(void *start, const ch
        p->manufacturer_str = 1;
        p->product_name_str = 2;
        p->version_str = 3;
-       p->serial_number_str = 0;
+       p->serial_number_str = 4;
     
        memcpy(p->uuid, uuid, 16);
 
@@ -395,6 +398,9 @@ smbios_type_1_init(void *start, const ch
        start += strlen("HVM domU") + 1;
        strcpy((char *)start, xen_version);
        start += strlen(xen_version) + 1;
+       uuid_to_string(uuid_str, uuid); 
+       strcpy((char *)start, uuid_str);
+       start += strlen(uuid_str) + 1;
        *((uint8_t *)start) = 0;
     
        return start+1; 
diff -r c61b8296b39a -r 028862ea9c9d tools/firmware/hvmloader/util.c
--- a/tools/firmware/hvmloader/util.c   Mon Aug 28 12:50:55 2006 +0100
+++ b/tools/firmware/hvmloader/util.c   Mon Aug 28 12:59:07 2006 +0100
@@ -174,3 +174,57 @@ cpuid(uint32_t idx, uint32_t *eax, uint3
                : "0" (idx) );
 }
 
+/* Write a two-character hex representation of 'byte' to digits[].
+   Pre-condition: sizeof(digits) >= 2 */
+void
+byte_to_hex(char *digits, uint8_t byte)
+{
+       uint8_t nybbel = byte >> 4;
+
+       if (nybbel > 9)
+               digits[0] = 'a' + nybbel-10;
+       else
+               digits[0] = '0' + nybbel;
+
+       nybbel = byte & 0x0f;
+       if (nybbel > 9)
+               digits[1] = 'a' + nybbel-10;
+       else
+               digits[1] = '0' + nybbel;
+}
+
+/* Convert an array of 16 unsigned bytes to a DCE/OSF formatted UUID
+   string.
+
+   Pre-condition: sizeof(dest) >= 37 */
+void
+uuid_to_string(char *dest, uint8_t *uuid)
+{
+       int i = 0;
+       char *p = dest;
+
+       for (i = 0; i < 4; ++i) {
+               byte_to_hex(p, uuid[i]);
+               p += 2;
+       }
+       *p++ = '-';
+       for (i = 4; i < 6; ++i) {
+               byte_to_hex(p, uuid[i]);
+               p += 2;
+       }
+       *p++ = '-';
+       for (i = 6; i < 8; ++i) {
+               byte_to_hex(p, uuid[i]);
+               p += 2;
+       }
+       *p++ = '-';
+       for (i = 8; i < 10; ++i) {
+               byte_to_hex(p, uuid[i]);
+               p += 2;
+       }
+       *p++ = '-';
+       for (i = 10; i < 16; ++i) {
+               byte_to_hex(p, uuid[i]);
+               p += 2;
+       }
+}
diff -r c61b8296b39a -r 028862ea9c9d tools/firmware/hvmloader/util.h
--- a/tools/firmware/hvmloader/util.h   Mon Aug 28 12:50:55 2006 +0100
+++ b/tools/firmware/hvmloader/util.h   Mon Aug 28 12:59:07 2006 +0100
@@ -25,6 +25,16 @@ void *memset(void *s, int c, unsigned n)
 void *memset(void *s, int c, unsigned n);
 char *itoa(char *a, unsigned int i);
 
+/* convert a byte to two lowercase hex digits, with no terminating NUL 
+   character.  digits[] must have at least two elements. */
+void byte_to_hex(char *digits, uint8_t byte);
+
+/* Convert an array of 16 unsigned bytes to a DCE/OSF formatted UUID
+   string.
+
+   Pre-condition: sizeof(dest) >= 37 */
+void uuid_to_string(char *dest, uint8_t *uuid);
+
 /* Debug output */
 void puts(const char *s);
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [HVM] [SMBIOS] Duplicate UUID into serial number in SMBIOS tables., Xen patchbot-unstable <=