From patchwork Thu Mar 15 04:00:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gary guo X-Patchwork-Id: 131731 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp618443ljb; Wed, 14 Mar 2018 21:01:00 -0700 (PDT) X-Google-Smtp-Source: AG47ELs2n9D2UApAPCbk3RtnikpPPrIrRQdNjDnvOnvCQ+QI2sgPJp8xNq8oo1garMArPukK7Fu5 X-Received: by 2002:a17:902:51a9:: with SMTP id y38-v6mr6633534plh.120.1521086460183; Wed, 14 Mar 2018 21:01:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521086460; cv=none; d=google.com; s=arc-20160816; b=PlOeYk8TlYiwDZNkcoeDZu83OspxY8FqyYQ3izETE8onFRlIkrAi0g9ygusET+AYdA KvrC4CLIQ89jPr60TDcycvZKFNCewab1z6UZtGRxkWat1Lquh4PgxpkHpKvzZIDIulIT 2lHwiPhi79KbTV+fzmpuaBzsSfLl8H9XRwyV/S9Ph2jsPSSJC80TSrOP8a/rTb/TUYOU zVzK7XIrto/2fZYcpkz5F9NY4gn0CCeOOEDiM6IYH3xb83STvWgZdBuycRiybFXy+S5o o6+yoYxsqnZUGtPjSyb6Fm2Eox6TJygWm+RfxDpGKnlwCdQeOPvg1r22SbKcXzsLpeYq HKzg== 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=mw7NQE6Q6VffItz8Sa9LMzBuetxeUGCAOvD4xApPs+0=; b=c/0X/TV2zzh6731laPB7OtanE0APMarOqLDyeR1aWDgqmhNjEulIre3XNgPSNTOGiz XuQf/xyanrd6dl/jrwbSqIlkmW6tvlXpgiEyvnQdHkVdaAxEq3EQ81nX3vK3XTIZroUh INQv+ukE7dFHrf1R4hYAmxgneOGBib9WoFnp3QrjMsRS03DkBuZXoS5kZaT7AHcJLHGz YSKoglOgU4GSV4PGRJMHuX9x50LYRbfLRNgEHB3LloD1EYRdd0OTeJ712qpJ+b4Tg36F hZbLS/0deg1RJ1FG/m4NXymSai3uFubPVr84cyOOkwnm8aJvOTz2fh6Evr2BeOIkcxy4 QpSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=QiALn0Pf; 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 k10si2830010pgo.39.2018.03.14.21.00.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Mar 2018 21:00:59 -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=QiALn0Pf; 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 AF0F422603B1C; Wed, 14 Mar 2018 20:54:32 -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:c00::231; helo=mail-pf0-x231.google.com; envelope-from=heyi.guo@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pf0-x231.google.com (mail-pf0-x231.google.com [IPv6:2607:f8b0:400e:c00::231]) (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 29C80225892D3 for ; Wed, 14 Mar 2018 20:54:30 -0700 (PDT) Received: by mail-pf0-x231.google.com with SMTP id j2so2354515pff.10 for ; Wed, 14 Mar 2018 21:00:54 -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=BwZx+quN1GrEF+Tkz0rgusbFNo/t8Ot0pZFC3n8/xF4=; b=QiALn0Pf7KQMEZ/0BRU0KLRitmnjIEGihiLAg/x78WPUVIbb1JnSwCDIGZM2O3Hsrb kWj/7YT9xcRaueQvkZoHme88AeQt8wMN5NB5GsEA+hE51vAqz9cQSGwFCfOOMww5y/Mr z9XLwDfe4z5P8euTmRl8PANA5l8WTx3iyQcEU= 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=BwZx+quN1GrEF+Tkz0rgusbFNo/t8Ot0pZFC3n8/xF4=; b=d+YKEHLKgbvJMxECSh/qaMMF/I6PvNVfQ3bCR1WAAENlfkZahEFCWoxPcXcOIBv82G 7ltnyFw68EGIex2OQISFX/gQh+R7L9MWbeko8YEn5q55NEJ+Wsyw1fRWve5bKlvjzcE6 EJTTpG73pLxSzenqs5PYC+Ms1fWukjFjJ2HS8PCTnPkkfnBDhBPRSL8CaAWDWnAWr7+3 huBGw2O/eFeeFHzjHswAT6Ixb8gaiQAEqVDEtb07E7SWzf2qq/5kaL7OhJpgQ/DJWxzO BOBMu2pr4QYdHZHgFOsGGtXWfocSwLGWcLJgYv5GrxRHKXAk7/s77GKMb6xEGeEMkVyo WX/g== X-Gm-Message-State: AElRT7HcHZvR6aZZVqwIWKKF5Ai6jwso5rzGTnq8PUlQRkYdY2RqBs1b 9aSedjIFzYbjNkBRdAnV8W42AiuY4+4= X-Received: by 10.98.133.193 with SMTP id m62mr6478706pfk.74.1521086453927; Wed, 14 Mar 2018 21:00:53 -0700 (PDT) Received: from localhost.localdomain ([45.56.152.100]) by smtp.gmail.com with ESMTPSA id e4sm8107785pfa.166.2018.03.14.21.00.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 14 Mar 2018 21:00:53 -0700 (PDT) From: Heyi Guo To: edk2-devel@lists.01.org Date: Thu, 15 Mar 2018 12:00:19 +0800 Message-Id: <1521086424-113954-2-git-send-email-heyi.guo@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521086424-113954-1-git-send-email-heyi.guo@linaro.org> References: <1521086424-113954-1-git-send-email-heyi.guo@linaro.org> Subject: [edk2] [PATCH v6 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 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 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 //