summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/Library/PciHostBridgeLib
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2016-01-25 23:43:50 +0100
committerLaszlo Ersek <lersek@redhat.com>2016-03-03 18:18:39 +0100
commit65de2ef54ffe8936b9d60ea3a4782798ef47f6c9 (patch)
treefacd180ea34a2823ae2a8fdf40b9f8aae9288094 /OvmfPkg/Library/PciHostBridgeLib
parentdc4d64670a19d4f813e8f3dc7231998615404511 (diff)
downloadedk2-65de2ef54ffe8936b9d60ea3a4782798ef47f6c9.tar.gz
edk2-65de2ef54ffe8936b9d60ea3a4782798ef47f6c9.tar.bz2
edk2-65de2ef54ffe8936b9d60ea3a4782798ef47f6c9.zip
OvmfPkg: PciHostBridgeLib: set RootBus->Segment
This is the first of the patches that set the fields of PCI_ROOT_BRIDGE. The structure is zero-filled as a precaution for later field additions. Here we set the Segment member explicitly to zero (so that any later customization can be easier). Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Marcel Apfelbaum <marcel@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Diffstat (limited to 'OvmfPkg/Library/PciHostBridgeLib')
-rw-r--r--OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c8
-rw-r--r--OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf1
2 files changed, 9 insertions, 0 deletions
diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
index 25746dd1cf..39dc2b5acb 100644
--- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
+++ b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
@@ -17,6 +17,7 @@
#include <IndustryStandard/Pci.h>
+#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/PciHostBridgeLib.h>
@@ -63,6 +64,13 @@ InitRootBridge (
OUT PCI_ROOT_BRIDGE *RootBus
)
{
+ //
+ // Be safe if other fields are added to PCI_ROOT_BRIDGE later.
+ //
+ ZeroMem (RootBus, sizeof *RootBus);
+
+ RootBus->Segment = 0;
+
return EFI_OUT_OF_RESOURCES;
}
diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
index b836931912..096d728f3c 100644
--- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
+++ b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
@@ -39,6 +39,7 @@
OvmfPkg/OvmfPkg.dec
[LibraryClasses]
+ BaseMemoryLib
DebugLib
MemoryAllocationLib
PciLib