Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: David Woodhouse <david.woodho...@intel.com>
---

Seriously, UTF-16? Or is that UCS-2? What bizarre world am I in that
people don't just use UTF-8?

Yes, the 'WTF' in there needs fixing but I have no idea where those
numbers come from. I'm assuming there's *some* meaning to them since
they're not just sequential?

 .../Include/Library/GenericBdsLib.h                 |   1 +
 .../Library/GenericBdsLib/BdsBoot.c                 |  20 ++++++++++++++++++++
 .../Library/GenericBdsLib/GenericBdsStrings.uni     | Bin 3852 -> 4174 bytes
 3 files changed, 21 insertions(+)

diff --git a/IntelFrameworkModulePkg/Include/Library/GenericBdsLib.h 
b/IntelFrameworkModulePkg/Include/Library/GenericBdsLib.h
index b1887b6..3154643 100644
--- a/IntelFrameworkModulePkg/Include/Library/GenericBdsLib.h
+++ b/IntelFrameworkModulePkg/Include/Library/GenericBdsLib.h
@@ -845,6 +845,7 @@ SetupResetReminder (
 #define  BDS_EFI_MESSAGE_USB_DEVICE_BOOT  0x0305 // Type 03; Sub-Type 05
 #define  BDS_EFI_MESSAGE_SATA_BOOT        0x0312 // Type 03; Sub-Type 18
 #define  BDS_EFI_MESSAGE_MAC_BOOT         0x030b // Type 03; Sub-Type 11
+#define  BDS_EFI_MESSAGE_VIRTIO_BOOT      0x03FE // Type 03; Sub-Type WTF
 #define  BDS_EFI_MESSAGE_MISC_BOOT        0x03FF
 
 ///
diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c 
b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
index c04c586..fa5ba8c 100644
--- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
+++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
@@ -3079,6 +3079,7 @@ BdsLibEnumerateAllBootOption (
   UINT16                        HarddriveNumber;
   UINT16                        CdromNumber;
   UINT16                        UsbNumber;
+  UINT16                        VirtioNumber;
   UINT16                        MiscNumber;
   UINT16                        ScsiNumber;
   UINT16                        NonBlockNumber;
@@ -3113,6 +3114,7 @@ BdsLibEnumerateAllBootOption (
   HarddriveNumber = 0;
   CdromNumber     = 0;
   UsbNumber       = 0;
+  VirtioNumber    = 0;
   MiscNumber      = 0;
   ScsiNumber      = 0;
   PlatLang        = NULL;
@@ -3248,6 +3250,16 @@ BdsLibEnumerateAllBootOption (
         ScsiNumber++;
         break;
 
+      case BDS_EFI_MESSAGE_VIRTIO_BOOT:
+        if (VirtioNumber != 0) {
+          UnicodeSPrint (Buffer, sizeof (Buffer), L"%s %d", 
BdsLibGetStringById (STRING_TOKEN (STR_DESCRIPTION_VIRTIO)), VirtioNumber);
+        } else {
+          UnicodeSPrint (Buffer, sizeof (Buffer), L"%s", BdsLibGetStringById 
(STRING_TOKEN (STR_DESCRIPTION_VIRTIO)));
+        }
+        BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, 
Buffer);
+        VirtioNumber++;
+       break;
+
       case BDS_EFI_MESSAGE_MISC_BOOT:
         if (MiscNumber != 0) {
           UnicodeSPrint (Buffer, sizeof (Buffer), L"%s %d", 
BdsLibGetStringById (STRING_TOKEN (STR_DESCRIPTION_MISC)), MiscNumber);
@@ -3814,6 +3826,8 @@ BdsLibNetworkBootWithMediaPresent (
                                           and its last device path node's 
subtype is MSG_SCSI_DP.
   @retval BDS_EFI_MESSAGE_USB_DEVICE_BOOT If given device path contains 
MESSAGING_DEVICE_PATH type device path node
                                           and its last device path node's 
subtype is MSG_USB_DP.
+  @retval BDS_EFI_MESSAGE_VIRTIO_BOOT     If the device path not contains any 
media device path node,  and
+                                          its last device path node point to a 
PCI device path node.
   @retval BDS_EFI_MESSAGE_MISC_BOOT       If the device path not contains any 
media device path node,  and
                                           its last device path node point to a 
message device path node.
   @retval BDS_LEGACY_BBS_BOOT             If given device path contains 
BBS_DEVICE_PATH type device path node.
@@ -3854,6 +3868,12 @@ BdsGetBootTypeFromDevicePath (
           return BDS_EFI_ACPI_FLOPPY_BOOT;
         }
         break;
+      case HARDWARE_DEVICE_PATH:
+        // Virtio disks will be a plain PCI device
+        if (DevicePathSubType (TempDevicePath) == HW_PCI_DP &&
+           IsDevicePathEndType (NextDevicePathNode (TempDevicePath)))
+          return BDS_EFI_MESSAGE_VIRTIO_BOOT;
+       break;
       case MESSAGING_DEVICE_PATH:
         //
         // Get the last device path node
diff --git 
a/IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsStrings.uni 
b/IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsStrings.uni
index 
7c3b4f96900c0d36ad9c272b5a6372afb1a3a788..b3eb07719733ec7504b20a789e4a2f9a9c81a231
 100644
GIT binary patch
delta 60
zcmeB?JEyRrjGH@*!IL3~Ap}VJPZs2~2l6u+iWo|OWd3ABZqdnixI2)=HXCx^W(EMv
CH4k9`

delta 12
TcmX@7&?C2@jC=DAo@vYgB1i<<

-- 
1.8.0.2


-- 
dwmw2

Attachment: smime.p7s
Description: S/MIME cryptographic signature

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to