qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Beth Kon <eak@us.ibm.com>
To: qemu-devel@nongnu.org
Cc: bochs-developers@lists.sourceforge.net, Beth Kon <eak@us.ibm.com>,
	alex.williamson@hp.com
Subject: [Qemu-devel] [PATCH] Correct SMBIOS handling of multiple tables
Date: Wed, 27 May 2009 17:42:05 -0400	[thread overview]
Message-ID: <1243460525-25570-1-git-send-email-eak@us.ibm.com> (raw)

The current code prevents multiple entries of the same type table, as required,
for example, by table type 4.


Signed-off-by:  Beth Kon <eak@us.ibm.com>


diff --git a/bios/rombios32.c b/bios/rombios32.c
index f861f81..43aa065 100644
--- a/bios/rombios32.c
+++ b/bios/rombios32.c
@@ -2146,6 +2146,10 @@ struct smbios_table {
 #define SMBIOS_FIELD_ENTRY 0
 #define SMBIOS_TABLE_ENTRY 1
 
+#ifdef BX_QEMU
+    static uint64_t smbios_used_bitmap[4] = { 0 };
+#endif
+
 static size_t
 smbios_load_field(int type, size_t offset, void *addr)
 {
@@ -2496,14 +2500,9 @@ smbios_load_external(int type, char **p, unsigned *nr_structs,
                      unsigned *max_struct_size)
 {
 #ifdef BX_QEMU
-    static uint64_t used_bitmap[4] = { 0 };
     char *start = *p;
     int i;
 
-    /* Check if we've already reported these tables */
-    if (used_bitmap[(type >> 6) & 0x3] & (1ULL << (type & 0x3f)))
-        return 1;
-
     /* Don't introduce spurious end markers */
     if (type == 127)
         return 0;
@@ -2555,7 +2554,7 @@ smbios_load_external(int type, char **p, unsigned *nr_structs,
     }
 
     /* Mark that we've reported on this type */
-    used_bitmap[(type >> 6) & 0x3] |= (1ULL << (type & 0x3f));
+    smbios_used_bitmap[(type >> 6) & 0x3] |= (1ULL << (type & 0x3f));
 
     return (start != *p);
 #else /* !BX_QEMU */
@@ -2612,6 +2611,9 @@ void smbios_init(void)
     add_struct(32, p);
     /* Add any remaining provided entries before the end marker */
     for (i = 0; i < 256; i++)
+        /* Check if we've already reported these tables */
+        if (smbios_used_bitmap[(i >> 6) & 0x3] & (1ULL << (i & 0x3f)))
+            continue;
         smbios_load_external(i, &p, &nr_structs, &max_struct_size);
     add_struct(127, p);
 

             reply	other threads:[~2009-05-27 21:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-27 21:42 Beth Kon [this message]
2009-05-27 23:17 ` [Qemu-devel] Re: [PATCH] Correct SMBIOS handling of multiple tables Alex Williamson
2009-05-28  0:10   ` Beth Kon
2009-05-28  1:38     ` Alex Williamson
2009-05-28 15:05       ` Beth Kon
2009-05-28 15:51         ` Alex Williamson
2009-05-28 16:29           ` Beth Kon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1243460525-25570-1-git-send-email-eak@us.ibm.com \
    --to=eak@us.ibm.com \
    --cc=alex.williamson@hp.com \
    --cc=bochs-developers@lists.sourceforge.net \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).