]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg: QemuBootOrderLib: recognize Q35 SATA disks / CD-ROMs
authorLaszlo Ersek <lersek@redhat.com>
Tue, 22 Sep 2015 11:18:41 +0000 (11:18 +0000)
committerlersek <lersek@Edk2>
Tue, 22 Sep 2015 11:18:41 +0000 (11:18 +0000)
The OpenFirmware device paths that QEMU generates for these disks and
CD-ROMs are very similar to those generated for the i440fx IDE disks and
CD-ROMs (including the same number of devpath nodes necessary for unique
parsing). The interpretations and the translation to UEFI devpath
fragments are different, of course.

(The spaces after "ide@1,1" are inserted below only for illustration
purposes.)

                                                 primary or secondary
                                                 |      master or slave
                                                 v      v
  i440fx IDE: /pci@i0cf8/ide@1,1          /drive@0/disk@0
  Q35 SATA:   /pci@i0cf8/pci8086,2922@1f,2/drive@1/disk@0
                                                 ^      ^
                                                 |      device number
                                                 |      (fixed 0)
                                                 channel (port) number

The similarity is reflected in the translation output (spaces again
inserted for illustration only):

  i440fx IDE: PciRoot(0x0)/Pci(0x1,0x1) /Ata(Primary,Master,0x0)
  Q35 SATA:   PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x1,0x0,0x0)
                                              ^   ^   ^
                                              |   |   LUN;
                                              |   |   always 0 on Q35
                                              |   port multiplier port
                                              |   number; always 0 on Q35
                                              channel (port) number

Cc: Alexander Graf <agraf@suse.de>
Cc: Reza Jelveh <reza.jelveh@tuhh.de>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Gabriel L. Somlo <somlo@cmu.edu>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Gabriel Somlo <somlo@cmu.edu>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18531 6f19259b-4bc3-4df7-8a09-765794883524

OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c

index 2e9634359d3a6679eee8fbee4861b61f1048a248..43dbaffaa421747a931acb4e2c1e2b07cfeebe60 100644 (file)
@@ -769,6 +769,49 @@ TranslatePciOfwNodes (
       Secondary ? "Secondary" : "Primary",\r
       Slave ? "Slave" : "Master"\r
       );\r
+  } else if (NumNodes >= FirstNonBridge + 3 &&\r
+      SubstringEq (OfwNode[FirstNonBridge + 0].DriverName, "pci8086,2922") &&\r
+      SubstringEq (OfwNode[FirstNonBridge + 1].DriverName, "drive") &&\r
+      SubstringEq (OfwNode[FirstNonBridge + 2].DriverName, "disk")\r
+      ) {\r
+    //\r
+    // OpenFirmware device path (Q35 SATA disk and CD-ROM):\r
+    //\r
+    //   /pci@i0cf8/pci8086,2922@1f,2/drive@1/disk@0\r
+    //        ^                  ^  ^       ^      ^\r
+    //        |                  |  |       |      device number (fixed 0)\r
+    //        |                  |  |       channel (port) number\r
+    //        |                  PCI slot & function holding SATA HBA\r
+    //        PCI root at system bus port, PIO\r
+    //\r
+    // UEFI device path:\r
+    //\r
+    //   PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x1,0x0,0x0)\r
+    //                                   ^   ^   ^\r
+    //                                   |   |   LUN (always 0 on Q35)\r
+    //                                   |   port multiplier port number,\r
+    //                                   |   always 0 on Q35\r
+    //                                   channel (port) number\r
+    //\r
+    UINT64 Channel;\r
+\r
+    NumEntries = 1;\r
+    if (RETURN_ERROR (ParseUnitAddressHexList (\r
+                        OfwNode[FirstNonBridge + 1].UnitAddress, &Channel,\r
+                        &NumEntries))) {\r
+      return RETURN_UNSUPPORTED;\r
+    }\r
+\r
+    Written = UnicodeSPrintAsciiFormat (\r
+      Translated,\r
+      *TranslatedSize * sizeof (*Translated), // BufferSize in bytes\r
+      "PciRoot(0x%x)%s/Pci(0x%Lx,0x%Lx)/Sata(0x%Lx,0x0,0x0)",\r
+      PciRoot,\r
+      Bridges,\r
+      PciDevFun[0],\r
+      PciDevFun[1],\r
+      Channel\r
+      );\r
   } else if (NumNodes >= FirstNonBridge + 3 &&\r
              SubstringEq (OfwNode[FirstNonBridge + 0].DriverName, "isa") &&\r
              SubstringEq (OfwNode[FirstNonBridge + 1].DriverName, "fdc") &&\r