public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: edk2-devel-01 <edk2-devel@ml01.01.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Subject: [PATCH 6/6] OvmfPkg/QemuFwCfg: introduce FW_CFG_IO_DMA_ADDRESS, adapt the package
Date: Tue, 21 Feb 2017 16:38:12 +0100	[thread overview]
Message-ID: <20170221153812.1420-7-lersek@redhat.com> (raw)
In-Reply-To: <20170221153812.1420-1-lersek@redhat.com>

Introduce the FW_CFG_IO_DMA_ADDRESS macro for IO Ports 0x514 and 0x518
(most significant and least significant halves of the DMA Address
Register, respectively), and update all references in OvmfPkg.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Suggested-by: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/Include/IndustryStandard/QemuFwCfg.h | 1 +
 OvmfPkg/AcpiPlatformDxe/BootScript.c         | 4 ++--
 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c  | 4 ++--
 OvmfPkg/SmmControl2Dxe/SmiFeatures.c         | 2 +-
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/OvmfPkg/Include/IndustryStandard/QemuFwCfg.h b/OvmfPkg/Include/IndustryStandard/QemuFwCfg.h
index 5da6b456febe..8c32f83e8e16 100644
--- a/OvmfPkg/Include/IndustryStandard/QemuFwCfg.h
+++ b/OvmfPkg/Include/IndustryStandard/QemuFwCfg.h
@@ -48,6 +48,7 @@
 //
 #define FW_CFG_IO_SELECTOR    0x510
 #define FW_CFG_IO_DATA        0x511
+#define FW_CFG_IO_DMA_ADDRESS 0x514
 
 //
 // Numerically defined keys.
diff --git a/OvmfPkg/AcpiPlatformDxe/BootScript.c b/OvmfPkg/AcpiPlatformDxe/BootScript.c
index 1ad468e2f834..bff42ad8b9b0 100644
--- a/OvmfPkg/AcpiPlatformDxe/BootScript.c
+++ b/OvmfPkg/AcpiPlatformDxe/BootScript.c
@@ -317,7 +317,7 @@ TransferS3ContextToBootScript (
                             S3SaveState,                     // This
                             EFI_BOOT_SCRIPT_IO_WRITE_OPCODE, // OpCode
                             EfiBootScriptWidthUint32,        // Width
-                            (UINT64)0x514,                   // Address
+                            (UINT64)FW_CFG_IO_DMA_ADDRESS,   // Address
                             (UINTN)2,                        // Count
                             &BigEndianAddressOfAccess        // Buffer
                             );
@@ -376,7 +376,7 @@ TransferS3ContextToBootScript (
                             S3SaveState,                     // This
                             EFI_BOOT_SCRIPT_IO_WRITE_OPCODE, // OpCode
                             EfiBootScriptWidthUint32,        // Width
-                            (UINT64)0x514,                   // Address
+                            (UINT64)FW_CFG_IO_DMA_ADDRESS,   // Address
                             (UINTN)2,                        // Count
                             &BigEndianAddressOfAccess        // Buffer
                             );
diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
index d79d0a444ca7..3dd55ba5042e 100644
--- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
+++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
@@ -94,8 +94,8 @@ InternalQemuFwCfgDmaBytes (
   //
   AccessHigh = (UINT32)RShiftU64 ((UINTN)&Access, 32);
   AccessLow  = (UINT32)(UINTN)&Access;
-  IoWrite32 (0x514, SwapBytes32 (AccessHigh));
-  IoWrite32 (0x518, SwapBytes32 (AccessLow));
+  IoWrite32 (FW_CFG_IO_DMA_ADDRESS,     SwapBytes32 (AccessHigh));
+  IoWrite32 (FW_CFG_IO_DMA_ADDRESS + 4, SwapBytes32 (AccessLow));
 
   //
   // Don't look at Access.Control before starting the transfer.
diff --git a/OvmfPkg/SmmControl2Dxe/SmiFeatures.c b/OvmfPkg/SmmControl2Dxe/SmiFeatures.c
index 73c29848b334..bd257f15d955 100644
--- a/OvmfPkg/SmmControl2Dxe/SmiFeatures.c
+++ b/OvmfPkg/SmmControl2Dxe/SmiFeatures.c
@@ -240,7 +240,7 @@ SaveSmiFeatures (
                           S3SaveState,                     // This
                           EFI_BOOT_SCRIPT_IO_WRITE_OPCODE, // OpCode
                           EfiBootScriptWidthUint32,        // Width
-                          (UINT64)0x514,                   // Address
+                          (UINT64)FW_CFG_IO_DMA_ADDRESS,   // Address
                           (UINTN)2,                        // Count
                           &AccessAddress                   // Buffer
                           );
-- 
2.9.3



  parent reply	other threads:[~2017-02-21 15:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-21 15:38 [PATCH 0/6] OvmfPkg: AcpiPlatformDxe, QemuFwCfg: small cleanups after WRITE_POINTER Laszlo Ersek
2017-02-21 15:38 ` [PATCH 1/6] OvmfPkg/AcpiPlatformDxe: drop double right shift in ADD/WRITE POINTER cmds Laszlo Ersek
2017-02-21 15:38 ` [PATCH 2/6] OvmfPkg/AcpiPlatformDxe: update PointerValue comments in "BootScript.c" Laszlo Ersek
2017-02-21 15:38 ` [PATCH 3/6] OvmfPkg/QemuFwCfgLib: move types/macros from lib class to IndustryStandard Laszlo Ersek
2017-02-21 15:38 ` [PATCH 4/6] OvmfPkg/QemuFwCfg: introduce FW_CFG_IO_SELECTOR, adapt the package Laszlo Ersek
2017-02-21 15:38 ` [PATCH 5/6] OvmfPkg/QemuFwCfg: introduce FW_CFG_IO_DATA, " Laszlo Ersek
2017-02-21 15:38 ` Laszlo Ersek [this message]
2017-02-22  1:58 ` [PATCH 0/6] OvmfPkg: AcpiPlatformDxe, QemuFwCfg: small cleanups after WRITE_POINTER Jordan Justen
2017-02-22  2:41   ` 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-list 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=20170221153812.1420-7-lersek@redhat.com \
    --to=devel@edk2.groups.io \
    /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