From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57859) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VghQL-0001PJ-6N for qemu-devel@nongnu.org; Wed, 13 Nov 2013 15:52:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VghQF-0002KB-Rw for qemu-devel@nongnu.org; Wed, 13 Nov 2013 15:52:29 -0500 Received: from mail-ob0-f169.google.com ([209.85.214.169]:53344) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VghQF-0002K7-Mv for qemu-devel@nongnu.org; Wed, 13 Nov 2013 15:52:23 -0500 Received: by mail-ob0-f169.google.com with SMTP id wn1so1134599obc.28 for ; Wed, 13 Nov 2013 12:52:23 -0800 (PST) Message-ID: <5283E684.2010308@mvista.com> Date: Wed, 13 Nov 2013 14:52:20 -0600 From: Corey Minyard MIME-Version: 1.0 References: <1384273995-16486-1-git-send-email-cminyard@mvista.com> <1384273995-16486-16-git-send-email-cminyard@mvista.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 15/16] smbios: Add a function to directly add an entry List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bret Ketchum , Corey Minyard Cc: qemu-devel@nongnu.org, =?ISO-8859-1?Q?Andreas_F=E4rber?= , "Michael S. Tsirkin" On 11/13/2013 08:37 AM, Bret Ketchum wrote: > > Don't know if it matters much but this patch cannot be applied > without the prototype definition in 16/16. Thanks, I'll fix this. -corey > > > On Tue, Nov 12, 2013 at 10:33 AM, Corey Minyard > wrote: > > There was no way to directly add a table entry to the SMBIOS table, > even though the BIOS supports this. So add a function to do this. > This is in preparation for the IPMI handler adding it's SMBIOS table > entry. > > Signed-off-by: Corey Minyard > > --- > hw/i386/smbios.c | 27 +++++++++++++++++++++++++++ > 1 file changed, 27 insertions(+) > > diff --git a/hw/i386/smbios.c b/hw/i386/smbios.c > index d3f1ee6..9c53131 100644 > --- a/hw/i386/smbios.c > +++ b/hw/i386/smbios.c > @@ -277,6 +277,33 @@ static void save_opt(const char **dest, > QemuOpts *opts, const char *name) > } > } > > +int smbios_table_entry_add(struct smbios_structure_header *entry) > +{ > + struct smbios_table *table; > + struct smbios_structure_header *header; > + unsigned int size = entry->length; > + > + if (!smbios_entries) { > + smbios_entries_len = sizeof(uint16_t); > + smbios_entries = g_malloc0(smbios_entries_len); > + } > + smbios_entries = g_realloc(smbios_entries, smbios_entries_len + > + sizeof(*table) + size); > + table = (struct smbios_table *)(smbios_entries + > smbios_entries_len); > + table->header.type = SMBIOS_TABLE_ENTRY; > + table->header.length = cpu_to_le16(sizeof(*table) + size); > + > + header = (struct smbios_structure_header *)(table->data); > + memcpy(header, entry, size); > + > + smbios_check_collision(header->type, SMBIOS_TABLE_ENTRY); > + > + smbios_entries_len += sizeof(*table) + size; > + (*(uint16_t *)smbios_entries) = > + cpu_to_le16(le16_to_cpu(*(uint16_t *)smbios_entries) + 1); > + return 0; > +} > + > void smbios_entry_add(QemuOpts *opts) > { > Error *local_err = NULL; > -- > 1.8.3.1 > >