From: "Gerd Hoffmann" <kraxel@redhat.com>
To: devel@edk2.groups.io
Cc: "Stefan Berger" <stefanb@linux.ibm.com>,
"Julien Grall" <julien@xen.org>,
"Anthony Perard" <anthony.perard@citrix.com>,
"Ard Biesheuvel" <ardb+tianocore@kernel.org>,
"Jordan Justen" <jordan.l.justen@intel.com>,
"Pawel Polawski" <ppolawsk@redhat.com>,
"Oliver Steffen" <osteffen@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Jiewen Yao" <jiewen.yao@intel.com>,
"Gerd Hoffmann" <kraxel@redhat.com>
Subject: [PATCH 4/4] OvmfPkg/PlatformBootManagerLib: setup virtio serial console
Date: Mon, 17 Apr 2023 11:03:20 +0200 [thread overview]
Message-ID: <20230417090320.225046-5-kraxel@redhat.com> (raw)
In-Reply-To: <20230417090320.225046-1-kraxel@redhat.com>
In case a virtio-serial device is present in the system register the
first serial port as console.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
.../PlatformBootManagerLib/BdsPlatform.c | 47 +++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index a90076c9e672..3b7dc53e9f86 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -976,6 +976,45 @@ PreparePciSerialDevicePath (
return EFI_SUCCESS;
}
+EFI_STATUS
+PrepareVirtioSerialDevicePath (
+ IN EFI_HANDLE DeviceHandle
+ )
+{
+ EFI_STATUS Status;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+
+ DevicePath = NULL;
+ Status = gBS->HandleProtocol (
+ DeviceHandle,
+ &gEfiDevicePathProtocolGuid,
+ (VOID *)&DevicePath
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ gPnp16550ComPortDeviceNode.UID = 0;
+ DevicePath = AppendDevicePathNode (
+ DevicePath,
+ (EFI_DEVICE_PATH_PROTOCOL *)&gPnp16550ComPortDeviceNode
+ );
+ DevicePath = AppendDevicePathNode (
+ DevicePath,
+ (EFI_DEVICE_PATH_PROTOCOL *)&gUartDeviceNode
+ );
+ DevicePath = AppendDevicePathNode (
+ DevicePath,
+ (EFI_DEVICE_PATH_PROTOCOL *)&gTerminalTypeDeviceNode
+ );
+
+ EfiBootManagerUpdateConsoleVariable (ConOut, DevicePath, NULL);
+ EfiBootManagerUpdateConsoleVariable (ConIn, DevicePath, NULL);
+ EfiBootManagerUpdateConsoleVariable (ErrOut, DevicePath, NULL);
+
+ return EFI_SUCCESS;
+}
+
EFI_STATUS
VisitAllInstancesOfProtocol (
IN EFI_GUID *Id,
@@ -1144,6 +1183,14 @@ DetectAndPreparePlatformPciDevicePath (
return EFI_SUCCESS;
}
+ if (((Pci->Hdr.VendorId == 0x1af4) && (Pci->Hdr.DeviceId == 0x1003)) ||
+ ((Pci->Hdr.VendorId == 0x1af4) && (Pci->Hdr.DeviceId == 0x1043)))
+ {
+ DEBUG ((DEBUG_INFO, "Found virtio serial device\n"));
+ PrepareVirtioSerialDevicePath (Handle);
+ return EFI_SUCCESS;
+ }
+
return Status;
}
--
2.39.2
next prev parent reply other threads:[~2023-04-17 9:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-17 9:03 [PATCH 0/4] OvmfPkg: add virtio serial driver Gerd Hoffmann
2023-04-17 9:03 ` [PATCH 1/4] OvmfPkg: add IndustryStandard/VirtioSerial.h Gerd Hoffmann
2023-04-17 9:03 ` [PATCH 2/4] OvmfPkg/VirtioSerialDxe: add driver Gerd Hoffmann
2023-04-17 9:03 ` [PATCH 3/4] OvmfPkg/VirtioSerialDxe: wire up in OvmfPkg* Gerd Hoffmann
2023-04-17 9:03 ` Gerd Hoffmann [this message]
2023-04-18 15:46 ` [PATCH 0/4] OvmfPkg: add virtio serial driver Ard Biesheuvel
2023-04-19 6:18 ` Gerd Hoffmann
2023-04-20 9:52 ` [edk2-devel] " Gupta, Pankaj
2023-04-20 11:46 ` Gerd Hoffmann
2023-04-20 13:31 ` Gupta, Pankaj
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-list 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=20230417090320.225046-5-kraxel@redhat.com \
--to=devel@edk2.groups.io \
/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