From nobody Tue Oct 15 11:14:07 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XSWgz5cmfz5Ymtb; Tue, 15 Oct 2024 11:14:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XSWgz27M6z4ZPy; Tue, 15 Oct 2024 11:14:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728990847; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+O2ANFWKf8OQX81EQzbzxcK/ZikvdJ2qYJisYze+V2M=; b=kmKT/pFLvEEphZljtJ2/bruoBG5jIkHDRPPhyykRo4SORNjfH57WTCa+1d2U8eY0YFYfmM NABqKrODjmei/QFHRQbblPNHSjOh79mmY5FmFyzZJ5VgE6KuJM2ILW6uKvw19/yF2ZmEIH S8USdc1xeKl0kfOQBTL+ZEaS/iS+O9uE25zBH1SU+U8OgCLZABE5mfCyllcvbzGrnqTk7t AyEhdZjc1ohSWwNkX/0mcP44iafwY7g1uhmorkLzBOwGRjb9YpxJIiEiESs5iW3MvuLe6Z CxwGLvWs0F1n4cz7uP9EFnrQOOvfX07YgiG0hLApj+/VYvUpchXetOjH79x2qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728990847; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+O2ANFWKf8OQX81EQzbzxcK/ZikvdJ2qYJisYze+V2M=; b=FRgzHTvjSSQH8UQfYmNJN2hEJ+NOlawhaPVGBPIm97tF1A0DHg0vd5djTCaK/DKLdSYUaD sq01elr2PGUq1jXAsyqwJQu+bDnalynEoUGlDi/zw6sOfZPZ92Q//59GtR/2CEDfz+6P4q SRJCgd9FFqqrPOEx9GrBnDUFh+A9+rFid5eUsJYCC5D/VheDOWvshKcKPdnneBUqTxYxfi tC/GZfMh8UmW+llYaJrupyb8z/Wq72PXuB3R1upGg8KogoHyzQ3YVjuonYM2ooO71omMN3 n11lMTzQS/5hdTu7+t2XvjpLaOESoq7bZHf6inavjD9oJHa+p8UKaU4kJBgAeA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1728990847; a=rsa-sha256; cv=none; b=VeE0I3jtKm999xoO8qN4L499AvSg2kbWtGUBW/iZTqS8pn64TSC8BpOVQ7eM7nZgGBXlq4 Gu7oZJqVoSyg2xLgu4ckjjrpKtwK5RAsAiz3QmrcWUH8MyXTrI42A6NUj3L7DF8B8h/OCA XLb990x20K9A1f9QrQSWvUesdhT9bPjFU+tB2ZQhG8N/d/ChVdeGvs2NrRoBmb8Rp0h9Et 1J59+YzT4L/+6RXCV72hoD/+PAg8QzJcj/TL7+zSrP/QuoO50l+0iAI3aXMizVWublX1Po OE4T16CGNe5g6d1yOlIC2u//KGOOqXvWdDYsjmCYrA28mmqz/RK/cAWccawUmQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XSWgz1lCYzKTT; Tue, 15 Oct 2024 11:14:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49FBE7kv098136; Tue, 15 Oct 2024 11:14:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49FBE7Jv098133; Tue, 15 Oct 2024 11:14:07 GMT (envelope-from git) Date: Tue, 15 Oct 2024 11:14:07 GMT Message-Id: <202410151114.49FBE7Jv098133@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 501983e62e75 - main - loader.efi: Parse SPCR v3 and v4 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 501983e62e754d0b260c0dfe7f23042c89acd9f1 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=501983e62e754d0b260c0dfe7f23042c89acd9f1 commit 501983e62e754d0b260c0dfe7f23042c89acd9f1 Author: Warner Losh AuthorDate: 2024-10-15 11:12:59 +0000 Commit: Warner Losh CommitDate: 2024-10-15 11:12:59 +0000 loader.efi: Parse SPCR v3 and v4 We can get the UART clock from v3 SPCR, and a precise baudrate from v4. Some precise baudrates will currently be rejected by the kernel. Sponsored by: Netflix Reviewed by: adrian, andrew Differential Revision: https://reviews.freebsd.org/D47096 --- stand/efi/loader/main.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c index e8db72bf4c8a..0e2c580d1a8a 100644 --- a/stand/efi/loader/main.c +++ b/stand/efi/loader/main.c @@ -888,14 +888,24 @@ check_acpi_spcr(void) db = 8; /* - * Note: We don't support SPCR Rev3 or Rev4 so use Rev2 values, if we - * did we wouldn't have to do this weird dances with baud or xtal rates. - * Rev 3 and 4 are too new to have seen any deployment, and aren't in - * the system's actblX.h files yet. This will fail for newer high-speed - * consoles until acpica catches up with Microsoft's new definitions. + * UartClkFreq is 3 and newer. We always use it then (it's only valid if + * it isn't 0, but if it is 0, we want to use 0 to have the kernel + * guess). */ - xo = 0; - br = acpi_uart_baud(spcr->BaudRate); + if (spcr->Header.Revision <= 2) + xo = 0; + else + xo = spcr->UartClkFreq; + + /* + * PreciseBaudrate, when non-zero, is to be preferred. It's only valid, + * though, for rev 4 and newer. So when it's 0 or the version is too + * old, we do the old-style table lookup. Otherwise we believe it. + */ + if (spcr->Header.Revision <= 3 || spcr->PreciseBaudrate == 0) + br = acpi_uart_baud(spcr->BaudRate); + else + br = spcr->PreciseBaudrate; if (io != -1) { asprintf(&val, "db:%d,dt:%s,io:%#x,pa:%s,br:%d,xo=%d",