From patchwork Thu Mar 15 04:00:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gary guo X-Patchwork-Id: 131730 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp618428ljb; Wed, 14 Mar 2018 21:00:59 -0700 (PDT) X-Google-Smtp-Source: AG47ELvOdkzoGBbMI0MN8SFroN9NtP+t1Mas1TR+CPVskrXtpumI5Eke6yZw4l2K6o+cyWHD4d37 X-Received: by 2002:a17:902:a705:: with SMTP id w5-v6mr6579632plq.299.1521086459379; Wed, 14 Mar 2018 21:00:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521086459; cv=none; d=google.com; s=arc-20160816; b=OmRAZlGYa1U+ngcwWDR6lf/B3lIwl1G8KvVdfC2camhC+KQSHT9VDlKg6Y5yxfPjv2 xy4XqtzT3uDzEhxr3T44fzmcv3htLBYo1Vr/FG68DkG3OsakySrE1D/d7s8E0AyCHaDx kOdKSmiVKWYD6W4BYELEL8ngQukNLStFdm/i++71qgo+NDz67UKFnP8XRdpqj4zC0xQD 0f9ZtwQsPKaSjxgCxDY6KIB2oWluZdhY+e1b36HihAY/JFQnt/jzmFq5XwdDYgaEjGBJ XcSVdeAaS2UmAcyfnI7Q7wpRME7EfESxrCv22E+bFnf7Wnf+9C+ZeZCZDCIhGivBextn CVYA== 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=XlwsxTIUKHNb0DPANqN2mnPSyj8aiqoUkkYccR+AKGQ=; b=apQFY1BvFrZNARaQq+VQ63awNXXiKM4tA9JP9F1WH/mMHr/xvUNOR2fsUDd5ghGolB OfQqGQAfpFkQ8tkQYPKaMZxiyrJLfw7zSqRUH8JJmrpTfDHl1fQZyNiGFkEdvDvpH4ir KI+kw8vVCUWDtomUZykbgzj/s/+O8rCx3HoRRuv2rJYTZjBDvVczBfOuxvXVMmA7wmW+ Qc3BWN/6Y/TbaKG5H1yKgxBnxifoLEMwace3n0a6Ucq5OTg6uvcoFPhyoPLh246Qsxt3 SPKZmzysmfepfc2GS+Bc8mKyV54ZCDsDqnbmaM3ArWLqHxhr0H12Jeri6033HQiS7w+N vRBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=EFztKKJP; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 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. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id m63-v6si3230335pld.602.2018.03.14.21.00.58 (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 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=EFztKKJP; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 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 146B9226462FA; Wed, 14 Mar 2018 20:54:35 -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::22c; helo=mail-pl0-x22c.google.com; envelope-from=heyi.guo@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pl0-x22c.google.com (mail-pl0-x22c.google.com [IPv6:2607:f8b0:400e:c01::22c]) (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 6966F225892C7 for ; Wed, 14 Mar 2018 20:54:33 -0700 (PDT) Received: by mail-pl0-x22c.google.com with SMTP id f23-v6so3004424plr.10 for ; Wed, 14 Mar 2018 21:00:56 -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=Z8JVlvRoQ3Jwafg74pPV1vabHXB0mrC1DPXnIdywwvE=; b=EFztKKJPaAjvWli2uGqkaXCBJ7K+wqf1CVm6zMVD9JOCfA7lzbBiBQnbAXZMCmAhQh cdBz0yY0HUqsdqZSWIhZg0O2iZUrHH5g802kzEaUxm8Vo8ekCAVjS8dp8+v+HbLSfWbk JKiU6SpoMjrBY1S6NUXfey1OZfXj+jlahxQhM= 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=Z8JVlvRoQ3Jwafg74pPV1vabHXB0mrC1DPXnIdywwvE=; b=FXJ7DufNglhtut2RDyiJgan/hVZ7k89XlB8SR/4x16+kNuvVKmf3EhzbWv3lPn2hJF Of2gmAwefcczysoWaEtL+DqeSvrX9a7SXmhCxNPZMaqFuZxVU2c7+Z9oXet/PN5dP9D3 mti2HZbe6O5dh3bxZo6b+V4/Xwpw/fbNt09RYHJfYJJKzF1jq+gHfZzBqLm4OE0lLo3I tUwswh4so5bCQP5mARp+mcf8rIx5UF++liD6tatU+ZrEEr3qvJrHomILwnOakcMYq0a3 lFvDfSXvTqBLaYOSi1LUfWbdAALiH3FKW4fkio3weBEHv6pOu53sqCiuxaDs5L5Fl4VL sr1A== X-Gm-Message-State: AElRT7FKIqgBD5rKwS/mDFWu0FE0aWX9jCiPuiszqutrWS2Ur99881+o 9o4uauYcOi/5fg5Fw3bV8ZnggM5uDMo= X-Received: by 2002:a17:902:8c97:: with SMTP id t23-v6mr6635508plo.372.1521086456403; Wed, 14 Mar 2018 21:00:56 -0700 (PDT) Received: from localhost.localdomain ([45.56.152.100]) by smtp.gmail.com with ESMTPSA id e4sm8107785pfa.166.2018.03.14.21.00.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 14 Mar 2018 21:00:55 -0700 (PDT) From: Heyi Guo To: edk2-devel@lists.01.org Date: Thu, 15 Mar 2018 12:00:20 +0800 Message-Id: <1521086424-113954-3-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 2/6] OvmfPkg/PciHostBridgeLib: clear PCI 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 , Jordan Justen , Heyi Guo , Anthony Perard , Laszlo Ersek 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 is 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: Jordan Justen Cc: Anthony Perard Cc: Julien Grall Cc: Ruiyu Ni Cc: Laszlo Ersek Cc: Ard Biesheuvel --- Notes: v6: - Move ZeroMem() into the loop [Laszlo] - Move ZeroMem() after checking PcdPciDisableBusEnumeration [Laszlo] - Commit title change (However 74 characters will cause PatchCheck warning, so I tried to reduce the length to eliminate the warning) [laszlo] - Minor changes in commit message OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c | 4 ++++ OvmfPkg/Library/PciHostBridgeLib/XenSupport.c | 7 ++++++- 2 files changed, 10 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/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c index ff837035caff..65d0ef9252c5 100644 --- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c +++ b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c @@ -221,6 +221,10 @@ PciHostBridgeGetRootBridges ( return ScanForRootBridges (Count); } + ZeroMem (&Io, sizeof (Io)); + ZeroMem (&Mem, sizeof (Mem)); + ZeroMem (&MemAbove4G, sizeof (MemAbove4G)); + Attributes = EFI_PCI_ATTRIBUTE_IDE_PRIMARY_IO | EFI_PCI_ATTRIBUTE_IDE_SECONDARY_IO | EFI_PCI_ATTRIBUTE_ISA_IO_16 | diff --git a/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c b/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c index 31c63ae19e0a..920417950ad9 100644 --- a/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c +++ b/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c @@ -202,8 +202,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 //