Skip to content

Commit

Permalink
loader.efi: Parse SPCR v3 and v4
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bsdimp committed Oct 15, 2024
1 parent 70253b5 commit 501983e
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions stand/efi/loader/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 501983e

Please sign in to comment.