From 65de2ef54ffe8936b9d60ea3a4782798ef47f6c9 Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Mon, 25 Jan 2016 23:43:50 +0100 Subject: [PATCH] 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 Cc: Ruiyu Ni Cc: Marcel Apfelbaum Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek Reviewed-by: Jordan Justen --- OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c | 8 ++++++++ OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf | 1 + 2 files changed, 9 insertions(+) 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 +#include #include #include #include @@ -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 -- 2.39.2