Branch: refs/heads/master
Home: https://github.com/tianocore/edk2
Commit: eb83b53309611aba6160ef396c91f36eb8975eca
https://github.com/tianocore/edk2/commit/eb83b53309611aba6160ef396c91f36eb8975eca
Author: Laszlo Ersek <[email protected]>
Date: 2023-10-26 (Thu, 26 Oct 2023)
Changed paths:
M ArmVirtPkg/ArmVirt.dsc.inc
M ArmVirtPkg/ArmVirtPkg.dec
A ArmVirtPkg/Include/Library/FdtSerialPortAddressLib.h
A ArmVirtPkg/Library/FdtSerialPortAddressLib/FdtSerialPortAddressLib.c
A ArmVirtPkg/Library/FdtSerialPortAddressLib/FdtSerialPortAddressLib.inf
Log Message:
-----------
ArmVirtPkg: introduce FdtSerialPortAddressLib
Introduce a new library class + instance for:
- collecting serial port base addresses from the device tree,
- collecting the /chosen stdout-path serial port base address from the
device tree.
The logic is loosely based on the following functions:
- SerialPortGetBaseAddress()
[ArmVirtPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c]
- PlatformPeim() [ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c]
- GetSerialConsolePortAddress()
[ArmVirtPkg/Library/Fdt16550SerialPortHookLib/EarlyFdt16550SerialPortHookLib.c]
which are going to be converted to clients of the new library later.
Copyright notices from those other files are preserved.
The new library fixes the following warts, found by reading the existent
code:
- Neither of the three functions check whether the "reg" property exists.
(This may be implicitly checked when they compare the property size to
16.)
- GetSerialConsolePortAddress() uses ScanMem8() for locating a colon (":")
node path separator in "stdout-path", when AsciiStrStr() could work just
as fine. While ScanMem8() is likely faster, "stdout-path" is presumably
very short, and ScanMem8() introduces an extra lib class dependency
(namely BaseMemoryLib).
- If ScanMem8() fails to locate a colon in "stdout-path", then
GetSerialConsolePortAddress() re-measures the length of the whole
"stdout-path" property. This is conceptually (if not performance-wise)
disturbing, because we know the whole size of the "stdout-path" property
from the property lookup just before, so we only need to subtract the
NUL-terminator for learning the length.
- GetSerialConsolePortAddress() does not check if the first (or only) node
path inside the "stdout-path" property is empty. (Not a big deal, the
subsequent alias resolution should simply fail.)
- GetSerialConsolePortAddress() does not verify if the node path retrieved
(and potentially alias-resolved) from "stdout-path" can be located in
the device tree; it assumes it.
- Code is duplicated (of course) between SerialPortGetBaseAddress() and
PlatformPeim(), but more surprisingly, all three functions embed the
same code for verifying the "status" property of the serial port node,
and for checking and reading its "reg" property.
Cc: Ard Biesheuvel <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Cc: Leif Lindholm <[email protected]>
Cc: Sami Mujawar <[email protected]>
Signed-off-by: Laszlo Ersek <[email protected]>
Message-Id: <[email protected]>
Acked-by: Ard Biesheuvel <[email protected]>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4577
[[email protected]: add TianoCore BZ reference]
Commit: f078a6fdd4d78c8ff39a554625f1cc3d2c32b538
https://github.com/tianocore/edk2/commit/f078a6fdd4d78c8ff39a554625f1cc3d2c32b538
Author: Laszlo Ersek <[email protected]>
Date: 2023-10-26 (Thu, 26 Oct 2023)
Changed paths:
M
ArmVirtPkg/Library/Fdt16550SerialPortHookLib/EarlyFdt16550SerialPortHookLib.c
M
ArmVirtPkg/Library/Fdt16550SerialPortHookLib/EarlyFdt16550SerialPortHookLib.inf
Log Message:
-----------
ArmVirtPkg/Fdt16550SerialPortHookLib: rebase to FdtSerialPortAddressLib
This is only a refactoring; the patch is not supposed to cause any
observable change.
Build-tested only (with "ArmVirtKvmTool.dsc").
Cc: Ard Biesheuvel <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Cc: Leif Lindholm <[email protected]>
Cc: Sami Mujawar <[email protected]>
Signed-off-by: Laszlo Ersek <[email protected]>
Message-Id: <[email protected]>
Acked-by: Ard Biesheuvel <[email protected]>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4577
[[email protected]: add TianoCore BZ reference]
Commit: 5fc3c397048596cf319c6addbd2f9c07db7fb87a
https://github.com/tianocore/edk2/commit/5fc3c397048596cf319c6addbd2f9c07db7fb87a
Author: Laszlo Ersek <[email protected]>
Date: 2023-10-26 (Thu, 26 Oct 2023)
Changed paths:
M ArmVirtPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.c
M ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c
Log Message:
-----------
ArmVirtPkg: adjust whitespace in block scope declarations
I strongly dislike when *small* local variable declaration changes are
muddled by whitespace changes. When that happens, a reviewer can choose
from two suboptimal options: display the patch with "git show -b", which
creates confusion in *other* parts of the patch, or display the patch with
just "git show", which then produces an unjustifiedly large hunk for the
sequence of declarations.
For avoiding that in subsequent patches, adjust some whitespace in this
patch in isolation. Functionally this is a no-op; "git show -b" produces
empty output.
Note that uncrustify is (of course) unhappy with this patch, but that's
fine -- this patch is in the middle of a series, and by the end of the
series (which is where uncrustify is run in CI) the whitespace is going to
be tight.
Cc: Ard Biesheuvel <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Cc: Leif Lindholm <[email protected]>
Cc: Sami Mujawar <[email protected]>
Signed-off-by: Laszlo Ersek <[email protected]>
Message-Id: <[email protected]>
Acked-by: Ard Biesheuvel <[email protected]>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4577
[[email protected]: add TianoCore BZ reference]
Commit: 66046aeb6dfab48122944ae6f8bcc9ddcdc065ff
https://github.com/tianocore/edk2/commit/66046aeb6dfab48122944ae6f8bcc9ddcdc065ff
Author: Laszlo Ersek <[email protected]>
Date: 2023-10-26 (Thu, 26 Oct 2023)
Changed paths:
M ArmVirtPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c
M ArmVirtPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.inf
M ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c
M ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.inf
Log Message:
-----------
ArmVirtPkg: adhere to the serial port selected by /chosen "stdout-path"
Convert both EarlyFdtPL011SerialPortLib and PlatformPeiLib at the same
time to clients of FdtSerialPortAddressLib (so that both "early" and
"late" serial output continue going to a common serial port). If the
device tree specifies just one serial port, this conversion makes no
difference, but if there are multiple ports, the output is written to the
port identified by /chosen "stdout-path".
In this patch, DebugLib output is not separated yet from the UEFI console.
Cc: Ard Biesheuvel <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Cc: Leif Lindholm <[email protected]>
Cc: Sami Mujawar <[email protected]>
Signed-off-by: Laszlo Ersek <[email protected]>
Message-Id: <[email protected]>
Acked-by: Ard Biesheuvel <[email protected]>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4577
[[email protected]: add TianoCore BZ reference]
Commit: 115b59d9c60fffb22eeab2ed467b888e4b24c1dc
https://github.com/tianocore/edk2/commit/115b59d9c60fffb22eeab2ed467b888e4b24c1dc
Author: Laszlo Ersek <[email protected]>
Date: 2023-10-26 (Thu, 26 Oct 2023)
Changed paths:
M ArmVirtPkg/Include/Guid/EarlyPL011BaseAddress.h
M ArmVirtPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.c
M ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c
M ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.inf
Log Message:
-----------
ArmVirtPkg: store separate console and debug PL011 addresses in GUID HOB
PlatformPeiLib produces the EarlyPL011BaseAddress GUID HOB, and
FdtPL011SerialPortLib consumes it. Extend the HOB such that it also carry
the base address of the PL011 UART meant for DebugLib usage -- namely the
first UART that is *not* designated by the /chosen node's "stdout-path"
property. Implement this policy in PlatformPeiLib.
Note that as far as the SerialPortLib+console UART is concerned, this
patch makes no difference. That selection remains consistent with the
pre-patch state, and therefore consistent with EarlyFdtPL011SerialPortLib.
Cc: Ard Biesheuvel <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Cc: Leif Lindholm <[email protected]>
Cc: Sami Mujawar <[email protected]>
Signed-off-by: Laszlo Ersek <[email protected]>
Message-Id: <[email protected]>
Acked-by: Ard Biesheuvel <[email protected]>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4577
[[email protected]: add TianoCore BZ reference]
Commit: b7e6d979732f1cf127ffd8ef4e366cf37e43fa37
https://github.com/tianocore/edk2/commit/b7e6d979732f1cf127ffd8ef4e366cf37e43fa37
Author: Laszlo Ersek <[email protected]>
Date: 2023-10-26 (Thu, 26 Oct 2023)
Changed paths:
A ArmVirtPkg/Library/DebugLibFdtPL011Uart/DebugLib.c
A ArmVirtPkg/Library/DebugLibFdtPL011Uart/DebugLibFdtPL011UartFlash.inf
A ArmVirtPkg/Library/DebugLibFdtPL011Uart/Flash.c
A ArmVirtPkg/Library/DebugLibFdtPL011Uart/Write.h
Log Message:
-----------
ArmVirtPkg: introduce DebugLibFdtPL011Uart Flash instance
Introduce three new DebugLib instances, forked from
MdePkg/Library/BaseDebugLibSerialPort. All three instances rely on
PL011UartLib rather than SerialPortLib so that they can customize the
PL011 UART that the debug messages are written to. All three instances
direct the debug output to the first such PL011 UART that *differs* from
the one specified in the Device Tree's /chosen node's "stdout-path"
property.
>From these, DebugLibFdtPL011UartFlash mirrors EarlyFdtPL011SerialPortLib:
it parses the initial Device Tree, and initializes the UART -- a UART
different from EarlyFdtPL011SerialPortLib's -- for every message written.
Suitable for SEC, PEI_CORE, PEIM.
(Note that OVMF uses a similar set of dedicated DebugLib instances
(PlatformDebugLibIoPort) for logging to the (x86-only) isa-debugcon device
from various firmware phases.)
The contexts in which these DebugLib instances run are identical to those
in which the corresponding SerialPortLib instances run. The particular
original dependency chain is
BaseDebugLibSerialPort (SEC, PEI_CORE, PEIM)
EarlyFdtPL011SerialPortLib
PcdDeviceTreeInitialBaseAddress
FdtSerialPortAddressLib
PL011UartLib
and the new dependency chain is
DebugLibFdtPL011UartFlash (SEC, PEI_CORE, PEIM)
PcdDeviceTreeInitialBaseAddress
FdtSerialPortAddressLib
PL011UartLib
Note that EarlyFdtPL011SerialPortLib remains in use (just not via
BaseDebugLibSerialPort), namely for direct SerialPortLib calls from SEC,
PEI_CORE, PEIM. See for example commit 56035d1c8b25
("ArmPlatformPkg/PrePeiCore: Print the firmware version early in boot",
2022-10-25).
The ArmVirtPkg DSC files will be switched to the new library instances in
a separate patch.
This patch is worth viewing with "git show --find-copies-harder".
Cc: Ard Biesheuvel <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Cc: Leif Lindholm <[email protected]>
Cc: Sami Mujawar <[email protected]>
Signed-off-by: Laszlo Ersek <[email protected]>
Message-Id: <[email protected]>
Acked-by: Ard Biesheuvel <[email protected]>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4577
[[email protected]: add TianoCore BZ reference]
Commit: ba5d955e2505e963eaf91f7ba7d7d5db534372ad
https://github.com/tianocore/edk2/commit/ba5d955e2505e963eaf91f7ba7d7d5db534372ad
Author: Laszlo Ersek <[email protected]>
Date: 2023-10-26 (Thu, 26 Oct 2023)
Changed paths:
A ArmVirtPkg/Library/DebugLibFdtPL011Uart/DebugLibFdtPL011UartRam.inf
A ArmVirtPkg/Library/DebugLibFdtPL011Uart/Ram.c
A ArmVirtPkg/Library/DebugLibFdtPL011Uart/Ram.h
A ArmVirtPkg/Library/DebugLibFdtPL011Uart/RamNonRuntime.c
Log Message:
-----------
ArmVirtPkg: introduce DebugLibFdtPL011Uart RAM instance
Introduce three new DebugLib instances, forked from
MdePkg/Library/BaseDebugLibSerialPort. All three instances rely on
PL011UartLib rather than SerialPortLib so that they can customize the
PL011 UART that the debug messages are written to. All three instances
direct the debug output to the first such PL011 UART that *differs* from
the one specified in the Device Tree's /chosen node's "stdout-path"
property.
>From these, DebugLibFdtPL011UartRam mirrors FdtPL011SerialPortLib: it
relies on the EarlyPL011BaseAddress GUID HOB, and initializes the UART --
a UART different from FdtPL011SerialPortLib's -- only once in the lifetime
of the containing module. Suitable for module types that can only execute
from RAM (i.e., all types different from SEC, PEI_CORE, PEIM), except
DXE_RUNTIME_DRIVER.
(Note that OVMF uses a similar set of dedicated DebugLib instances
(PlatformDebugLibIoPort) for logging to the (x86-only) isa-debugcon device
from various firmware phases.)
The contexts in which these DebugLib instances run are identical to those
in which the corresponding SerialPortLib instances run. The particular
original dependency chain is
BaseDebugLibSerialPort (not SEC, PEI_CORE, PEIM, DXE_RUNTIME_DRIVER)
FdtPL011SerialPortLib
gEarlyPL011BaseAddressGuid
HobLib
PL011UartLib
and the new dependency chain is
DebugLibFdtPL011UartRam (not SEC, PEI_CORE, PEIM, DXE_RUNTIME_DRIVER)
gEarlyPL011BaseAddressGuid
HobLib
PL011UartLib
Note that FdtPL011SerialPortLib remains in use (just not via
BaseDebugLibSerialPort); for instance by MdeModulePkg/Universal/SerialDxe,
which produces the SerialIo protocol, underlying the UEFI console.
The ArmVirtPkg DSC files will be switched to the new library instances in
a separate patch.
This patch is worth viewing with "git show --find-copies-harder".
Cc: Ard Biesheuvel <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Cc: Leif Lindholm <[email protected]>
Cc: Sami Mujawar <[email protected]>
Signed-off-by: Laszlo Ersek <[email protected]>
Message-Id: <[email protected]>
Acked-by: Ard Biesheuvel <[email protected]>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4577
[[email protected]: add TianoCore BZ reference]
Commit: 601abf5d50ca7e797bf0e3e9f3398cd7225aa30b
https://github.com/tianocore/edk2/commit/601abf5d50ca7e797bf0e3e9f3398cd7225aa30b
Author: Laszlo Ersek <[email protected]>
Date: 2023-10-26 (Thu, 26 Oct 2023)
Changed paths:
A ArmVirtPkg/Library/DebugLibFdtPL011Uart/DxeRuntimeDebugLibFdtPL011Uart.inf
A ArmVirtPkg/Library/DebugLibFdtPL011Uart/Runtime.c
Log Message:
-----------
ArmVirtPkg: introduce DebugLibFdtPL011Uart DXE Runtime instance
Introduce three new DebugLib instances, forked from
MdePkg/Library/BaseDebugLibSerialPort. All three instances rely on
PL011UartLib rather than SerialPortLib so that they can customize the
PL011 UART that the debug messages are written to. All three instances
direct the debug output to the first such PL011 UART that *differs* from
the one specified in the Device Tree's /chosen node's "stdout-path"
property.
>From these, DxeRuntimeDebugLibFdtPL011Uart is identical to
DebugLibFdtPL011UartRam, with the addition that UART access is permanently
disabled when the containing DXE_RUNTIME_DRIVER module is notified about
exiting boot services.
The contexts in which these DebugLib instances run are identical to those
in which the corresponding SerialPortLib instances run. The particular
original dependency chain is
DxeRuntimeDebugLibSerialPort (DXE_RUNTIME_DRIVER)
FdtPL011SerialPortLib
gEarlyPL011BaseAddressGuid
HobLib
PL011UartLib
and the new dependency chain is
DxeRuntimeDebugLibFdtPL011Uart (DXE_RUNTIME_DRIVER)
gEarlyPL011BaseAddressGuid
HobLib
PL011UartLib
The ArmVirtPkg DSC files will be switched to the new library instances in
a separate patch.
This patch is worth viewing with "git show --find-copies-harder".
Cc: Ard Biesheuvel <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Cc: Leif Lindholm <[email protected]>
Cc: Sami Mujawar <[email protected]>
Signed-off-by: Laszlo Ersek <[email protected]>
Message-Id: <[email protected]>
Acked-by: Ard Biesheuvel <[email protected]>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4577
[[email protected]: add TianoCore BZ reference]
Commit: f945b72331d7e9eed7f84c71052f198377ac3950
https://github.com/tianocore/edk2/commit/f945b72331d7e9eed7f84c71052f198377ac3950
Author: Laszlo Ersek <[email protected]>
Date: 2023-10-26 (Thu, 26 Oct 2023)
Changed paths:
M ArmVirtPkg/ArmVirt.dsc.inc
M ArmVirtPkg/ArmVirtKvmTool.dsc
M ArmVirtPkg/ArmVirtXen.dsc
Log Message:
-----------
ArmVirtPkg: steer DebugLib output away from SerialPortLib+console traffic
For the RELEASE target, all ArmVirtPkg DSCs inherit BaseDebugLibNull from
"ArmVirt.dsc.inc"; keep that.
For NOOPT and DEBUG:
- switch the lib class resolution pair (BaseDebugLibSerialPort +
FdtPL011SerialPortLib) that is set as the default for all module types
in "ArmVirt.dsc.inc" to DebugLibFdtPL011UartRam;
- switch the lib class resolution pair (BaseDebugLibSerialPort +
EarlyFdtPL011SerialPortLib) that is set as an override for SEC,
PEI_CORE, PEIM modules in "ArmVirt.dsc.inc" to
DebugLibFdtPL011UartFlash;
- switch the lib class resolution pair (DxeRuntimeDebugLibSerialPort +
FdtPL011SerialPortLib) that is set as an override for DXE_RUNTIME_DRIVER
modules in "ArmVirt.dsc.inc" to DxeRuntimeDebugLibFdtPL011Uart;
- mask all of the above DebugLib class resolution changes in
"ArmVirtKvmTool.dsc", because "ArmVirtKvmTool.dsc" uses
BaseSerialPortLib16550 rather than PL011 UARTs,
- mask all of the above DebugLib class resolution changes in
"ArmVirtXen.dsc" too, because "ArmVirtXen.dsc" uses
XenConsoleSerialPortLib rather than PL011 UARTs.
I regression-tested this change for "ArmVirtKvmTool.dsc" and
"ArmVirtXen.dsc" by building them for both DEBUG and RELEASE, both before
the patch and after, and comparing the edk2 build report files (focusing
on lib class resolutions). There are no changes.
Cc: Ard Biesheuvel <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Cc: Julien Grall <[email protected]>
Cc: Leif Lindholm <[email protected]>
Cc: Sami Mujawar <[email protected]>
Signed-off-by: Laszlo Ersek <[email protected]>
Message-Id: <[email protected]>
Acked-by: Ard Biesheuvel <[email protected]>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4577
[[email protected]: add TianoCore BZ reference]
Compare: https://github.com/tianocore/edk2/compare/74c687cc2f2f...f945b72331d7
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits