From: cp0613@linux.alibaba.com
To: rafael@kernel.org, lenb@kernel.org, guoren@kernel.org,
jeeheng.sia@starfivetech.com
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
Chen Pei <cp0613@linux.alibaba.com>
Subject: [PATCH v2] ACPI: SPCR: Support Precise Baud Rate filed
Date: Fri, 12 Sep 2025 20:25:14 +0800 [thread overview]
Message-ID: <20250912122514.2303-1-cp0613@linux.alibaba.com> (raw)
From: Chen Pei <cp0613@linux.alibaba.com>
The Microsoft Serial Port Console Redirection (SPCR) specification
revision 1.09 comprises additional field: Precise Baud Rate [1].
It is used to describe non-traditional baud rates (such as those
used by high-speed UARTs).
It contains a specific non-zero baud rate which overrides the value
of the Configured Baud Rate field. If this field is zero or not
present, Configured Baud Rate is used.
Link: https://learn.microsoft.com/en-us/windows-hardware/drivers/serports/serial-port-console-redirection-table # 1
Signed-off-by: Chen Pei <cp0613@linux.alibaba.com>
---
drivers/acpi/spcr.c | 54 ++++++++++++++++++++++++++-------------------
1 file changed, 31 insertions(+), 23 deletions(-)
diff --git a/drivers/acpi/spcr.c b/drivers/acpi/spcr.c
index cd36a97b0ea2..a97b02ee5538 100644
--- a/drivers/acpi/spcr.c
+++ b/drivers/acpi/spcr.c
@@ -146,29 +146,37 @@ int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console)
goto done;
}
- switch (table->baud_rate) {
- case 0:
- /*
- * SPCR 1.04 defines 0 as a preconfigured state of UART.
- * Assume firmware or bootloader configures console correctly.
- */
- baud_rate = 0;
- break;
- case 3:
- baud_rate = 9600;
- break;
- case 4:
- baud_rate = 19200;
- break;
- case 6:
- baud_rate = 57600;
- break;
- case 7:
- baud_rate = 115200;
- break;
- default:
- err = -ENOENT;
- goto done;
+ /*
+ * SPCR 1.09 defines Precise Baud Rate Filed contains a specific
+ * non-zero baud rate which overrides the value of the Configured
+ * Baud Rate field. If this field is zero or not present, Configured
+ * Baud Rate is used.
+ */
+ if (table->precise_baudrate)
+ baud_rate = table->precise_baudrate;
+ else switch (table->baud_rate) {
+ case 0:
+ /*
+ * SPCR 1.04 defines 0 as a preconfigured state of UART.
+ * Assume firmware or bootloader configures console correctly.
+ */
+ baud_rate = 0;
+ break;
+ case 3:
+ baud_rate = 9600;
+ break;
+ case 4:
+ baud_rate = 19200;
+ break;
+ case 6:
+ baud_rate = 57600;
+ break;
+ case 7:
+ baud_rate = 115200;
+ break;
+ default:
+ err = -ENOENT;
+ goto done;
}
/*
--
2.49.0
next reply other threads:[~2025-09-12 12:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-12 12:25 cp0613 [this message]
2025-09-12 14:02 ` Rafael J. Wysocki
2025-09-13 7:07 ` [PATCH] " cp0613
2025-09-13 5:24 ` [PATCH v2] " Guo Ren
2025-09-13 7:06 ` [PATCH] " cp0613
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250912122514.2303-1-cp0613@linux.alibaba.com \
--to=cp0613@linux.alibaba.com \
--cc=guoren@kernel.org \
--cc=jeeheng.sia@starfivetech.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®