summaryrefslogtreecommitdiff
path: root/OvmfPkg/Library
diff options
context:
space:
mode:
authorjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>2012-10-18 17:08:01 +0000
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>2012-10-18 17:08:01 +0000
commitd2bf9913a6fa689b17e53722adaba6a42ccf98d2 (patch)
treec0809b6735a45b1db920c593241e4a9c03ff58fc /OvmfPkg/Library
parent37078a63b1911f8b320bab6d82a2183a84f8858c (diff)
downloadedk2-platforms-d2bf9913a6fa689b17e53722adaba6a42ccf98d2.tar.xz
OvmfPkg: QemuBootOrder: recognize virtio-scsi devices
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13868 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'OvmfPkg/Library')
-rw-r--r--OvmfPkg/Library/PlatformBdsLib/QemuBootOrder.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/OvmfPkg/Library/PlatformBdsLib/QemuBootOrder.c b/OvmfPkg/Library/PlatformBdsLib/QemuBootOrder.c
index 9807039f2f..d2d60c389f 100644
--- a/OvmfPkg/Library/PlatformBdsLib/QemuBootOrder.c
+++ b/OvmfPkg/Library/PlatformBdsLib/QemuBootOrder.c
@@ -632,6 +632,51 @@ TranslateOfwNodes (
PciDevFun[0],
PciDevFun[1]
);
+ } else if (NumNodes >= 4 &&
+ SubstringEq (OfwNode[1].DriverName, "scsi") &&
+ SubstringEq (OfwNode[2].DriverName, "channel") &&
+ SubstringEq (OfwNode[3].DriverName, "disk")
+ ) {
+ //
+ // OpenFirmware device path (virtio-scsi disk):
+ //
+ // /pci@i0cf8/scsi@7[,3]/channel@0/disk@2,3
+ // ^ ^ ^ ^ ^
+ // | | | | LUN
+ // | | | target
+ // | | channel (unused, fixed 0)
+ // | PCI slot[, function] holding SCSI controller
+ // PCI root at system bus port, PIO
+ //
+ // UEFI device path prefix:
+ //
+ // PciRoot(0x0)/Pci(0x7,0x0)/Scsi(0x2,0x3)
+ // -- if PCI function is 0 or absent
+ // PciRoot(0x0)/Pci(0x7,0x3)/Scsi(0x2,0x3)
+ // -- if PCI function is present and nonzero
+ //
+ UINT32 TargetLun[2];
+
+ TargetLun[1] = 0;
+ NumEntries = sizeof (TargetLun) / sizeof (TargetLun[0]);
+ if (ParseUnitAddressHexList (
+ OfwNode[3].UnitAddress,
+ TargetLun,
+ &NumEntries
+ ) != RETURN_SUCCESS
+ ) {
+ return RETURN_UNSUPPORTED;
+ }
+
+ Written = UnicodeSPrintAsciiFormat (
+ Translated,
+ *TranslatedSize * sizeof (*Translated), // BufferSize in bytes
+ "PciRoot(0x0)/Pci(0x%x,0x%x)/Scsi(0x%x,0x%x)",
+ PciDevFun[0],
+ PciDevFun[1],
+ TargetLun[0],
+ TargetLun[1]
+ );
} else {
return RETURN_UNSUPPORTED;
}