Skip to contentSkip to conversation

MdeModulePkg: introduce PcdPciDisableBusEnumeration

PATCH New Wei Liu 5 participants 17 messages Nov 29, 2013 – Dec 8, 2013 11 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Wei Liu

author
#1 lore raw

PATCH v4 1/7 MdeModulePkg: introduce PcdPciDisableBusEnumeration

Platforms such as Xen already enumerates PCI bridges and devices. Use this PCD to control EDK2 behavior.

PcdPciDisableBusEnumeration is placed under [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx], so that it is possible to alter it during runtime.

The default setting of this PCD is false (allow full PCI enumeration) to preserve the same behavior before this change.

Contributed-under: TianoCore Contribution Agreement 1.0

---
 MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.c      |    5 ++++-
 MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf |    1 +
 MdeModulePkg/MdeModulePkg.dec                |    3 +++
 3 files changed, 8 insertions(+), 1 deletion(-)
MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.c +4 -1
index 5afbb82..cc6be8b 100644
@@ -284,7 +284,10 @@ PciBusDriverBindingStart (
           );
   }  
 
-  gFullEnumeration = (BOOLEAN) ((SearchHostBridgeHandle (Controller) ? FALSE : TRUE));
+  if (PcdGetBool (PcdPciDisableBusEnumeration))
+    gFullEnumeration = FALSE;
+  else
+    gFullEnumeration = (BOOLEAN) ((SearchHostBridgeHandle (Controller) ? FALSE : TRUE));
 
   //
   // Open Device Path Protocol for PCI root bridge
MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf +1 -0
index 34eb672..917889c 100644
@@ -108,6 +108,7 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdSrIovSupport
   gEfiMdeModulePkgTokenSpaceGuid.PcdAriSupport
   gEfiMdeModulePkgTokenSpaceGuid.PcdMrIovSupport
+  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration
 
 # [Event]
 #   ##
MdeModulePkg/MdeModulePkg.dec +3 -0
index b627eb1..5198451 100644
@@ -878,6 +878,9 @@
   ## This PCD specified whether the S.M.A.R.T feature of attached ATA hard disks are enabled.
   gEfiMdeModulePkgTokenSpaceGuid.PcdAtaSmartEnable|TRUE|BOOLEAN|0x00010065
 
+  ## This PCD specifies whether full PCI enumeration is disabled.
+  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|FALSE|BOOLEAN|0x10000048
+
 [PcdsPatchableInModule]
   ## Specify  memory size with page number for PEI code when 
   #  the feature of Loading Module at Fixed Address is enabled
Signature · 1 line
1.7.10.4
author
#2 lore raw

PATCH v4 2/7 OvmfPkg: introduce E820.h

In reply to a message not in the archive

E820 definitions copied from IntelFrameworkModulePkg/Csm/ LegacyBiosDxe/LegacyBiosInterface.h.

Contributed-under: TianoCore Contribution Agreement 1.0

---
 OvmfPkg/Include/IndustryStandard/E820.h |   46 +++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 OvmfPkg/Include/IndustryStandard/E820.h
OvmfPkg/Include/IndustryStandard/E820.h new file +46 -0
new file mode 100644
index 0000000..aeafd89
@@ -0,0 +1,46 @@
+/** @file
+
+Copyright (c) 2013, Citrix Systems UK Ltd.
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
+
+This program and the accompanying materials
+are licensed and made available under the terms and conditions
+of the BSD License which accompanies this distribution.  The
+full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+
+#ifndef __E820_H__
+#define __E820_H__
+
+#pragma pack(1)
+
+typedef enum {
+  EfiAcpiAddressRangeMemory   = 1,
+  EfiAcpiAddressRangeReserved = 2,
+  EfiAcpiAddressRangeACPI     = 3,
+  EfiAcpiAddressRangeNVS      = 4
+} EFI_ACPI_MEMORY_TYPE;
+
+typedef struct {
+  UINT64                BaseAddr;
+  UINT64                Length;
+  EFI_ACPI_MEMORY_TYPE  Type;
+} EFI_E820_ENTRY64;
+
+typedef struct {
+  UINT32                BassAddrLow;
+  UINT32                BaseAddrHigh;
+  UINT32                LengthLow;
+  UINT32                LengthHigh;
+  EFI_ACPI_MEMORY_TYPE  Type;
+} EFI_E820_ENTRY;
+
+#pragma pack()
+
+#endif /* __E820_H__ */
Signature · 1 line
1.7.10.4
author
#3 lore raw

