Re: [PATCH v3 2/2] ACPI: SPCR: Support UART clock frequency field
Markus Probst <[email protected]> Fri, 24 Jul 2026 15:14:40 +0000
| Newsgroups | org.kernel.vger.linux-serial,org.kernel.vger.linux-acpi,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On Fri, 2026-07-10 at 14:34 +0200, Greg Kroah-Hartman wrote: I just noticed, I never replied to this email. My apologies for the late response. > On Mon, Jun 15, 2026 at 12:40:22AM +0000, Markus Probst wrote: > > The Microsoft Serial Port Console Redirection (SPCR) specification > > revision 1.08 comprises additional field: UART Clock Frequency [1]. > > > > It contains a non-zero value indicating the UART clock frequency in Hz. > > Ok, but then what are we going to do with this? Please make this a lot > more descriptive, I have no idea what this is supposed to be doing at > all. The SPCR table provides information about a serial port. This can be used, to make use of a serial port, before the necessary drivers are loaded. Linux makes use of this in the earlycon console, if `earlycon` is added to the kernel parameters. Currently the "UART clock frequency" field in the SPCR table is completely ignored. Thus if the uart clock frequency differs from the kernel default of `BAUD*16`, it results in a misconfiguration of the serial port. > > > > > Link: https://learn.microsoft.com/en-us/windows-hardware/drivers/serports/serial-port-console-redirection-table [1] > > Signed-off-by: Markus Probst <[email protected]> > > --- > > drivers/acpi/spcr.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/acpi/spcr.c b/drivers/acpi/spcr.c > > index 73cb933fdc89..c79c809f49d4 100644 > > --- a/drivers/acpi/spcr.c > > +++ b/drivers/acpi/spcr.c > > @@ -228,7 +228,8 @@ int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console) > > pr_info("console: %s\n", opts); > > > > if (enable_earlycon) > > - setup_earlycon(opts); > > + setup_earlycon_with_uartclk(opts, > > + table->header.revision >= 3 ? table->uart_clk_freq : 0); > > Why the magic number 3? As seen on the Link in the commit message, the "UART Clock Frequency" field was introduced in the SPCR table with revision 3. For lower revisions, this value must be ignored (and should be 0 anyway). Thanks - Markus Probst > > thanks, > greg k-h
signature.asc
(application/pgp-signature, 870 B)
-----BEGIN PGP SIGNATURE----- iQJPBAABCAA5FiEEgnQYxPSsWOdyMMRzNHYf+OetQ9IFAmpjgVobFIAAAAAABAAO bWFudTIsMi41KzEuMTIsMiwyAAoJEDR2H/jnrUPSyoEP/1n08OeLwwzniIeiiIKC L947nnmTc6831Xqt0RPLbme3Bj2Pk3UKrGx21DcbaDjojOEIBGYCa30rfshkatvZ ISzKxn1iLjIiit3yNed6+jbS3mweEuIzHTRaTx2l66sUVLtVhPKKTU1/dOSVtYVW EOzAuNloSTG4BFEhIipyV4RzkiC3YKAyUEL2E6xfKXifZkAfe4N1jYljyyGKCe97 J47SSML6DHoHfL6CdPdLVsEBXVbkt9EY6gpv1ZWt9TbPWZfEpx8W9RcF1auGRe8K m1BdSDsrHTQMAOiab8qF/YGHwRxUQIvK7nPOiB7XTP+1Rem0B/BZpBl+iW50snoG 0YeNfNu3Btj6JUp/y+Z5XfPEdKASYZ0RKRKH1XPpMfl+eArKRFMRzVGedY+Qlm9K X/G2G2VLPtoN//rJNSvsBQF/kfuDHowGVQCrG0QfncNynb3TGViSnfUqsjRVca3L C46ahVgQqmDkBHjGdS05hnedZAaEM3lezXemjlzN3dw1EVx3doATyoKAby9IuY9N g34qeRcQf6Am1uI89yEYA71gfgPt7tSeaMBtRPu+DGUQq4z9kIU2aGszKNLs+zAz DuJ6vP4jLnw22BInATC4cFmlNaaL95gGI836mUO/Kqlce/uCEkelG3y6jgMnW4o4 EWfRpRESsXsape0nZIUzmZCb =z/xK -----END PGP SIGNATURE-----