From patchwork Thu Mar 15 06:03:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gary guo X-Patchwork-Id: 131746 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp703105ljb; Wed, 14 Mar 2018 23:05:16 -0700 (PDT) X-Google-Smtp-Source: AG47ELukhPoZuKgkZ+Ox8n+3WPa6TRDWjpTaxBAQn9Vs/ICBS2vYFWIr5JRJ6/85wdjzZkOEsq82 X-Received: by 10.98.36.25 with SMTP id r25mr6775375pfj.106.1521093915847; Wed, 14 Mar 2018 23:05:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521093915; cv=none; d=google.com; s=arc-20160816; b=e/WVp/9ziTfp8M8tIlk+1dd2ljzUdSx/ll+Uay1ujQJ5xtrSQXMYukMp9nfu5fXZGw oz2qoKyHY4cmCey+Pa5NFCM2Q+kACpTXoBhv/Ze3MHA8NsImOYE75Q/xR2/S95r/AGk9 BPmHgodQtshOfE6R7Ub9Z5CqRUkv20Om8pnlpQLAxFBVswUq12ce3abXu+EQlKanTBHI nv9Hn1Uk9qUDemAtMUQ/YGFM8qc0kD5iGMjFgOqGj70uBsPvHWPKP1tCW+J7DPLRnhrZ TWXNUG8ex+8UzP2zVk0tYzmp2bwKJ9DcxBnrlcUkeTh21wFVQodN4EKLje5pteMiiCmv xofA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=L9cLuPJEGb34CT4P3wsULrF8TK677eba4LerW3bgot4=; b=KS2nTe5xC/n60Nkg8KcvHWvcwNkIdfNlQa90e625F+bQlpsmOWMOyUf+oMEYKyNX1k LOkd2Bwtie7sjqHu2bS42JqKC3yUjM0+eyw1A0nml4oEs1Znw8xZ9lYfiOsOArWRQdyL at2hjOge2Bn6Hk5KxPdki/+k6VrWj9sOfjBJLcT2MuKFmh+hocWMvF6WfqpOO6L+Y20O 1PJaJNegFiVa/ODQ/g326oawxKqZuGZoPVaIUrfFSh1ldXBh0TrFcMiwu19UCNtl3ADc sCjQrWpcMSNmqG7twNaJMQMp2MvRIjbN/2FVOCdv2ehZM3qYQNKTYpsi6859ibx99DGQ JezQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=elqpovMX; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id e10si3025944pgf.45.2018.03.14.23.05.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Mar 2018 23:05:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=elqpovMX; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 6B3E52202E4A6; Wed, 14 Mar 2018 22:58:50 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org 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-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 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: [edk2] [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: , Cc: Ruiyu Ni , Yi Li , Ard Biesheuvel , Heyi Guo , Laszlo Ersek , Prince Agyeman MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(-) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Benjamin You 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 //