PATCH v4 3/7 OvmfPkg: define EFI_XEN_OVMF_INFO

In reply to a message not in the archive

EFI_XEN_OVMF_INFO is defined to accept configurations from hvmloader. It must match the definition on Xen side.

Contributed-under: TianoCore Contribution Agreement 1.0

---
 OvmfPkg/PlatformPei/Xen.h |   45 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 OvmfPkg/PlatformPei/Xen.h
OvmfPkg/PlatformPei/Xen.h new file +45 -0
new file mode 100644
index 0000000..aaa24f9
@@ -0,0 +1,45 @@
+/** @file
+  Ovmf info structure passed by Xen
+
+Copyright (c) 2013, Citrix Systems UK Ltd.<BR>
+
+This program and the accompanying materials are licensed and made available under
+the terms and conditions of the BSD License that accompanies this distribution.
+The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php.
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef __XEN_H__
+#define __XEN_H__
+
+#include <PiPei.h>
+
+// Physical address of OVMF info
+#define OVMF_INFO_PHYSICAL_ADDRESS 0x00001000
+
+// This structure must match the definition on Xen side
+#pragma pack(1)
+typedef struct {
+  CHAR8 Signature[14]; // XenHVMOVMF\0
+  UINT8 Length;        // Length of this structure
+  UINT8 Checksum;      // Set such that the sum over bytes 0..length == 0
+  //
+  // Physical address of an array of TablesCount elements.
+  //
+  // Each element contains the physical address of a BIOS table.
+  //
+  EFI_PHYSICAL_ADDRESS Tables;
+  UINT32 TablesCount;
+  //
+  // Physical address of the E820 table, contains E820EntriesCount entries.
+  //
+  EFI_PHYSICAL_ADDRESS E820;
+  UINT32 E820EntriesCount;
+} EFI_XEN_OVMF_INFO;
+#pragma pack()
+
+#endif /* __XEN_H__ */
Signature · 1 line
1.7.10.4
author
#4 lore raw

PATCH v4 4/7 OvmfPkg: detect Xen earlier

In reply to a message not in the archive

This is useful for initializing memory map.

Contributed-under: TianoCore Contribution Agreement 1.0

---
 OvmfPkg/PlatformPei/Platform.c |    8 +++++++-
 OvmfPkg/PlatformPei/Platform.h |    5 +++++
 OvmfPkg/PlatformPei/Xen.c      |   12 +-----------
 3 files changed, 13 insertions(+), 12 deletions(-)
