qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: qemu-devel@nongnu.org, edk2-devel@lists.sourceforge.net,
	drjones@redhat.com, ard.biesheuvel@linaro.org,
	peter.maydell@linaro.org, imammedo@redhat.com, mst@redhat.com
Subject: [Qemu-devel] [edk2 PATCH 09/12] OvmfPkg: QemuBootOrderLib: widen ParseUnitAddressHexList() to UINT64
Date: Fri, 28 Nov 2014 00:19:24 +0100	[thread overview]
Message-ID: <1417130367-17777-10-git-send-email-lersek@redhat.com> (raw)
In-Reply-To: <1417130367-17777-1-git-send-email-lersek@redhat.com>

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 <lersek@redhat.com>
---
 OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c b/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
index 174fd1f..3599437 100644
--- a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
+++ b/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
@@ -128,7 +128,7 @@ SubstringEq (
 /**
 
   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 @@ STATIC
 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 @@ ParseUnitAddressHexList (
           -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 @@ TranslatePciOfwNodes (
   IN OUT  UINTN          *TranslatedSize
   )
 {
-  UINT32 PciDevFun[2];
+  UINT64 PciDevFun[2];
   UINTN  NumEntries;
   UINTN  Written;
 
@@ -622,8 +622,8 @@ TranslatePciOfwNodes (
     //                                                ^
     //                                                fixed LUN
     //
-    UINT32 Secondary;
-    UINT32 Slave;
+    UINT64 Secondary;
+    UINT64 Slave;
 
     NumEntries = 1;
     if (ParseUnitAddressHexList (
@@ -645,7 +645,7 @@ TranslatePciOfwNodes (
     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 @@ TranslatePciOfwNodes (
     //                                    ^
     //                                    ACPI UID
     //
-    UINT32 AcpiUid;
+    UINT64 AcpiUid;
 
     NumEntries = 1;
     if (ParseUnitAddressHexList (
@@ -688,7 +688,7 @@ TranslatePciOfwNodes (
     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 @@ TranslatePciOfwNodes (
     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 @@ TranslatePciOfwNodes (
     //   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 @@ TranslatePciOfwNodes (
     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 @@ TranslatePciOfwNodes (
     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]
       );
-- 
1.8.3.1

  parent reply	other threads:[~2014-11-27 23:20 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-27 23:17 [Qemu-devel] expose QEMU's fw_cfg boot order to ARM guest firmware (Intel BDS) Laszlo Ersek
2014-11-27 23:18 ` [Qemu-devel] [qemu PATCH 0/2] DTB- and MMIO-based fw_cfg for hw/arm/virt Laszlo Ersek
2014-11-27 23:18   ` [Qemu-devel] [qemu PATCH 1/2] fw_cfg: make the FW_CFG_SIZE and FW_CFG_DATA_SIZE macros public Laszlo Ersek
2014-11-27 23:18   ` [Qemu-devel] [qemu PATCH 2/2] arm: add fw_cfg to "virt" board Laszlo Ersek
2014-11-27 23:28     ` Peter Maydell
2014-11-27 23:34       ` Laszlo Ersek
2014-11-27 23:37         ` Peter Maydell
2014-11-28 10:38     ` Andrew Jones
2014-11-28 10:43       ` Laszlo Ersek
2014-11-28 10:49         ` Laszlo Ersek
2014-11-28 11:17           ` Andrew Jones
2014-11-28 10:51         ` Andrew Jones
2014-11-27 23:19 ` [Qemu-devel] [edk2 PATCH 00/12] consume fw_cfg boot order in ArmVirtualizationQemu Laszlo Ersek
2014-11-27 23:19   ` [Qemu-devel] [edk2 PATCH 01/12] ArmVirtualizationPkg: VirtFdtDxe: forward FwCfg addresses from DTB to PCDs Laszlo Ersek
2014-12-05 17:39     ` [Qemu-devel] [edk2] " Laszlo Ersek
2014-11-27 23:19   ` [Qemu-devel] [edk2 PATCH 02/12] ArmVirtualizationPkg: introduce QemuFwCfgLib instance for DXE drivers Laszlo Ersek
2014-11-27 23:19   ` [Qemu-devel] [edk2 PATCH 03/12] ArmVirtualizationPkg: clone PlatformIntelBdsLib from ArmPlatformPkg Laszlo Ersek
2014-11-27 23:19   ` [Qemu-devel] [edk2 PATCH 04/12] ArmVirtualizationPkg: PlatformIntelBdsLib: add basic policy Laszlo Ersek
2014-11-27 23:19   ` [Qemu-devel] [edk2 PATCH 05/12] OvmfPkg: extract QemuBootOrderLib Laszlo Ersek
2014-11-27 23:19   ` [Qemu-devel] [edk2 PATCH 06/12] OvmfPkg: QemuBootOrderLib: featurize PCI-like device path translation Laszlo Ersek
2014-11-27 23:19   ` [Qemu-devel] [edk2 PATCH 07/12] OvmfPkg: introduce VIRTIO_MMIO_TRANSPORT_GUID Laszlo Ersek
2014-11-27 23:19   ` [Qemu-devel] [edk2 PATCH 08/12] ArmVirtualizationPkg: VirtFdtDxe: use dedicated VIRTIO_MMIO_TRANSPORT_GUID Laszlo Ersek
2014-11-27 23:19   ` Laszlo Ersek [this message]
2014-11-27 23:19   ` [Qemu-devel] [edk2 PATCH 10/12] OvmfPkg: QemuBootOrderLib: OFW-to-UEFI translation for virtio-mmio Laszlo Ersek
2014-11-27 23:19   ` [Qemu-devel] [edk2 PATCH 11/12] ArmVirtualizationPkg: PlatformIntelBdsLib: adhere to QEMU's boot order Laszlo Ersek
2014-11-27 23:19   ` [Qemu-devel] [edk2 PATCH 12/12] ArmVirtualizationPkg: identify "new shell" as builtin shell for Intel BDS Laszlo Ersek

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-all 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=1417130367-17777-10-git-send-email-lersek@redhat.com \
    --to=lersek@redhat.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=drjones@redhat.com \
    --cc=edk2-devel@lists.sourceforge.net \
    --cc=imammedo@redhat.com \
    --cc=mst@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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;
as well as URLs for NNTP newsgroup(s).