From nobody Sun Dec 22 03:58:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1732286014240886.657956782802; Fri, 22 Nov 2024 06:33:34 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 4E759ECEB5; Fri, 22 Nov 2024 14:33:30 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 94352ECEA1 for ; Fri, 22 Nov 2024 14:33:12 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-186-t0_nCG74OkeoyPTbJr2T2A-1; Fri, 22 Nov 2024 09:33:10 -0500 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 472F51953955 for ; Fri, 22 Nov 2024 14:33:09 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D1D8A1955F3E; Fri, 22 Nov 2024 14:33:08 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) id 6D18518009B1; Fri, 22 Nov 2024 15:33:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732285991; 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=Sl1/5UaW0WeM55+AcnTgYVQM1ES63rb8Xan/kv3e9U8=; b=GGpmwyRDf4+5wUhi4cevkDot6K5MXGO4u3JNpDfa74fHtS4/gVJmf2lrro36AXnivmJEys PXWC2F6fyRc+zpHDmOSGC5TIZFOqanlf55T/0PC812spNebVFoJ96aLap01TV/hUOeYITy LV2GfRxRaGORBaCeMdtOOHeBS2YXbYQ= X-MC-Unique: t0_nCG74OkeoyPTbJr2T2A-1 X-Mimecast-MFC-AGG-ID: t0_nCG74OkeoyPTbJr2T2A From: Gerd Hoffmann To: seabios@seabios.org Date: Fri, 22 Nov 2024 15:33:05 +0100 Message-ID: <20241122143306.1475767-2-kraxel@redhat.com> In-Reply-To: <20241122143306.1475767-1-kraxel@redhat.com> References: <20241122143306.1475767-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: zOWKdX39vhKUtUHdVh_AwUbWtX1nsHz2uvEREobEk8Q_1732285989 X-Mimecast-Originator: redhat.com Message-ID-Hash: ZBXW6CO35UJWOD4XWFACFDIKE3QSYD6L X-Message-ID-Hash: ZBXW6CO35UJWOD4XWFACFDIKE3QSYD6L X-MailFrom: kraxel@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; digests; suspicious-header CC: Gerd Hoffmann X-Mailman-Version: 3.3.6b1 Precedence: list Subject: [SeaBIOS] [PATCH v2 1/2] add romfile_loadbool() List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Owner: 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) X-ZM-MESSAGEID: 1732286023254116600 Content-Type: text/plain; charset="utf-8"; x-default="true" Translates strings in fw_cfg files into boolean values. Signed-off-by: Gerd Hoffmann --- src/romfile.h | 1 + src/romfile.c | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/romfile.h b/src/romfile.h index 3e0f820047dd..ae2f4ac7e718 100644 --- a/src/romfile.h +++ b/src/romfile.h @@ -15,6 +15,7 @@ struct romfile_s *romfile_findprefix(const char *prefix, = struct romfile_s *prev) struct romfile_s *romfile_find(const char *name); void *romfile_loadfile(const char *name, int *psize); u64 romfile_loadint(const char *name, u64 defval); +u32 romfile_loadbool(const char *name, u32 defval); =20 void const_romfile_add_int(char *name, u32 value); =20 diff --git a/src/romfile.c b/src/romfile.c index b598274edc09..8072a9150685 100644 --- a/src/romfile.c +++ b/src/romfile.c @@ -99,6 +99,29 @@ romfile_loadint(const char *name, u64 defval) return val; } =20 +u32 +romfile_loadbool(const char *name, u32 defval) +{ + static const char *true_strings[] =3D { "1", "on", "yes" }; + static const char *false_strings[] =3D { "0", "off", "no" }; + char *str =3D romfile_loadfile(name, NULL); + int i; + + if (!str) + return defval; + + for (i =3D 0; i < ARRAY_SIZE(true_strings); i++) + if (0 =3D=3D strcmp(str, true_strings[i])) + return 1; + + for (i =3D 0; i < ARRAY_SIZE(false_strings); i++) + if (0 =3D=3D strcmp(str, false_strings[i])) + return 0; + + dprintf(1, "%s: unknown bool string: %s\n", __func__, str); + return defval; +} + struct const_romfile_s { struct romfile_s file; void *data; --=20 2.47.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Sun Dec 22 03:58:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1732286044579310.67168447935103; Fri, 22 Nov 2024 06:34:04 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id D55CAECEC8; Fri, 22 Nov 2024 14:34:00 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 4CD20ECEA8 for ; Fri, 22 Nov 2024 14:33:17 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-257-pmRw3ABMMliVOKu5P0HrrQ-1; Fri, 22 Nov 2024 09:33:13 -0500 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3B936195608B for ; Fri, 22 Nov 2024 14:33:12 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id F2A041955F69; Fri, 22 Nov 2024 14:33:11 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) id 719D21800D62; Fri, 22 Nov 2024 15:33:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732285996; 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=M1pPcIMwmYxo+HSDHsyEeA6e+v0vGXBkujrsvADmCQU=; b=eEqZympXx3mGHq7urkw/h+s9GrV7JcAak1E9zQl44LmCtnCAbIMk+aTS7IDeTcCXnf2R4P +QQWpw0vPhaau7IPLbFp2nrwpC2Fs569pFWTzY6VhsoHc8q/m1Gprl+D36R5VtOaVZa9hY /s+jrYIsfAVgNrsrMkDO8DcoEX96urI= X-MC-Unique: pmRw3ABMMliVOKu5P0HrrQ-1 X-Mimecast-MFC-AGG-ID: pmRw3ABMMliVOKu5P0HrrQ From: Gerd Hoffmann To: seabios@seabios.org Date: Fri, 22 Nov 2024 15:33:06 +0100 Message-ID: <20241122143306.1475767-3-kraxel@redhat.com> In-Reply-To: <20241122143306.1475767-1-kraxel@redhat.com> References: <20241122143306.1475767-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: l4I26M6qVACKtJjBcYjcQns5yuPOWeJXJnlwcXJJTvI_1732285992 X-Mimecast-Originator: redhat.com Message-ID-Hash: NMHSYNXO3MOAO5EPK64SM7KEYKA5GAC4 X-Message-ID-Hash: NMHSYNXO3MOAO5EPK64SM7KEYKA5GAC4 X-MailFrom: kraxel@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; digests; suspicious-header CC: Gerd Hoffmann X-Mailman-Version: 3.3.6b1 Precedence: list Subject: [SeaBIOS] [PATCH v2 2/2] update pci_pad_mem64 handling List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Owner: 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) X-ZM-MESSAGEID: 1732286045489116600 Content-Type: text/plain; charset="utf-8"; x-default="true" Add a new possible state: '-1' means 'use default'. In that case seabios continue to use the current heuristic: In case memory above 4G is present enable 64-bit guest friendly configuration. This allows forcing the one or the other behavior by setting the pci_pad_mem64 variable beforehand (which is done by another patch). Signed-off-by: Gerd Hoffmann --- src/fw/pciinit.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/fw/pciinit.c b/src/fw/pciinit.c index b3e359d7fe62..be76c447cf19 100644 --- a/src/fw/pciinit.c +++ b/src/fw/pciinit.c @@ -55,7 +55,7 @@ u64 pcimem64_end =3D BUILD_PCIMEM64_END; // Resource allocation limits static u64 pci_io_low_end =3D 0xa000; static u64 pci_mem64_top =3D 0; -static u32 pci_pad_mem64 =3D 0; +static u32 pci_pad_mem64 =3D -1; =20 struct pci_region_entry { struct pci_device *dev; @@ -1202,8 +1202,15 @@ pci_setup(void) } } =20 - if (CPUPhysBits >=3D 36 && CPULongMode && RamSizeOver4G) - pci_pad_mem64 =3D 1; + pci_pad_mem64 =3D romfile_loadbool("opt/org.seabios/pci64", -1); + + if (pci_pad_mem64 =3D=3D -1) + // when not set enable in case memory over 4G is present + pci_pad_mem64 =3D RamSizeOver4G ? 1 : 0; + + if (!CPULongMode) + // force off for 32-bit CPUs + pci_pad_mem64 =3D 0; =20 dprintf(1, "=3D=3D=3D PCI bus & bridge init =3D=3D=3D\n"); if (pci_probe_host() !=3D 0) { --=20 2.47.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org