From nobody Fri Apr 19 10:27:20 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607635648; cv=none; d=zohomail.com; s=zohoarc; b=EX4s/Fe0k6wDJu/wpT5xQ3B5710VQRNZAgbK4Sy+qnmkhT1trUzRocII7hFlCUSnzwXRNcyWkE0IDl5Xu/cEAdpSAmNCR6pmQfNjgKzf6p2xpZeUyl90E8SIlIyZSn+hzLgGQvhdowtFCHFrdGJgFUjPHMGiIQofsFT7iXR7zQ4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607635648; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Subject:To; bh=t/APcLnnnt8YucdpykYniYd3X73zmoAoWUE2M/mJDLE=; b=c2IYc1sQZBbX80a/JU1ee/lgrr84QDNr5uMEqnTi6Cr3VO2SaKjQCyIGjW6y5buG0b2SYcupT3XZXe7hThjWFZNIRVNqvBGE9J5fNd2HLCCUhkI9EmIxBz3+T+yVB5jRSKp1DTCmpxXQi8mDWMA0bBzBK8c+CTC5gQRUdqzVY28= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1607635648956908.6260333709063; Thu, 10 Dec 2020 13:27:28 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 629AA10C0ACB; Thu, 10 Dec 2020 21:27:25 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 4530310C0AAD for ; Thu, 10 Dec 2020 21:26:55 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-509-rI8d9dFGNiWNK3iVG3IrmQ-1; Thu, 10 Dec 2020 16:26:52 -0500 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 784AE800D53 for ; Thu, 10 Dec 2020 21:26:51 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.corp.redhat.com (Postfix) with ESMTP id 058EC60BF3; Thu, 10 Dec 2020 21:26:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607635614; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kP+GaQX3vUQHkBD5HHnYAFZtPaUv8XJp1r4q8/I2bAs=; b=KMutwbaSC9nHREbPGG7c08fq6JVnuyxYEoUm/+bEfWFPTXKP5vfYT5zdWIpDuE5igf3HSk R+NYZHRKJK44+WF+uDhzq4ACUAYeugQUghnnwsrObCCK0TZUSTePi/jsBzDceqA53uCfg/ IC1d39Rigvb7tsW6P7WhTWedjNfIoEM= X-MC-Unique: rI8d9dFGNiWNK3iVG3IrmQ-1 From: Eduardo Habkost To: seabios@seabios.org Date: Thu, 10 Dec 2020 16:26:22 -0500 Message-Id: <20201210212640.2023885-2-ehabkost@redhat.com> In-Reply-To: <20201210212640.2023885-1-ehabkost@redhat.com> References: <20201210212640.2023885-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: VLEW7SL3YVZSXWTWFDZJGQHKIANS2FFT X-Message-ID-Hash: VLEW7SL3YVZSXWTWFDZJGQHKIANS2FFT X-MailFrom: ehabkost@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: "Daniel P. Berrange" , Gerd Hoffmann X-Mailman-Version: 3.3.2b1 Precedence: list Subject: [SeaBIOS] [PATCH 01/19] biostables: copy_fseg_table() function List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: ------ X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Replace the common malloc_fseg() + memcpy() code pattern with a helper function. Signed-off-by: Eduardo Habkost --- src/fw/biostables.c | 40 ++++++++++++++++------------------------ 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/src/fw/biostables.c b/src/fw/biostables.c index 794b5be8..a6f316fa 100644 --- a/src/fw/biostables.c +++ b/src/fw/biostables.c @@ -21,6 +21,19 @@ =20 struct pir_header *PirAddr VARFSEG; =20 +static void * +copy_fseg_table(const char *name, void *pos, u32 size) +{ + void *newpos =3D malloc_fseg(size); + if (!newpos) { + warn_noalloc(); + return NULL; + } + dprintf(1, "Copying %s from %p to %p\n", name, pos, newpos); + memcpy(newpos, pos, size); + return newpos; +} + void copy_pir(void *pos) { @@ -33,14 +46,7 @@ copy_pir(void *pos) return; if (checksum(pos, p->size) !=3D 0) return; - void *newpos =3D malloc_fseg(p->size); - if (!newpos) { - warn_noalloc(); - return; - } - dprintf(1, "Copying PIR from %p to %p\n", pos, newpos); - memcpy(newpos, pos, p->size); - PirAddr =3D newpos; + PirAddr =3D copy_fseg_table("PIR", pos, p->size); } =20 void @@ -111,14 +117,7 @@ copy_acpi_rsdp(void *pos) int length =3D get_acpi_rsdp_length(pos, -1); if (length < 0) return; - void *newpos =3D malloc_fseg(length); - if (!newpos) { - warn_noalloc(); - return; - } - dprintf(1, "Copying ACPI RSDP from %p to %p\n", pos, newpos); - memcpy(newpos, pos, length); - RsdpAddr =3D newpos; + RsdpAddr =3D copy_fseg_table("ACPI RSDP", pos, length); } =20 void *find_acpi_rsdp(void) @@ -305,14 +304,7 @@ copy_smbios(void *pos) return; if (checksum(pos+0x10, p->length-0x10) !=3D 0) return; - struct smbios_entry_point *newpos =3D malloc_fseg(p->length); - if (!newpos) { - warn_noalloc(); - return; - } - dprintf(1, "Copying SMBIOS entry point from %p to %p\n", pos, newpos); - memcpy(newpos, pos, p->length); - SMBiosAddr =3D newpos; + SMBiosAddr =3D copy_fseg_table("SMBIOS", pos, p->length); } =20 void --=20 2.28.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Fri Apr 19 10:27:20 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607635661; cv=none; d=zohomail.com; s=zohoarc; b=VU6OBVT9HHjT4kXyCNZ1M6lYkGLI326dU7dAnWkegUQ64C/TXWyg9xx+WNiS1ERHdvn+6AveQe20kiLWx9IMWH+rvv2annUpPqmM3tSlC9i6H/wHaUZ2ofkKlUYgb9JulvTB0HX16F2qfAnsh8Xsc+CW330SnIy3IEfE1152ndg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607635661; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Subject:To; bh=mGSHJUa4Auzt80uo1bwDKczNxwXRN95MntoC0bCPSgY=; b=bT0wb+7s4wigjzpz1/w483w8dh4aK5KdN5uPDKK+5vQcifsVEr6+RXjfOehG5HCL6cRh8DFblDLWSedoqcAQt6F8+2kd4M+s4JUq7MYLm/luwRLNcpGpkhGjo3mGPP9IIW6RM+r01jUBo2pkL7Visf8s6g7a5FVLCmzvzIHes1I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1607635661937987.701737190596; Thu, 10 Dec 2020 13:27:41 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 57CEE10C0AD0; Thu, 10 Dec 2020 21:27:38 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 8048210C0AB4 for ; Thu, 10 Dec 2020 21:26:59 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-517-QMq-4qr6OfqSJHDpmTzafQ-1; Thu, 10 Dec 2020 16:26:57 -0500 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0AFBF107ACE6 for ; Thu, 10 Dec 2020 21:26:56 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC7A919C78; Thu, 10 Dec 2020 21:26:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607635618; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RLaJRqYyEX7CrFTzCYuEwhGKAbC6ICcIICpO7SAsjLE=; b=BdK4oooD9ibylwpAM9Du1P8yXrg3Ko6NCddrSifJAE6/twE7s7Yz+dp2pjsdPE3dQ8xEaM 00Yr/hWYRer/f/Z1olsLfxnoaej0Mt8hDaGaYF4hrs6Vd4uyAMW+EgNkcUeksyi21eJJq9 3E88/HJTnwTUw/pjT50dYYIF2FHiot0= X-MC-Unique: QMq-4qr6OfqSJHDpmTzafQ-1 From: Eduardo Habkost To: seabios@seabios.org Date: Thu, 10 Dec 2020 16:26:23 -0500 Message-Id: <20201210212640.2023885-3-ehabkost@redhat.com> In-Reply-To: <20201210212640.2023885-1-ehabkost@redhat.com> References: <20201210212640.2023885-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: U4LKQQNZ4PQ2WL7NI2BOO5V2WF6LV5TV X-Message-ID-Hash: U4LKQQNZ4PQ2WL7NI2BOO5V2WF6LV5TV X-MailFrom: ehabkost@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: "Daniel P. Berrange" , Gerd Hoffmann X-Mailman-Version: 3.3.2b1 Precedence: list Subject: [SeaBIOS] [PATCH 02/19] util.h: Delete unused get_smbios_entry_point() prototype List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: ------ X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The get_smbios_entry_point() function doesn't exist, delete unused prototype. Signed-off-by: Eduardo Habkost --- src/util.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/util.h b/src/util.h index 0de35229..652ca6b1 100644 --- a/src/util.h +++ b/src/util.h @@ -88,7 +88,6 @@ u32 find_resume_vector(void); void acpi_reboot(void); void find_acpi_features(void); extern struct smbios_entry_point *SMBiosAddr; -struct smbios_entry_point *get_smbios_entry_point(); void copy_smbios(void *pos); void display_uuid(void); void copy_table(void *pos); --=20 2.28.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Fri Apr 19 10:27:20 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607635675; cv=none; d=zohomail.com; s=zohoarc; b=NnCO+qq2QvZLFBUtCIuK5zzeSeRKL/F7eVtS6/n5JiGL7HFnK4+t1p2UFcYN+xnMA373BehruxUEksx7LfEWCQ6oWirFwidQ4Nrr8P+QWlkAFQ9gNk/vCErzV+kBA1aFF9cMoGwvxL8b+DXfSHXxVu9Jr25R9BmF0CNK/d9f3QY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607635675; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Subject:To; bh=1bWl832I3hz1TEDlkMQO1In5I411QiUZNh3A6zkHJuQ=; b=T72h0yLXfUqXC9+ADesLDR++twsJxwn75p/3qHAattHVsCeXJT1VlLb9EGqPy6hi+4YTovn4Lx9rWGFBglZbWcOjB07ze5Nz8jWgvgXFhhCZiKC9twCRMIdB3ukZawbGKyYb2fRnAILxwBbHbf9W87p9eoS+SUH4ZHV/cVQt2Es= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1607635675847208.53224893205845; Thu, 10 Dec 2020 13:27:55 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id A3CAA10C0AD2; Thu, 10 Dec 2020 21:27:51 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id B33C410C0AAD for ; Thu, 10 Dec 2020 21:27:04 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-458-s118OGe3NriECKsspD9emA-1; Thu, 10 Dec 2020 16:27:01 -0500 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 84CB51936B68 for ; Thu, 10 Dec 2020 21:27:00 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.corp.redhat.com (Postfix) with ESMTP id C0D171E5; Thu, 10 Dec 2020 21:26:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607635623; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7nchydqlKSbSnu3vvX/cXdg2O4Xlo5a1gy2x2/U/5pk=; b=AOcsRROc4Bcj0PvtgMea/+IZovzYI6t2jUcVPdWEC1bd8ONbhRCHGLiSEzzngrvbuu8fGv VcB0FNohFaua0NhggEMNJpmbwW6qB4TqW7j+iwUPQdm8+uxUUvqbw4FoK97NKtODv9iD6M I0EJWGiEpYfMpGP+BpT7udpXdHjvmRY= X-MC-Unique: s118OGe3NriECKsspD9emA-1 From: Eduardo Habkost To: seabios@seabios.org Date: Thu, 10 Dec 2020 16:26:24 -0500 Message-Id: <20201210212640.2023885-4-ehabkost@redhat.com> In-Reply-To: <20201210212640.2023885-1-ehabkost@redhat.com> References: <20201210212640.2023885-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: V6PJRL3UJTRAMXXXAPSGC5KDMJLZD6DV X-Message-ID-Hash: V6PJRL3UJTRAMXXXAPSGC5KDMJLZD6DV X-MailFrom: ehabkost@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: "Daniel P. Berrange" , Gerd Hoffmann X-Mailman-Version: 3.3.2b1 Precedence: list Subject: [SeaBIOS] [PATCH 03/19] smbios: Rename code specific for SMBIOS 2.1 entry points List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: ------ X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Rename copy_smbios(), smbios_next(), SMBIOS_SIGNATURE, smbios_entry_point, and SMBiosAddr, to indicate they refer to SMBIOS 2.1 entry points. Signed-off-by: Eduardo Habkost --- src/std/smbios.h | 4 ++-- src/util.h | 4 ++-- src/fw/biostables.c | 36 ++++++++++++++++++------------------ src/fw/csm.c | 6 +++--- src/fw/smbios.c | 12 ++++++------ src/tcgbios.c | 4 ++-- 6 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/std/smbios.h b/src/std/smbios.h index 4ccf2ea3..17fdfed6 100644 --- a/src/std/smbios.h +++ b/src/std/smbios.h @@ -3,12 +3,12 @@ =20 #include "types.h" // u32 =20 -#define SMBIOS_SIGNATURE 0x5f4d535f // "_SM_" +#define SMBIOS_21_SIGNATURE 0x5f4d535f // "_SM_" =20 /* SMBIOS entry point -- must be written to a 16-bit aligned address between 0xf0000 and 0xfffff. */ -struct smbios_entry_point { +struct smbios_21_entry_point { u32 signature; u8 checksum; u8 length; diff --git a/src/util.h b/src/util.h index 652ca6b1..f761271c 100644 --- a/src/util.h +++ b/src/util.h @@ -87,8 +87,8 @@ void *find_acpi_table(u32 signature); u32 find_resume_vector(void); void acpi_reboot(void); void find_acpi_features(void); -extern struct smbios_entry_point *SMBiosAddr; -void copy_smbios(void *pos); +extern struct smbios_21_entry_point *SMBios21Addr; +void copy_smbios_21(void *pos); void display_uuid(void); void copy_table(void *pos); void smbios_setup(void); diff --git a/src/fw/biostables.c b/src/fw/biostables.c index a6f316fa..8e53ae2e 100644 --- a/src/fw/biostables.c +++ b/src/fw/biostables.c @@ -14,7 +14,7 @@ #include "std/acpi.h" // struct rsdp_descriptor #include "std/mptable.h" // MPTABLE_SIGNATURE #include "std/pirtable.h" // struct pir_header -#include "std/smbios.h" // struct smbios_entry_point +#include "std/smbios.h" // struct smbios_21_entry_point #include "string.h" // memcpy #include "util.h" // copy_table #include "x86.h" // outb @@ -265,7 +265,7 @@ find_acpi_features(void) =20 // Iterator for each sub-table in the smbios blob. void * -smbios_next(struct smbios_entry_point *smbios, void *prev) +smbios_21_next(struct smbios_21_entry_point *smbios, void *prev) { if (!smbios) return NULL; @@ -288,15 +288,15 @@ smbios_next(struct smbios_entry_point *smbios, void *= prev) return prev; } =20 -struct smbios_entry_point *SMBiosAddr; +struct smbios_21_entry_point *SMBios21Addr; =20 void -copy_smbios(void *pos) +copy_smbios_21(void *pos) { - if (SMBiosAddr) + if (SMBios21Addr) return; - struct smbios_entry_point *p =3D pos; - if (p->signature !=3D SMBIOS_SIGNATURE) + struct smbios_21_entry_point *p =3D pos; + if (p->signature !=3D SMBIOS_21_SIGNATURE) return; if (checksum(pos, 0x10) !=3D 0) return; @@ -304,15 +304,15 @@ copy_smbios(void *pos) return; if (checksum(pos+0x10, p->length-0x10) !=3D 0) return; - SMBiosAddr =3D copy_fseg_table("SMBIOS", pos, p->length); + SMBios21Addr =3D copy_fseg_table("SMBIOS", pos, p->length); } =20 void display_uuid(void) { - struct smbios_type_1 *tbl =3D smbios_next(SMBiosAddr, NULL); + struct smbios_type_1 *tbl =3D smbios_21_next(SMBios21Addr, NULL); int minlen =3D offsetof(struct smbios_type_1, uuid) + sizeof(tbl->uuid= ); - for (; tbl; tbl =3D smbios_next(SMBiosAddr, tbl)) + for (; tbl; tbl =3D smbios_21_next(SMBios21Addr, tbl)) if (tbl->header.type =3D=3D 1 && tbl->header.length >=3D minlen) { u8 *uuid =3D tbl->uuid; u8 empty_uuid[sizeof(tbl->uuid)] =3D { 0 }; @@ -325,9 +325,9 @@ display_uuid(void) * the encoding, but we follow dmidecode and assume big-endian * encoding. */ - if (SMBiosAddr->smbios_major_version > 2 || - (SMBiosAddr->smbios_major_version =3D=3D 2 && - SMBiosAddr->smbios_minor_version >=3D 6)) { + if (SMBios21Addr->smbios_major_version > 2 || + (SMBios21Addr->smbios_major_version =3D=3D 2 && + SMBios21Addr->smbios_minor_version >=3D 6)) { printf("Machine UUID" " %02x%02x%02x%02x" "-%02x%02x" @@ -421,7 +421,7 @@ smbios_romfile_setup(void) { struct romfile_s *f_anchor =3D romfile_find("etc/smbios/smbios-anchor"= ); struct romfile_s *f_tables =3D romfile_find("etc/smbios/smbios-tables"= ); - struct smbios_entry_point ep; + struct smbios_21_entry_point ep; struct smbios_type_0 *t0; u16 qtables_len, need_t0 =3D 1; u8 *qtables, *tables; @@ -440,10 +440,10 @@ smbios_romfile_setup(void) return 0; } f_tables->copy(f_tables, qtables, f_tables->size); - ep.structure_table_address =3D (u32)qtables; /* for smbios_next(), bel= ow */ + ep.structure_table_address =3D (u32)qtables; /* for smbios_21_next(), = below */ =20 /* did we get a type 0 structure ? */ - for (t0 =3D smbios_next(&ep, NULL); t0; t0 =3D smbios_next(&ep, t0)) + for (t0 =3D smbios_21_next(&ep, NULL); t0; t0 =3D smbios_21_next(&ep, = t0)) if (t0->header.type =3D=3D 0) { need_t0 =3D 0; break; @@ -488,7 +488,7 @@ smbios_romfile_setup(void) ep.checksum -=3D checksum(&ep, 0x10); ep.intermediate_checksum -=3D checksum((void *)&ep + 0x10, ep.length -= 0x10); =20 - copy_smbios(&ep); + copy_smbios_21(&ep); return 1; } =20 @@ -506,5 +506,5 @@ copy_table(void *pos) copy_pir(pos); copy_mptable(pos); copy_acpi_rsdp(pos); - copy_smbios(pos); + copy_smbios_21(pos); } diff --git a/src/fw/csm.c b/src/fw/csm.c index 8359bcba..74069028 100644 --- a/src/fw/csm.c +++ b/src/fw/csm.c @@ -19,7 +19,7 @@ #include "std/acpi.h" // RSDP_SIGNATURE #include "std/bda.h" // struct bios_data_area_s #include "std/optionrom.h" // struct rom_header -#include "util.h" // copy_smbios +#include "util.h" // copy_smbios_21 =20 #define UINT8 u8 #define UINT16 u16 @@ -172,8 +172,8 @@ handle_csm_0002(struct bregs *regs) =20 // SMBIOS table needs to be copied into the f-seg // XX: OVMF doesn't seem to set SmbiosTableLength so don't check it - if (csm_boot_table->SmbiosTable && !SMBiosAddr) - copy_smbios((void *)csm_boot_table->SmbiosTable); + if (csm_boot_table->SmbiosTable && !SMBios21Addr) + copy_smbios_21((void *)csm_boot_table->SmbiosTable); =20 // MPTABLE is just there; we don't care where. =20 diff --git a/src/fw/smbios.c b/src/fw/smbios.c index 62a563b2..730b6898 100644 --- a/src/fw/smbios.c +++ b/src/fw/smbios.c @@ -11,13 +11,13 @@ #include "output.h" // dprintf #include "paravirt.h" // RamSize #include "romfile.h" // romfile_findprefix -#include "std/smbios.h" // struct smbios_entry_point +#include "std/smbios.h" // struct smbios_21_entry_point #include "string.h" // memset #include "util.h" // MaxCountCPUs #include "x86.h" // cpuid =20 static void -smbios_entry_point_setup(u16 max_structure_size, +smbios_21_entry_point_setup(u16 max_structure_size, u16 structure_table_length, void *structure_table_address, u16 number_of_structures) @@ -35,9 +35,9 @@ smbios_entry_point_setup(u16 max_structure_size, } memcpy(finaltable, structure_table_address, structure_table_length); =20 - struct smbios_entry_point ep; + struct smbios_21_entry_point ep; memset(&ep, 0, sizeof(ep)); - ep.signature =3D SMBIOS_SIGNATURE; + ep.signature =3D SMBIOS_21_SIGNATURE; ep.length =3D 0x1f; ep.smbios_major_version =3D 2; ep.smbios_minor_version =3D 4; @@ -53,7 +53,7 @@ smbios_entry_point_setup(u16 max_structure_size, =20 ep.intermediate_checksum -=3D checksum((void*)&ep + 0x10, ep.length - = 0x10); =20 - copy_smbios(&ep); + copy_smbios_21(&ep); } =20 static int @@ -584,6 +584,6 @@ smbios_legacy_setup(void) =20 #undef add_struct =20 - smbios_entry_point_setup(max_struct_size, p - start, start, nr_structs= ); + smbios_21_entry_point_setup(max_struct_size, p - start, start, nr_stru= cts); free(start); } diff --git a/src/tcgbios.c b/src/tcgbios.c index 82894f5c..148c0220 100644 --- a/src/tcgbios.c +++ b/src/tcgbios.c @@ -18,7 +18,7 @@ #include "output.h" // dprintf #include "sha1.h" // sha1 #include "std/acpi.h" // RSDP_SIGNATURE, rsdt_descriptor -#include "std/smbios.h" // struct smbios_entry_point +#include "std/smbios.h" // struct smbios_21_entry_point #include "std/tcg.h" // TCG_PC_LOGOVERFLOW #include "string.h" // checksum #include "tcgbios.h"// tpm_*, prototypes @@ -1028,7 +1028,7 @@ tpm_smbios_measure(void) .eventid =3D 1, .eventdatasize =3D SHA1_BUFSIZE, }; - struct smbios_entry_point *sep =3D SMBiosAddr; + struct smbios_21_entry_point *sep =3D SMBios21Addr; =20 dprintf(DEBUG_tcg, "TCGBIOS: SMBIOS at %p\n", sep); =20 --=20 2.28.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Fri Apr 19 10:27:20 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607635704; cv=none; d=zohomail.com; s=zohoarc; b=PJQL+5dSHdw3unSTtuOtJyF8PqREB6cZdGvfz5rDziCOBzY3/v0RY30EjOrcUnu5Jx1QZvwIAm1oqmqGVvFoLSg4ECsO9S52fZ23LA9cNXLAgr0LD/lYBjNdtTJ8FUHJVSZ4saEzpxzBuT8LT0ITbiLOszk0tz+eAEwjGpO9ccg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607635704; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Subject:To; bh=7SIvwIvZU/3NmEtH+zMuit3PjjxpFp57tFP+1owxmeA=; b=Es1udgjfEV57ZSdCKF0GgTyis0lFkQez/ZZcFH3z5FtNgugQ67q6UGYTOhHrcbuVzOhSmzB7Vj3hAY3I2cN9LoKOt2DDyh5wnT92WBVb3J0sWeoO0EK3yRo7B4uXOJQ+wCG7T5ZFU1uW8DaqIFIaONTKQhqT4789qeNAjLyBhf4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1607635704023791.1934407940637; Thu, 10 Dec 2020 13:28:24 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id B00B210C0AC8; Thu, 10 Dec 2020 21:28:19 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id DBAC610C0ACE for ; Thu, 10 Dec 2020 21:27:13 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-25-X103HgRxOZmJa5GXUCxZqQ-1; Thu, 10 Dec 2020 16:27:05 -0500 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CB1D710054FF for ; Thu, 10 Dec 2020 21:27:04 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7467E5D9CC; Thu, 10 Dec 2020 21:27:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607635632; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NTeYtQlrNgHamOb0tigQvZSUKT+H9JQMSABLsj+VcxA=; b=CD4gpc4+xSXgSveNNXXwVe3+o7lmjkqs5LR1OxTIVHuOINZyeQNBm/TQKYpuufCmHJYEIC DLnTb89YxQ3GHOzAZXGuZ6flhgVEtDBDKpgI1i4kMA5Ou1uvZceeDGL4qY3ZnAUbK6Lui0 0nMuBtpcH27mcA9GRfvczpmeFk+u2jo= X-MC-Unique: X103HgRxOZmJa5GXUCxZqQ-1 From: Eduardo Habkost To: seabios@seabios.org Date: Thu, 10 Dec 2020 16:26:25 -0500 Message-Id: <20201210212640.2023885-5-ehabkost@redhat.com> In-Reply-To: <20201210212640.2023885-1-ehabkost@redhat.com> References: <20201210212640.2023885-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: GJAOUK34PE6HDMUTAYKB6Z5SLZJZPG24 X-Message-ID-Hash: GJAOUK34PE6HDMUTAYKB6Z5SLZJZPG24 X-MailFrom: ehabkost@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: "Daniel P. Berrange" , Gerd Hoffmann X-Mailman-Version: 3.3.2b1 Precedence: list Subject: [SeaBIOS] [PATCH 04/19] smbios: Generic smbios_next() function List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: ------ X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Extract generic code from smbios_21_next(), so it can be reused for SMBIOS 3.0 support. Signed-off-by: Eduardo Habkost --- src/fw/biostables.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/fw/biostables.c b/src/fw/biostables.c index 8e53ae2e..3c30331e 100644 --- a/src/fw/biostables.c +++ b/src/fw/biostables.c @@ -265,12 +265,11 @@ find_acpi_features(void) =20 // Iterator for each sub-table in the smbios blob. void * -smbios_21_next(struct smbios_21_entry_point *smbios, void *prev) +smbios_next(void *start, u32 length, void *prev) { - if (!smbios) + if (!start) return NULL; - void *start =3D (void*)smbios->structure_table_address; - void *end =3D start + smbios->structure_table_length; + void *end =3D start + length; =20 if (!prev) { prev =3D start; @@ -288,6 +287,15 @@ smbios_21_next(struct smbios_21_entry_point *smbios, v= oid *prev) return prev; } =20 +void * +smbios_21_next(struct smbios_21_entry_point *smbios, void *prev) +{ + if (!smbios) + return NULL; + return smbios_next((void*)smbios->structure_table_address, + smbios->structure_table_length, prev); +} + struct smbios_21_entry_point *SMBios21Addr; =20 void --=20 2.28.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Fri Apr 19 10:27:20 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607635691; cv=none; d=zohomail.com; s=zohoarc; b=MgpUAJ/1TgO2UKO2H5xW7ZhLphKl3evfh7oBjF/3uYPHEgN4mSJWkmMeFiw7MCW0eIL6YVl3hfMf18SSrcWHP9LTkiICIBUJStssRoYvz0ibFI9KnliJ9bzUdp3rZPbPIe/4UcCOChzsiXQGOJyYESv3X5Z6l8ZB1fJJwlnCT/I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607635691; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Subject:To; bh=xud5/d2JXQbXuvWXJOjwmjLG8ZuIVH63vVGhximZHcc=; b=BK7tQ4xdkTwRl2n4KM5L4FvKBdPvKBCLC6+PFD93SrI+fZ1CafkO6fp3EHDqujdRbPHW5oCaEI8eZtyBL/5I3ZrLoQ+n/Sq+jIaF8hujT9xa4mLnt0Xo81qUoarwqaUCV7EGlv1eTn4Xtvy/ZKZfHFHPVmIKlprGuvfv92Iasug= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1607635691702955.7694577310825; Thu, 10 Dec 2020 13:28:11 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id E7E8010C0ACC; Thu, 10 Dec 2020 21:28:07 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 3D1DF10C0AAD for ; Thu, 10 Dec 2020 21:27:10 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-296-Veq6WVjZMrCPuN71k_bL8A-1; Thu, 10 Dec 2020 16:27:07 -0500 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9C564802B42 for ; Thu, 10 Dec 2020 21:27:06 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.corp.redhat.com (Postfix) with ESMTP id 300845D9CC; Thu, 10 Dec 2020 21:27:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607635629; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FsLOaBZ0J/rogZRmyXc9rmElJE7aCuMsBY+xcInxqes=; b=HCGvmviiJnmkAhJQDtrY8jSIP8XB9ftI+dhITnovxTTnUShjfci4Wdn+ZFT92iCTEIvcrs FhcKMf57PU7Ay5Vy7afMalX2V7NpSdhI060UhGEhxCDKqub2ai/w/m6Ca0syBNNvx73zaW 2oiKH5SApdIAzrJZOmdupLtdtvrGRFc= X-MC-Unique: Veq6WVjZMrCPuN71k_bL8A-1 From: Eduardo Habkost To: seabios@seabios.org Date: Thu, 10 Dec 2020 16:26:26 -0500 Message-Id: <20201210212640.2023885-6-ehabkost@redhat.com> In-Reply-To: <20201210212640.2023885-1-ehabkost@redhat.com> References: <20201210212640.2023885-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: GBETFHI5TRBZVLYS5ULNICAUWRVK3VXK X-Message-ID-Hash: GBETFHI5TRBZVLYS5ULNICAUWRVK3VXK X-MailFrom: ehabkost@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: "Daniel P. Berrange" , Gerd Hoffmann X-Mailman-Version: 3.3.2b1 Precedence: list Subject: [SeaBIOS] [PATCH 05/19] smbios: smbios_get_tables() function List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: ------ X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The new function will be useful for code that just needs the address and length of SMBIOS tables. Signed-off-by: Eduardo Habkost --- src/util.h | 1 + src/fw/biostables.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/src/util.h b/src/util.h index f761271c..2e151752 100644 --- a/src/util.h +++ b/src/util.h @@ -88,6 +88,7 @@ u32 find_resume_vector(void); void acpi_reboot(void); void find_acpi_features(void); extern struct smbios_21_entry_point *SMBios21Addr; +void *smbios_get_tables(u32 *length); void copy_smbios_21(void *pos); void display_uuid(void); void copy_table(void *pos); diff --git a/src/fw/biostables.c b/src/fw/biostables.c index 3c30331e..1adc694c 100644 --- a/src/fw/biostables.c +++ b/src/fw/biostables.c @@ -315,6 +315,15 @@ copy_smbios_21(void *pos) SMBios21Addr =3D copy_fseg_table("SMBIOS", pos, p->length); } =20 +void *smbios_get_tables(u32 *length) +{ + if (SMBios21Addr) { + *length =3D SMBios21Addr->structure_table_length; + return (void *)SMBios21Addr->structure_table_address; + } + return NULL; +} + void display_uuid(void) { --=20 2.28.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Fri Apr 19 10:27:20 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607635714; cv=none; d=zohomail.com; s=zohoarc; b=cVEHtv12a9TxCyibyAUusByiDOZfDCUKE10XZmbQZQhPSCALSR4sf3cuZEAJuIWLDO/aiWthng7ErW83n191Q3bz2bKSwszM98AVoYh2bd136paVrQSVfsHoWOVgnmKebalfS+2quQErBitU+3WeWi3b9nauPu5RcQbZQg07n/Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607635714; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Subject:To; bh=ffnmlctmo6JNILBnZ4vrg1XF3bTKaPFm9wmj7IXC9tU=; b=Z28s5e8W4wWt+BOjfBvGj0hn2yp4aZdzpnOimGldxCcjz9AiWG+bqwriE/y40Xe9HxN0tMmxgmeiaT2I0ATFTtemCgH2CFmS8Y+LJVZFXWy11tUpLDhUV0Fc7zkLzytbG8sO0FuT+ZDkHFVge9Hc3cCeuu70SqkrGkjpuTPwEg4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1607635714814673.0758688937364; Thu, 10 Dec 2020 13:28:34 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id BE6B810C0AD4; Thu, 10 Dec 2020 21:28:30 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id DD93D10C0ACF for ; Thu, 10 Dec 2020 21:27:16 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-535-15F2fXMONqy63o4nMiCzeA-1; Thu, 10 Dec 2020 16:27:13 -0500 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0B08D1006C8D for ; Thu, 10 Dec 2020 21:27:12 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0CCF710016F5; Thu, 10 Dec 2020 21:27:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607635635; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RFwBtiz+vbIuE7Xcxm++/c0dV1AGvaq2xYHOhmsY/Sc=; b=VjUGHjJVJNj6xfUkHxnfNgtbm6L8KVD10Hfw5YLvOHOqe2u2DjZ1lac/xegYogSmQiuaKV EvDDWuiDf45OEsor+Z1bFwXzkUOJU46F009rjGgpyAZDHve6E+BxCfa2utx5uTmYVhr7Lz cm0NddpIydE9oxq0RjaMZXDK2XXxg48= X-MC-Unique: 15F2fXMONqy63o4nMiCzeA-1 From: Eduardo Habkost To: seabios@seabios.org Date: Thu, 10 Dec 2020 16:26:27 -0500 Message-Id: <20201210212640.2023885-7-ehabkost@redhat.com> In-Reply-To: <20201210212640.2023885-1-ehabkost@redhat.com> References: <20201210212640.2023885-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: E4WRE6S7Y7VALCFRD3TRH266VFJDHOXI X-Message-ID-Hash: E4WRE6S7Y7VALCFRD3TRH266VFJDHOXI X-MailFrom: ehabkost@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: "Daniel P. Berrange" , Gerd Hoffmann X-Mailman-Version: 3.3.2b1 Precedence: list Subject: [SeaBIOS] [PATCH 06/19] smbios: Use smbios_get_tables()/smbios_next() at display_uuid() List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: ------ X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Make the code more generic, and not specific for SMBIOS 2.1 entry points. Signed-off-by: Eduardo Habkost --- src/fw/biostables.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/fw/biostables.c b/src/fw/biostables.c index 1adc694c..d22ab643 100644 --- a/src/fw/biostables.c +++ b/src/fw/biostables.c @@ -327,9 +327,11 @@ void *smbios_get_tables(u32 *length) void display_uuid(void) { - struct smbios_type_1 *tbl =3D smbios_21_next(SMBios21Addr, NULL); + u32 smbios_len =3D 0; + void *smbios_tables =3D smbios_get_tables(&smbios_len); + struct smbios_type_1 *tbl =3D smbios_next(smbios_tables, smbios_len, N= ULL); int minlen =3D offsetof(struct smbios_type_1, uuid) + sizeof(tbl->uuid= ); - for (; tbl; tbl =3D smbios_21_next(SMBios21Addr, tbl)) + for (; tbl; tbl =3D smbios_next(smbios_tables, smbios_len, tbl)) if (tbl->header.type =3D=3D 1 && tbl->header.length >=3D minlen) { u8 *uuid =3D tbl->uuid; u8 empty_uuid[sizeof(tbl->uuid)] =3D { 0 }; --=20 2.28.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Fri Apr 19 10:27:20 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607635726; cv=none; d=zohomail.com; s=zohoarc; b=NezA7LsKt5uzXdg2vVrpKSwJ7neFBiugItT240X7eWl1JphWMvWiH002Om/nBcVJz57QPerW2chXUebf9c2P7qRvYpnGzRrBzoLwBkc5LDBJlXW/Ze3noUi0Is2IEotC0dOYXJ/b1QRGPxffnKwhe41DQNSTP16cEfcTVuArQmo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607635726; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Subject:To; bh=qqTVOHkNzDr+FPV/G5jUa9Kfo/I++WOcE/uQ9Nc0qVc=; b=RVsZUSe65KS/KfNkM/WuT/A+ob0TngICTFC11uUmWvwmcKNj43xDNIZ4+W47jJl5g5LCgJSErKIaJvNmqo9b7NFi05x4/neW0Q090L0kGZlLtPTbCs+pe69p2lQW3TSL8Dnbs/GLTfWPUTe/xjdLY8koyrX4Ly27XO4NAHOfqHg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1607635726837797.8682270548746; Thu, 10 Dec 2020 13:28:46 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 89A2010C0AF1; Thu, 10 Dec 2020 21:28:42 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 2134210C0AAD for ; Thu, 10 Dec 2020 21:27:20 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-569-VZi9b2e9PnS9nvU3rCuFaQ-1; Thu, 10 Dec 2020 16:27:17 -0500 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 780C1107ACF6 for ; Thu, 10 Dec 2020 21:27:16 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0D32671C80; Thu, 10 Dec 2020 21:27:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607635639; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=a1JLWVrFffKvlmQ5elWXmbYwYz7UbNyfFrrpEPsaH6A=; b=PNfCT8kN8GUIxuEzeiyIgVedESNkqzUncZKfr4y6XPdTMaaBjvn9phplIyM8XcE2X7exq1 o/NFNsDqRkRUDWVPjRO3BErdGo3lIrb4+64s7fALw6ASNzjYkLcr6NB4T5N9YW74fhzsk9 sXOLrrpBcGumB2kaWogxn9cCupZHQKc= X-MC-Unique: VZi9b2e9PnS9nvU3rCuFaQ-1 From: Eduardo Habkost To: seabios@seabios.org Date: Thu, 10 Dec 2020 16:26:28 -0500 Message-Id: <20201210212640.2023885-8-ehabkost@redhat.com> In-Reply-To: <20201210212640.2023885-1-ehabkost@redhat.com> References: <20201210212640.2023885-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: XHO3CQ4GGAH2ODBJNJPIH54WJQG37MIO X-Message-ID-Hash: XHO3CQ4GGAH2ODBJNJPIH54WJQG37MIO X-MailFrom: ehabkost@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: "Daniel P. Berrange" , Gerd Hoffmann X-Mailman-Version: 3.3.2b1 Precedence: list Subject: [SeaBIOS] [PATCH 07/19] smbios: smbios_major_version()/smbios_minor_version() helpers List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: ------ X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" They new helpers will be useful when we start supporting SMBIOS 3.0 entry points. Use the new helpers at display_uuid(). Signed-off-by: Eduardo Habkost --- src/fw/biostables.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/fw/biostables.c b/src/fw/biostables.c index d22ab643..10eaa369 100644 --- a/src/fw/biostables.c +++ b/src/fw/biostables.c @@ -324,6 +324,24 @@ void *smbios_get_tables(u32 *length) return NULL; } =20 +static int +smbios_major_version(void) +{ + if (SMBios21Addr) + return SMBios21Addr->smbios_major_version; + else + return 0; +} + +static int +smbios_minor_version(void) +{ + if (SMBios21Addr) + return SMBios21Addr->smbios_minor_version; + else + return 0; +} + void display_uuid(void) { @@ -344,9 +362,9 @@ display_uuid(void) * the encoding, but we follow dmidecode and assume big-endian * encoding. */ - if (SMBios21Addr->smbios_major_version > 2 || - (SMBios21Addr->smbios_major_version =3D=3D 2 && - SMBios21Addr->smbios_minor_version >=3D 6)) { + if (smbios_major_version() > 2 || + (smbios_major_version() =3D=3D 2 && + smbios_minor_version() >=3D 6)) { printf("Machine UUID" " %02x%02x%02x%02x" "-%02x%02x" --=20 2.28.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Fri Apr 19 10:27:20 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607635739; cv=none; d=zohomail.com; s=zohoarc; b=Jk+Z8/oZRnl3Xl8mWGObrFPhQ8FL7BXTa0Nq2R06+S0mm1Qvbr1QV2TxzyVXPa0WUbsOBp2lF0R05PBsxcDAhk434ItlqwCY0wttCb8Ndy9xHUdlQzu9R6iZWmFxvtDIrkmcpku2QUIq/beRpvXM4yrbgn52bBmp5OX0MOP0hiU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607635739; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Subject:To; bh=JGS7XhVjmzaNTLZwYij7uhYawlIuWIae3r866lBupwg=; b=NUXQwv8nqjM49ZCxi1N414ROoAEGj28fIIbR1de3Pqm1IAwZtXUGaAxw1YueSXaSBJpzXtP2Krqwe+xRl3LdomrY0KUD/6KkICI0/9kitZt1sw2PkvqtwmOBTMUyi/qBp6jmthR/Gx2ZFLdFsR0D5CicN568qB4+IU5bnIzpOIw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1607635739344695.1492714029938; Thu, 10 Dec 2020 13:28:59 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 2679210C0AD6; Thu, 10 Dec 2020 21:28:55 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 24D1510C0ACE for ; Thu, 10 Dec 2020 21:27:22 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-39-I-In67N8NKKZqNIIR5GLrQ-1; Thu, 10 Dec 2020 16:27:19 -0500 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4F4D659 for ; Thu, 10 Dec 2020 21:27:18 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.corp.redhat.com (Postfix) with ESMTP id DA5421001B2C; Thu, 10 Dec 2020 21:27:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607635641; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0LvUCvWhLrFP7sV9lkKrO2jawvzaejCstBmDoFu2anc=; b=EdMLA2pnkqxSy9WADoHGefS5axo1ULL8252ety0xmiLpDvN+BxS9oHL5DnTOZ/6pkNc7cm 1YqZ2OdgKJTHaJd0FJtkpQy4vApywo3AjLjwCVLgl2xCaAN+KppVwuYaYnpW5tZx3mk6iy 2w8WO38r/O7HdOTBFH/b0SuUnBI3G6k= X-MC-Unique: I-In67N8NKKZqNIIR5GLrQ-1 From: Eduardo Habkost To: seabios@seabios.org Date: Thu, 10 Dec 2020 16:26:29 -0500 Message-Id: <20201210212640.2023885-9-ehabkost@redhat.com> In-Reply-To: <20201210212640.2023885-1-ehabkost@redhat.com> References: <20201210212640.2023885-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: YG6HUDEF2JA54R6EWFALXVCRGGR3LIDU X-Message-ID-Hash: YG6HUDEF2JA54R6EWFALXVCRGGR3LIDU X-MailFrom: ehabkost@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: "Daniel P. Berrange" , Gerd Hoffmann X-Mailman-Version: 3.3.2b1 Precedence: list Subject: [SeaBIOS] [PATCH 08/19] tpm: Use smbios_get_tables() List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: ------ X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Instead of using the SMBios21Addr global variable, use the smbios_get_tables() helper. This doesn't change any behavior yet, but it will be useful when we start supporting SMBIOS 3.0 entry points. Signed-off-by: Eduardo Habkost --- src/tcgbios.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/tcgbios.c b/src/tcgbios.c index 148c0220..841da708 100644 --- a/src/tcgbios.c +++ b/src/tcgbios.c @@ -1028,15 +1028,15 @@ tpm_smbios_measure(void) .eventid =3D 1, .eventdatasize =3D SHA1_BUFSIZE, }; - struct smbios_21_entry_point *sep =3D SMBios21Addr; + u32 smbios_len; + void *smbios_tables =3D smbios_get_tables(&smbios_len); =20 - dprintf(DEBUG_tcg, "TCGBIOS: SMBIOS at %p\n", sep); + dprintf(DEBUG_tcg, "TCGBIOS: SMBIOS tables at %p\n", smbios_tables); =20 - if (!sep) + if (!smbios_tables) return; =20 - sha1((const u8 *)sep->structure_table_address, - sep->structure_table_length, pcctes.digest); + sha1((const u8 *)smbios_tables, smbios_len, pcctes.digest); tpm_add_measurement_to_log(1, EV_EVENT_TAG, (const char *)&pcctes, sizeof(pcctes), --=20 2.28.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Fri Apr 19 10:27:20 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607635751; cv=none; d=zohomail.com; s=zohoarc; b=WsKjN9Q5cRBmuXiZ2/G+9yo3C/vm15f1fLA1tzu6tCuBtpwlT2JM6W9yAKVcPXxKAoaMWacCKtYeqoMelhEFYcg2/2+GdbKzMxsX8EupjpTdHIlqd9emQCAWVursle5c/B00CUf9dxthkJYu9nEXQkzqIHpRmtmLloytwkjfiWU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607635751; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Subject:To; bh=PTuXAraxlnBorgattvhEADlwDk2W5eqrY31yWQqEo8U=; b=ePe0h6xds2ZqKgsFVspwtvFwP5WpfQlq5Fr8/4TimNTSiolaDiZE4oA7E2EWEujabZvFbK1EiNp8WIkij+A2nm68S/nSxHmOGuydTg5kE6bujl5M6j5kdC/Q9XOYJY1XURbvaoxU3qGUgS9QsH/YAM1Y4t8oFrcznPxqNfxeKoI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1607635751412723.9805962196274; Thu, 10 Dec 2020 13:29:11 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 0874010C0AFD; Thu, 10 Dec 2020 21:29:06 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 55AC610C0AD1 for ; Thu, 10 Dec 2020 21:27:27 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-175-wcMnnvwcMs2dkJ91ZTuqsQ-1; Thu, 10 Dec 2020 16:27:24 -0500 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9B4951012E66 for ; Thu, 10 Dec 2020 21:27:23 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.corp.redhat.com (Postfix) with ESMTP id B122160BF3; Thu, 10 Dec 2020 21:27:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607635646; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=or+i0gCg909AyyhkKYjEsqxrlTBa11/ydly86neWPBw=; b=AXAhzkSVpSUT4LQ+8jQsYEG/21uYeKOPvjMZW0+DrK0oEera/kltaSmoWMYNUsJGdPTv8/ +B+2b+F2zN6EnD+BV4YOmCMLLyVOaywnMEE/Qiy0jOl8A0+wz5CX/7EKKB6yaZnjB7SQ4r 2s8K6CO1R9X4nrMLvy6r4RJu0aDVGUw= X-MC-Unique: wcMnnvwcMs2dkJ91ZTuqsQ-1 From: Eduardo Habkost To: seabios@seabios.org Date: Thu, 10 Dec 2020 16:26:30 -0500 Message-Id: <20201210212640.2023885-10-ehabkost@redhat.com> In-Reply-To: <20201210212640.2023885-1-ehabkost@redhat.com> References: <20201210212640.2023885-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: 76NV34PAMAQKYOE3JAPBHDN2GAP5A7ID X-Message-ID-Hash: 76NV34PAMAQKYOE3JAPBHDN2GAP5A7ID X-MailFrom: ehabkost@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: "Daniel P. Berrange" , Gerd Hoffmann X-Mailman-Version: 3.3.2b1 Precedence: list Subject: [SeaBIOS] [PATCH 09/19] csm: Don't check SMBios21Addr before calling copy_smbios_21() List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: ------ X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" copy_smbios_21() already checks if SMBios21Addr is NULL, there's no need to check it before calling the function. Signed-off-by: Eduardo Habkost --- src/fw/csm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fw/csm.c b/src/fw/csm.c index 74069028..bc14a925 100644 --- a/src/fw/csm.c +++ b/src/fw/csm.c @@ -172,7 +172,7 @@ handle_csm_0002(struct bregs *regs) =20 // SMBIOS table needs to be copied into the f-seg // XX: OVMF doesn't seem to set SmbiosTableLength so don't check it - if (csm_boot_table->SmbiosTable && !SMBios21Addr) + if (csm_boot_table->SmbiosTable) copy_smbios_21((void *)csm_boot_table->SmbiosTable); =20 // MPTABLE is just there; we don't care where. --=20 2.28.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Fri Apr 19 10:27:20 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607635763; cv=none; d=zohomail.com; s=zohoarc; b=Bj9XkVt0Q42bHzuHXTl6Q8u4c8ryEOh1Rd2cglGpZfM+gH7zgEKg7ca1sergDRqUeU2pSdA+mu1d0axRohRMrIiAGdfVcpqtG5NggJ29K7sNXSgrN/d+gt8fF+8LfJGEspFlKEpH4dF58e920YD+PkPWqvBR5xlv4426tx4CvKM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607635763; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Subject:To; bh=QaIHLOYhiBU3Ye2f/csoyWmtVLVIhPKMPfBKytMPbAY=; b=HswU53kLXqc95U1A8cjf6DZA4PKFW82pXU6oIyWPZw0oIAiK/tSFNYA7XhhB4D6nLc0zrZtZoBC0+aRnzqjaf5HCIDJRvYq3KmqvOj46MfrfB2CZVsnSlYPjYUY8bSKCKPB7UpMq71rqGmrGH6yRAYGn8u54vnSUdceauL44J/g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1607635763042308.09087455601195; Thu, 10 Dec 2020 13:29:23 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 0256510C0AF3; Thu, 10 Dec 2020 21:29:18 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 85C5C10C0ACE for ; Thu, 10 Dec 2020 21:27:29 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-65-j0zT56fHMKWgtTfEMeaFHQ-1; Thu, 10 Dec 2020 16:27:26 -0500 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 08C1D1006C9B for ; Thu, 10 Dec 2020 21:27:25 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.corp.redhat.com (Postfix) with ESMTP id BABD960BF3; Thu, 10 Dec 2020 21:27:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607635648; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3WZXbTwMElvcTFrgs6sHFGenA0dI2KhfUz/F3/yvTIs=; b=fyc/fOAhguo+E0uS8CxNVQClgIlLT3BTnBDNrheQFQngJD4f0Ux2IE9u+VvyJbPClZWViE pr6+hUCGCsKGrjBp5yjQVa+Y84H9BO8ilWL0TUarDkdTMlOjUq2Vtdmns0jY90+XzIqiP4 UIDxsHcmQeydQmhWM8gaUEfzxkZ1i4I= X-MC-Unique: j0zT56fHMKWgtTfEMeaFHQ-1 From: Eduardo Habkost To: seabios@seabios.org Date: Thu, 10 Dec 2020 16:26:31 -0500 Message-Id: <20201210212640.2023885-11-ehabkost@redhat.com> In-Reply-To: <20201210212640.2023885-1-ehabkost@redhat.com> References: <20201210212640.2023885-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: QVZS6LEO2O65DO64MZ2E6KZJCMCANNI5 X-Message-ID-Hash: QVZS6LEO2O65DO64MZ2E6KZJCMCANNI5 X-MailFrom: ehabkost@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: "Daniel P. Berrange" , Gerd Hoffmann X-Mailman-Version: 3.3.2b1 Precedence: list Subject: [SeaBIOS] [PATCH 10/19] smbios: Make SMBios21Addr variable static List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: ------ X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The variable is now only used inside biostables.c, there's no need to make it global. Signed-off-by: Eduardo Habkost --- src/util.h | 1 - src/fw/biostables.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/util.h b/src/util.h index 2e151752..aff8e888 100644 --- a/src/util.h +++ b/src/util.h @@ -87,7 +87,6 @@ void *find_acpi_table(u32 signature); u32 find_resume_vector(void); void acpi_reboot(void); void find_acpi_features(void); -extern struct smbios_21_entry_point *SMBios21Addr; void *smbios_get_tables(u32 *length); void copy_smbios_21(void *pos); void display_uuid(void); diff --git a/src/fw/biostables.c b/src/fw/biostables.c index 10eaa369..47463be9 100644 --- a/src/fw/biostables.c +++ b/src/fw/biostables.c @@ -296,7 +296,7 @@ smbios_21_next(struct smbios_21_entry_point *smbios, vo= id *prev) smbios->structure_table_length, prev); } =20 -struct smbios_21_entry_point *SMBios21Addr; +static struct smbios_21_entry_point *SMBios21Addr; =20 void copy_smbios_21(void *pos) --=20 2.28.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Fri Apr 19 10:27:20 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607635773; cv=none; d=zohomail.com; s=zohoarc; b=iJz14QgwJdsV2DRdMlNwT7UbYxOsBMWV1ZmUfpCqaiY9JTKOwzrD16FcHYLnYYS3VJG6wJDPnGjNaL7ie0X20X8qudbxA7HcDP54apZGHY9zFVEDaXD1R/m9NtXvbL8GkvNpb/auK0dScLhfJ0y0shyWwVhIrv7keIsJQgw06AI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607635773; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Subject:To; bh=Bsh25QiULPXTkavs9+uaXrzaRAR5YnViUplCt/ugCTQ=; b=BCbHjnJHaJzDQYKpilsZCrus1E0MQaxSP/r2b7Ls/0CJItargzUTuNh5vMGRayh641BrYxPHVX/yT/B+rRFCQhmnS+Ir1utejRNZXJFJzdZi8/Bs+3/nT27pbWFvRSSR/C2XzSAtwBV58v2fTmzF8PtNDBXvC7xtTHxyzeSyvc8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 160763577399091.18300794227116; Thu, 10 Dec 2020 13:29:33 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id E36F610C0AFD; Thu, 10 Dec 2020 21:29:29 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 3052A10C0AD2 for ; Thu, 10 Dec 2020 21:27:30 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-179-vzQf1treMXS98K-SWwnrEw-1; Thu, 10 Dec 2020 16:27:27 -0500 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 52EA41936B60 for ; Thu, 10 Dec 2020 21:27:26 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.corp.redhat.com (Postfix) with ESMTP id 046FF5C6C1; Thu, 10 Dec 2020 21:27:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607635649; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v0qLau7P9bTfD08herGHfFs1Nw+iqpURwbRQWr/GbFs=; b=JtQm2fhGTM/Pko0TceoxgklmWh8bleCnfjl2XOQKIu9pEHI7YqAz2PrKURWT5LDGIKPpMQ KKwRerxHSg/5UnflkIoI50EjfJxit9nERQ+qLPDkBBhuRvPrOqFuLR6ydOIGPoq1Svo2le zFnISZYmlLC712BVBllrnWsGs+oc3N8= X-MC-Unique: vzQf1treMXS98K-SWwnrEw-1 From: Eduardo Habkost To: seabios@seabios.org Date: Thu, 10 Dec 2020 16:26:32 -0500 Message-Id: <20201210212640.2023885-12-ehabkost@redhat.com> In-Reply-To: <20201210212640.2023885-1-ehabkost@redhat.com> References: <20201210212640.2023885-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: 26XL2UHRAEU2OUOF3WRZ5TNZU2AROACK X-Message-ID-Hash: 26XL2UHRAEU2OUOF3WRZ5TNZU2AROACK X-MailFrom: ehabkost@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: "Daniel P. Berrange" , Gerd Hoffmann X-Mailman-Version: 3.3.2b1 Precedence: list Subject: [SeaBIOS] [PATCH 11/19] smbios: Use smbios_next() at smbios_romfile_setup() List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: ------ X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Use smbios_next() instead of smbios_21_next(), to make the code more generic and reusable for SMBIOS 3.0 support. Note that `qtables_len` is initialized to `ftables->size` instead of `ep.structure_table_length` now, but both fields are guaranteed to have exactly the same value. Signed-off-by: Eduardo Habkost --- src/fw/biostables.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/fw/biostables.c b/src/fw/biostables.c index 47463be9..11eaeaec 100644 --- a/src/fw/biostables.c +++ b/src/fw/biostables.c @@ -477,16 +477,17 @@ smbios_romfile_setup(void) return 0; } f_tables->copy(f_tables, qtables, f_tables->size); - ep.structure_table_address =3D (u32)qtables; /* for smbios_21_next(), = below */ + qtables_len =3D f_tables->size; =20 /* did we get a type 0 structure ? */ - for (t0 =3D smbios_21_next(&ep, NULL); t0; t0 =3D smbios_21_next(&ep, = t0)) + for (t0 =3D smbios_next(qtables, qtables_len, NULL); t0; + t0 =3D smbios_next(qtables, qtables_len, t0)) { if (t0->header.type =3D=3D 0) { need_t0 =3D 0; break; } + } =20 - qtables_len =3D ep.structure_table_length; if (need_t0) { /* common case: add our own type 0, with 3 strings and 4 '\0's */ u16 t0_len =3D sizeof(struct smbios_type_0) + strlen(BIOS_NAME) + --=20 2.28.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Fri Apr 19 10:27:20 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607635787; cv=none; d=zohomail.com; s=zohoarc; b=BoXBeu59sodezw1yZNq5avzmx5rWwOWE/7S25Gfhu8QMjiA5XSx4Ej8/QqaYQ3dd+cMkXVXPJaWtYqrllttlrW1B9PRW1iTB7UNv1cODUM9Fs89kHa5S/Mu7MmSuyGRwmTFW4bzHXY33bUo3WXIuGMiiNjASFcfH+fh5TmrC0Ic= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607635787; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Subject:To; bh=ZoZZu60x5EwKUav/Ab5+mGexc66t7s5yIhW3TBkyHtI=; b=dJEisKlB5MgNvdkxrQBBi+Pa7l3Ao37BFNLl7P+veuGY96gw9bW5YJ3EsSv1QdD+lT+sfciDKzHZLBguV+vRYo7vNR/pR0e2iLPfCd/q/34H8WQbDQS9kz0dOkcfNktOYFmc1pr94NN7riiDV2C0SaBig9s1wjN74gvjt1lUHX8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1607635787472813.9764442080627; Thu, 10 Dec 2020 13:29:47 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id F2A1210C0ACB; Thu, 10 Dec 2020 21:29:43 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id AF6F710C0AD3 for ; Thu, 10 Dec 2020 21:27:36 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-48--ydEcvcWMKWETfYnYLVTtA-1; Thu, 10 Dec 2020 16:27:31 -0500 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C7F95801817 for ; Thu, 10 Dec 2020 21:27:30 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E0795D9CC; Thu, 10 Dec 2020 21:27:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607635655; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HIJ31Ko/jBn9iPNEdFA5ohsCz+Ymp7JDf7V/lqEM8D4=; b=RMpxyC9+MWm83ngs6qqVu5bTY2pMtOcOE8IDL/safz5II+9inCtrVujo6YcTxi62A+Kn0x JB/zWBkGJnSX5unzRwPvQLPbu+GXvnM3S86fB6EVx5VFs1IV9+T9ilLxrchOc9RLpgI035 mNLYuRiUnsGKI94JhGwQKVrwNJ06fxA= X-MC-Unique: -ydEcvcWMKWETfYnYLVTtA-1 From: Eduardo Habkost To: seabios@seabios.org Date: Thu, 10 Dec 2020 16:26:33 -0500 Message-Id: <20201210212640.2023885-13-ehabkost@redhat.com> In-Reply-To: <20201210212640.2023885-1-ehabkost@redhat.com> References: <20201210212640.2023885-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: 4AXSON4G76Q5I6HWGRCPMPSPGNTKIAOS X-Message-ID-Hash: 4AXSON4G76Q5I6HWGRCPMPSPGNTKIAOS X-MailFrom: ehabkost@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: "Daniel P. Berrange" , Gerd Hoffmann X-Mailman-Version: 3.3.2b1 Precedence: list Subject: [SeaBIOS] [PATCH 12/19] smbios: Extract SMBIOS table building code to separate function List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: --- X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Move the code that builds the SMBIOS tables to a separate smbios_build_tables() function, to keep it isolated from the code that initializes the SMBIOS entry point. Thew new function will still take a smbios_21_entry_point argument to make code review easier, but this will be changed by the next commits. Signed-off-by: Eduardo Habkost --- src/fw/biostables.c | 54 ++++++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 20 deletions(-) diff --git a/src/fw/biostables.c b/src/fw/biostables.c index 11eaeaec..5eeceb52 100644 --- a/src/fw/biostables.c +++ b/src/fw/biostables.c @@ -453,22 +453,19 @@ smbios_new_type_0(void *start, #define BIOS_NAME "SeaBIOS" #define BIOS_DATE "04/01/2014" =20 +/* + * Build tables using qtables as input, adding additional type 0 + * table if necessary. + */ static int -smbios_romfile_setup(void) +smbios_build_tables(struct romfile_s *f_tables, + struct smbios_21_entry_point *ep) { - struct romfile_s *f_anchor =3D romfile_find("etc/smbios/smbios-anchor"= ); - struct romfile_s *f_tables =3D romfile_find("etc/smbios/smbios-tables"= ); - struct smbios_21_entry_point ep; struct smbios_type_0 *t0; u16 qtables_len, need_t0 =3D 1; u8 *qtables, *tables; =20 - if (!f_anchor || !f_tables || f_anchor->size !=3D sizeof(ep)) - return 0; - - f_anchor->copy(f_anchor, &ep, f_anchor->size); - - if (f_tables->size !=3D ep.structure_table_length) + if (f_tables->size !=3D ep->structure_table_length) return 0; =20 qtables =3D malloc_tmphigh(f_tables->size); @@ -492,35 +489,52 @@ smbios_romfile_setup(void) /* common case: add our own type 0, with 3 strings and 4 '\0's */ u16 t0_len =3D sizeof(struct smbios_type_0) + strlen(BIOS_NAME) + strlen(VERSION) + strlen(BIOS_DATE) + 4; - if (t0_len > (0xffff - ep.structure_table_length)) { + if (t0_len > (0xffff - ep->structure_table_length)) { dprintf(1, "Insufficient space (%d bytes) to add SMBIOS type 0= table (%d bytes)\n", - 0xffff - ep.structure_table_length, t0_len); + 0xffff - ep->structure_table_length, t0_len); need_t0 =3D 0; } else { - ep.structure_table_length +=3D t0_len; - if (t0_len > ep.max_structure_size) - ep.max_structure_size =3D t0_len; - ep.number_of_structures++; + ep->structure_table_length +=3D t0_len; + if (t0_len > ep->max_structure_size) + ep->max_structure_size =3D t0_len; + ep->number_of_structures++; } } =20 /* allocate final blob and record its address in the entry point */ - if (ep.structure_table_length > BUILD_MAX_SMBIOS_FSEG) - tables =3D malloc_high(ep.structure_table_length); + if (ep->structure_table_length > BUILD_MAX_SMBIOS_FSEG) + tables =3D malloc_high(ep->structure_table_length); else - tables =3D malloc_fseg(ep.structure_table_length); + tables =3D malloc_fseg(ep->structure_table_length); if (!tables) { warn_noalloc(); free(qtables); return 0; } - ep.structure_table_address =3D (u32)tables; + ep->structure_table_address =3D (u32)tables; =20 /* populate final blob */ if (need_t0) tables =3D smbios_new_type_0(tables, BIOS_NAME, VERSION, BIOS_DATE= ); memcpy(tables, qtables, qtables_len); free(qtables); + return 1; +} + +static int +smbios_romfile_setup(void) +{ + struct romfile_s *f_anchor =3D romfile_find("etc/smbios/smbios-anchor"= ); + struct romfile_s *f_tables =3D romfile_find("etc/smbios/smbios-tables"= ); + struct smbios_21_entry_point ep; + + if (!f_anchor || !f_tables || f_anchor->size !=3D sizeof(ep)) + return 0; + + f_anchor->copy(f_anchor, &ep, f_anchor->size); + + if (!smbios_build_tables(f_tables, &ep)) + return 0; =20 /* finalize entry point */ ep.checksum -=3D checksum(&ep, 0x10); --=20 2.28.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Fri Apr 19 10:27:20 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607635799; cv=none; d=zohomail.com; s=zohoarc; b=PXwpL3knk6WFpUmS0/Y+rQq34ZR+QyT5bPcH5R0uZNuqGCVpMXFnAJN8WzXWlkFSyE9zSC12jGMsHhZKGNHAWg6kvREbDrn5EZa1SIf4RQyht7lb78qszjQWEyrAc8sPS8iivzuZcLMp0cBYdeD4ws+J+vm+eMpGispdjoalrII= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607635799; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Subject:To; bh=pw6yn0IVIRrUpSnRVXIIwVtl7blA9FngHrk6QJXfcL0=; b=PCDIZsa1RyHsCO7b7YL045BPDnYb/vqgZISXT6SEfikhIXCq7K4LmOkqcoa0wVWIIVkYh1t6cFsTNziv5U5xZMzEyFwwWuuxtUyMMNQsnuqUJ5F90RhgGAPquvAq/O4EeAJFJtNN+Fb13YNLhFa9HbeqSmZBw65RLoio/znVRss= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1607635799130801.7260412925832; Thu, 10 Dec 2020 13:29:59 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 070F410C0AD4; Thu, 10 Dec 2020 21:29:54 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 68C7210C0AD4 for ; Thu, 10 Dec 2020 21:27:37 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-163-10avMEnDNSOmcHUqjDEtvA-1; Thu, 10 Dec 2020 16:27:34 -0500 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9F3F31936B78 for ; Thu, 10 Dec 2020 21:27:32 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.corp.redhat.com (Postfix) with ESMTP id 363DD60BF1; Thu, 10 Dec 2020 21:27:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607635656; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KW3zhMMJ1Y1vhcmRdC8uPE8fGwYdz1XmTD5kNS+nGp8=; b=VvQB5u3HVjmyRCNES2aaVz3uAHe4ri6L+DeBNkW4/uZ00Jw+nVFm1p012TWsbwppDx24Io DLiKHTerBemfOoF2jCkMuh/J8kBwptSMTPwYEErnbJz741tlqaz5IS8w/d0U56HWAP9kpw S4iLQL6aNfk1s8FbPyUCGuE5Fa2dQAs= X-MC-Unique: 10avMEnDNSOmcHUqjDEtvA-1 From: Eduardo Habkost To: seabios@seabios.org Date: Thu, 10 Dec 2020 16:26:34 -0500 Message-Id: <20201210212640.2023885-14-ehabkost@redhat.com> In-Reply-To: <20201210212640.2023885-1-ehabkost@redhat.com> References: <20201210212640.2023885-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: VZLUDF66HKMDWDBROJ77SLA5XQXABT6E X-Message-ID-Hash: VZLUDF66HKMDWDBROJ77SLA5XQXABT6E X-MailFrom: ehabkost@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: "Daniel P. Berrange" , Gerd Hoffmann X-Mailman-Version: 3.3.2b1 Precedence: list Subject: [SeaBIOS] [PATCH 13/19] smbios: Make smbios_build_tables() more generic List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: --- X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Instead of taking a SMBIOS 2.1 entry point as argument, make smbios_build_tables() take pointers to the fields it actually changes. This will allow us to reuse the function for SMBIOS 3.0 later. Signed-off-by: Eduardo Habkost --- src/fw/biostables.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/fw/biostables.c b/src/fw/biostables.c index 5eeceb52..f0aa7ed3 100644 --- a/src/fw/biostables.c +++ b/src/fw/biostables.c @@ -459,13 +459,15 @@ smbios_new_type_0(void *start, */ static int smbios_build_tables(struct romfile_s *f_tables, - struct smbios_21_entry_point *ep) + u32 *address, u16 *length, + u16 *max_structure_size, + u16 *number_of_structures) { struct smbios_type_0 *t0; u16 qtables_len, need_t0 =3D 1; u8 *qtables, *tables; =20 - if (f_tables->size !=3D ep->structure_table_length) + if (f_tables->size !=3D *length) return 0; =20 qtables =3D malloc_tmphigh(f_tables->size); @@ -489,29 +491,29 @@ smbios_build_tables(struct romfile_s *f_tables, /* common case: add our own type 0, with 3 strings and 4 '\0's */ u16 t0_len =3D sizeof(struct smbios_type_0) + strlen(BIOS_NAME) + strlen(VERSION) + strlen(BIOS_DATE) + 4; - if (t0_len > (0xffff - ep->structure_table_length)) { + if (t0_len > (0xffff - *length)) { dprintf(1, "Insufficient space (%d bytes) to add SMBIOS type 0= table (%d bytes)\n", - 0xffff - ep->structure_table_length, t0_len); + 0xffff - *length, t0_len); need_t0 =3D 0; } else { - ep->structure_table_length +=3D t0_len; - if (t0_len > ep->max_structure_size) - ep->max_structure_size =3D t0_len; - ep->number_of_structures++; + *length +=3D t0_len; + if (t0_len > *max_structure_size) + *max_structure_size =3D t0_len; + (*number_of_structures)++; } } =20 /* allocate final blob and record its address in the entry point */ - if (ep->structure_table_length > BUILD_MAX_SMBIOS_FSEG) - tables =3D malloc_high(ep->structure_table_length); + if (*length > BUILD_MAX_SMBIOS_FSEG) + tables =3D malloc_high(*length); else - tables =3D malloc_fseg(ep->structure_table_length); + tables =3D malloc_fseg(*length); if (!tables) { warn_noalloc(); free(qtables); return 0; } - ep->structure_table_address =3D (u32)tables; + *address =3D (u32)tables; =20 /* populate final blob */ if (need_t0) @@ -533,7 +535,11 @@ smbios_romfile_setup(void) =20 f_anchor->copy(f_anchor, &ep, f_anchor->size); =20 - if (!smbios_build_tables(f_tables, &ep)) + if (!smbios_build_tables(f_tables, + &ep.structure_table_address, + &ep.structure_table_length, + &ep.max_structure_size, + &ep.number_of_structures)) return 0; =20 /* finalize entry point */ --=20 2.28.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Fri Apr 19 10:27:20 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607635810; cv=none; d=zohomail.com; s=zohoarc; b=CrFdUA069wkzRMWEaHSwMC8OfHG/Mznlgifm0c8MPPOhiTgWi449MvLRHx7c0+J8bsVJu8YhtASQwtUPbdhtewLj59WYs5g6XMSgHNo5nUK2dWkABRvVHR4V8bXkXAgso64AKPHC5svz8RI7KQQt/4WwrzBH/fFUTLzfyH0ymEc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607635810; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Subject:To; bh=W0pYNcD98S1ezihRw434I5PwOuXYnbhUerOENytBhJI=; b=nYVj7IkqCMIGQbkFx4HEB40i65oKHncfYKgvpE1RwS3pHPu9UYrMK7MefUxKMK2CZ4UHHTkkNR6U/tTinnldmkzbHAv3uukVPf+4aPQMs/dhDqA2nzVmmJnPeyAUWi91AARyFNyRLycMG+7/NyfTjztMl8ZedsUE7i1NvVjQxDI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1607635810311887.3933171743884; Thu, 10 Dec 2020 13:30:10 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id ACF6910C0AFE; Thu, 10 Dec 2020 21:30:05 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 62C9810C0AD5 for ; Thu, 10 Dec 2020 21:27:41 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-506-Udjhst-7MROpFzPKDumeGA-1; Thu, 10 Dec 2020 16:27:38 -0500 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 834FD59 for ; Thu, 10 Dec 2020 21:27:37 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.corp.redhat.com (Postfix) with ESMTP id 857E06F982; Thu, 10 Dec 2020 21:27:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607635660; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fRqZOEtCw4ubxuegj4NXUNkEZa19PfQM4qkiSAYrD3s=; b=g4nCiP2+KXqTgGGsr26P4GlTJBkau91Bx42IwWD/RrAcyupC6+C3KBvLYkvObPDwpEjLbC pFnLBTAAnRSFSCgE8F0ltFkwEgJ741CRFocYZyIAqgnrVEDIv/DqZTn3uO69WarV/Kecth a6/scaP/2x4AOpFHa32+uceJ3ZY39uA= X-MC-Unique: Udjhst-7MROpFzPKDumeGA-1 From: Eduardo Habkost To: seabios@seabios.org Date: Thu, 10 Dec 2020 16:26:35 -0500 Message-Id: <20201210212640.2023885-15-ehabkost@redhat.com> In-Reply-To: <20201210212640.2023885-1-ehabkost@redhat.com> References: <20201210212640.2023885-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: XDJMFYXC676ZDXV2PXYCYN3OSNVGE4G7 X-Message-ID-Hash: XDJMFYXC676ZDXV2PXYCYN3OSNVGE4G7 X-MailFrom: ehabkost@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: "Daniel P. Berrange" , Gerd Hoffmann X-Mailman-Version: 3.3.2b1 Precedence: list Subject: [SeaBIOS] [PATCH 14/19] smbios: smbios_21_setup_entry_point() function List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: ------ X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Extract the code specific for building the SMBIOS 2.1 entry point from smbios_romfile_setup() to a new smbios_21_setup_entry_point() function. Signed-off-by: Eduardo Habkost --- src/fw/biostables.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/src/fw/biostables.c b/src/fw/biostables.c index f0aa7ed3..559a5867 100644 --- a/src/fw/biostables.c +++ b/src/fw/biostables.c @@ -523,6 +523,25 @@ smbios_build_tables(struct romfile_s *f_tables, return 1; } =20 +static int +smbios_21_setup_entry_point(struct romfile_s *f_tables, + struct smbios_21_entry_point *ep) +{ + if (!smbios_build_tables(f_tables, + &ep->structure_table_address, + &ep->structure_table_length, + &ep->max_structure_size, + &ep->number_of_structures)) + return 0; + + /* finalize entry point */ + ep->checksum -=3D checksum(ep, 0x10); + ep->intermediate_checksum -=3D checksum((void *)ep + 0x10, ep->length = - 0x10); + + copy_smbios_21(ep); + return 1; +} + static int smbios_romfile_setup(void) { @@ -535,19 +554,7 @@ smbios_romfile_setup(void) =20 f_anchor->copy(f_anchor, &ep, f_anchor->size); =20 - if (!smbios_build_tables(f_tables, - &ep.structure_table_address, - &ep.structure_table_length, - &ep.max_structure_size, - &ep.number_of_structures)) - return 0; - - /* finalize entry point */ - ep.checksum -=3D checksum(&ep, 0x10); - ep.intermediate_checksum -=3D checksum((void *)&ep + 0x10, ep.length -= 0x10); - - copy_smbios_21(&ep); - return 1; + return smbios_21_setup_entry_point(f_tables, &ep); } =20 void --=20 2.28.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Fri Apr 19 10:27:20 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607635820; cv=none; d=zohomail.com; s=zohoarc; b=oHR4DaDW7vCPzITKFP/XwZGY20e+B6DDCL3aWZr+X+Gp1AHJFbDyKeBSCuRHpECeUyWUeWo5cyoNqtfRWwpWQKAP5sP3AjzocMb53wdTKnZXkf8/wxDPNitDeJeWPNyr0jrn30aumWkzAHsp0+tajt81ItL8t9gJphBscpfDYh8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607635820; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Subject:To; bh=bQisy47KqgnXLhO5Rijq+NqnLwHCuwgFi3YBWLO8vqI=; b=Hl/mLGdoL9CRwlkCtoUkP/qRdP8cTXBPhmgNca0Vty449s7hU5HAXZGjEjXgiArZf/8WWCnUrwcdIc6aRr99VH1vSlcniAFnEhRmAA7ZR8yR7zFlNk34ipQU1yXmqgpQq7++3vX9/HU2scOOiYX2BRsPZFejToX12EnpH5CKJNg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1607635820532150.94545931644666; Thu, 10 Dec 2020 13:30:20 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 6F46610C0AF0; Thu, 10 Dec 2020 21:30:16 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id DF0DC10C0AD3 for ; Thu, 10 Dec 2020 21:27:42 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-459-ZVE0G_bQMEynWN6QxqlUGA-1; Thu, 10 Dec 2020 16:27:40 -0500 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F3C4F107ACE8 for ; Thu, 10 Dec 2020 21:27:38 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8AA266F965; Thu, 10 Dec 2020 21:27:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607635661; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sKF74/qKNiZ/+0BrMsTHJ94hQ+IAnaN5zwfUu/IYYNs=; b=cVa1jAGxFIAzhYqOCcq1UD4UtooVAWuDyE8wI2Aao6ghhHRQUyT6wR7QNfv8KR4XHRa+qK N6KClOSl2m95rutknV7FVySayRhhveWpd06YgmLnjZt5qu1YKgbJ07apiPfzijoDGJ2pT6 8xEEuHg14NDagUctt+IRNutrqV4Od/k= X-MC-Unique: ZVE0G_bQMEynWN6QxqlUGA-1 From: Eduardo Habkost To: seabios@seabios.org Date: Thu, 10 Dec 2020 16:26:36 -0500 Message-Id: <20201210212640.2023885-16-ehabkost@redhat.com> In-Reply-To: <20201210212640.2023885-1-ehabkost@redhat.com> References: <20201210212640.2023885-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: WGRQT6LSJKG2T5SDY3L5LMMDTAVVWI54 X-Message-ID-Hash: WGRQT6LSJKG2T5SDY3L5LMMDTAVVWI54 X-MailFrom: ehabkost@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: "Daniel P. Berrange" , Gerd Hoffmann X-Mailman-Version: 3.3.2b1 Precedence: list Subject: [SeaBIOS] [PATCH 15/19] smbios: Make some smbios_build_tables() arguments optional List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: ------ X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Make max_structure_size and number_of_structures optional, as we don't have those fields in SMBIOS 3.0 entry points. Signed-off-by: Eduardo Habkost --- src/fw/biostables.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/fw/biostables.c b/src/fw/biostables.c index 559a5867..d65d91ab 100644 --- a/src/fw/biostables.c +++ b/src/fw/biostables.c @@ -456,6 +456,9 @@ smbios_new_type_0(void *start, /* * Build tables using qtables as input, adding additional type 0 * table if necessary. + * + * @address and @length can't be NULL. @max_structure_size and + * @number_of_structures are optional and can be NULL. */ static int smbios_build_tables(struct romfile_s *f_tables, @@ -497,9 +500,10 @@ smbios_build_tables(struct romfile_s *f_tables, need_t0 =3D 0; } else { *length +=3D t0_len; - if (t0_len > *max_structure_size) + if (max_structure_size && t0_len > *max_structure_size) *max_structure_size =3D t0_len; - (*number_of_structures)++; + if (number_of_structures) + (*number_of_structures)++; } } =20 --=20 2.28.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Fri Apr 19 10:27:20 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607635831; cv=none; d=zohomail.com; s=zohoarc; b=CVvpDH57YcyO3epZCEQ0qOohvg8iFVuO8lzFYhtZwJtxFhCdChBkR8YAlwmbfjUg54eLyL0HRIPS3wnKQrW4cSrE/BLGk4ESyDXO1sD5gWD+NfXWHQvw9RFZhtl/YZstcfu+iin1jy9O/8hzMjhsopfg+XFnOFOKaG56g2i+w5g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607635831; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Subject:To; bh=9pmMD2XXnDTFRbxPIpGpZlk+vhWi9u36rfRVwnyToqg=; b=JomY/6QpOw4/xljQnXrASQd4DOx9DPUIPo6nlqb55CYa9hCI3MA8eMggSvmzDkXXNDqYaY9RkX9lGbUHclGOJDA+eiWPHLNk5MbW3HeJds2D4PEz+sQxb7xsbjh08WTTCa2KF2OtV/cRXf19rB3mOPU9o79EZdA79Vga8ltEESs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1607635831664636.4931754694769; Thu, 10 Dec 2020 13:30:31 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 3690410C0AFC; Thu, 10 Dec 2020 21:30:27 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id D2AE210C0AD4 for ; Thu, 10 Dec 2020 21:27:46 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-351-P8GDkWZHPJmOvp1RkVj3lA-1; Thu, 10 Dec 2020 16:27:44 -0500 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1B2C859 for ; Thu, 10 Dec 2020 21:27:43 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.corp.redhat.com (Postfix) with ESMTP id B824719725; Thu, 10 Dec 2020 21:27:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607635665; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IGoukMeAna+IVYy5zpL3HCqStr/Of+HkbqbFVGjFqmE=; b=LfjMJWEagR+9SOO4ygqvEWcmnvJSeFYDxYIqE9RFlrc544PqvqY07AYt1L5ABvKk3/i5VG scEEX68zFI7ntIZAnnEVL4HWRWGzsH8R5M5brBPzGCmEJ81X4cQME2iBxxnbx5d18UZwB1 JAW6S20gidvdO3IUF4Wk6JO4LdHaIGU= X-MC-Unique: P8GDkWZHPJmOvp1RkVj3lA-1 From: Eduardo Habkost To: seabios@seabios.org Date: Thu, 10 Dec 2020 16:26:37 -0500 Message-Id: <20201210212640.2023885-17-ehabkost@redhat.com> In-Reply-To: <20201210212640.2023885-1-ehabkost@redhat.com> References: <20201210212640.2023885-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: UJFIB4XHR4EL2A4AQDONMW4RV7T6HSWT X-Message-ID-Hash: UJFIB4XHR4EL2A4AQDONMW4RV7T6HSWT X-MailFrom: ehabkost@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: "Daniel P. Berrange" , Gerd Hoffmann X-Mailman-Version: 3.3.2b1 Precedence: list Subject: [SeaBIOS] [PATCH 16/19] smbios: Make smbios_build_tables() ready for 64-bit tables List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: ------ X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Make smbios_build_tables() get u64 address and u32 length arguments, making it usable for SMBIOS 3.0. Adapt smbios_21_setup_entry_point() to use intermediate variables when calling smbios_build_tables(). Signed-off-by: Eduardo Habkost --- src/fw/biostables.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/fw/biostables.c b/src/fw/biostables.c index d65d91ab..91fe7470 100644 --- a/src/fw/biostables.c +++ b/src/fw/biostables.c @@ -462,7 +462,7 @@ smbios_new_type_0(void *start, */ static int smbios_build_tables(struct romfile_s *f_tables, - u32 *address, u16 *length, + u64 *address, u32 *length, u16 *max_structure_size, u16 *number_of_structures) { @@ -531,14 +531,24 @@ static int smbios_21_setup_entry_point(struct romfile_s *f_tables, struct smbios_21_entry_point *ep) { + u64 address =3D ep->structure_table_address; + u32 length =3D ep->structure_table_length; + if (!smbios_build_tables(f_tables, - &ep->structure_table_address, - &ep->structure_table_length, + &address, + &length, &ep->max_structure_size, &ep->number_of_structures)) return 0; =20 + if ((u32)address !=3D address || (u16)length !=3D length) { + warn_internalerror(); + return 0; + } + /* finalize entry point */ + ep->structure_table_address =3D address; + ep->structure_table_length =3D length; ep->checksum -=3D checksum(ep, 0x10); ep->intermediate_checksum -=3D checksum((void *)ep + 0x10, ep->length = - 0x10); =20 --=20 2.28.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Fri Apr 19 10:27:20 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607635843; cv=none; d=zohomail.com; s=zohoarc; b=ANkPznuSh9h0bjntoYdnOPCtWkVVdyU28vmdoa/zrdus7bjTvhv+cd8rN8XQV2ghMBpwvnRylXY+/ecCcrT1F2vjTAfWGfUibSbzWS2mxqaaCpf42whHZZw0+hFUrht9s95XirAmcs2f5mtRK5WEWOKc46MrQ2ceo0Rg9pulWEE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607635843; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Subject:To; bh=tqvrwB/aAeWSTFOGSUUHBdX2TQNNDndJeXJTmeZjFBg=; b=DFZ1yyyeHzYCw/ZuJA/m4fx8HB4XJPXGbCKdZS/mruPqpqQPU/itwgNjjIjv8XXbMQ2Ww1Gk5N8IArDvvbF8xNwsRU/YObKv5ceZgTD7nIyfke+00KsgUY1NiRyE32hYfgwq4k7ZxfxqtaFz6Q18i5p0KOQGPqhrslri+x1tbHI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1607635843990493.5224240177066; Thu, 10 Dec 2020 13:30:43 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id DA4A210C0AF3; Thu, 10 Dec 2020 21:30:39 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 6561F10C0AEE for ; Thu, 10 Dec 2020 21:27:52 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-479-zD4pxpa0NyOw9oq_akrBIw-1; Thu, 10 Dec 2020 16:27:49 -0500 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 98FC61936B6E for ; Thu, 10 Dec 2020 21:27:48 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7F35E10016F5; Thu, 10 Dec 2020 21:27:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607635671; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GPL9DeBdTxFDSq9XD2E4iL8z+1zwHvJLpBDLCrFIFpU=; b=UIByd3oc+3ez1b6O+c8QY4W70qK6T5cl03jK7qJd1lfW1dDikPKiJMcf8j397FhWTvJQHx /qVJUReVGXAeogUvQEbYONn3yMrO3cvO+9DVHRAzzVleWsBAUdlsmF8Nubf5X6KQ72QSz6 jBLzqUhZYDvFGO438ujruA+5kuzVJrs= X-MC-Unique: zD4pxpa0NyOw9oq_akrBIw-1 From: Eduardo Habkost To: seabios@seabios.org Date: Thu, 10 Dec 2020 16:26:38 -0500 Message-Id: <20201210212640.2023885-18-ehabkost@redhat.com> In-Reply-To: <20201210212640.2023885-1-ehabkost@redhat.com> References: <20201210212640.2023885-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: XYIOQ3CFOYDIYNHYJRKR6IBYDOSAZBGU X-Message-ID-Hash: XYIOQ3CFOYDIYNHYJRKR6IBYDOSAZBGU X-MailFrom: ehabkost@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: "Daniel P. Berrange" , Gerd Hoffmann X-Mailman-Version: 3.3.2b1 Precedence: list Subject: [SeaBIOS] [PATCH 17/19] smbios: copy_smbios_30() function List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: ------ X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Add new copy_smbios_30() function, that will be used to support SMBIOS 3.0 entry points. The SMBIOS 3.0 entry point will be tracked in a separate SMBios30Addr variable, because both 2.1 and 3.0 entry points may exist at the same time. Adjust the smbios_get_tables(), smbios_major_version(), and smbios_minor_version() helpers to use the SMBIOS 3.0 entry point if available. Signed-off-by: Eduardo Habkost --- src/std/smbios.h | 13 +++++++++++++ src/fw/biostables.c | 36 ++++++++++++++++++++++++++++++++++-- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/src/std/smbios.h b/src/std/smbios.h index 17fdfed6..208440b1 100644 --- a/src/std/smbios.h +++ b/src/std/smbios.h @@ -25,6 +25,19 @@ struct smbios_21_entry_point { u8 smbios_bcd_revision; } PACKED; =20 +struct smbios_30_entry_point { + char signature[5]; + u8 checksum; + u8 length; + u8 smbios_major_version; + u8 smbios_minor_version; + u8 smbios_docrev; + u8 entry_point_revision; + u8 reserved; + u32 structure_table_max_size; + u64 structure_table_address; +} PACKED; + /* This goes at the beginning of every SMBIOS structure. */ struct smbios_structure_header { u8 type; diff --git a/src/fw/biostables.c b/src/fw/biostables.c index 91fe7470..b2c84a12 100644 --- a/src/fw/biostables.c +++ b/src/fw/biostables.c @@ -315,8 +315,36 @@ copy_smbios_21(void *pos) SMBios21Addr =3D copy_fseg_table("SMBIOS", pos, p->length); } =20 +static struct smbios_30_entry_point *SMBios30Addr; + +static int +valid_smbios_30_signature(struct smbios_30_entry_point *p) +{ + return !memcmp(p->signature, "_SM3_", 5); +} + +void +copy_smbios_30(void *pos) +{ + if (SMBios30Addr) + return; + struct smbios_30_entry_point *p =3D pos; + if (!valid_smbios_30_signature(p)) + return; + if (checksum(pos, p->length) !=3D 0) + return; + SMBios30Addr =3D copy_fseg_table("SMBIOS 3.0", pos, p->length); +} + void *smbios_get_tables(u32 *length) { + if (SMBios30Addr) { + u32 addr32 =3D SMBios30Addr->structure_table_address; + if (addr32 =3D=3D SMBios30Addr->structure_table_address) { + *length =3D SMBios30Addr->structure_table_max_size; + return (void *)addr32; + } + } if (SMBios21Addr) { *length =3D SMBios21Addr->structure_table_length; return (void *)SMBios21Addr->structure_table_address; @@ -327,7 +355,9 @@ void *smbios_get_tables(u32 *length) static int smbios_major_version(void) { - if (SMBios21Addr) + if (SMBios30Addr) + return SMBios30Addr->smbios_major_version; + else if (SMBios21Addr) return SMBios21Addr->smbios_major_version; else return 0; @@ -336,7 +366,9 @@ smbios_major_version(void) static int smbios_minor_version(void) { - if (SMBios21Addr) + if (SMBios30Addr) + return SMBios30Addr->smbios_minor_version; + else if (SMBios21Addr) return SMBios21Addr->smbios_minor_version; else return 0; --=20 2.28.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Fri Apr 19 10:27:20 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607635854; cv=none; d=zohomail.com; s=zohoarc; b=CC4/awV6FqNpAw26ikf8epHhPXAnhWxcnCNBxLHoZFudVUPGrCk3Q9WpbDO61zRudEimo8aEHm9U6FUTZMuqMC8hV9jlMvOQ5Iga5EO7x5hTB2/JeOGCvhLRap4zJUIiQZ4o8tNE3RG+2iIsqtyyR05g/khhlS1nafuWCXYaAVU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607635854; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Subject:To; bh=Uz5unfYOGYpZNNneDQ0peTgIn3ahQJEekjSgHRhOtSY=; b=OToo1dtJPcPyg9Xzg0YKOnqv+c22G4WPpCQOWevc5nUYNJDOcZcYeiLQB0voRQEuVyQL60gMIT8weTxJb852C+Z1ucA+vGtOT5tEchMpz5+X6cNijf11AqXexuKm5820SVrQZgrWoMKBRqt1JRgH+pKwQbBk+YVehHBoYwGv+WQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1607635854709242.64500043370344; Thu, 10 Dec 2020 13:30:54 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 8EA6F10C0AFE; Thu, 10 Dec 2020 21:30:50 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 0EA0510C0AF1 for ; Thu, 10 Dec 2020 21:27:57 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-279-R-9fNlZmN3K0n4OaEkcCVQ-1; Thu, 10 Dec 2020 16:27:54 -0500 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 863341005504 for ; Thu, 10 Dec 2020 21:27:53 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9B82D60BF1; Thu, 10 Dec 2020 21:27:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607635676; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qZlyIEVorAGdEc31U6yvyphAU+ZA7MbQDQXxIgpuP/0=; b=MLSxhUhhLrBQPmmHV4R/+ULI9lyohAn/D7pMUs8eItWTNSikaqdR0XYDzxgUQxsLwiNz+k 9wdd3QYpttlzpeFLDm7PNLxkwa6s2r9JKzNqqEalZ46Sq/RvxIbGaEu4VYNnfD/YAjxkhm dVr0/sbD3OPBc9wO8a1S2Kyl3D1418E= X-MC-Unique: R-9fNlZmN3K0n4OaEkcCVQ-1 From: Eduardo Habkost To: seabios@seabios.org Date: Thu, 10 Dec 2020 16:26:39 -0500 Message-Id: <20201210212640.2023885-19-ehabkost@redhat.com> In-Reply-To: <20201210212640.2023885-1-ehabkost@redhat.com> References: <20201210212640.2023885-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: 7T2DPKSQJNMNPPQIXVNAH6KZCCMF4OWW X-Message-ID-Hash: 7T2DPKSQJNMNPPQIXVNAH6KZCCMF4OWW X-MailFrom: ehabkost@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: "Daniel P. Berrange" , Gerd Hoffmann X-Mailman-Version: 3.3.2b1 Precedence: list Subject: [SeaBIOS] [PATCH 18/19] smbios: Support SMBIOS 3.0 entry point at copy_table() List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: ------ X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" This will make coreboot code (scan_tables()) and xen code (xen_biostable_setup()) copy SMBIOS 3.0 entry points if found. Signed-off-by: Eduardo Habkost --- src/fw/biostables.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/fw/biostables.c b/src/fw/biostables.c index b2c84a12..5ff1b0ed 100644 --- a/src/fw/biostables.c +++ b/src/fw/biostables.c @@ -618,4 +618,5 @@ copy_table(void *pos) copy_mptable(pos); copy_acpi_rsdp(pos); copy_smbios_21(pos); + copy_smbios_30(pos); } --=20 2.28.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Fri Apr 19 10:27:20 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607635865; cv=none; d=zohomail.com; s=zohoarc; b=lAVdTjLvdEyrHsMjCaB0irUv8KCZxESpvrfSFjKzcA82JuoNtbo+iVTpQgpzM9uz/GDiIifb71xt9J5FrZzmgW0l9qN4xKquUPzaBq8z3S/hYyHy+B2XYOzGeaiF3t/scnPHe6B9mmRpO6YNGTzQEVh0TA0ZH7h3zZ5UMEERiWI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607635865; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Subject:To; bh=2MrpivyTmmpohVvY8ibE4pEsZOv6jGEncoH+DaalQcY=; b=NF4II0bsQbsLtN0TnOhY04Gq4UcneX5QvDnxxab2JAjol07n4OqXfWSznpIE5gIBn53Z2XwXqJV54L1lDpyzXYro4mNlDFPlalj0Za1H+9Uixr9AhZ6aFn9unh73r+Ini1yu/pCotLs86p76Cq0i1Yeybwa5GH8P5eeSEN1YfDs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 16076358656881006.4031321915495; Thu, 10 Dec 2020 13:31:05 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 8065610C0AF0; Thu, 10 Dec 2020 21:31:01 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id C3E6F10C0AEE for ; Thu, 10 Dec 2020 21:27:58 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-408-wV5Ku7HwPyi8j_Dr9-WkcA-1; Thu, 10 Dec 2020 16:27:56 -0500 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 601BC59 for ; Thu, 10 Dec 2020 21:27:55 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB23060BF1; Thu, 10 Dec 2020 21:27:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607635677; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GByP0AUOK2nv2JfNQj/RZ7gaTJnv6mFnnqikA2iS90o=; b=JTp9rvsYkThI12lNrr/i4cIyM/w66soLnTOC6MEoe8g6I3Ax7NJH0aBN6qkStLN3Goo6mg VAd3oIasp05+kdKZeZ2bgjVuHw9ymmr5VVajv3Ev83K0M538NGfA3rVkMJ/atn03tXeYtt ZxCUvPceZxxXQaszQoxC6IFn9WI1W4U= X-MC-Unique: wV5Ku7HwPyi8j_Dr9-WkcA-1 From: Eduardo Habkost To: seabios@seabios.org Date: Thu, 10 Dec 2020 16:26:40 -0500 Message-Id: <20201210212640.2023885-20-ehabkost@redhat.com> In-Reply-To: <20201210212640.2023885-1-ehabkost@redhat.com> References: <20201210212640.2023885-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: YSZZJACUPRBW24N7DNHPPFDLMZRVL6E2 X-Message-ID-Hash: YSZZJACUPRBW24N7DNHPPFDLMZRVL6E2 X-MailFrom: ehabkost@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: "Daniel P. Berrange" , Gerd Hoffmann X-Mailman-Version: 3.3.2b1 Precedence: list Subject: [SeaBIOS] [PATCH 19/19] smbios: Support SMBIOS 3.0 entry point at smbios_romfile_setup() List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: ------ X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Support SMBIOS 3.0 entry points if exposed by QEMU in fw_cfg. Signed-off-by: Eduardo Habkost --- src/fw/biostables.c | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/src/fw/biostables.c b/src/fw/biostables.c index 5ff1b0ed..1c09a785 100644 --- a/src/fw/biostables.c +++ b/src/fw/biostables.c @@ -588,19 +588,46 @@ smbios_21_setup_entry_point(struct romfile_s *f_table= s, return 1; } =20 +static int +smbios_30_setup_entry_point(struct romfile_s *f_tables, + struct smbios_30_entry_point *ep) +{ + if (!smbios_build_tables(f_tables, + &ep->structure_table_address, + &ep->structure_table_max_size, + NULL, NULL)) + return 0; + + ep->checksum -=3D checksum(ep, sizeof(*ep)); + copy_smbios_30(ep); + return 1; +} + static int smbios_romfile_setup(void) { struct romfile_s *f_anchor =3D romfile_find("etc/smbios/smbios-anchor"= ); struct romfile_s *f_tables =3D romfile_find("etc/smbios/smbios-tables"= ); - struct smbios_21_entry_point ep; + union { + struct smbios_21_entry_point ep21; + struct smbios_30_entry_point ep30; + } ep; =20 - if (!f_anchor || !f_tables || f_anchor->size !=3D sizeof(ep)) + if (!f_anchor || !f_tables || f_anchor->size > sizeof(ep)) return 0; =20 f_anchor->copy(f_anchor, &ep, f_anchor->size); =20 - return smbios_21_setup_entry_point(f_tables, &ep); + if (f_anchor->size =3D=3D sizeof(ep.ep21) && + ep.ep21.signature =3D=3D SMBIOS_21_SIGNATURE) { + return smbios_21_setup_entry_point(f_tables, &ep.ep21); + } else if (f_anchor->size =3D=3D sizeof(ep.ep30) && + valid_smbios_30_signature(&ep.ep30)) { + return smbios_30_setup_entry_point(f_tables, &ep.ep30); + } else { + dprintf(1, "Invalid SMBIOS signature at etc/smbios/smbios-anchor\n= "); + return 0; + } } =20 void --=20 2.28.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org