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: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-Google-Smtp-Source: AG47ELuyKWGcVFxnPUwsywIrHX48MHcbC2jAsay0YHyPow71o/51wV5wjSzRIZ65LYlwiYWm9xRM/w== 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 Cc: Heyi Guo , Jordan Justen , Anthony Perard , Julien Grall , Ruiyu Ni , Laszlo Ersek , Ard Biesheuvel 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: [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: , X-List-Received-Date: Thu, 01 Mar 2018 06:52:01 -0000 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(+) 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, -- 2.7.4