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 1579A21196213 for ; Wed, 28 Nov 2018 06:34:15 -0800 (PST) Received: by mail-wr1-x441.google.com with SMTP id j10so26531344wru.4 for ; Wed, 28 Nov 2018 06:34:14 -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=uETaXBrNv5jsuw8eC89fjrzgEn1ia5ncb6V0hkNlox4=; b=h/PFUSIGa/UaCNebSet6BOi4wmoDSSKsR3DmBoaGtlVycX2YCH8vnQurLMHzcVOQp6 QAJeEZ0wr+1juG1Eqi2c0EWKjSUsKNS0h1b2EKZmiE8+RG+dLoV31360D0A4Pxy6V1g9 JP0+Hsf1Yf9aRiMI5qfTW277jjLQWXjL03ABU= 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=uETaXBrNv5jsuw8eC89fjrzgEn1ia5ncb6V0hkNlox4=; b=Gy18HUReyvRg+ABZtjlxA64wMB1s7WxLkd9sMTzXUm7tWuh8YkmhYNjUKiH3Err0ez hnPLHtDQjSA7m5bjHO3W6zwi9srZ8qjTKe9Zk9njXMW9JDzx1FDg4mYbfy4+ElmeJ0Km aPCcsBJbwiHFAN4bbYZtGbd3fCNM7bF1kgpm6IYx8aGkPulrcNZb6ZuYZB0Vmqbo0TDD dfF1wDREawzgMg107zlWthFKMOj+m9bnwrkHPn6tBbu+p5SLIdm00gbLrkKUT2KJPJps RERW5qFcEkNMwrbPBQxx2VVtAn9P+guRJDhgM1dFehPKNCtoVFEZVgrNvGcIgq7owLeh UHAA== X-Gm-Message-State: AA+aEWbAUgRBajd/15FVbg0dFo3dfKoE2cYMLv1amDMsThrACTh3+5OE whwK9aMZpZdu2tIxr/zx4yWfZMGenUc= X-Google-Smtp-Source: AFSGD/VEWTT1N4u6rygYE3R1FfV39Ornd2E2oNqZx3jQAERj+HGesd81bPfe6gZHRfrelRt1PdIuRQ== X-Received: by 2002:a5d:52ca:: with SMTP id r10mr6817784wrv.123.1543415653297; Wed, 28 Nov 2018 06:34:13 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:296f:238b:c20d:3626]) by smtp.gmail.com with ESMTPSA id 6sm3391891wmk.26.2018.11.28.06.34.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Nov 2018 06:34:12 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Cc: Ard Biesheuvel , Laszlo Ersek , Leif Lindholm , Eric Auger , Andrew Jones , Philippe Mathieu-Daude , Julien Grall Date: Wed, 28 Nov 2018 15:33:48 +0100 Message-Id: <20181128143357.991-8-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181128143357.991-1-ard.biesheuvel@linaro.org> References: <20181128143357.991-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Subject: [PATCH v3 07/16] ArmVirtPkg/XenVirtMemInfoLib: refactor reading of the PA space size 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, 28 Nov 2018 14:34:15 -0000 Content-Transfer-Encoding: 8bit Use the new ArmLib helper to read the CPU's physical address limit so we can drop our own homecooked one. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.inf | 6 --- ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.c | 11 +++--- ArmVirtPkg/Library/XenVirtMemInfoLib/AArch64/PhysAddrTop.S | 39 -------------------- ArmVirtPkg/Library/XenVirtMemInfoLib/Arm/PhysAddrTop.S | 24 ------------ 4 files changed, 5 insertions(+), 75 deletions(-) diff --git a/ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.inf b/ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.inf index cd4c805a4db9..ae107810e927 100644 --- a/ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.inf +++ b/ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.inf @@ -24,12 +24,6 @@ [Defines] [Sources] XenVirtMemInfoLib.c -[Sources.ARM] - Arm/PhysAddrTop.S - -[Sources.AARCH64] - AArch64/PhysAddrTop.S - [Packages] ArmPkg/ArmPkg.dec ArmVirtPkg/ArmVirtPkg.dec diff --git a/ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.c b/ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.c index 88ff3167cbfd..6701dec50ea8 100644 --- a/ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.c +++ b/ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.c @@ -18,11 +18,6 @@ STATIC ARM_MEMORY_REGION_DESCRIPTOR mVirtualMemoryTable[2]; -EFI_PHYSICAL_ADDRESS -ArmGetPhysAddrTop ( - VOID - ); - /** Return the Virtual Memory Map of your platform @@ -42,8 +37,12 @@ ArmVirtGetMemoryMap ( OUT ARM_MEMORY_REGION_DESCRIPTOR **VirtualMemoryMap ) { + EFI_PHYSICAL_ADDRESS TopOfAddressSpace; + ASSERT (VirtualMemoryMap != NULL); + TopOfAddressSpace = LShiftU64 (1ULL, ArmGetPhysicalAddressBits ()); + // // Map the entire physical memory space as cached. The only device // we care about is the GIC, which will be stage 2 mapped as a device @@ -51,7 +50,7 @@ ArmVirtGetMemoryMap ( // mVirtualMemoryTable[0].PhysicalBase = 0x0; mVirtualMemoryTable[0].VirtualBase = 0x0; - mVirtualMemoryTable[0].Length = ArmGetPhysAddrTop (); + mVirtualMemoryTable[0].Length = TopOfAddressSpace; mVirtualMemoryTable[0].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK; mVirtualMemoryTable[1].PhysicalBase = 0x0; diff --git a/ArmVirtPkg/Library/XenVirtMemInfoLib/AArch64/PhysAddrTop.S b/ArmVirtPkg/Library/XenVirtMemInfoLib/AArch64/PhysAddrTop.S deleted file mode 100644 index a1f6a194d59b..000000000000 --- a/ArmVirtPkg/Library/XenVirtMemInfoLib/AArch64/PhysAddrTop.S +++ /dev/null @@ -1,39 +0,0 @@ -# -# Copyright (c) 2011-2013, ARM Limited. All rights reserved. -# Copyright (c) 2016-2017, Linaro Limited. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# - -#include - -//EFI_PHYSICAL_ADDRESS -//GetPhysAddrTop ( -// VOID -// ); -ASM_FUNC(ArmGetPhysAddrTop) - mrs x0, id_aa64mmfr0_el1 - adr x1, .LPARanges - and x0, x0, #7 - ldrb w1, [x1, x0] - mov x0, #1 - lsl x0, x0, x1 - ret - -// -// Bits 0..2 of the AA64MFR0_EL1 system register encode the size of the -// physical address space support on this CPU: -// 0 == 32 bits, 1 == 36 bits, etc etc -// 6 and 7 are reserved -// -.LPARanges: - .byte 32, 36, 40, 42, 44, 48, -1, -1 - -ASM_FUNCTION_REMOVE_IF_UNREFERENCED diff --git a/ArmVirtPkg/Library/XenVirtMemInfoLib/Arm/PhysAddrTop.S b/ArmVirtPkg/Library/XenVirtMemInfoLib/Arm/PhysAddrTop.S deleted file mode 100644 index 9cd81529fb3d..000000000000 --- a/ArmVirtPkg/Library/XenVirtMemInfoLib/Arm/PhysAddrTop.S +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright (c) 2011-2013, ARM Limited. All rights reserved. -# Copyright (c) 2014-2017, Linaro Limited. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# - -#include - -//EFI_PHYSICAL_ADDRESS -//GetPhysAddrTop ( -// VOID -// ); -ASM_FUNC(ArmGetPhysAddrTop) - mov r0, #0x00000000 - mov r1, #0x10000 - bx lr -- 2.19.1