From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40187) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNOTK-0005dU-5d for qemu-devel@nongnu.org; Tue, 11 Mar 2014 11:20:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WNOTC-0007Gk-Pt for qemu-devel@nongnu.org; Tue, 11 Mar 2014 11:20:02 -0400 Received: from mail-qc0-x22f.google.com ([2607:f8b0:400d:c01::22f]:37845) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNOTC-0007Gg-Jy for qemu-devel@nongnu.org; Tue, 11 Mar 2014 11:19:54 -0400 Received: by mail-qc0-f175.google.com with SMTP id e16so9632870qcx.34 for ; Tue, 11 Mar 2014 08:19:54 -0700 (PDT) From: "Gabriel L. Somlo" Date: Tue, 11 Mar 2014 11:16:23 -0400 Message-Id: <1394550989-693-8-git-send-email-somlo@cmu.edu> In-Reply-To: <1394550989-693-1-git-send-email-somlo@cmu.edu> References: <1394532186.22422.24.camel@nilsson.home.kraxel.org> <1394550989-693-1-git-send-email-somlo@cmu.edu> Subject: [Qemu-devel] [v2 PATCH 07/13] SMBIOS: Remove unused code for passing individual fields to bios List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: agraf@suse.de, gsomlo@gmail.com, armbru@redhat.com, alex.williamson@redhat.com, kevin@koconnor.net, kraxel@redhat.com, lersek@redhat.com From: "Gabriel L. Somlo" This patch removes smbios_add_field() and the old code to insert individual fields for types 0 and 1 into fw_cfg. Signed-off-by: Gabriel Somlo --- hw/i386/smbios.c | 80 -------------------------------------------------------- 1 file changed, 80 deletions(-) diff --git a/hw/i386/smbios.c b/hw/i386/smbios.c index 1a7e2b5..16d400a 100644 --- a/hw/i386/smbios.c +++ b/hw/i386/smbios.c @@ -29,13 +29,6 @@ struct smbios_header { uint8_t type; } QEMU_PACKED; -struct smbios_field { - struct smbios_header header; - uint8_t type; - uint16_t offset; - uint8_t data[]; -} QEMU_PACKED; - struct smbios_table { struct smbios_header header; uint8_t data[]; @@ -283,75 +276,6 @@ static bool smbios_skip_table(uint8_t type, bool required_table) *(uint16_t *)smbios_entries += 1; \ } while (0) -static void smbios_add_field(int type, int offset, const void *data, size_t len) -{ - struct smbios_field *field; - - 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(*field) + len); - field = (struct smbios_field *)(smbios_entries + smbios_entries_len); - field->header.type = SMBIOS_FIELD_ENTRY; - field->header.length = cpu_to_le16(sizeof(*field) + len); - - field->type = type; - field->offset = cpu_to_le16(offset); - memcpy(field->data, data, len); - - smbios_entries_len += sizeof(*field) + len; - (*(uint16_t *)smbios_entries) = - cpu_to_le16(le16_to_cpu(*(uint16_t *)smbios_entries) + 1); -} - -static void smbios_maybe_add_str(int type, int offset, const char *data) -{ - if (data) { - smbios_add_field(type, offset, data, strlen(data) + 1); - } -} - -static void smbios_build_type_0_fields(void) -{ - smbios_maybe_add_str(0, offsetof(struct smbios_type_0, vendor_str), - type0.vendor); - smbios_maybe_add_str(0, offsetof(struct smbios_type_0, bios_version_str), - type0.version); - smbios_maybe_add_str(0, offsetof(struct smbios_type_0, - bios_release_date_str), - type0.date); - if (type0.have_major_minor) { - smbios_add_field(0, offsetof(struct smbios_type_0, - system_bios_major_release), - &type0.major, 1); - smbios_add_field(0, offsetof(struct smbios_type_0, - system_bios_minor_release), - &type0.minor, 1); - } -} - -static void smbios_build_type_1_fields(void) -{ - smbios_maybe_add_str(1, offsetof(struct smbios_type_1, manufacturer_str), - type1.manufacturer); - smbios_maybe_add_str(1, offsetof(struct smbios_type_1, product_name_str), - type1.product); - smbios_maybe_add_str(1, offsetof(struct smbios_type_1, version_str), - type1.version); - smbios_maybe_add_str(1, offsetof(struct smbios_type_1, serial_number_str), - type1.serial); - smbios_maybe_add_str(1, offsetof(struct smbios_type_1, sku_number_str), - type1.sku); - smbios_maybe_add_str(1, offsetof(struct smbios_type_1, family_str), - type1.family); - if (qemu_uuid_set) { - smbios_add_field(1, offsetof(struct smbios_type_1, uuid), - qemu_uuid, 16); - } -} - static void smbios_build_type_0_table(void) { SMBIOS_BUILD_TABLE_PRE(0, 0x000, false); /* optional, leave up to BIOS */ @@ -452,10 +376,6 @@ uint8_t *smbios_get_table(size_t *length) smbios_build_type_0_table(); smbios_build_type_1_table(); smbios_build_type_2_table(); -if (false) { /* shut up gcc until we remove deprecated code */ - smbios_build_type_0_fields(); - smbios_build_type_1_fields(); -} smbios_validate_table(); smbios_immutable = true; } -- 1.8.1.4