From patchwork Mon Apr 14 20:55:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gabriel L. Somlo" X-Patchwork-Id: 339053 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 36B741400E8 for ; Tue, 15 Apr 2014 06:56:16 +1000 (EST) Received: from localhost ([::1]:45599 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WZnvK-0008PR-3l for incoming@patchwork.ozlabs.org; Mon, 14 Apr 2014 16:56:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56167) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WZnua-0008Iy-0k for qemu-devel@nongnu.org; Mon, 14 Apr 2014 16:55:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WZnuU-0003sg-8z for qemu-devel@nongnu.org; Mon, 14 Apr 2014 16:55:27 -0400 Received: from mail-qa0-x236.google.com ([2607:f8b0:400d:c00::236]:65241) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WZnuU-0003sP-3Z for qemu-devel@nongnu.org; Mon, 14 Apr 2014 16:55:22 -0400 Received: by mail-qa0-f54.google.com with SMTP id w8so8552056qac.13 for ; Mon, 14 Apr 2014 13:55:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2yaD2DhJweXGW4+Qks5NmLZdwbztSvTnqRMGv2Ir/VU=; b=V2PctExLUCHJMMB0R0ude+gWMABP/EqyEk+iD70AOOcW7TYZBhGZmc1xUnefLuFU3b LwKIEEgbbg4YXhUMZ8M86XefnB0aEiAbQsXM1vuxsWnU+86cQAAQr1mu9Vu9DVsAsevt O1ydPLcYM8/KMVKwwDw3oPtn3jaCfwhP8x9wOJgZvINQqivZDeyQCnvv8mv8WcXNU0Je A8gx1EHkxA7IMzvKMKIa7u3KXGgpNf/3+LS35lPTX4fmmE1aIyZSm2tkEBhXkLdRrxeu 0lFQQacDuc0AmfCtYwUc1u7H3oOfc5QnW/1MYtymzPOhDVMugd9NB9KdrmK8sOw8s8Mg Fnsg== X-Received: by 10.224.57.142 with SMTP id c14mr50404952qah.23.1397508921592; Mon, 14 Apr 2014 13:55:21 -0700 (PDT) Received: from ERROL.ini.cmu.edu (ERROL.INI.CMU.EDU. [128.2.16.43]) by mx.google.com with ESMTPSA id 21sm21884140qgh.23.2014.04.14.13.55.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Apr 2014 13:55:21 -0700 (PDT) From: "Gabriel L. Somlo" To: qemu-devel@nongnu.org Date: Mon, 14 Apr 2014 16:55:00 -0400 Message-Id: <1397508911-18691-7-git-send-email-somlo@cmu.edu> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1397508911-18691-1-git-send-email-somlo@cmu.edu> References: <1397508911-18691-1-git-send-email-somlo@cmu.edu> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c00::236 Cc: seabios@seabios.org, agraf@suse.de, armbru@redhat.com, kevin@koconnor.net, kraxel@redhat.com, lersek@redhat.com Subject: [Qemu-devel] [QEMU v6 PATCH 06/17] SMBIOS: Remove unused code for passing individual fields to bios X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 b00a367..4584774 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; }