From nobody Thu Oct 31 23:55:13 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) client-ip=80.81.252.135; envelope-from=seabios-bounces@seabios.org; helo=mail.coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=oracle.com Return-Path: Received: from mail.coreboot.org (mail.coreboot.org [80.81.252.135]) by mx.zohomail.com with SMTPS id 154342053694730.928431550975688; Wed, 28 Nov 2018 07:55:36 -0800 (PST) Received: from [127.0.0.1] (helo=ra.coreboot.org) by mail.coreboot.org with esmtp (Exim 4.88) (envelope-from ) id 1gS2AN-0004y7-9m; Wed, 28 Nov 2018 16:54:19 +0100 Received: from userp2130.oracle.com ([156.151.31.86]) by mail.coreboot.org with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.88) (envelope-from ) id 1gS2A7-0004xx-NT for seabios@seabios.org; Wed, 28 Nov 2018 16:54:17 +0100 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wASFsChJ022760; Wed, 28 Nov 2018 15:54:41 GMT Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2130.oracle.com with ESMTP id 2nxx2ub3c1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Nov 2018 15:54:41 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id wASFseUM026363 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Nov 2018 15:54:40 GMT Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id wASFseaC010758; Wed, 28 Nov 2018 15:54:40 GMT Received: from spark.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 28 Nov 2018 07:54:40 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2018-07-02; bh=sZ/ezDwC/Zgb7m5IR9WY0T8G/OorjpHrpWlvQ8tY6XE=; b=ulYO9oXUsOzYZULYPui8MLDbtbOIkVyobNkpLwEmoMVFbrCU1SgQjgao6HtDu79ynryk AjYoI5jqWqk1OLA2Ipy60wZnwxsaAIhcEdgxa80p4ZFmq/jZc/j9Jml78KIFw6KYEunl Z51hwBFtRNyDMKnmZhh6IitnURL14kH0TwfR4tNewVCEyJk3gW/TpecVjINN0jyZzH+R UgvivtWVCOUbgS0CZKXtAK9fsfxyREcHYpjuHuZHLfpkIcPPDnC/LSHDwFBrnoz/ZFid QVqN/9t80LtKdBFZhfcbtfLBtLKKzHmObv+duNIjamAen3o0PSrpBjGyZ1rYfsowrRtq Qg== From: Liran Alon To: seabios@seabios.org, kraxel@redhat.com, kevin@koconnor.net Date: Wed, 28 Nov 2018 17:54:22 +0200 Message-Id: <20181128155422.29113-1-liran.alon@oracle.com> X-Mailer: git-send-email 2.16.1 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9091 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811280139 X-Spam-Score: -5.6 (-----) Subject: [SeaBIOS] [PATCH] SMBIOS: Add SMBIOS Type 6 Memory Module Information X-BeenThere: seabios@seabios.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SeaBIOS mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arbel Moshe MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: seabios-bounces@seabios.org Sender: "SeaBIOS" X-Duff: Orig. Duff, Duff Lite, Duff Dry, Duff Dark, Raspberry Duff, Lady Duff, Red Duff, Tartar Control Duff X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Arbel Moshe Add support for obsolete SMBIOS Type 6 which describes the speed, type, size and error status of each system memory module. This is required by some guests to boot successfully. Such an example is Cisco NGFW appliance which has a script which runs every boot that parses this SMBIOS Type 6 information and if it doesn't exists, it just fails to boot with an error of "Unable to parse dmidecode. Restarting now!". Reviewed-by: Liran Alon Reviewed-by: Ross Philipson Signed-off-by: Arbel Moshe --- src/fw/smbios.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ src/std/smbios.h | 12 ++++++++++++ 2 files changed, 58 insertions(+) diff --git a/src/fw/smbios.c b/src/fw/smbios.c index f3b5ad9dd9a0..751ae98f0fc4 100644 --- a/src/fw/smbios.c +++ b/src/fw/smbios.c @@ -348,6 +348,51 @@ smbios_init_type_4(void *start, unsigned int cpu_numbe= r) return end; } =20 +/* Type 6 -- Memory Module Information */ +static void * +smbios_init_type_6(void *start, u32 size_mb, int instance) +{ + struct smbios_type_6 *p =3D (struct smbios_type_6 *)start; + char *end =3D (char *)start + sizeof(struct smbios_type_6); + u8 size_mem =3D 0; + char name[1024]; + int str_index =3D 0; + + p->header.type =3D 6; + p->header.length =3D sizeof(struct smbios_type_6); + p->header.handle =3D 0x600 + instance; + + snprintf(name, sizeof(name), "RAM socket #%2x", instance); + + memcpy(end, name, strlen(name) + 1); + end +=3D strlen(name) + 1; + p->socket_designation_str =3D ++str_index; + + set_field_with_default(6, bank_connection, 0xff); /* No connection */ + set_field_with_default(6, current_speed, 0); /* Unknown Speed */ + set_field_with_default(6, memory_type, 0x400); /* SDRAM */ + + /* size_mem =3D n, where 2**n =3D size_mb */ + size_mb =3D size_mb >> 1; + while (size_mb) { + ++size_mem; + size_mb =3D size_mb >> 1; + } + + p->installed_size =3D size_mem; + p->enabled_size =3D size_mem; + set_field_with_default(6, error_status, 0); + + *end =3D 0; + end++; + if (!str_index) { + *end =3D 0; + end++; + } + + return end; +} + /* Type 16 -- Physical Memory Array */ static void * smbios_init_type_16(void *start, u32 memory_size_mb, int nr_mem_devs) @@ -550,6 +595,7 @@ smbios_legacy_setup(void) u32 dev_mb =3D ((i =3D=3D (nr_mem_devs - 1)) ? (((ram_mb - 1) & 0x3fff) + 1) : 16384); + add_struct(6, p, dev_mb, i); add_struct(17, p, dev_mb, i); } =20 diff --git a/src/std/smbios.h b/src/std/smbios.h index 4ccf2ea348ee..765ac51667ed 100644 --- a/src/std/smbios.h +++ b/src/std/smbios.h @@ -100,6 +100,18 @@ struct smbios_type_4 { u16 l3_cache_handle; } PACKED; =20 +/* SMBIOS type 6 - Memory Module Information */ +struct smbios_type_6 { + struct smbios_structure_header header; + u8 socket_designation_str; + u8 bank_connection; + u8 current_speed; + u16 memory_type; + u8 installed_size; + u8 enabled_size; + u8 error_status; +} PACKED; + /* SMBIOS type 16 - Physical Memory Array * Associated with one type 17 (Memory Device). */ --=20 2.16.1 _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios