Revision: 16574
          http://sourceforge.net/p/edk2/code/16574
Author:   lersek
Date:     2015-01-02 12:08:15 +0000 (Fri, 02 Jan 2015)
Log Message:
-----------
OvmfPkg: QemuBootOrderLib: widen ParseUnitAddressHexList() to UINT64

The OpenFirmware device path nodes that QEMU generates for virtio-mmio
transports contain 64-bit hexadecimal values (16 nibbles) -- the base
addresses of the register blocks. In order to parse them soon,
ParseUnitAddressHexList() must parse UINT64 values.

Call sites need to be adapted, as expected.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <[email protected]>
Acked-by: Jordan Justen <[email protected]>

Modified Paths:
--------------
    trunk/edk2/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c

Modified: trunk/edk2/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
===================================================================
--- trunk/edk2/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c      
2015-01-02 12:08:11 UTC (rev 16573)
+++ trunk/edk2/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c      
2015-01-02 12:08:15 UTC (rev 16574)
@@ -128,7 +128,7 @@
 /**
 
   Parse a comma-separated list of hexadecimal integers into the elements of an
-  UINT32 array.
+  UINT64 array.
 
   Whitespace, "0x" prefixes, leading or trailing commas, sequences of commas,
   or an empty string are not allowed; they are rejected.
@@ -168,12 +168,12 @@
 RETURN_STATUS
 ParseUnitAddressHexList (
   IN      SUBSTRING  UnitAddress,
-  OUT     UINT32     *Result,
+  OUT     UINT64     *Result,
   IN OUT  UINTN      *NumResults
   )
 {
   UINTN         Entry;    // number of entry currently being parsed
-  UINT32        EntryVal; // value being constructed for current entry
+  UINT64        EntryVal; // value being constructed for current entry
   CHAR8         PrevChr;  // UnitAddress character previously checked
   UINTN         Pos;      // current position within UnitAddress
   RETURN_STATUS Status;
@@ -193,10 +193,10 @@
           -1;
 
     if (Val >= 0) {
-      if (EntryVal > 0xFFFFFFF) {
+      if (EntryVal > 0xFFFFFFFFFFFFFFFull) {
         return RETURN_INVALID_PARAMETER;
       }
-      EntryVal = (EntryVal << 4) | Val;
+      EntryVal = LShiftU64 (EntryVal, 4) | Val;
     } else if (Chr == ',') {
       if (PrevChr == ',') {
         return RETURN_INVALID_PARAMETER;
@@ -578,7 +578,7 @@
   IN OUT  UINTN          *TranslatedSize
   )
 {
-  UINT32 PciDevFun[2];
+  UINT64 PciDevFun[2];
   UINTN  NumEntries;
   UINTN  Written;
 
@@ -622,8 +622,8 @@
     //                                                ^
     //                                                fixed LUN
     //
-    UINT32 Secondary;
-    UINT32 Slave;
+    UINT64 Secondary;
+    UINT64 Slave;
 
     NumEntries = 1;
     if (ParseUnitAddressHexList (
@@ -645,7 +645,7 @@
     Written = UnicodeSPrintAsciiFormat (
       Translated,
       *TranslatedSize * sizeof (*Translated), // BufferSize in bytes
-      "PciRoot(0x0)/Pci(0x%x,0x%x)/Ata(%a,%a,0x0)",
+      "PciRoot(0x0)/Pci(0x%Lx,0x%Lx)/Ata(%a,%a,0x0)",
       PciDevFun[0],
       PciDevFun[1],
       Secondary ? "Secondary" : "Primary",
@@ -672,7 +672,7 @@
     //                                    ^
     //                                    ACPI UID
     //
-    UINT32 AcpiUid;
+    UINT64 AcpiUid;
 
     NumEntries = 1;
     if (ParseUnitAddressHexList (
@@ -688,7 +688,7 @@
     Written = UnicodeSPrintAsciiFormat (
       Translated,
       *TranslatedSize * sizeof (*Translated), // BufferSize in bytes
-      "PciRoot(0x0)/Pci(0x%x,0x%x)/Floppy(0x%x)",
+      "PciRoot(0x0)/Pci(0x%Lx,0x%Lx)/Floppy(0x%Lx)",
       PciDevFun[0],
       PciDevFun[1],
       AcpiUid
@@ -715,7 +715,7 @@
     Written = UnicodeSPrintAsciiFormat (
       Translated,
       *TranslatedSize * sizeof (*Translated), // BufferSize in bytes
-      "PciRoot(0x0)/Pci(0x%x,0x%x)/HD(",
+      "PciRoot(0x0)/Pci(0x%Lx,0x%Lx)/HD(",
       PciDevFun[0],
       PciDevFun[1]
       );
@@ -742,7 +742,7 @@
     //   PciRoot(0x0)/Pci(0x7,0x3)/Scsi(0x2,0x3)
     //                                -- if PCI function is present and nonzero
     //
-    UINT32 TargetLun[2];
+    UINT64 TargetLun[2];
 
     TargetLun[1] = 0;
     NumEntries = sizeof (TargetLun) / sizeof (TargetLun[0]);
@@ -758,7 +758,7 @@
     Written = UnicodeSPrintAsciiFormat (
       Translated,
       *TranslatedSize * sizeof (*Translated), // BufferSize in bytes
-      "PciRoot(0x0)/Pci(0x%x,0x%x)/Scsi(0x%x,0x%x)",
+      "PciRoot(0x0)/Pci(0x%Lx,0x%Lx)/Scsi(0x%Lx,0x%Lx)",
       PciDevFun[0],
       PciDevFun[1],
       TargetLun[0],
@@ -781,7 +781,7 @@
     Written = UnicodeSPrintAsciiFormat (
       Translated,
       *TranslatedSize * sizeof (*Translated), // BufferSize in bytes
-      "PciRoot(0x0)/Pci(0x%x,0x%x)",
+      "PciRoot(0x0)/Pci(0x%Lx,0x%Lx)",
       PciDevFun[0],
       PciDevFun[1]
       );


------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to