OvmfPkg/PlatformPei/Platform.c +7 -1
index fb56e99..9b7828f 100644
@@ -338,14 +338,20 @@ InitializePlatform (
   )
 {
   EFI_PHYSICAL_ADDRESS  TopOfMemory;
+  UINT32 XenLeaf;
 
   DEBUG ((EFI_D_ERROR, "Platform PEIM Loaded\n"));
 
   DebugDumpCmos ();
 
+  XenLeaf = XenDetect ();
+
   TopOfMemory = MemDetect ();
 
-  InitializeXen ();
+  if (XenLeaf != 0) {
+    DEBUG ((EFI_D_INFO, "Xen was detected\n"));
+    InitializeXen (XenLeaf);
+  }
 
   ReserveEmuVariableNvStore ();
 
OvmfPkg/PlatformPei/Platform.h +5 -0
index 383e6a4..d63d124 100644
@@ -69,6 +69,11 @@ PeiFvInitialization (
 
 EFI_STATUS
 InitializeXen (
+  UINT32 XenLeaf
+  );
+
+UINT32
+XenDetect (
   VOID
   );
 
OvmfPkg/PlatformPei/Xen.c +1 -11
index a720b91..054cc4a 100644
@@ -119,19 +119,9 @@ XenDetect (
 **/
 EFI_STATUS
 InitializeXen (
-  VOID
+  UINT32 XenLeaf
   )
 {
-  UINT32 XenLeaf;
-
-  XenLeaf = XenDetect ();
-
-  if (XenLeaf == 0) {
-    return EFI_NOT_FOUND;
-  }
-
-  DEBUG ((EFI_D_INFO, "Xen was detected\n"));
-
   XenConnect (XenLeaf);
 
   //
Signature · 1 line
1.7.10.4
author
#5 lore raw

PATCH v4 5/7 OvmfPkg: introduce PublishPeiMemory

In reply to a message not in the archive

MemDetect actully does too many things, the underlying platform might want to have more control over memory layout.

Extract the functionality of publishing PEI memory to a dedicated function.

Also fixed wrong comment while I was there.

Contributed-under: TianoCore Contribution Agreement 1.0

---
 OvmfPkg/PlatformPei/MemDetect.c |   36 +++++++++++++++++++++++++++++++++++-
 OvmfPkg/PlatformPei/Platform.h  |    5 +++++
 2 files changed, 40 insertions(+), 1 deletion(-)
OvmfPkg/PlatformPei/MemDetect.c +35 -1
index 9f6ca19..9145ebb 100644
@@ -83,11 +83,45 @@ GetSystemMemorySizeAbove4gb (
   return LShiftU64 (Size, 16);
 }
 
+/**
+  Publish PEI core memory
+
+  @return EFI_SUCCESS     The PEIM initialized successfully.
+
+**/
+EFI_STATUS
+PublishPeiMemory (
+  VOID
+  )
+{
+  EFI_STATUS                  Status;
+  EFI_PHYSICAL_ADDRESS        MemoryBase;
+  UINT64                      MemorySize;
+  UINT64                      LowerMemorySize;
+
+  LowerMemorySize = GetSystemMemorySizeBelow4gb ();
+
+  MemoryBase = PcdGet32 (PcdOvmfMemFvBase) + PcdGet32 (PcdOvmfMemFvSize);
+  MemorySize = LowerMemorySize - MemoryBase;
+  if (MemorySize > SIZE_64MB) {
+    MemoryBase = LowerMemorySize - SIZE_64MB;
+    MemorySize = SIZE_64MB;
+  }
+
+  //
+  // Publish this memory to the PEI Core
+  //
+  Status = PublishSystemMemory(MemoryBase, MemorySize);
+  ASSERT_EFI_ERROR (Status);
+
+  return Status;
+}
+
 
 /**
   Peform Memory Detection
 
-  @return EFI_SUCCESS     The PEIM initialized successfully.
+  @return Top of memory
 
 **/
 EFI_PHYSICAL_ADDRESS
OvmfPkg/PlatformPei/Platform.h +5 -0
index d63d124..7344c61 100644
@@ -57,6 +57,11 @@ AddUntestedMemoryRangeHob (
   EFI_PHYSICAL_ADDRESS        MemoryLimit
   );
 
+EFI_STATUS
+PublishPeiMemory (
+  VOID
+  );
+
 EFI_PHYSICAL_ADDRESS
 MemDetect (
   VOID
Signature · 1 line
1.7.10.4
author
#6 lore raw

PATCH v4 6/7 OvmfPkg: introduce XenMemMapInitialization

In reply to a message not in the archive

This function parses E820 map provided by Xen and arrange memory maps accordingly.

Contributed-under: TianoCore Contribution Agreement 1.0

---
 OvmfPkg/PlatformPei/Platform.c |   70 ++++++++++++++++++++++++++++++++++++++++
 OvmfPkg/PlatformPei/Platform.h |    8 +++++
 OvmfPkg/PlatformPei/Xen.c      |   26 +++++++++++++++
 3 files changed, 104 insertions(+)
OvmfPkg/PlatformPei/Platform.c +70 -0
index 9b7828f..83acd8b 100644
@@ -34,6 +34,10 @@
 #include <Guid/MemoryTypeInformation.h>
 #include <Ppi/MasterBootMode.h>
 #include <IndustryStandard/Pci22.h>
+#include <Guid/XenInfo.h>
+#include <IndustryStandard/E820.h>
+#include <Library/ResourcePublicationLib.h>
+#include <Library/MtrrLib.h>
 
 #include "Platform.h"
 #include "Cmos.h"
@@ -163,6 +167,72 @@ AddUntestedMemoryRangeHob (
   AddUntestedMemoryBaseSizeHob (MemoryBase, (UINT64)(MemoryLimit - MemoryBase));
 }
 
+VOID
+XenMemMapInitialization (
+  VOID
+  )
+{
+  EFI_E820_ENTRY64 *E820Map;
+  UINT32 E820EntriesCount;
+  EFI_STATUS Status;
+
+  DEBUG ((EFI_D_ERROR, "Using memory map provided by Xen\n"));
+
+  //
+  // Create Memory Type Information HOB
+  //
+  BuildGuidDataHob (
+    &gEfiMemoryTypeInformationGuid,
+    mDefaultMemoryTypeInformation,
+    sizeof(mDefaultMemoryTypeInformation)
+    );
+
+  //
+  // Add PCI IO Port space available for PCI resource allocations.
+  //
+  BuildResourceDescriptorHob (
+    EFI_RESOURCE_IO,
+    EFI_RESOURCE_ATTRIBUTE_PRESENT     |
+    EFI_RESOURCE_ATTRIBUTE_INITIALIZED,
+    0xC000,
+    0x4000
+    );
+
+  //
+  // Video memory + Legacy BIOS region
+  //
+  AddIoMemoryRangeHob (0x0A0000, BASE_1MB);
+
+  //
+  // Parse RAM in E820 map
+  //
+  Status = XenGetE820Map(&E820Map, &E820EntriesCount);
+
+  ASSERT_EFI_ERROR (Status);
+
+  if (E820EntriesCount > 0) {
+    EFI_E820_ENTRY64 *Entry;
+    UINT32 Loop;
+
+    for (Loop = 0; Loop < E820EntriesCount; Loop++) {
+      Entry = E820Map + Loop;
+
+      // only care about RAM
+      if (Entry->Type != EfiAcpiAddressRangeMemory) {
+        continue;
+      }
+
+      if (Entry->BaseAddr >= BASE_4GB) {
+        AddUntestedMemoryBaseSizeHob (Entry->BaseAddr, Entry->Length);
+      } else {
+        AddMemoryBaseSizeHob (Entry->BaseAddr, Entry->Length);
+      }
+
+      MtrrSetMemoryAttribute (Entry->BaseAddr, Entry->Length, CacheWriteBack);
+    }
+  }
+}
+
 
 VOID
 MemMapInitialization (
OvmfPkg/PlatformPei/Platform.h +8 -0
index 7344c61..5378b9d 100644
@@ -15,6 +15,8 @@
 #ifndef _PLATFORM_PEI_H_INCLUDED_
 #define _PLATFORM_PEI_H_INCLUDED_
 
+#include <IndustryStandard/E820.h>
+
 VOID
 AddIoMemoryBaseSizeHob (
   EFI_PHYSICAL_ADDRESS        MemoryBase,
@@ -82,4 +84,10 @@ XenDetect (
   VOID
   );
 
+EFI_STATUS
+XenGetE820Map (
+  EFI_E820_ENTRY64 **Entries,
+  UINT32 *Count
+  );
+
 #endif // _PLATFORM_PEI_H_INCLUDED_
OvmfPkg/PlatformPei/Xen.c +26 -0
index 054cc4a..88c0aec 100644
@@ -29,9 +29,35 @@
 #include <Guid/XenInfo.h>
 
 #include "Platform.h"
+#include "Xen.h"
 
 EFI_XEN_INFO mXenInfo;
 
+/**
+  Returns E820 map provided by Xen
+
+  @param Entries      Pointer to E820 map
+  @param Count        Number of entries
+
+  @return EFI_STATUS
+**/
+EFI_STATUS
+XenGetE820Map (
+  EFI_E820_ENTRY64 **Entries,
+  UINT32 *Count
+  )
+{
+ EFI_XEN_OVMF_INFO *Info = (EFI_XEN_OVMF_INFO *) OVMF_INFO_PHYSICAL_ADDRESS;
+
+ if (AsciiStrCmp ((CHAR8 *) Info->Signature, "XenHVMOVMF")) {
+   return EFI_NOT_FOUND;
+ }
+
+ *Entries = (EFI_E820_ENTRY64 *) Info->E820;
+ *Count = Info->E820EntriesCount;
+
+ return EFI_SUCCESS;
+}
 
 /**
   Connects to the Hypervisor.
Signature · 1 line
1.7.10.4
author
#7 lore raw

PATCH v4 7/7 OvmfPkg: enable Xen specific path

In reply to a message not in the archive

This patch sets PcdPciDisableBusEnumeration to true then makes use of PublishPeiMemory and XenMemMapInitialization to construct memory map for Xen guest.

Contributed-under: TianoCore Contribution Agreement 1.0

---
 OvmfPkg/OvmfPkgIa32.dsc             |    6 +++++-
 OvmfPkg/OvmfPkgIa32X64.dsc          |    6 +++++-
 OvmfPkg/OvmfPkgX64.dsc              |    6 +++++-
 OvmfPkg/PlatformPei/Platform.c      |   13 +++++++++++--
 OvmfPkg/PlatformPei/PlatformPei.inf |    1 +
 5 files changed, 27 insertions(+), 5 deletions(-)
OvmfPkg/OvmfPkgIa32.dsc +5 -1
index 760bd41..d2341d6 100644
@@ -320,6 +320,7 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0
+  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|FALSE
 
 
 ################################################################################
@@ -384,7 +385,10 @@
   UefiCpuPkg/CpuDxe/CpuDxe.inf
   PcAtChipsetPkg/8254TimerDxe/8254Timer.inf
   PcAtChipsetPkg/PciHostBridgeDxe/PciHostBridgeDxe.inf
-  MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
+  MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {
+    <LibraryClasses>
+      PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
+  }
   PcAtChipsetPkg/KbcResetDxe/Reset.inf
   MdeModulePkg/Universal/Metronome/Metronome.inf {
     <LibraryClasses>
OvmfPkg/OvmfPkgIa32X64.dsc +5 -1
index 268d722..c3e1a80 100644
@@ -326,6 +326,7 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0
+  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|FALSE
 
 
 ################################################################################
@@ -391,7 +392,10 @@
   UefiCpuPkg/CpuDxe/CpuDxe.inf
   PcAtChipsetPkg/8254TimerDxe/8254Timer.inf
   PcAtChipsetPkg/PciHostBridgeDxe/PciHostBridgeDxe.inf
-  MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
+  MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {
+    <LibraryClasses>
+      PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
+  }
   PcAtChipsetPkg/KbcResetDxe/Reset.inf
   MdeModulePkg/Universal/Metronome/Metronome.inf {
     <LibraryClasses>
OvmfPkg/OvmfPkgX64.dsc +5 -1
index 53945d0..4043f69 100644
@@ -325,6 +325,7 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0
+  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|FALSE
 
 
 ################################################################################
@@ -389,7 +390,10 @@
   UefiCpuPkg/CpuDxe/CpuDxe.inf
   PcAtChipsetPkg/8254TimerDxe/8254Timer.inf
   PcAtChipsetPkg/PciHostBridgeDxe/PciHostBridgeDxe.inf
-  MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
+  MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {
+    <LibraryClasses>
+      PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
+  }
   PcAtChipsetPkg/KbcResetDxe/Reset.inf
   MdeModulePkg/Universal/Metronome/Metronome.inf {
     <LibraryClasses>
OvmfPkg/PlatformPei/Platform.c +11 -2
index 83acd8b..6c40190 100644
@@ -416,7 +416,12 @@ InitializePlatform (
 
   XenLeaf = XenDetect ();
 
-  TopOfMemory = MemDetect ();
+  if (XenLeaf != 0) {
+    PublishPeiMemory ();
+    PcdSetBool (PcdPciDisableBusEnumeration, TRUE);
+  } else {
+    TopOfMemory = MemDetect ();
+  }
 
   if (XenLeaf != 0) {
     DEBUG ((EFI_D_INFO, "Xen was detected\n"));
@@ -427,7 +432,11 @@ InitializePlatform (
 
   PeiFvInitialization ();
 
-  MemMapInitialization (TopOfMemory);
+  if (XenLeaf != 0) {
+    XenMemMapInitialization ();
+  } else {
+    MemMapInitialization (TopOfMemory);
+  }
 
   MiscInitialization ();
 
OvmfPkg/PlatformPei/PlatformPei.inf +1 -0
index 3d5cbbb..7fe9d47 100644
@@ -65,6 +65,7 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
   gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved
+  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration
   gUefiCpuPkgTokenSpaceGuid.PcdCpuLocalApicBaseAddress
 
 [Ppis]
Signature · 1 line
1.7.10.4

A message that is not in the archive (sent off-list or not yet received): [email protected]

#9 lore raw

MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.c PciBusDriverBindingStart ( · line 290

Quoted 13 lines · Wei Liu
MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.c +4 -1
index 5afbb82..cc6be8b 100644
@@ -284,7 +284,10 @@ PciBusDriverBindingStart (
           );
   }
 
-  gFullEnumeration = (BOOLEAN) ((SearchHostBridgeHandle (Controller) ? FALSE : TRUE));
+  if (PcdGetBool (PcdPciDisableBusEnumeration))
+    gFullEnumeration = FALSE;
+  else
+    gFullEnumeration = (BOOLEAN) ((SearchHostBridgeHandle (Controller) ? FALSE : TRUE));

Code style { }

I think this could be fixed at commit time.

MdeModulePkg/MdeModulePkg.dec line 882

Quoted 10 lines
MdeModulePkg/MdeModulePkg.dec +2 -0
index b627eb1..5198451 100644
@@ -878,6 +878,9 @@
   ## This PCD specified whether the S.M.A.R.T feature of attached ATA hard disks are enabled.
   gEfiMdeModulePkgTokenSpaceGuid.PcdAtaSmartEnable|TRUE|BOOLEAN|0x00010065
 
+  ## This PCD specifies whether full PCI enumeration is disabled.
+  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|FALSE|BOOLEAN|0x10000048

Mike,

Any preference on token number other than don't clash?

Do you give your Reviewed-by for this patch? If so, I could take care of committing it.

-Jordan

A message that is not in the archive (sent off-list or not yet received): CAFe8ug9vt+tp4vZVXs9ytLuhaKiRTZCkYbuN+=rvOjH6oaRtEA@mail.gmail.com

Reviewed-by Michael Kinney
#11 lore raw

Jordan,

Only rule is that TokenNumber must be unique within the TokenSpaceGuid.

Mike

-----Original Message-----
From: Jordan Justen [mailto:[email protected]]
Sent: Saturday, November 30, 2013 3:56 PM
To: Kinney, Michael D; Wei Liu
Cc: xen-devel; [email protected]
Subject: Re: [edk2] [PATCH v4 1/7] MdeModulePkg: introduce PcdPciDisableBusEnumeration

MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.c PciBusDriverBindingStart ( · line 290

Quoted 13 lines · Wei Liu
MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.c +4 -1
index 5afbb82..cc6be8b 100644
@@ -284,7 +284,10 @@ PciBusDriverBindingStart (
           );
   }
 
-  gFullEnumeration = (BOOLEAN) ((SearchHostBridgeHandle (Controller) ? FALSE : TRUE));
+  if (PcdGetBool (PcdPciDisableBusEnumeration))
+    gFullEnumeration = FALSE;
+  else
+    gFullEnumeration = (BOOLEAN) ((SearchHostBridgeHandle (Controller) ? FALSE : TRUE));

Code style { }

I think this could be fixed at commit time.

MdeModulePkg/MdeModulePkg.dec line 882

Quoted 10 lines
MdeModulePkg/MdeModulePkg.dec +2 -0
index b627eb1..5198451 100644
@@ -878,6 +878,9 @@
   ## This PCD specified whether the S.M.A.R.T feature of attached ATA hard disks are enabled.
   gEfiMdeModulePkgTokenSpaceGuid.PcdAtaSmartEnable|TRUE|BOOLEAN|0x00010065
 
+  ## This PCD specifies whether full PCI enumeration is disabled.
+  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|FALSE|BOOLEAN|0x10000048

Mike,

Any preference on token number other than don't clash?

Do you give your Reviewed-by for this patch? If so, I could take care of committing it.

-Jordan

A message that is not in the archive (sent off-list or not yet received): E92EE9817A31E24EB0585FDF735412F562528EE5@ORSMSX106.amr.corp.intel.com

Reviewed-by Michael Kinney
#13 lore raw

For your information, I tried to replace the DUET PciBus driver using MdeModulePkg one. It works well after a small fix to the DUET PciRootBridgeNoEnumerationDxe driver.

Thanks,
Ray

-----Original Message-----
From: Kinney, Michael D [mailto:[email protected]]
Sent: Tuesday, December 03, 2013 3:44 AM
To: Jordan Justen; Wei Liu
Cc: [email protected]; xen-devel
Subject: Re: [edk2] [PATCH v4 1/7] MdeModulePkg: introduce PcdPciDisableBusEnumeration

Jordan,

Only rule is that TokenNumber must be unique within the TokenSpaceGuid.

Mike

-----Original Message-----
From: Jordan Justen [mailto:[email protected]]
Sent: Saturday, November 30, 2013 3:56 PM
To: Kinney, Michael D; Wei Liu
Cc: xen-devel; [email protected]
Subject: Re: [edk2] [PATCH v4 1/7] MdeModulePkg: introduce PcdPciDisableBusEnumeration

MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.c PciBusDriverBindingStart ( · line 290

Quoted 13 lines · Wei Liu
MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.c +4 -1
index 5afbb82..cc6be8b 100644
@@ -284,7 +284,10 @@ PciBusDriverBindingStart (
           );
   }
 
-  gFullEnumeration = (BOOLEAN) ((SearchHostBridgeHandle (Controller) ? FALSE : TRUE));
+  if (PcdGetBool (PcdPciDisableBusEnumeration))
+    gFullEnumeration = FALSE;
+  else
+    gFullEnumeration = (BOOLEAN) ((SearchHostBridgeHandle (Controller) ? FALSE : TRUE));

Code style { }

I think this could be fixed at commit time.

MdeModulePkg/MdeModulePkg.dec line 882

Quoted 10 lines
MdeModulePkg/MdeModulePkg.dec +2 -0
index b627eb1..5198451 100644
@@ -878,6 +878,9 @@
   ## This PCD specified whether the S.M.A.R.T feature of attached ATA hard disks are enabled.
   gEfiMdeModulePkgTokenSpaceGuid.PcdAtaSmartEnable|TRUE|BOOLEAN|0x00010065
 
+  ## This PCD specifies whether full PCI enumeration is disabled.
+  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|FALSE|BOOLEAN|0x10000048

Mike,

Any preference on token number other than don't clash?

Do you give your Reviewed-by for this patch? If so, I could take care of committing it.

-Jordan

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

A message that is not in the archive (sent off-list or not yet received): 734D49CCEBEEF84792F5B80ED585239D0A834488@SHSMSX103.ccr.corp.intel.com

A message that is not in the archive (sent off-list or not yet received): CAFe8ug-vqbsTs1A8=pufv0sLvnOjAJiEKVU8URN8RaWmfb-hKQ@mail.gmail.com

A message that is not in the archive (sent off-list or not yet received): 734D49CCEBEEF84792F5B80ED585239D0A8349BE@SHSMSX103.ccr.corp.intel.com

author
#17 lore raw

Please don't drop Xen-devel.

Quoted 2 lines · Ruiyu

Jordan/Wei,
Does Xen care about the PCI option rom? Because I just found the

Yes. In seabios case it calls options roms if there's any. I think OVMF should do the same thing.

Quoted 9 lines

PciBusNoEnumerationDxe driver support dispatching the UEFI option rom loaded by the PciRootBridgeNoEnumerationDxe driver. PciRootBridgeNoEnumerationDxe installs an option ROM buffer table to configuration table to be retrieved by PciBusNoEnumerationDxe.

One possible way to resolve this and safely retire PciBusNoEnumerationDxe is to change PciBus driver full enumeration logic to also install the option rom buffer table to configuration table, instead of to save it in a global variable.

I can't speak for code that I'm not familiar with. I just want to ask if there's any implication on Xen side's implementation?

Wei.

#18 lore raw

Re: [PATCH v4 0/7] Make OVMF fully working with Xen

In reply to a message not in the archive

Series Reviewed-by: Jordan Justen <[email protected]>

Some minor issues mentioned in a reply to patch 1.

-Jordan

Quoted 62 lines · Wei Liu

Hi all

This is version 4 of this series.

The first patch adds PcdPciDisableBusEnumeration in MdeModulePkg, which short-circuits full enumeration if set to true.

We maintain some Xen specific functions at the moment, hopefully when QEMU / KVM figures out what to do with memory map we can refactor this part.

The tree can be found at:
http://xenbits.xen.org/git-http/people/liuw/ovmf.git v4
starting from 021b9538.

Wei.

Changes since V3:
* make PcdPciDisableBusEnumeration PatchableInModule as well
* fix copy right information in E820.h
* do not embed E820 map to EFI_XEN_INFO
* fix Pcd library inclusion in Ovmf*.dsc
* some coding style fixes

Changes since RFC v2:
* PcdPciAllowFullEnumeration -> PcdPciDisableBusEnumeration
* enable Xen path in dedicated patch
* OVMF info moved to dedicated header

Wei Liu (7):
MdeModulePkg: introduce PcdPciDisableBusEnumeration
OvmfPkg: introduce E820.h
OvmfPkg: define EFI_XEN_OVMF_INFO
OvmfPkg: detect Xen earlier
OvmfPkg: introduce PublishPeiMemory
OvmfPkg: introduce XenMemMapInitialization
OvmfPkg: enable Xen specific path

 MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.c      |    5 +-
 MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf |    1 +
 MdeModulePkg/MdeModulePkg.dec                |    3 +
 OvmfPkg/Include/IndustryStandard/E820.h      |   46 +++++++++++++
 OvmfPkg/OvmfPkgIa32.dsc                      |    6 +-
 OvmfPkg/OvmfPkgIa32X64.dsc                   |    6 +-
 OvmfPkg/OvmfPkgX64.dsc                       |    6 +-
 OvmfPkg/PlatformPei/MemDetect.c              |   36 +++++++++-
 OvmfPkg/PlatformPei/Platform.c               |   91 +++++++++++++++++++++++++-
 OvmfPkg/PlatformPei/Platform.h               |   18 +++++
 OvmfPkg/PlatformPei/PlatformPei.inf          |    1 +
 OvmfPkg/PlatformPei/Xen.c                    |   38 +++++++----
 OvmfPkg/PlatformPei/Xen.h                    |   45 +++++++++++++
 13 files changed, 283 insertions(+), 19 deletions(-)
 create mode 100644 OvmfPkg/Include/IndustryStandard/E820.h
 create mode 100644 OvmfPkg/PlatformPei/Xen.h

--
1.7.10.4

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

A message that is not in the archive (sent off-list or not yet received): CAFe8ug9iVsrOXnBt6EbTWiqtxGMrSrmgNDRVj8+anU-sOy=ZfA@mail.gmail.com

author
#20 lore raw

Re: [PATCH v4 0/7] Make OVMF fully working with Xen

Quoted 2 lines · Jordan Justen

Series Reviewed-by: Jordan Justen <[email protected]>

Thanks!

Wei.

Quoted 4 lines

Some minor issues mentioned in a reply to patch 1.

-Jordan

author
#21 lore raw

Re: [PATCH v4 0/7] Make OVMF fully working with Xen

In reply to a message not in the archive
Quoted 4 lines · Jordan Justen

Series Reviewed-by: Jordan Justen <[email protected]>

Some minor issues mentioned in a reply to patch 1.

Hi Jordan

Is there any more concerns regarding this series? All patches have reviewed-by tag now.

I was quite clear about Ray's question. Anything else I need to do to get this series merged?

Wei.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#23 lore raw

Re: [edk2] [PATCH v4 0/7] Make OVMF fully working with Xen

Quoted 11 lines · Wei Liu
Quoted 4 lines · Jordan Justen

Series Reviewed-by: Jordan Justen <[email protected]>

Some minor issues mentioned in a reply to patch 1.

Is there any more concerns regarding this series? All patches have reviewed-by tag now.

I was quite clear about Ray's question. Anything else I need to do to get this series merged?

It is basically ready to be committed. I just need to find the time to test it building on Visual Studio.

-Jordan

A message that is not in the archive (sent off-list or not yet received): 1386267452.1857.407.camel@jljusten-ivy

author
#25 lore raw

Re: [edk2] [PATCH v4 0/7] Make OVMF fully working with Xen

Quoted 7 lines · Jordan Justen
Quoted 6 lines · Wei Liu
Quoted 4 lines · Jordan Justen

Series Reviewed-by: Jordan Justen <[email protected]>

Some minor issues mentioned in a reply to patch 1.

Quoted 9 lines
Quoted 5 lines

Is there any more concerns regarding this series? All patches have reviewed-by tag now.

I was quite clear about Ray's question. Anything else I need to do to get this series merged?

It is basically ready to be committed. I just need to find the time to test it building on Visual Studio.

Thanks. Let me know if there's any issue.

Wei.

Quoted 2 lines

-Jordan

A message that is not in the archive (sent off-list or not yet received): [email protected]

#27 lore raw

Re: [edk2] [PATCH v4 0/7] Make OVMF fully working with Xen

Quoted 11 lines · Wei Liu
Quoted 10 lines · Jordan Justen
Quoted 9 lines · Wei Liu
Quoted 4 lines · Jordan Justen

Series Reviewed-by: Jordan Justen <[email protected]>

Some minor issues mentioned in a reply to patch 1.

Is there any more concerns regarding this series? All patches have reviewed-by tag now.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

I was quite clear about Ray's question. Anything else I need to do to get this series merged?

It is basically ready to be committed. I just need to find the time to test it building on Visual Studio.

Thanks. Let me know if there's any issue.

Committed in r14940-r14946.

I made a few minor adjustments for VS2010.

Thanks for the contribution,

-Jordan