qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paulo Alcantara <pcacjr@gmail.com>
To: edk2-devel@lists.sourceforge.net
Cc: mst@redhat.com, jordan.l.justen@intel.com, qemu-devel@nongnu.org,
	Paulo Alcantara <pcacjr@zytor.com>,
	pbonzini@redhat.com, lersek@redhat.com
Subject: [Qemu-devel] [PATCH v5 1/2] OvmfPkg/PlatformPei: Query Host Bridge DID only once
Date: Mon,  8 Jun 2015 21:16:13 -0300	[thread overview]
Message-ID: <1433808974-28459-1-git-send-email-pcacjr@zytor.com> (raw)

Make HostBridgeDevId global so MemMapInitialization() can also use it to
conditionally add RCRB MMIO address to HOB.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
---
 OvmfPkg/PlatformPei/Platform.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c
index 1126c65..0e41d30 100644
--- a/OvmfPkg/PlatformPei/Platform.c
+++ b/OvmfPkg/PlatformPei/Platform.c
@@ -61,6 +61,8 @@ EFI_PEI_PPI_DESCRIPTOR   mPpiBootMode[] = {
 };
 
 
+UINT16 mHostBridgeDevId;
+
 EFI_BOOT_MODE mBootMode = BOOT_WITH_FULL_CONFIGURATION;
 
 BOOLEAN mS3Supported = FALSE;
@@ -229,7 +231,6 @@ MiscInitialization (
   VOID
   )
 {
-  UINT16 HostBridgeDevId;
   UINTN  PmCmd;
   UINTN  Pmba;
   UINTN  AcpiCtlReg;
@@ -246,10 +247,9 @@ MiscInitialization (
   BuildCpuHob (36, 16);
 
   //
-  // Query Host Bridge DID to determine platform type and save to PCD
+  // Determine platform type and save Host Bridge DID to PCD
   //
-  HostBridgeDevId = PciRead16 (OVMF_HOSTBRIDGE_DID);
-  switch (HostBridgeDevId) {
+  switch (mHostBridgeDevId) {
     case INTEL_82441_DEVICE_ID:
       PmCmd      = POWER_MGMT_REGISTER_PIIX4 (PCI_COMMAND_OFFSET);
       Pmba       = POWER_MGMT_REGISTER_PIIX4 (PIIX4_PMBA);
@@ -264,11 +264,11 @@ MiscInitialization (
       break;
     default:
       DEBUG ((EFI_D_ERROR, "%a: Unknown Host Bridge Device ID: 0x%04x\n",
-        __FUNCTION__, HostBridgeDevId));
+        __FUNCTION__, mHostBridgeDevId));
       ASSERT (FALSE);
       return;
   }
-  PcdSet16 (PcdOvmfHostBridgePciDevId, HostBridgeDevId);
+  PcdSet16 (PcdOvmfHostBridgePciDevId, mHostBridgeDevId);
 
   //
   // If the appropriate IOspace enable bit is set, assume the ACPI PMBA
@@ -400,6 +400,11 @@ InitializePlatform (
     InitializeXen ();
   }
 
+  //
+  // Query Host Bridge DID
+  //
+  mHostBridgeDevId = PciRead16 (OVMF_HOSTBRIDGE_DID);
+
   if (mBootMode != BOOT_ON_S3_RESUME) {
     ReserveEmuVariableNvStore ();
 
-- 
2.1.0

             reply	other threads:[~2015-06-09  0:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-09  0:16 Paulo Alcantara [this message]
2015-06-09  0:16 ` [Qemu-devel] [PATCH v5 2/2] OvmfPkg/PlatformPei: Initialise RCBA (B0:D31:F0 0xf0) register Paulo Alcantara
2015-06-09 14:35   ` Laszlo Ersek
2015-06-09 15:33   ` Jordan Justen

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=1433808974-28459-1-git-send-email-pcacjr@zytor.com \
    --to=pcacjr@gmail.com \
    --cc=edk2-devel@lists.sourceforge.net \
    --cc=jordan.l.justen@intel.com \
    --cc=lersek@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=pcacjr@zytor.com \
    --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).