From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:4864:20::441; helo=mail-wr1-x441.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) (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 748AF211A2D88 for ; Wed, 19 Dec 2018 12:56:54 -0800 (PST) Received: by mail-wr1-x441.google.com with SMTP id l9so20866018wrt.13 for ; Wed, 19 Dec 2018 12:56:54 -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 :mime-version:content-transfer-encoding; bh=3d0467lefD/nB3Ybk3v99pEO4QMNXBQORMfuohqAGXc=; b=XnfMSgyHj6/Srz9PupGSaNZrhl7i43ds8BAMrD8maey1Ue5oiE8s0MY2XnS83ltCv8 JANCp1aDXLgihRzSuO6Nrn9oa9Rx4Fn5V2vlQj0XIl/QEi589dfXIxm8CSHeR6Y50dJx pucJUXgwgtN3CSngqaA55+959w52V5xR0ahAU= 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:mime-version:content-transfer-encoding; bh=3d0467lefD/nB3Ybk3v99pEO4QMNXBQORMfuohqAGXc=; b=rlxJcoeTgPY8CCjLGTB44YMTnUWW3xmPnV1zUmGYDCXDeT6R+Er7A7jEfnHARao9Is pMXcyk57UADC2vQAgUfFBI1h0omhev3xP8EAP+a5Y1NYo6IcrG8Xz3T3OOXozRWN7N6/ rDe6qLRX3Lwx3Dr+iJdwEKGWyJ9xU0wGtk2VX0POHVL9T6q46jwTVvMR9MWdKQG4YjUx Rj9ppj1j8Ls5xsPncZpnZzz3Vv1LRfzy2jeMgFeU7oMfMQrpfOU7gi1VZdqcDShnHyq9 AXQCRN6eiEjnMmSuHV085kFd3ILx173FAbkiOlxo7RQvL2Xfj7yGLMmCNzNlu0s5M6qq LqVQ== X-Gm-Message-State: AA+aEWaOFwdvrUVXvEwq451DgmoaelSTF3iXVUMzSmMU90ZryEbCgbSY 9m0dVXxP1NpTO3An9aYid/CvLNvrjMftbg== X-Google-Smtp-Source: AFSGD/V49ctc4ryhs6bv0SUnSrB3tFX1sfvNejIkQBBKCQRcIv6c/IcWNlbUOjlwMYFHRz1tjvYETQ== X-Received: by 2002:a5d:6a42:: with SMTP id t2mr21753400wrw.50.1545253012744; Wed, 19 Dec 2018 12:56:52 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:e5c9:6e00:25cb:e32e]) by smtp.gmail.com with ESMTPSA id j202sm16267294wmf.15.2018.12.19.12.56.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Dec 2018 12:56:51 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Cc: Ard Biesheuvel , Michael D Kinney , Liming Gao , Jian J Wang , Hao Wu , Leif Lindholm , Laszlo Ersek , Eric Auger , Andrew Jones , Philippe Mathieu-Daude Date: Wed, 19 Dec 2018 21:56:36 +0100 Message-Id: <20181219205640.4704-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181219205640.4704-1-ard.biesheuvel@linaro.org> References: <20181219205640.4704-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Subject: [PATCH v2 2/6] MdeModulePkg/Dxe/Gcd: disregard memory above MAX_ALLOC_ADDRESS X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2018 20:56:54 -0000 Content-Transfer-Encoding: 8bit Update the GCD memory map initialization code so it disregards memory that is not addressable by the CPU at boot time. This only affects the first memory descriptor that is added, other memory descriptors are permitted that describe memory ranges that may be accessible to the CPU itself only when executing under the OS. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Jian J Wang --- MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c index a76d2db73c46..504e14a74e1d 100644 --- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c +++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c @@ -2284,7 +2284,7 @@ CoreInitializeMemoryServices ( // region that is big enough to initialize the DXE core. Always skip the PHIT Resource HOB. // The max address must be within the physically addressible range for the processor. // - HighAddress = MAX_ADDRESS; + HighAddress = MAX_ALLOC_ADDRESS; for (Hob.Raw = *HobStart; !END_OF_HOB_LIST(Hob); Hob.Raw = GET_NEXT_HOB(Hob)) { // // Skip the Resource Descriptor HOB that contains the PHIT @@ -2300,7 +2300,7 @@ CoreInitializeMemoryServices ( } // - // Skip Resource Descriptor HOBs that do not describe tested system memory below MAX_ADDRESS + // Skip Resource Descriptor HOBs that do not describe tested system memory below MAX_ALLOC_ADDRESS // ResourceHob = Hob.ResourceDescriptor; if (ResourceHob->ResourceType != EFI_RESOURCE_SYSTEM_MEMORY) { @@ -2309,14 +2309,14 @@ CoreInitializeMemoryServices ( if ((ResourceHob->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) != TESTED_MEMORY_ATTRIBUTES) { continue; } - if ((ResourceHob->PhysicalStart + ResourceHob->ResourceLength) > (EFI_PHYSICAL_ADDRESS)MAX_ADDRESS) { + if ((ResourceHob->PhysicalStart + ResourceHob->ResourceLength) > (EFI_PHYSICAL_ADDRESS)MAX_ALLOC_ADDRESS) { continue; } // // Skip Resource Descriptor HOBs that are below a previously found Resource Descriptor HOB // - if (HighAddress != (EFI_PHYSICAL_ADDRESS)MAX_ADDRESS && ResourceHob->PhysicalStart <= HighAddress) { + if (HighAddress != (EFI_PHYSICAL_ADDRESS)MAX_ALLOC_ADDRESS && ResourceHob->PhysicalStart <= HighAddress) { continue; } -- 2.19.2