From patchwork Thu Mar 1 06:57: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: 130110 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp2452324edc; Wed, 28 Feb 2018 22:58:11 -0800 (PST) X-Google-Smtp-Source: AG47ELta9Ta8ZxVJ0TAlr9rqEbwDXRKO8mQ8cHGC8pZp1Cp2gsse1ltlVNzoY1X25yXVrvf8J2vz X-Received: by 2002:a17:902:b7cc:: with SMTP id v12-v6mr935243plz.249.1519887491300; Wed, 28 Feb 2018 22:58:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519887491; cv=none; d=google.com; s=arc-20160816; b=bAhUwHoCluqp0r8rc/W/L8Gbk+hykBDc76P5Al7agdE6IdmKLrrcm2Zte45WxzA8tQ 9Kl4XHnqmrzBk5t/QKH6Ot507DdY0yfI1odqUIC1okRcF6Yd8Z27W2331u7ktR+FO9yy 10qZ12SvInexdYd0lKfT+FNSuss9hsYtzYCz61jMKPTvy8gd+DUshHprmqEQGt8nD5Th 1BWcOrktwT70EevFP3kdb3179iWCkd9EoxMOOU2mCIOuktVo2q6nO4/pxvGvtWstBBPv Vxm6wd5JnQ+vKc01zVfuioxI04au5KdeBoDYDUUb895aaQZMZYt5PDQddJ4BDxt8Xx+8 vufA== 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=66gD7dCe1w4giWEnI/n+YfmkUrAANJol0htP5JuYe4w=; b=GsNRNrOeMC1QvxbLOCKitqkIqBvuF3xII0ZPX9ICjaicyeqoXT7C+4W1hnnjoFHU2q c2Syt7SWHmcDZgWZk/VtVbfQE6NQD0WmXnMFZHge8LH89/Y+3vqa8yiAaxpFtbPgE3P2 FolLgugl6odnx5crUkQWqQCl1eX9saWR14hq7ddi0w9n69vL2gex0IAotIzEP9h6jjll L0YbxgfVCNzrLCL3ZJA5xwJZWdebTmO8H9jrPEoPMnwkxQhnXcf2KNhJmDlDbkotpk2C 39/wzKphqVFsSedb8xFmprWyq/KJSQ2956+8L7NlgKwDTkAj+lVrVBvLz+WJ9fIoqAkc fM2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=dO/KtnJB; 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 t1si2082598pgv.668.2018.02.28.22.58.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Feb 2018 22:58:11 -0800 (PST) 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=dO/KtnJB; 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 97C6322423853; Wed, 28 Feb 2018 22:52:02 -0800 (PST) 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::244; helo=mail-pf0-x244.google.com; envelope-from=heyi.guo@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pf0-x244.google.com (mail-pf0-x244.google.com [IPv6:2607:f8b0:400e:c00::244]) (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 669282242384D for ; Wed, 28 Feb 2018 22:52:01 -0800 (PST) Received: by mail-pf0-x244.google.com with SMTP id u5so2088003pfh.6 for ; Wed, 28 Feb 2018 22:58:09 -0800 (PST) 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=+l5P3SpoNzVI01jT5vur2BeNu3YylFW+/juKckuFnnk=; b=dO/KtnJBVCu7ze11YE11rbbETwxMSEgKRna1aCPfOCX82qtthEfdbHYy6W+r8+j4TV jXkAzhd8iE7BZdHR/Unjp9d6o6sv7BnpIoETIdTopYU7BDU1RI66mEwOhyCX5gx/2L/a U8Vxlmo7pwXVsv2l4Fk4wLQZ3YqmBmVwIR1pM= 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=+l5P3SpoNzVI01jT5vur2BeNu3YylFW+/juKckuFnnk=; b=GIvDsctF3uarKOiMZqurZbHm6H41iuSalOLKKeQ3ZEO+5pBFcmxCWCXPjzkojSphix 31s5HveL40EE92jRo5mfA5y8ITWFap+9Mg1bFFHx4ecod33MCMkSanMo2zU/6Ndhlo91 rJNm6QcgMsbdej1NXHvHywydjXAJb0JbGREOUOeQh0TMerfF6nPdOybJvSw1mT/9HAsG B0ZnjDk/tp2rixeHGjJWRVLbD8fJYmR2CYe4hYhj6/2aS4pRS5VWSYJa+WyGft1a40nK 77yaIMEw4EwyokRBci/duvRNHF+YZvMLNN/eyRy5xArZj/00UJVcBvYvRH0CfjweEEWk W1hQ== X-Gm-Message-State: APf1xPBzF+S7xkLdSad8CRFIubbNpvhfie3hYXCNYXEtenK3pS27IzrD GN4H4yJTKBkNZ9EA34C77MVCLGdPKsA= X-Received: by 10.98.70.89 with SMTP id t86mr896406pfa.215.1519887489011; Wed, 28 Feb 2018 22:58:09 -0800 (PST) Received: from localhost.localdomain ([45.56.152.115]) by smtp.gmail.com with ESMTPSA id p63sm6489867pfk.74.2018.02.28.22.58.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Feb 2018 22:58:08 -0800 (PST) From: Heyi Guo To: edk2-devel@lists.01.org Date: Thu, 1 Mar 2018 14:57:20 +0800 Message-Id: <1519887444-75510-3-git-send-email-heyi.guo@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519887444-75510-1-git-send-email-heyi.guo@linaro.org> References: <1519887444-75510-1-git-send-email-heyi.guo@linaro.org> Subject: [edk2] [PATCH v5 2/6] OvmfPkg/PciHostBridgeLib: Init PCI aperture to 0 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 , 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 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 Cc: Jordan Justen Cc: Anthony Perard Cc: Julien Grall Cc: Ruiyu Ni Cc: Laszlo Ersek Cc: Ard Biesheuvel --- OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c | 4 ++++ OvmfPkg/Library/PciHostBridgeLib/XenSupport.c | 5 +++++ 2 files changed, 9 insertions(+) -- 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..4a650a4c6df9 100644 --- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c +++ b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c @@ -217,6 +217,10 @@ PciHostBridgeGetRootBridges ( PCI_ROOT_BRIDGE_APERTURE Mem; PCI_ROOT_BRIDGE_APERTURE MemAbove4G; + ZeroMem (&Io, sizeof (Io)); + ZeroMem (&Mem, sizeof (Mem)); + ZeroMem (&MemAbove4G, sizeof (MemAbove4G)); + if (PcdGetBool (PcdPciDisableBusEnumeration)) { return ScanForRootBridges (Count); } diff --git a/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c b/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c index 31c63ae19e0a..aaf101dfcb0e 100644 --- a/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c +++ b/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c @@ -193,6 +193,11 @@ ScanForRootBridges ( *NumberOfRootBridges = 0; RootBridges = NULL; + ZeroMem (&Io, sizeof (Io)); + ZeroMem (&Mem, sizeof (Mem)); + ZeroMem (&MemAbove4G, sizeof (MemAbove4G)); + ZeroMem (&PMem, sizeof (PMem)); + ZeroMem (&PMemAbove4G, sizeof (PMemAbove4G)); // // After scanning all the PCI devices on the PCI root bridge's primary bus,