summaryrefslogtreecommitdiff
path: root/OvmfPkg
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2022-09-21 07:30:44 +0200
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2022-09-28 10:46:29 +0000
commitd63242bd69a0e3eaa39afd644b634f60f384b278 (patch)
tree85fc097219cef765a73b20ed8a5ecafa210e31f9 /OvmfPkg
parent2a0bd3bffc80d1982cf85cdad066f79a2f60c769 (diff)
downloadedk2-d63242bd69a0e3eaa39afd644b634f60f384b278.zip
edk2-d63242bd69a0e3eaa39afd644b634f60f384b278.tar.gz
edk2-d63242bd69a0e3eaa39afd644b634f60f384b278.tar.bz2
OvmfPkg/QemuBootOrderLib: allow slash in rom filenames
See comment for details. Needed to avoid the parser abort, so we can continue parsing the bootorder fw_cfg file. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Diffstat (limited to 'OvmfPkg')
-rw-r--r--OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c b/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
index 398de7f..374c6d8 100644
--- a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
+++ b/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
@@ -432,6 +432,8 @@ ParseOfwNode (
OUT BOOLEAN *IsFinal
)
{
+ BOOLEAN AcceptSlash = FALSE;
+
//
// A leading slash is expected. End of string is tolerated.
//
@@ -464,6 +466,21 @@ ParseOfwNode (
return RETURN_INVALID_PARAMETER;
}
+ if (SubstringEq (OfwNode->DriverName, "rom")) {
+ //
+ // bug compatibility hack
+ //
+ // qemu passes fw_cfg filenames as rom unit address.
+ // The filenames have slashes:
+ // /rom@genroms/linuxboot_dma.bin
+ //
+ // Alow slashes in the unit address to avoid the parser trip up,
+ // so we can successfully parse the following lines (the rom
+ // entries themself are ignored).
+ //
+ AcceptSlash = TRUE;
+ }
+
//
// unit-address
//
@@ -475,7 +492,7 @@ ParseOfwNode (
OfwNode->UnitAddress.Ptr = *Ptr;
OfwNode->UnitAddress.Len = 0;
- while (IsPrintNotDelim (**Ptr)) {
+ while (IsPrintNotDelim (**Ptr) || (AcceptSlash && **Ptr == '/')) {
++*Ptr;
++OfwNode->UnitAddress.Len;
}