From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:400e:c01::22d; helo=mail-pl0-x22d.google.com; envelope-from=heyi.guo@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pl0-x22d.google.com (mail-pl0-x22d.google.com [IPv6:2607:f8b0:400e:c01::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id B41F321E08283 for ; Wed, 14 Mar 2018 22:58:49 -0700 (PDT) Received: by mail-pl0-x22d.google.com with SMTP id f5-v6so3142062plj.13 for ; Wed, 14 Mar 2018 23:05:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OPK4RhszyeDXlSWyJKEN5VmhDTYCS7ksK+BmbF4IegM=; b=elqpovMXRk3it3d88haNHNAnUPu6vxLsy1Xap/EUClVVppSB43BR0nlu3iO46HsaHA zpakXP2ITcZLyIm2vA+PbCS2JYkQ1FCIQ2EJHgm+JII9VjufOQrYr0AjzDQGgHMr/Rwz 7f2daSxkzE+/7UdxzvpKcL0ve6g95+9qmuD2I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=OPK4RhszyeDXlSWyJKEN5VmhDTYCS7ksK+BmbF4IegM=; b=HYr9dPQHK/tIKo04NGdLnTRwRUeoKFPg9N/BMSoCvc+OQzird2V/UUWbLp3WmZLf50 9lmzHE7Vd+c9LQfUxQRMHaNqJ7vK4SiML0a5wPmD1LRLiK3dJWx0aeSAOnyhvm3p5Sso hPqy9O3cIgJtPGu8omJNqr7USJdHX5JZVmS/1l9DpXYu3o5/jHGegCMatz90VZFKAgsv exiNgUrzsuY2nzvqkWWq0BOg21wLKdVjDkGR+FU3xad2EWD7qw1uiapxpLpwNcnvl1Hv 4QYuWOS0uG8+IvuJpmSorj+4esA6EIap/ETgw8D55yNKZym8k0DgWKQY2thDWlwc13Sj coAg== X-Gm-Message-State: AElRT7Hein0tw0tEpxIJOPS5BnDmGLLST38BDjT08sI/mMH7ppnrHnww t5d8QxQLb7aTOlIPF9btFu+zz/Dz13M= X-Google-Smtp-Source: AG47ELt2bqE7rCYNgrlDVRbPvzm/vRlBSmgtGy7DEhHXUOoAvYkxzgWRVNf3skqrNU9Kc1168rx7hA== X-Received: by 2002:a17:902:4025:: with SMTP id b34-v6mr6861453pld.359.1521093913002; Wed, 14 Mar 2018 23:05:13 -0700 (PDT) Received: from localhost.localdomain ([45.56.152.100]) by smtp.gmail.com with ESMTPSA id 70sm7436192pgb.86.2018.03.14.23.05.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 14 Mar 2018 23:05:12 -0700 (PDT) From: Heyi Guo To: edk2-devel@lists.01.org Cc: Heyi Guo , Yi Li , Maurice Ma , Prince Agyeman , Benjamin You , Ruiyu Ni , Laszlo Ersek , Ard Biesheuvel Date: Thu, 15 Mar 2018 14:03:58 +0800 Message-Id: <1521093843-48615-2-git-send-email-heyi.guo@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521093843-48615-1-git-send-email-heyi.guo@linaro.org> References: <1521093843-48615-1-git-send-email-heyi.guo@linaro.org> Subject: [PATCH v7 1/6] CorebootPayloadPkg/PciHostBridgeLib: clear aperture vars for (re)init X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Mar 2018 05:58:50 -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 Signed-off-by: Yi Li Reviewed-by: Ni Ruiyu Cc: Maurice Ma Cc: Prince Agyeman Cc: Benjamin You Cc: Ruiyu Ni Cc: Laszlo Ersek Cc: Ard Biesheuvel --- Notes: v6: - Move ZeroMem() into the loop just as Laszlo commented on OvmfPkg [Laszlo] - Minor changes in commit message CorebootPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CorebootPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c b/CorebootPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c index 6d94ff72c956..18dcbafdf0c6 100644 --- a/CorebootPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c +++ b/CorebootPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c @@ -328,8 +328,13 @@ ScanForRootBridges ( for (PrimaryBus = 0; PrimaryBus <= PCI_MAX_BUS; PrimaryBus = SubBus + 1) { SubBus = PrimaryBus; Attributes = 0; + + ZeroMem (&Io, sizeof (Io)); + ZeroMem (&Mem, sizeof (Mem)); + ZeroMem (&MemAbove4G, sizeof (MemAbove4G)); + ZeroMem (&PMem, sizeof (PMem)); + ZeroMem (&PMemAbove4G, sizeof (PMemAbove4G)); Io.Base = Mem.Base = MemAbove4G.Base = PMem.Base = PMemAbove4G.Base = MAX_UINT64; - Io.Limit = Mem.Limit = MemAbove4G.Limit = PMem.Limit = PMemAbove4G.Limit = 0; // // Scan all the PCI devices on the primary bus of the PCI root bridge // -- 2.7.4