]> git.proxmox.com Git - mirror_edk2.git/commitdiff
CorebootPayloadPkg/PciHostBridgeLib: clear aperture vars for (re)init
authorHeyi Guo <heyi.guo@linaro.org>
Wed, 28 Feb 2018 02:19:28 +0000 (10:19 +0800)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 15 Mar 2018 08:25:56 +0000 (08:25 +0000)
Use ZeroMem() to initialize (or re-initialize) all fields in temporary
PCI_ROOT_BRIDGE_APERTURE variables to zero. This is not mandatory but
helpful for future extension: when we add new fields to
PCI_ROOT_BRIDGE_APERTURE and the default value of these fields can
safely be zero, this code will not suffer from an additional change.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Heyi Guo <heyi.guo@linaro.org>
Signed-off-by: Yi Li <phoenix.liyi@huawei.com>
Reviewed-by: Ni Ruiyu <ruiyu.ni@intel.com>
Reviewed-by: Benjamin You <benjamin.you@intel.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
CorebootPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c

index 6d94ff72c95695cf9c0bee7b57738baec5b7b32e..18dcbafdf0c6776e5d6bc192580c0dc88d8842e1 100644 (file)
@@ -328,8 +328,13 @@ ScanForRootBridges (
   for (PrimaryBus = 0; PrimaryBus <= PCI_MAX_BUS; PrimaryBus = SubBus + 1) {\r
     SubBus = PrimaryBus;\r
     Attributes = 0;\r
+\r
+    ZeroMem (&Io, sizeof (Io));\r
+    ZeroMem (&Mem, sizeof (Mem));\r
+    ZeroMem (&MemAbove4G, sizeof (MemAbove4G));\r
+    ZeroMem (&PMem, sizeof (PMem));\r
+    ZeroMem (&PMemAbove4G, sizeof (PMemAbove4G));\r
     Io.Base = Mem.Base = MemAbove4G.Base = PMem.Base = PMemAbove4G.Base = MAX_UINT64;\r
-    Io.Limit = Mem.Limit = MemAbove4G.Limit = PMem.Limit = PMemAbove4G.Limit = 0;\r
     //\r
     // Scan all the PCI devices on the primary bus of the PCI root bridge\r
     //\r