From nobody Tue Dec 24 13:17:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1511345266540537.7996910428823; Wed, 22 Nov 2017 02:07:46 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 52CC4220C160B; Wed, 22 Nov 2017 02:03:28 -0800 (PST) Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) (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 3A673220C1600 for ; Wed, 22 Nov 2017 02:03:26 -0800 (PST) Received: by mail-wm0-x243.google.com with SMTP id u83so9121057wmb.5 for ; Wed, 22 Nov 2017 02:07:42 -0800 (PST) Received: from localhost.localdomain ([154.145.25.106]) by smtp.gmail.com with ESMTPSA id i192sm2761457wmf.46.2017.11.22.02.07.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:07:39 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::243; helo=mail-wm0-x243.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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=tCVf7Xxj5oi0a27cDasuipmoXeaGA+MellLzjuBNZvs=; b=EWh6nELfjIgPVc7gw6LkVqUr4oXzCIK4CyDRBuN3RA3pmOiP3RRn93YT9PyEy7NZgS SJoB9TYbzHytfTgqqTeGJsKahkzL9oDAbJjzi9H5+dcdiKEk3gtfDA0b6NbyoaziXqK4 CwJX8ETfFnyd11FcxZojFnJFCulXsA1PD8XcA= 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=tCVf7Xxj5oi0a27cDasuipmoXeaGA+MellLzjuBNZvs=; b=iaYZ6zfYRLHl4KyNgJo8q2TpXQNwdcAlmzXd21JiBifF+qGlwmDnoA+nyKDooJHMkx 2xWbwqG/vjdNJpFC4g3kxSc+EU+4l+QfT4+f+O27g17uVaOBtbQorJd6VyKT10fRQ+f3 e8lPzYjNu/FF1V68ZISlVqtj3xBYwpKvXU5in/jGxLVRmy+6ZaqpZ+Y0quy/GUGzA09v Fn0jgPToaG0PmbTL0XqRzhjAfUXiRP2KCaFgVv9wo+BFYoaUlBH+FqeiXUogqganpGrz 9DXmzja45329dEbOMwdFumhRPt4rTX7ur2evBr0NiSUc2D4DjscIzV8ra7fcQGVikukO xPKA== X-Gm-Message-State: AJaThX5Qdg0pchBtB0R1QzPnKHlVCCWa86dH5jV/oHRwCzh9L0XFx0aM 7KUW314a5umNbz1FiuLEY/gUdRByZgI= X-Google-Smtp-Source: AGs4zMaeJCwV/ZKCp7aEcL7NXhwIlbyDHBmqshpXcUeksJFEJ2ymXvtVAEh8h3WrsJO5dQYGuAmBng== X-Received: by 10.28.34.67 with SMTP id i64mr3674271wmi.57.1511345260856; Wed, 22 Nov 2017 02:07:40 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Date: Wed, 22 Nov 2017 10:07:18 +0000 Message-Id: <20171122100731.24525-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171122100731.24525-1-ard.biesheuvel@linaro.org> References: <20171122100731.24525-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v2 01/14] ArmVirtPkg/PrePi: run all library constructors by hand X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Instead of invoking the library constructors of some libraries by hand, invoke the generated function ProcessLibraryConstructorList in AutoGen.c so all constructors are executed. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek --- ArmVirtPkg/PrePi/PrePi.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/ArmVirtPkg/PrePi/PrePi.c b/ArmVirtPkg/PrePi/PrePi.c index c69cff249e80..3679087aec4d 100755 --- a/ArmVirtPkg/PrePi/PrePi.c +++ b/ArmVirtPkg/PrePi/PrePi.c @@ -29,15 +29,9 @@ #include "PrePi.h" #include "LzmaDecompress.h" =20 -EFI_STATUS -EFIAPI -ExtractGuidedSectionLibConstructor ( - VOID - ); - -EFI_STATUS +VOID EFIAPI -LzmaDecompressLibConstructor ( +ProcessLibraryConstructorList ( VOID ); =20 @@ -125,8 +119,7 @@ PrePiMain ( PERF_START (NULL, "PEI", NULL, StartTimeStamp); =20 // SEC phase needs to run library constructors by hand. - ExtractGuidedSectionLibConstructor (); - LzmaDecompressLibConstructor (); + ProcessLibraryConstructorList (); =20 // Build HOBs to pass up our version of stuff the DXE Core needs to save= space BuildPeCoffLoaderHob (); --=20 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Tue Dec 24 13:17:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1511345268609442.2625698702593; Wed, 22 Nov 2017 02:07:48 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 8C1A1220C1610; Wed, 22 Nov 2017 02:03:29 -0800 (PST) Received: from mail-wr0-x243.google.com (mail-wr0-x243.google.com [IPv6:2a00:1450:400c:c0c::243]) (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 49729220C1608 for ; Wed, 22 Nov 2017 02:03:28 -0800 (PST) Received: by mail-wr0-x243.google.com with SMTP id k18so9040014wre.1 for ; Wed, 22 Nov 2017 02:07:44 -0800 (PST) Received: from localhost.localdomain ([154.145.25.106]) by smtp.gmail.com with ESMTPSA id i192sm2761457wmf.46.2017.11.22.02.07.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:07:41 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::243; helo=mail-wr0-x243.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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=u4dNtRs6JllofAsA9t+iMFTOq8romJgNxKj+UPaqM8U=; b=R+QOaWWFxh8YixkCQMnRAVQXxJ1+KqjCqZf1U9jSSHbdJIi7pEro53ZX3P2A4c2fVB 4Gip9TwskIO0TMfmUsMyMzhQM5ATRlcjsdZJyJZwWug3gBUyhErEpWl8UGrs1vKXh6kX OMg+oGlmV0e0nHIdMuJgldaKIazn8mMW9WBQs= 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=u4dNtRs6JllofAsA9t+iMFTOq8romJgNxKj+UPaqM8U=; b=pG6c/2Ikmlzdm0subYD7lyAVv7Rrp/LRwM8wuLSO0AxGKQfnCsYuofX3cYcunGq3Sr 9MzlqrUYcQbZNueqdKVj6OHahEk1JbyElWUczadRnViyELgsoWEWBNV7wAZ+f+ngTwHB CR1hy5rxyOQR/1yrSqkBhg49naXDqiPuftgntnjesuRCStVdHrtzwLhzaS7MmCYy+VBM hWNc3cFOfemHFL7hq/yKp+XniRR/3BacUFydJtf/tgYQad7dOayjjcH7Yl8B2RDdLMDv Lvod4fo1s4C88TDbChNiiyWymwllwam0Vu3BBkudqYdkgQRlInUF56SgFyRxa1/tPMsL XGmQ== X-Gm-Message-State: AJaThX7ndZ0J4iJZx5ADCDl498nKTCmp6Jh2UJBngDXs6jktWOvD/bxm X9afbxVFAepMWL8Hqaym7iq15uQD2YI= X-Google-Smtp-Source: AGs4zMZFHd5DZw6LhCF+X55EuAIkJRB0V0i7uFXKM6BIPH7x1XnPp2C/feF9HaB1zmfHDcXcMN2Xtw== X-Received: by 10.223.129.35 with SMTP id 32mr16082250wrm.271.1511345262419; Wed, 22 Nov 2017 02:07:42 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Date: Wed, 22 Nov 2017 10:07:19 +0000 Message-Id: <20171122100731.24525-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171122100731.24525-1-ard.biesheuvel@linaro.org> References: <20171122100731.24525-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v2 02/14] ArmVirtPkg/PrePi: remove unused GetPlatformPpi() function X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Remove GetPlatformPpi() from PrePi: it is not used anywhere. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek --- ArmVirtPkg/PrePi/PrePi.c | 24 -------------------- ArmVirtPkg/PrePi/PrePi.h | 6 ----- 2 files changed, 30 deletions(-) diff --git a/ArmVirtPkg/PrePi/PrePi.c b/ArmVirtPkg/PrePi/PrePi.c index 3679087aec4d..c4fa979c43ef 100755 --- a/ArmVirtPkg/PrePi/PrePi.c +++ b/ArmVirtPkg/PrePi/PrePi.c @@ -35,30 +35,6 @@ ProcessLibraryConstructorList ( VOID ); =20 -EFI_STATUS -GetPlatformPpi ( - IN EFI_GUID *PpiGuid, - OUT VOID **Ppi - ) -{ - UINTN PpiListSize; - UINTN PpiListCount; - EFI_PEI_PPI_DESCRIPTOR *PpiList; - UINTN Index; - - PpiListSize =3D 0; - ArmPlatformGetPlatformPpiList (&PpiListSize, &PpiList); - PpiListCount =3D PpiListSize / sizeof(EFI_PEI_PPI_DESCRIPTOR); - for (Index =3D 0; Index < PpiListCount; Index++, PpiList++) { - if (CompareGuid (PpiList->Guid, PpiGuid) =3D=3D TRUE) { - *Ppi =3D PpiList->Ppi; - return EFI_SUCCESS; - } - } - - return EFI_NOT_FOUND; -} - VOID PrePiMain ( IN UINTN UefiMemoryBase, diff --git a/ArmVirtPkg/PrePi/PrePi.h b/ArmVirtPkg/PrePi/PrePi.h index d3189c0b8a6f..153f06b9c7fb 100644 --- a/ArmVirtPkg/PrePi/PrePi.h +++ b/ArmVirtPkg/PrePi/PrePi.h @@ -61,12 +61,6 @@ BuildMemoryTypeInformationHob ( VOID ); =20 -EFI_STATUS -GetPlatformPpi ( - IN EFI_GUID *PpiGuid, - OUT VOID **Ppi - ); - // Initialize the Architecture specific controllers VOID ArchInitialize ( --=20 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Tue Dec 24 13:17:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1511345271057452.4748287357386; Wed, 22 Nov 2017 02:07:51 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id C951C220C1612; Wed, 22 Nov 2017 02:03:30 -0800 (PST) Received: from mail-wr0-x244.google.com (mail-wr0-x244.google.com [IPv6:2a00:1450:400c:c0c::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 735E2220C1608 for ; Wed, 22 Nov 2017 02:03:29 -0800 (PST) Received: by mail-wr0-x244.google.com with SMTP id z75so12643834wrc.5 for ; Wed, 22 Nov 2017 02:07:45 -0800 (PST) Received: from localhost.localdomain ([154.145.25.106]) by smtp.gmail.com with ESMTPSA id i192sm2761457wmf.46.2017.11.22.02.07.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:07:43 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::244; helo=mail-wr0-x244.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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=lTEFpZh+dgctLSe2P5kpl/Bt/gF97hPrX5I6UXrqAjg=; b=bskAeTBVhBzEJ2xVFaaNevvUU+rluJvf1Sy5z3obJVJQwMVUPiT6fAqjaj3NmLJ4ti gjqP56syNfTjKXmWbeZ6cINpIONkNkFI9SS4Qy9uaIfNNMzXt1PAKCqHn313VJ5KpSzh U6GYpChjDhTCrmkkNY2u93n44pFCUz7ikq6NU= 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=lTEFpZh+dgctLSe2P5kpl/Bt/gF97hPrX5I6UXrqAjg=; b=ICH14tjPGRfeIPR9A8+IqMjJUGplbFMmD31nYCfZfK4ota9akTV9FELb6QeR9uOIEu 9KGFJSYP2AE1Q1ha9lirW9gotxs4PGim6PtXw8UtvcQdBfafrTu7zbi50WCn12vQnyWr xFIj/Ua6xxSrkrokGvr9A0an+RpWdKbLrv0SwZ4VTwHsoK8RIdTQxxaY/8ylv0t0xvkU xNtxC0xR2DRZLl/kpTP2Fxdq2JMmja4F+wKhbQ4FO+OCdUMKTvdqQa+Los3Q4J4I6bnY aLPGREegxgXmoLBtuq9MqE/u7zWGaiElwxSUbK6gBlCFy5rUL6jl71AP1BPaNouQy6In 3Hvw== X-Gm-Message-State: AJaThX5cR3RL9v74zMihpNMPZ87hKCsfaj2SpYm4uSa7JKO8EH+MdyCP TU/J8iobuYeYRbGE0qj0kuF/RjgpjcU= X-Google-Smtp-Source: AGs4zMb1henXw/je4+lvQ86YgSK6b1+TdoNakx4b7NXx/VfPyjlGStWJBJ/nicV08sa4Lcg+pIg+ZA== X-Received: by 10.223.172.245 with SMTP id o108mr18733698wrc.122.1511345263974; Wed, 22 Nov 2017 02:07:43 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Date: Wed, 22 Nov 2017 10:07:20 +0000 Message-Id: <20171122100731.24525-4-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171122100731.24525-1-ard.biesheuvel@linaro.org> References: <20171122100731.24525-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v2 03/14] ArmVirtPkg/PrePi: remove bogus primary core check X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" QEMU and KVM based ARM/AARCH64 virtual machines only enter UEFI on a single core, so ArmPlatformIsPrimaryCore() always returns true. And even if it didn't, our code does absolutely nothing meaningful based on its return value, so don't bother calling it, and remove another frivolous dependency on ArmPlatformLib. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek --- ArmVirtPkg/PrePi/AArch64/ModuleEntryPoint.S | 7 ------- ArmVirtPkg/PrePi/Arm/ModuleEntryPoint.S | 7 ------- 2 files changed, 14 deletions(-) diff --git a/ArmVirtPkg/PrePi/AArch64/ModuleEntryPoint.S b/ArmVirtPkg/PrePi= /AArch64/ModuleEntryPoint.S index cc8b47e69026..7a9c0c3787cc 100644 --- a/ArmVirtPkg/PrePi/AArch64/ModuleEntryPoint.S +++ b/ArmVirtPkg/PrePi/AArch64/ModuleEntryPoint.S @@ -128,13 +128,6 @@ _GetStackBase: MOV32 (x3, FixedPcdGet32(PcdCPUCoreSecondaryStackSize)) bl ASM_PFX(ArmPlatformStackSet) =20 - // Is it the Primary Core ? - mov x0, x10 - bl ASM_PFX(ArmPlatformIsPrimaryCore) - cmp x0, #1 - bne _PrepareArguments - -_PrepareArguments: mov x0, x20 mov x1, x21 mov x2, x22 diff --git a/ArmVirtPkg/PrePi/Arm/ModuleEntryPoint.S b/ArmVirtPkg/PrePi/Arm= /ModuleEntryPoint.S index 59028d0a553e..eebf660acdb2 100644 --- a/ArmVirtPkg/PrePi/Arm/ModuleEntryPoint.S +++ b/ArmVirtPkg/PrePi/Arm/ModuleEntryPoint.S @@ -136,13 +136,6 @@ _GetStackBase: MOV32 (r3, FixedPcdGet32(PcdCPUCoreSecondaryStackSize)) bl ASM_PFX(ArmPlatformStackSet) =20 - // Is it the Primary Core ? - mov r0, r10 - bl ASM_PFX(ArmPlatformIsPrimaryCore) - cmp r0, #1 - bne _PrepareArguments - -_PrepareArguments: mov r0, r10 mov r1, r11 mov r2, r9 --=20 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Tue Dec 24 13:17:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1511345274141128.93476741395898; Wed, 22 Nov 2017 02:07:54 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 0BCC7220C1616; Wed, 22 Nov 2017 02:03:34 -0800 (PST) Received: from mail-wr0-x243.google.com (mail-wr0-x243.google.com [IPv6:2a00:1450:400c:c0c::243]) (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 14CC9220C1602 for ; Wed, 22 Nov 2017 02:03:31 -0800 (PST) Received: by mail-wr0-x243.google.com with SMTP id u40so13975202wrf.10 for ; Wed, 22 Nov 2017 02:07:47 -0800 (PST) Received: from localhost.localdomain ([154.145.25.106]) by smtp.gmail.com with ESMTPSA id i192sm2761457wmf.46.2017.11.22.02.07.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:07:44 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::243; helo=mail-wr0-x243.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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=yubiK+0HgathV8jnyXrnL0Fnpjv3W0sZQAZbbqB6qng=; b=emIV1mFEgjSFg9gHXL3Rx3sKhiIjM1wU3v2TF0H4g/CyrXTZ93SZe0MItgtBMrwj1C fwLLpR47ZhRXJNdN8ha3t3UYkKKVI1NzWXBNybVq+rxayImm+lKfHVFYBpOv99Oeg3YH e2IQgH8oJ8UjX0ZZQoxjEFw4Hc9pE/1s1DGc4= 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=yubiK+0HgathV8jnyXrnL0Fnpjv3W0sZQAZbbqB6qng=; b=cqX+zu8LulzByWJ+zQQ9X0d91fWxYlD/MPFgdOYx7UCV5h8AbS+IccOybBHDmDFd9u ZZ+W2kJHlEE9Y7uip4vgJI/vThRb2V126Gk1JCZqjon6rzEjJ72AKakt1mJPH5f66U/f 54yc4CdBKkBc3Qfw6d1Q/zuTuntUiXx4qe3SJt7160hOyIadBGyA/Vk38a8mwf0vMPOG xAcC/OhGrEdEVZrEzPJ2YpdYPOmXCcFgquy55aNf3cUlTlwCiAYtKQNnzAcgPnu6NP0p OizOIRQBFmZVEA/ya5YcZDHSWudaGWyKvNOJ1lTiVyRur0is3cxnIIdFseh1kjhXqHZ/ HbyQ== X-Gm-Message-State: AJaThX4gwSFVFY/CxQAMH+26DN8MHrRFBye429NBfoNfjy92XEqVARyZ Pa27VU6PQqme08J8Gb9snFrzWtBXkPU= X-Google-Smtp-Source: AGs4zMaPBnUHL9g5p1ea/UwiK8lVykQTSstLjcivT+bJjZe9/vAfkadi9fINuqFKa9lgsoAa8S8axw== X-Received: by 10.223.128.162 with SMTP id 31mr17574735wrl.258.1511345265569; Wed, 22 Nov 2017 02:07:45 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Date: Wed, 22 Nov 2017 10:07:21 +0000 Message-Id: <20171122100731.24525-5-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171122100731.24525-1-ard.biesheuvel@linaro.org> References: <20171122100731.24525-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v2 04/14] ArmVirtPkg/PrePi: move DRAM discovery code into PrePi X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" ArmVirtQemuKernel and ArmVirtXen use essentially the same code to retrieve DRAM information from the DT /memory node at early boot, and invoke it via the ArmPlatformPeiBootAction () hook exposed by ArmPlatformLib. Let's move this code into the PrePi implementation these platforms share between them (and not with any other platforms) so we can eliminate another dependency on the messy ArmPlatformLib. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Acked-by: Laszlo Ersek --- ArmVirtPkg/PrePi/AArch64/ModuleEntryPoint.S | 77 ++++++++++++++++- ArmVirtPkg/PrePi/Arm/ModuleEntryPoint.S | 71 +++++++++++++++ ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf | 2 + ArmVirtPkg/PrePi/FdtParser.c | 90 +++++++++++++++++= +++ 4 files changed, 238 insertions(+), 2 deletions(-) diff --git a/ArmVirtPkg/PrePi/AArch64/ModuleEntryPoint.S b/ArmVirtPkg/PrePi= /AArch64/ModuleEntryPoint.S index 7a9c0c3787cc..3296aedfe9aa 100644 --- a/ArmVirtPkg/PrePi/AArch64/ModuleEntryPoint.S +++ b/ArmVirtPkg/PrePi/AArch64/ModuleEntryPoint.S @@ -49,8 +49,7 @@ ASM_FUNC(_ModuleEntryPoint) b .Lreloc_loop .Lreloc_done: =20 - // Do early platform specific actions - bl ASM_PFX(ArmPlatformPeiBootAction) + bl ASM_PFX(DiscoverDramFromDt) =20 // Get ID of this CPU in Multicore system bl ASM_PFX(ArmReadMpidr) @@ -140,3 +139,77 @@ _GetStackBase: =20 _NeverReturn: b _NeverReturn + +// VOID +// DiscoverDramFromDt ( +// VOID *DeviceTreeBaseAddress, // passed by loader in x0 +// VOID *ImageBase // passed by FDF trampoline in x1 +// ); +ASM_PFX(DiscoverDramFromDt): + // + // If we are booting from RAM using the Linux kernel boot protocol, x0 w= ill + // point to the DTB image in memory. Otherwise, use the default value de= fined + // by the platform. + // + cbnz x0, 0f + ldr x0, PcdGet64 (PcdDeviceTreeInitialBaseAddress) + +0:mov x29, x30 // preserve LR + mov x28, x0 // preserve DTB pointer + mov x27, x1 // preserve base of image pointer + + // + // The base of the runtime image has been preserved in x1. Check whether + // the expected magic number can be found in the header. + // + ldr w8, .LArm64LinuxMagic + ldr w9, [x1, #0x38] + cmp w8, w9 + bne .Lout + + // + // + // OK, so far so good. We have confirmed that we likely have a DTB and a= re + // booting via the arm64 Linux boot protocol. Update the base-of-image P= CD + // to the actual relocated value, and add the shift of PcdFdBaseAddress = to + // PcdFvBaseAddress as well + // + adr x8, PcdGet64 (PcdFdBaseAddress) + adr x9, PcdGet64 (PcdFvBaseAddress) + ldr x6, [x8] + ldr x7, [x9] + sub x7, x7, x6 + add x7, x7, x1 + str x1, [x8] + str x7, [x9] + + // + // Discover the memory size and offset from the DTB, and record in the + // respective PCDs. This will also return false if a corrupt DTB is + // encountered. Since we are calling a C function, use the window at the + // beginning of the FD image as a temp stack. + // + adr x1, PcdGet64 (PcdSystemMemoryBase) + adr x2, PcdGet64 (PcdSystemMemorySize) + mov sp, x7 + bl FindMemnode + cbz x0, .Lout + + // + // Copy the DTB to the slack space right after the 64 byte arm64/Linux s= tyle + // image header at the base of this image (defined in the FDF), and reco= rd the + // pointer in PcdDeviceTreeInitialBaseAddress. + // + adr x8, PcdGet64 (PcdDeviceTreeInitialBaseAddress) + add x27, x27, #0x40 + str x27, [x8] + + mov x0, x27 + mov x1, x28 + bl CopyFdt + +.Lout: + ret x29 + +.LArm64LinuxMagic: + .byte 0x41, 0x52, 0x4d, 0x64 diff --git a/ArmVirtPkg/PrePi/Arm/ModuleEntryPoint.S b/ArmVirtPkg/PrePi/Arm= /ModuleEntryPoint.S index eebf660acdb2..a918c191432e 100644 --- a/ArmVirtPkg/PrePi/Arm/ModuleEntryPoint.S +++ b/ArmVirtPkg/PrePi/Arm/ModuleEntryPoint.S @@ -148,3 +148,74 @@ _GetStackBase: =20 _NeverReturn: b _NeverReturn + +ASM_PFX(ArmPlatformPeiBootAction): + // + // If we are booting from RAM using the Linux kernel boot protocol, r0 w= ill + // point to the DTB image in memory. Otherwise, use the default value de= fined + // by the platform. + // + teq r0, #0 + bne 0f + LDRL (r0, PcdGet64 (PcdDeviceTreeInitialBaseAddress)) + +0:mov r11, r14 // preserve LR + mov r10, r0 // preserve DTB pointer + mov r9, r1 // preserve base of image pointer + + // + // The base of the runtime image has been preserved in r1. Check whether + // the expected magic number can be found in the header. + // + ldr r8, .LArm32LinuxMagic + ldr r7, [r1, #0x24] + cmp r7, r8 + bne .Lout + + // + // + // OK, so far so good. We have confirmed that we likely have a DTB and a= re + // booting via the ARM Linux boot protocol. Update the base-of-image PCD + // to the actual relocated value, and add the shift of PcdFdBaseAddress = to + // PcdFvBaseAddress as well + // + ADRL (r8, PcdGet64 (PcdFdBaseAddress)) + ADRL (r7, PcdGet64 (PcdFvBaseAddress)) + ldr r6, [r8] + ldr r5, [r7] + sub r5, r5, r6 + add r5, r5, r1 + str r1, [r8] + str r5, [r7] + + // + // Discover the memory size and offset from the DTB, and record in the + // respective PCDs. This will also return false if a corrupt DTB is + // encountered. Since we are calling a C function, use the window at the + // beginning of the FD image as a temp stack. + // + ADRL (r1, PcdGet64 (PcdSystemMemoryBase)) + ADRL (r2, PcdGet64 (PcdSystemMemorySize)) + mov sp, r5 + bl FindMemnode + teq r0, #0 + beq .Lout + + // + // Copy the DTB to the slack space right after the 64 byte arm64/Linux s= tyle + // image header at the base of this image (defined in the FDF), and reco= rd the + // pointer in PcdDeviceTreeInitialBaseAddress. + // + ADRL (r8, PcdGet64 (PcdDeviceTreeInitialBaseAddress)) + add r9, r9, #0x40 + str r9, [r8] + + mov r0, r9 + mov r1, r10 + bl CopyFdt + +.Lout: + bx r11 + +.LArm32LinuxMagic: + .byte 0x18, 0x28, 0x6f, 0x01 diff --git a/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf b/ArmVirtP= kg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf index 5e706934f69f..789a896857aa 100755 --- a/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf +++ b/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf @@ -23,6 +23,7 @@ [Defines] =20 [Sources] PrePi.c + FdtParser.c =20 [Sources.AArch64] AArch64/ArchPrePi.c @@ -44,6 +45,7 @@ [Packages] [LibraryClasses] BaseLib DebugLib + FdtLib ArmLib IoLib TimerLib diff --git a/ArmVirtPkg/PrePi/FdtParser.c b/ArmVirtPkg/PrePi/FdtParser.c new file mode 100644 index 000000000000..afdc81a8839d --- /dev/null +++ b/ArmVirtPkg/PrePi/FdtParser.c @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2015, Linaro Ltd. All rights reserved. + * + * This program and the accompanying materials + * are licensed and made available under the terms and conditions of the B= SD 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 IM= PLIED. + */ + +#include +#include + +BOOLEAN +FindMemnode ( + IN VOID *DeviceTreeBlob, + OUT UINT64 *SystemMemoryBase, + OUT UINT64 *SystemMemorySize + ) +{ + INT32 MemoryNode; + INT32 AddressCells; + INT32 SizeCells; + INT32 Length; + CONST INT32 *Prop; + + if (fdt_check_header (DeviceTreeBlob) !=3D 0) { + return FALSE; + } + + // + // Look for a node called "memory" at the lowest level of the tree + // + MemoryNode =3D fdt_path_offset (DeviceTreeBlob, "/memory"); + if (MemoryNode <=3D 0) { + return FALSE; + } + + // + // Retrieve the #address-cells and #size-cells properties + // from the root node, or use the default if not provided. + // + AddressCells =3D 1; + SizeCells =3D 1; + + Prop =3D fdt_getprop (DeviceTreeBlob, 0, "#address-cells", &Length); + if (Length =3D=3D 4) { + AddressCells =3D fdt32_to_cpu (*Prop); + } + + Prop =3D fdt_getprop (DeviceTreeBlob, 0, "#size-cells", &Length); + if (Length =3D=3D 4) { + SizeCells =3D fdt32_to_cpu (*Prop); + } + + // + // Now find the 'reg' property of the /memory node, and read the first + // range listed. + // + Prop =3D fdt_getprop (DeviceTreeBlob, MemoryNode, "reg", &Length); + + if (Length < (AddressCells + SizeCells) * sizeof (INT32)) { + return FALSE; + } + + *SystemMemoryBase =3D fdt32_to_cpu (Prop[0]); + if (AddressCells > 1) { + *SystemMemoryBase =3D (*SystemMemoryBase << 32) | fdt32_to_cpu (Prop[1= ]); + } + Prop +=3D AddressCells; + + *SystemMemorySize =3D fdt32_to_cpu (Prop[0]); + if (SizeCells > 1) { + *SystemMemorySize =3D (*SystemMemorySize << 32) | fdt32_to_cpu (Prop[1= ]); + } + + return TRUE; +} + +VOID +CopyFdt ( + IN VOID *FdtDest, + IN VOID *FdtSource + ) +{ + fdt_pack(FdtSource); + CopyMem (FdtDest, FdtSource, fdt_totalsize (FdtSource)); +} --=20 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Tue Dec 24 13:17:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1511345278120263.1077491614367; Wed, 22 Nov 2017 02:07:58 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 47494220C1619; Wed, 22 Nov 2017 02:03:36 -0800 (PST) Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) (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 B0BA9220C1600 for ; Wed, 22 Nov 2017 02:03:32 -0800 (PST) Received: by mail-wm0-x241.google.com with SMTP id y80so8942100wmd.0 for ; Wed, 22 Nov 2017 02:07:48 -0800 (PST) Received: from localhost.localdomain ([154.145.25.106]) by smtp.gmail.com with ESMTPSA id i192sm2761457wmf.46.2017.11.22.02.07.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:07:46 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::241; helo=mail-wm0-x241.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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=s8a7BepvxOiDHDmKylPl4/JljNSAVz+zBtKnC0RblEQ=; b=csbM0+bvvTXeixlf3EwknxSgHfigCx90pcv4yaPS62w/Liaqzb3rY+yrYSkXl9VnQt psz3tjQubHYXuaIu515HecH9DSF1fFaWW8AeyxDcUcxoiAXRqAmfkGBYbAbIdlWV39oy 3ZPtBWwjRaLBlz/GSpskaE8NIQgyuC83XOWrc= 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=s8a7BepvxOiDHDmKylPl4/JljNSAVz+zBtKnC0RblEQ=; b=ZlwwNloCOivivXXhm6xkkhZyVk0WFL9ejWEV3gGBy45NSGpPvCW37bE38c2MG9OLsM ZS9N02W7F+T4kxysSlQBuJF/FhhkAhnwAMtKmEnOFfuJcFkeOO0PvpSMvr2OcDmc1tyZ WxqslsSjirb82LJLZJd32PieUJ/xscBJ2JirJDKrkqM2WYm3zSZhcNUf61sh3e1Rmkn7 ZpTbqqzwk3+NFhWZUOA0w+HWFyv/vRo1BemBWzZMC610bqn6v5aUyRY0nKvjZCbJ0odr lc2RYyTPd6dgmLhFxmoExFUtKBcm274Q69o2envPubYQ3R+JY8TtxPO3RR7tOTgZC1/K Luww== X-Gm-Message-State: AJaThX7L9off2FIgBk3b+6PuFCaHuZb47Kay/vdIVidxAVok42C1XaTb Y/tGpT45+MNYrZ6X6DK9qtWDLipEKFk= X-Google-Smtp-Source: AGs4zMYEhWyAGfTq3+qk73DngM57bSrKNJ+/gSuc3KIBfmfQ3X5h9R+EMoQcwvUk6VU8GkEJtXQOBQ== X-Received: by 10.28.14.85 with SMTP id 82mr3386948wmo.120.1511345267331; Wed, 22 Nov 2017 02:07:47 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Date: Wed, 22 Nov 2017 10:07:22 +0000 Message-Id: <20171122100731.24525-6-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171122100731.24525-1-ard.biesheuvel@linaro.org> References: <20171122100731.24525-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v2 05/14] ArmVirtPkg/PrePi: remove dependency on ArmPlatformLib X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Remove the pointless dependency on ArmPlatformLib: none of the code we call from it actually does anything useful. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek --- ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf | 1 - ArmVirtPkg/PrePi/PrePi.c | 6 ++---- ArmVirtPkg/PrePi/PrePi.h | 1 - 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf b/ArmVirtP= kg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf index 789a896857aa..e816e9583da8 100755 --- a/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf +++ b/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf @@ -54,7 +54,6 @@ [LibraryClasses] LzmaDecompressLib PeCoffGetEntryPointLib PrePiLib - ArmPlatformLib ArmPlatformStackLib MemoryAllocationLib HobLib diff --git a/ArmVirtPkg/PrePi/PrePi.c b/ArmVirtPkg/PrePi/PrePi.c index c4fa979c43ef..fce4ab9428a5 100755 --- a/ArmVirtPkg/PrePi/PrePi.c +++ b/ArmVirtPkg/PrePi/PrePi.c @@ -13,6 +13,7 @@ **/ =20 #include +#include =20 #include #include @@ -85,7 +86,7 @@ PrePiMain ( BuildCpuHob (PcdGet8 (PcdPrePiCpuMemorySize), PcdGet8 (PcdPrePiCpuIoSize= )); =20 // Set the Boot Mode - SetBootMode (ArmPlatformGetBootMode ()); + SetBootMode (BOOT_WITH_FULL_CONFIGURATION); =20 // Initialize Platform HOBs (CpuHob and FvHob) Status =3D PlatformPeim (); @@ -123,9 +124,6 @@ CEntryPoint ( { UINT64 StartTimeStamp; =20 - // Initialize the platform specific controllers - ArmPlatformInitialize (MpId); - if (PerformanceMeasurementEnabled ()) { // Initialize the Timer Library to setup the Timer HW controller TimerConstructor (); diff --git a/ArmVirtPkg/PrePi/PrePi.h b/ArmVirtPkg/PrePi/PrePi.h index 153f06b9c7fb..14c9bf92c115 100644 --- a/ArmVirtPkg/PrePi/PrePi.h +++ b/ArmVirtPkg/PrePi/PrePi.h @@ -25,7 +25,6 @@ #include #include #include -#include =20 #define SerialPrint(txt) SerialPortWrite (txt, AsciiStrLen(txt)+1); =20 --=20 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Tue Dec 24 13:17:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1511345280890632.0314725455771; Wed, 22 Nov 2017 02:08:00 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 8452C220C161C; Wed, 22 Nov 2017 02:03:36 -0800 (PST) Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) (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 55CDC220C1600 for ; Wed, 22 Nov 2017 02:03:34 -0800 (PST) Received: by mail-wm0-x241.google.com with SMTP id l188so7315852wma.1 for ; Wed, 22 Nov 2017 02:07:50 -0800 (PST) Received: from localhost.localdomain ([154.145.25.106]) by smtp.gmail.com with ESMTPSA id i192sm2761457wmf.46.2017.11.22.02.07.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:07:48 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::241; helo=mail-wm0-x241.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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=fdFwKTgdxEvMIHZYz0Fu19cFQUyZ8VcIqedyLDlmr8g=; b=kN0ISdKY5wyG2Sz9s2jlQKxyAtya6oOOtPfvPyr7lUY6HxV1nOGXbjx0rkGsZv/6oY bXjmy1fCUARySdJeiCWxpEKEGRYxB0i2RWWrDvXuy35la5l7B7Tz/KljYNA6i52W73bj uKoYeU4rvMqdIGwyKwjG0Rt2SShql1GlbnNZI= 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=fdFwKTgdxEvMIHZYz0Fu19cFQUyZ8VcIqedyLDlmr8g=; b=ZsIe0kcXN/O84RH6fLvdWLufxpFvUttePWss2QY49rM80zD5BgTvcaWXXCo88KpZcx fZ5Ri2HQHf6FIiNeLrnYaL7RKjab0p5IaQ0vZOoYHITtADUTomTa+lQ4fHgZvrqJeAuH SfGiyHbYYfm5aXljsAxcUEUQzw6Y4OKqWRTFZkYnb73mit6+2MCTLGs+XKbb1R/ouSen +WmoLdT9Bd/yOYgHFMFdL/VQgOGWFQe1ngUIKsxRfwI5lmWqEaeOj3oI3unJ8NwL2RPa H7b9hsFg+iWxbQKh32sXp5U/0jB12skJlDb6ZnA+cX3n1qbSbt/h6qwqTbmjIdwTYkgt ZY1A== X-Gm-Message-State: AJaThX5zq/k5A6onrf7hyourAlJHb2ZrQL6aWvbNcxOl7S/RYURqLlC5 QwlMGbt0Cz9ahjJssCjw15wNBOb1V9w= X-Google-Smtp-Source: AGs4zMZwwZBlzyFEu3URPNspegpm9Vl9s5W+JdyMeDX1fpM5cWYYO7UtqCS2XSc6tIj3ImV1c9IuWQ== X-Received: by 10.28.211.213 with SMTP id k204mr3311007wmg.68.1511345268996; Wed, 22 Nov 2017 02:07:48 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Date: Wed, 22 Nov 2017 10:07:23 +0000 Message-Id: <20171122100731.24525-7-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171122100731.24525-1-ard.biesheuvel@linaro.org> References: <20171122100731.24525-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v2 06/14] ArmVirtPkg/PrePi: remove ArmPlatformStackLib dependency X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" ArmPlatformStackLib has hooks into primary/secondary core PCDs and other ArmPlatformLib related junk, so let's simply set the stack pointer directly. This is trivial given that our PrePi is unicore only. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Acked-by: Laszlo Ersek --- ArmVirtPkg/ArmVirt.dsc.inc | 1 - ArmVirtPkg/PrePi/AArch64/ModuleEntryPoint.S | 14 ++------------ ArmVirtPkg/PrePi/Arm/ModuleEntryPoint.S | 14 ++------------ ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf | 1 - 4 files changed, 4 insertions(+), 26 deletions(-) diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc index 50eb8675d1c0..5d7edff104b5 100644 --- a/ArmVirtPkg/ArmVirt.dsc.inc +++ b/ArmVirtPkg/ArmVirt.dsc.inc @@ -93,7 +93,6 @@ [LibraryClasses.common] ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.= inf ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf ArmGicArchLib|ArmVirtPkg/Library/ArmVirtGicArchLib/ArmVirtGicArchLib.inf - ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatfo= rmStackLib.inf ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf ArmHvcLib|ArmPkg/Library/ArmHvcLib/ArmHvcLib.inf ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerVirtCounterLib/A= rmGenericTimerVirtCounterLib.inf diff --git a/ArmVirtPkg/PrePi/AArch64/ModuleEntryPoint.S b/ArmVirtPkg/PrePi= /AArch64/ModuleEntryPoint.S index 3296aedfe9aa..891cf1fcab40 100644 --- a/ArmVirtPkg/PrePi/AArch64/ModuleEntryPoint.S +++ b/ArmVirtPkg/PrePi/AArch64/ModuleEntryPoint.S @@ -111,22 +111,12 @@ _GetBaseUefiMemory: =20 _GetStackBase: // r1 =3D The top of the Mpcore Stacks + mov sp, x1 + // Stack for the primary core =3D PrimaryCoreStack MOV32 (x2, FixedPcdGet32(PcdCPUCorePrimaryStackSize)) sub x22, x1, x2 =20 - // Stack for the secondary core =3D Number of Cores - 1 - MOV32 (x1, (FixedPcdGet32(PcdCoreCount) - 1) * FixedPcdGet32(PcdCPUCoreS= econdaryStackSize)) - sub x22, x22, x1 - - // x22 =3D The base of the MpCore Stacks (primary stack & secondary stac= ks) - mov x0, x22 - mov x1, x20 - //ArmPlatformStackSet(StackBase, MpId, PrimaryStackSize, SecondaryStackS= ize) - MOV32 (x2, FixedPcdGet32(PcdCPUCorePrimaryStackSize)) - MOV32 (x3, FixedPcdGet32(PcdCPUCoreSecondaryStackSize)) - bl ASM_PFX(ArmPlatformStackSet) - mov x0, x20 mov x1, x21 mov x2, x22 diff --git a/ArmVirtPkg/PrePi/Arm/ModuleEntryPoint.S b/ArmVirtPkg/PrePi/Arm= /ModuleEntryPoint.S index a918c191432e..ced08593e9de 100644 --- a/ArmVirtPkg/PrePi/Arm/ModuleEntryPoint.S +++ b/ArmVirtPkg/PrePi/Arm/ModuleEntryPoint.S @@ -120,22 +120,12 @@ _GetBaseUefiMemory: =20 _GetStackBase: // r1 =3D The top of the Mpcore Stacks + mov sp, r1 + // Stack for the primary core =3D PrimaryCoreStack MOV32 (r2, FixedPcdGet32(PcdCPUCorePrimaryStackSize)) sub r9, r1, r2 =20 - // Stack for the secondary core =3D Number of Cores - 1 - MOV32 (r1, (FixedPcdGet32(PcdCoreCount) - 1) * FixedPcdGet32(PcdCPUCoreS= econdaryStackSize)) - sub r9, r9, r1 - - // r9 =3D The base of the MpCore Stacks (primary stack & secondary stack= s) - mov r0, r9 - mov r1, r10 - //ArmPlatformStackSet(StackBase, MpId, PrimaryStackSize, SecondaryStackS= ize) - MOV32 (r2, FixedPcdGet32(PcdCPUCorePrimaryStackSize)) - MOV32 (r3, FixedPcdGet32(PcdCPUCoreSecondaryStackSize)) - bl ASM_PFX(ArmPlatformStackSet) - mov r0, r10 mov r1, r11 mov r2, r9 diff --git a/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf b/ArmVirtP= kg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf index e816e9583da8..ae9a088c7256 100755 --- a/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf +++ b/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf @@ -54,7 +54,6 @@ [LibraryClasses] LzmaDecompressLib PeCoffGetEntryPointLib PrePiLib - ArmPlatformStackLib MemoryAllocationLib HobLib PrePiHobListPointerLib --=20 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Tue Dec 24 13:17:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1511345284197881.1630888271549; Wed, 22 Nov 2017 02:08:04 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id C29C0220C160F; Wed, 22 Nov 2017 02:03:39 -0800 (PST) Received: from mail-wr0-x242.google.com (mail-wr0-x242.google.com [IPv6:2a00:1450:400c:c0c::242]) (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 EAFDC220C1603 for ; Wed, 22 Nov 2017 02:03:35 -0800 (PST) Received: by mail-wr0-x242.google.com with SMTP id 11so10640372wrb.6 for ; Wed, 22 Nov 2017 02:07:52 -0800 (PST) Received: from localhost.localdomain ([154.145.25.106]) by smtp.gmail.com with ESMTPSA id i192sm2761457wmf.46.2017.11.22.02.07.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:07:49 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::242; helo=mail-wr0-x242.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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=QA4yMBFE4k+LOXl8A55oKoxHagMvlY33GJit9+vOzm0=; b=GqykdHjDHSCKc/R0FdIxUcXmZ7RPyOPbfHlU1Hs2swL7zyqr3Wg1OyRuzxB0btHIw9 ZGo9osIRsLexbxzwbPyI3j84jgp7gXzExExeHu85SAqDVzZJ9ceVJH/O6A6QVi5nrS7x AYnfsQVUQUJPUFUQxGl/y0vCExpiqpbR/Trs4= 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=QA4yMBFE4k+LOXl8A55oKoxHagMvlY33GJit9+vOzm0=; b=ubOH4qmag8Ve2p2Sf3kFzCjI4BfXCdpuH3WNwNbrlYNcSyPmK3uIGRQUMSY5tOTaDU nM+GjOsufIb5V4yBAhZFHJqDSDSyaEY2kHl+0hkgAQOKENWO4fGn6zXoM/QusOhw3oVv fZQq8gtR6VL5Un3JGRE4iBFQSm7dEDFl2OEoWoD4WnUC0lZSfOgIWD07/tS374NEjfzY J61BilmeKFxBaA8pPk0qfJziaXN3/WmvLRe0x6tfLrUqKYW2T0RvjzPf9DYIAY93PkBp /13fb/QTrKC92HDEMKpotbMmld4WTgRXTsBGWvig0CLx/tW99DobunKHPRNaPanIH5RQ hZyw== X-Gm-Message-State: AJaThX5jVdQ6KTmiyYlwEd26/CR4RRSXwTTypOhoTTL5g7cGHBrRkWZ3 w460lcz+JQuKxDzKGN74OlSXYqzFuuI= X-Google-Smtp-Source: AGs4zMY533TtNvcz2kVv3FWOtKKg+GUeZN5tere9NxboqHMj6/1MAJmfgSFA5L6rXfGEfFB/5L8kLA== X-Received: by 10.223.170.143 with SMTP id h15mr18975275wrc.49.1511345270532; Wed, 22 Nov 2017 02:07:50 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Date: Wed, 22 Nov 2017 10:07:24 +0000 Message-Id: <20171122100731.24525-8-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171122100731.24525-1-ard.biesheuvel@linaro.org> References: <20171122100731.24525-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v2 07/14] ArmVirtPkg/PrePi: remove bogus IntelFrameworkModulePkg.dec dependency X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" PrePi doesn't use anything defined by this package so drop the bogus dependency. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek --- ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf | 1 - 1 file changed, 1 deletion(-) diff --git a/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf b/ArmVirtP= kg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf index ae9a088c7256..58290d2d1b76 100755 --- a/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf +++ b/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf @@ -40,7 +40,6 @@ [Packages] ArmPkg/ArmPkg.dec ArmPlatformPkg/ArmPlatformPkg.dec ArmVirtPkg/ArmVirtPkg.dec - IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec =20 [LibraryClasses] BaseLib --=20 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Tue Dec 24 13:17:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1511345287048165.28117663315822; Wed, 22 Nov 2017 02:08:07 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 03F09220C1620; Wed, 22 Nov 2017 02:03:40 -0800 (PST) Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) (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 9DCB6220C1602 for ; Wed, 22 Nov 2017 02:03:37 -0800 (PST) Received: by mail-wm0-x241.google.com with SMTP id v186so8937700wma.2 for ; Wed, 22 Nov 2017 02:07:53 -0800 (PST) Received: from localhost.localdomain ([154.145.25.106]) by smtp.gmail.com with ESMTPSA id i192sm2761457wmf.46.2017.11.22.02.07.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:07:51 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::241; helo=mail-wm0-x241.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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=NHtF2+GCWtVtkzfqVOpiEvrKV1Y+RYnjVrQ+7d4ZKFI=; b=FYf7VMMmpg6DeOLuMvY5Ib07EIubR0G6G9krvq4JsooY2iYC3hkD3PiS8qhzL02J4L emNXBmwxmfe3s1pla5RoGxjg9rqsi3OHpvnFmQXsDkE5TVbE0WUkBFJYh6O/QWFsJogg EJZKG3JOXQINjE7Fh83EzHzCoA+y/TvNmQy1s= 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=NHtF2+GCWtVtkzfqVOpiEvrKV1Y+RYnjVrQ+7d4ZKFI=; b=sq7/l4EdJwHkzG2ZAjXt+BhJ/M+yoqnlucK0WWXyTtwBNp2oglfxfZHgTqWO0g/P+8 4i6/ws/l5id80J/63nLzWI9Zn6VdiTTczbySwg7xpDG4795KZw+2pLJFEnzmmW0Dq4oq U29pXGmjvIG6pcodFgzDQ72a+d7VcGGlEdGwzpUkOn9ey3zDH1AsdHeltq+GpKI0Xkgw 5BbOlBkvNvA1WD+0cQ5uq9+AqvDs/4ZZkR7BB9cFpExkiYhRWHT9tgK/dNodjRF6diaB ZFq3uqcYVSF2SWDW/bXFipYiKEFUXROkiZVFyxQkdwmoZQFwLJBQgC+TubvmuCKYa1RQ Ch/Q== X-Gm-Message-State: AJaThX4xZHwK8xtoi1CAovdD5OJQk+PSVfI13e/nGWdO9TOFpx7VQ1Jc FRuZIgcD5k4bmPHu6jSndS1QxEnHPS0= X-Google-Smtp-Source: AGs4zMbdxK/lFjwTt94vbONr1Ihuf4gf8v8I4VIbok5nl+LSMNYOv5gKVCz33giVYQJZ01FSBKXpbw== X-Received: by 10.28.67.68 with SMTP id q65mr3364838wma.26.1511345272133; Wed, 22 Nov 2017 02:07:52 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Date: Wed, 22 Nov 2017 10:07:25 +0000 Message-Id: <20171122100731.24525-9-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171122100731.24525-1-ard.biesheuvel@linaro.org> References: <20171122100731.24525-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v2 08/14] ArmVirtPkg/ArmVirtPlatformLib: remove support for uncached mappings X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" QEMU/KVM has very little tolerance for using anything except writeback cacheable mappings of DRAM, so let's remove the 'feature' that allows us to select uncached mappings at build time. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek --- ArmVirtPkg/Library/ArmVirtPlatformLib/VirtMem.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/ArmVirtPkg/Library/ArmVirtPlatformLib/VirtMem.c b/ArmVirtPkg/L= ibrary/ArmVirtPlatformLib/VirtMem.c index d10548f86dfc..4368d05f76ef 100644 --- a/ArmVirtPkg/Library/ArmVirtPlatformLib/VirtMem.c +++ b/ArmVirtPkg/Library/ArmVirtPlatformLib/VirtMem.c @@ -22,10 +22,6 @@ // Number of Virtual Memory Map Descriptors #define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 5 =20 -// DDR attributes -#define DDR_ATTRIBUTES_CACHED ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK -#define DDR_ATTRIBUTES_UNCACHED ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBU= FFERED - EFI_PHYSICAL_ADDRESS ArmGetPhysAddrTop ( VOID @@ -48,7 +44,6 @@ ArmPlatformGetVirtualMemoryMap ( IN ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap ) { - ARM_MEMORY_REGION_ATTRIBUTES CacheAttributes; ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable; =20 ASSERT (VirtualMemoryMap !=3D NULL); @@ -65,17 +60,11 @@ ArmPlatformGetVirtualMemoryMap ( return; } =20 - if (FeaturePcdGet (PcdCacheEnable) =3D=3D TRUE) { - CacheAttributes =3D DDR_ATTRIBUTES_CACHED; - } else { - CacheAttributes =3D DDR_ATTRIBUTES_UNCACHED; - } - // System DRAM VirtualMemoryTable[0].PhysicalBase =3D PcdGet64 (PcdSystemMemoryBase); VirtualMemoryTable[0].VirtualBase =3D VirtualMemoryTable[0].PhysicalBas= e; VirtualMemoryTable[0].Length =3D PcdGet64 (PcdSystemMemorySize); - VirtualMemoryTable[0].Attributes =3D CacheAttributes; + VirtualMemoryTable[0].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_WRITE= _BACK; =20 DEBUG ((EFI_D_INFO, "%a: Dumping System DRAM Memory Map:\n" "\tPhysicalBase: 0x%lX\n" @@ -104,7 +93,7 @@ ArmPlatformGetVirtualMemoryMap ( VirtualMemoryTable[3].PhysicalBase =3D FixedPcdGet64 (PcdFdBaseAddress); VirtualMemoryTable[3].VirtualBase =3D VirtualMemoryTable[3].PhysicalBas= e; VirtualMemoryTable[3].Length =3D FixedPcdGet32 (PcdFdSize); - VirtualMemoryTable[3].Attributes =3D CacheAttributes; + VirtualMemoryTable[3].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_WRITE= _BACK; =20 // End of Table ZeroMem (&VirtualMemoryTable[4], sizeof (ARM_MEMORY_REGION_DESCRIPTOR)); --=20 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Tue Dec 24 13:17:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1511345289886176.8333742157182; Wed, 22 Nov 2017 02:08:09 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 3B853220C1623; Wed, 22 Nov 2017 02:03:44 -0800 (PST) Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) (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 26116220C1602 for ; Wed, 22 Nov 2017 02:03:39 -0800 (PST) Received: by mail-wm0-x243.google.com with SMTP id v186so8937886wma.2 for ; Wed, 22 Nov 2017 02:07:55 -0800 (PST) Received: from localhost.localdomain ([154.145.25.106]) by smtp.gmail.com with ESMTPSA id i192sm2761457wmf.46.2017.11.22.02.07.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:07:52 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::243; helo=mail-wm0-x243.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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=hq9M4e+t/Dtj7DciQ9f1O+Zv/7Fr/aDPE0rN3WJcHfM=; b=MkHfWT5ob7p9DLBoYQp7CN16G06dRmK0MIFCHDI+bhdo3CXZM0O/q8EwdeYbA4Vn35 Crt84RW/+NNxJGWG0NvF/Z1Y1dhDigox2lv+tyF+pn9OLd5uARovUOiR7CB/m6+XXWFv LMcIP0zsf0YEVifr2UmZ+j9c91n6jMlSif/rQ= 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=hq9M4e+t/Dtj7DciQ9f1O+Zv/7Fr/aDPE0rN3WJcHfM=; b=A/kLRJtxTSu07J44FCjtpoZkCeoOk/sQuS7UEZhDvtF+AfskULBoMmhqjW01LuGHFR WzKyXuVUO0y5C3m9Qo0+La0zadUGhMgblg/om4G1BNmJFcJThAMIe7l8wiN4EZDQc/Xd G+EMNeqiCSRAAMGv2IcmhwIBVCnptexh2KVP+TsRLgs2/mt8SwVzC3HyXANVsYzI4i1o LxOKtSsnifGuDSfzq6KBLu/smJ/K9cecQvKKhlYv/N39bVlnnYa6sgXlz8souoKKehiv JMzYngJaoNQ8rwUQwPHrlPlPcqn9XSynaH/od2FIyHyJA2kqrGI3C6IgB2NumT+BzvZA Ch8A== X-Gm-Message-State: AJaThX4vbxYYRz5hTpJLyGyqhpH6AeRF6/qKLlTNXAFdk8Zc8YVPtrs7 LzsGzlm3HizcXisN3MQTMOLHtC8LR4g= X-Google-Smtp-Source: AGs4zMYcDkBuHRQmr0dW9m/Ap/X4p8owlKXRXPOPbaMjOOGziI1mdhRfelG4zuT5dyivRLFwn/IWdg== X-Received: by 10.28.217.75 with SMTP id q72mr3517998wmg.9.1511345273803; Wed, 22 Nov 2017 02:07:53 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Date: Wed, 22 Nov 2017 10:07:26 +0000 Message-Id: <20171122100731.24525-10-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171122100731.24525-1-ard.biesheuvel@linaro.org> References: <20171122100731.24525-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v2 09/14] ArmVirtPkg: introduce ArmVirtMemInfoLib library class X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" As part of the effort to get rid of ArmPlatformLib (which incorporates far too many duties in a single library), introduce ArmVirtMemInfoLib which will be invoked by our ArmVirtMemoryInitPeiLib implementation to get a description of the virtual address space. This will allow us to remove this functionality from ArmPlatformLib later, or, in the case of ArmVirtXen and ArmVirtQemuKernel, drop ArmPlatformLib altogether. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek --- ArmVirtPkg/ArmVirtPkg.dec | 3 ++ ArmVirtPkg/Include/Library/ArmVirtMemInfoLib.h | 41 ++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/ArmVirtPkg/ArmVirtPkg.dec b/ArmVirtPkg/ArmVirtPkg.dec index a8603e1b80e5..8f656fd2739d 100644 --- a/ArmVirtPkg/ArmVirtPkg.dec +++ b/ArmVirtPkg/ArmVirtPkg.dec @@ -30,6 +30,9 @@ [Defines] [Includes.common] Include # Root include for the package =20 +[LibraryClasses] + ArmVirtMemInfoLib|Include/Library/ArmVirtMemInfoLib.h + [Guids.common] gArmVirtTokenSpaceGuid =3D { 0x0B6F5CA7, 0x4F53, 0x445A, { 0xB7, 0x6E, 0= x2E, 0x36, 0x5B, 0x80, 0x63, 0x66 } } gEarlyPL011BaseAddressGuid =3D { 0xB199DEA9, 0xFD5C, 0x4A84, { 0x8= 0, 0x82, 0x2F, 0x41, 0x70, 0x78, 0x03, 0x05 } } diff --git a/ArmVirtPkg/Include/Library/ArmVirtMemInfoLib.h b/ArmVirtPkg/In= clude/Library/ArmVirtMemInfoLib.h new file mode 100644 index 000000000000..bdf1c513bc6d --- /dev/null +++ b/ArmVirtPkg/Include/Library/ArmVirtMemInfoLib.h @@ -0,0 +1,41 @@ +/** @file + + Copyright (c) 2011-2013, ARM Limited. All rights reserved. + Copyright (c) 2017, Linaro, Ltd. All rights reserved. + + This program and the accompanying materials are licensed and made availa= ble + 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 IMP= LIED. + +**/ + +#ifndef _ARM_VIRT_MEMINFO_LIB_H_ +#define _ARM_VIRT_MEMINFO_LIB_H_ + +#include +#include + +/** + Return the Virtual Memory Map of your platform + + This Virtual Memory Map is used by MemoryInitPei Module to initialize th= e MMU + on your platform. + + @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR + describing a Physical-to-Virtual Memory + mapping. This array must be ended by a + zero-filled entry. The allocated memory + will not be freed. + +**/ +VOID +EFIAPI +ArmVirtGetMemoryMap ( + OUT ARM_MEMORY_REGION_DESCRIPTOR **VirtualMemoryMap + ); + +#endif --=20 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Tue Dec 24 13:17:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1511345292556457.49870961518104; Wed, 22 Nov 2017 02:08:12 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 706F6220C1626; Wed, 22 Nov 2017 02:03:44 -0800 (PST) Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) (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 1C425220C1623 for ; Wed, 22 Nov 2017 02:03:41 -0800 (PST) Received: by mail-wm0-x243.google.com with SMTP id b189so8936767wmd.5 for ; Wed, 22 Nov 2017 02:07:57 -0800 (PST) Received: from localhost.localdomain ([154.145.25.106]) by smtp.gmail.com with ESMTPSA id i192sm2761457wmf.46.2017.11.22.02.07.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:07:54 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::243; helo=mail-wm0-x243.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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=jpWOBW5zWjFdCIJGJ2U5Yu7ixOoXFWvKSVljq9wCbrg=; b=FYUaRdqWpIV9fYJFdohPjp5UHRfCUJzhE2fglIk+ig3IRU200P3U7O4lfOU6DhNlPh sbY8ArhNBAHyY6d9pcVwGCePgis+r3PyXKzfO/rVfuqaNX0aoIuZQnx3fO9hlQpz67rJ c7w2woDYqFMfydHcIEpkPHPkL7p2/A/ZRNcMk= 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=jpWOBW5zWjFdCIJGJ2U5Yu7ixOoXFWvKSVljq9wCbrg=; b=DvvkQXIEVOULlFuWfDYXqvReyDctM8f0fYbiLxHaOGnxpDH5KO9yDuhlZAsXQ/1eDP HwrTFbnkPNtJ5w/R8sZX7em0K0OeYNnvK6M0emoNH+0kTB7nKzuoaOFIdIzL1dFAnNs4 gIa06c3WLAXlqwV/GDyFQ4SdCSujBYVu2QdAG7Z7Wv4KZK8HcSTTr7YsW+2Nv5qOJrSs RfjGNDY4PeCt7Qvn96iKzwlqxiVLDgZVwvtPkdwbMSdINJ9WNAVfjqzxBiU7mqQ7xvlO aNracdwFCqYkYWgJy9qe4I1GANJHo5RvUGTj4qzfclnidmLmOuiyVYp6f/UQGOU7k0T+ 1tjg== X-Gm-Message-State: AJaThX7Gkuqb0D7KjX/rDuM4XwexwyOAPp3kX6GHM6mKnYWDaHzkwFSL Bj2Q67kqVi3/cF1968SYW7AkSZcTb7g= X-Google-Smtp-Source: AGs4zMacqF/TH7MCz9yHlvhhQZiv7YJlhUCMGh2AX4u1K7m6yN1lmXZNPlt+1KxRndiw2y+yN2bITQ== X-Received: by 10.28.211.213 with SMTP id k204mr3311281wmg.68.1511345275653; Wed, 22 Nov 2017 02:07:55 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Date: Wed, 22 Nov 2017 10:07:27 +0000 Message-Id: <20171122100731.24525-11-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171122100731.24525-1-ard.biesheuvel@linaro.org> References: <20171122100731.24525-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v2 10/14] ArmVirtPkg/ArmVirtXen: add ArmVirtMemInfoLib implementation X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Clone the existing ArmPlatformGetVirtualMemoryMap () for this platform, clean it up slightly (by using a static buffer rather than a heap allocation, and removing the support for uncached DRAM mappings), and turn it into a new ArmVirtMemInfoLib implementation. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Acked-by: Laszlo Ersek Cc: Julien Grall Tested-by: Julien Grall --- ArmVirtPkg/ArmVirtXen.dsc | 1 + ArmVirtPkg/Library/XenVirtMemInfoLib/AArch64/PhysAddrTop.S | 39 ++++++++++= ++ ArmVirtPkg/Library/XenVirtMemInfoLib/Arm/PhysAddrTop.S | 24 ++++++++ ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.c | 63 ++++++++++= ++++++++++ ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.inf | 41 ++++++++++= +++ 5 files changed, 168 insertions(+) diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc index 7a443483d1ac..3df684d13cb0 100644 --- a/ArmVirtPkg/ArmVirtXen.dsc +++ b/ArmVirtPkg/ArmVirtXen.dsc @@ -44,6 +44,7 @@ [LibraryClasses] VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice= Lib.inf =20 ArmPlatformLib|ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/ArmXenRel= ocatablePlatformLib.inf + ArmVirtMemInfoLib|ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib= .inf =20 TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf =20 diff --git a/ArmVirtPkg/Library/XenVirtMemInfoLib/AArch64/PhysAddrTop.S b/A= rmVirtPkg/Library/XenVirtMemInfoLib/AArch64/PhysAddrTop.S new file mode 100644 index 000000000000..a1f6a194d59b --- /dev/null +++ b/ArmVirtPkg/Library/XenVirtMemInfoLib/AArch64/PhysAddrTop.S @@ -0,0 +1,39 @@ +# +# 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 B= SD 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 IM= PLIED. +# +# + +#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 =3D=3D 32 bits, 1 =3D=3D 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/ArmVi= rtPkg/Library/XenVirtMemInfoLib/Arm/PhysAddrTop.S new file mode 100644 index 000000000000..9cd81529fb3d --- /dev/null +++ b/ArmVirtPkg/Library/XenVirtMemInfoLib/Arm/PhysAddrTop.S @@ -0,0 +1,24 @@ +# +# 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 B= SD 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 IM= PLIED. +# +# + +#include + +//EFI_PHYSICAL_ADDRESS +//GetPhysAddrTop ( +// VOID +// ); +ASM_FUNC(ArmGetPhysAddrTop) + mov r0, #0x00000000 + mov r1, #0x10000 + bx lr diff --git a/ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.c b/Arm= VirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.c new file mode 100644 index 000000000000..88ff3167cbfd --- /dev/null +++ b/ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.c @@ -0,0 +1,63 @@ +/** @file + + Copyright (c) 2014-2017, Linaro Limited. All rights reserved. + + This program and the accompanying materials are licensed and made availa= ble + 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 IMP= LIED. + +**/ + +#include +#include +#include + +STATIC ARM_MEMORY_REGION_DESCRIPTOR mVirtualMemoryTable[2]; + +EFI_PHYSICAL_ADDRESS +ArmGetPhysAddrTop ( + VOID + ); + +/** + Return the Virtual Memory Map of your platform + + This Virtual Memory Map is used by MemoryInitPei Module to initialize th= e MMU + on your platform. + + @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR + describing a Physical-to-Virtual Memory + mapping. This array must be ended by a + zero-filled entry. The allocated memory + will not be freed. + +**/ +VOID +EFIAPI +ArmVirtGetMemoryMap ( + OUT ARM_MEMORY_REGION_DESCRIPTOR **VirtualMemoryMap + ) +{ + ASSERT (VirtualMemoryMap !=3D NULL); + + // + // 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 + // by the hypervisor, overriding the cached mapping we install here. + // + mVirtualMemoryTable[0].PhysicalBase =3D 0x0; + mVirtualMemoryTable[0].VirtualBase =3D 0x0; + mVirtualMemoryTable[0].Length =3D ArmGetPhysAddrTop (); + mVirtualMemoryTable[0].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_WRIT= E_BACK; + + mVirtualMemoryTable[1].PhysicalBase =3D 0x0; + mVirtualMemoryTable[1].VirtualBase =3D 0x0; + mVirtualMemoryTable[1].Length =3D 0x0; + mVirtualMemoryTable[1].Attributes =3D 0x0; + + *VirtualMemoryMap =3D mVirtualMemoryTable; +} diff --git a/ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.inf b/A= rmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.inf new file mode 100644 index 000000000000..cd4c805a4db9 --- /dev/null +++ b/ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.inf @@ -0,0 +1,41 @@ +#/* @file +# +# Copyright (c) 2011-2015, ARM Limited. All rights reserved. +# Copyright (c) 2014-2017, Linaro Limited. All rights reserved. +# +# This program and the accompanying materials are licensed and made avail= able +# 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 IM= PLIED. +# +#*/ + +[Defines] + INF_VERSION =3D 0x0001001A + BASE_NAME =3D XenVirtMemInfoLib + FILE_GUID =3D 40d1f8f5-4dfe-4e0f-9a15-b1de9dc9f4ed + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D ArmVirtMemInfoLib + +[Sources] + XenVirtMemInfoLib.c + +[Sources.ARM] + Arm/PhysAddrTop.S + +[Sources.AARCH64] + AArch64/PhysAddrTop.S + +[Packages] + ArmPkg/ArmPkg.dec + ArmVirtPkg/ArmVirtPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + +[LibraryClasses] + ArmLib + DebugLib --=20 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Tue Dec 24 13:17:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1511345296105357.80476065030996; Wed, 22 Nov 2017 02:08:16 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id A1D43220C162C; Wed, 22 Nov 2017 02:03:46 -0800 (PST) Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) (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 F33C1220C1600 for ; Wed, 22 Nov 2017 02:03:42 -0800 (PST) Received: by mail-wm0-x242.google.com with SMTP id x63so8920139wmf.4 for ; Wed, 22 Nov 2017 02:07:59 -0800 (PST) Received: from localhost.localdomain ([154.145.25.106]) by smtp.gmail.com with ESMTPSA id i192sm2761457wmf.46.2017.11.22.02.07.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:07:56 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::242; helo=mail-wm0-x242.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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=RtbtrQNGCDDtVPr+kttRw34DXIqA/CXLpnSA4VoHXRw=; b=X9Y76jUci5zi62MZWZZMWjHRrTqoNVKc0jGLrsNB53rz4rvtc9Lx5kucK4WcW65zpo TtCXb5lIB9kbcQqhP5nmTCB3lnJLvAmfOAe1wq4kJBhFoNGM9UevstLHPAeE0VwssnXn s52VF/+p/kyiZtuFvs7FcIZAa7ESpxkbThjKY= 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=RtbtrQNGCDDtVPr+kttRw34DXIqA/CXLpnSA4VoHXRw=; b=pUzk2+5RclScQYAIPwFfxew3E3hU0BgyqVwLDTMvq6iZjSe2D4fIQoreURdluTR/tx 6EdvemllFsTLwonmZ73h4a9yqGIPxffHWfbk9/5sUVJifPf9K+wjrA3pVhdUN0T6VsNs XNZuyK6b/KaFgt2kwcdb1CKlLIAO134nh4OwYIixad+85qM815jpRmo/kf1fuEBi7Krb 0cvFkoV5YvOu8tko82oi7hwYPYcPcL842f+3pCGpxZkiaXzYDKVCb/Rapk23oHsqL7Nl G4g9u2+nFmMBk0yUVK8g24QTb9vjltX3aNlmc52JFcylpPIHygBghPDGdkJ2kYepHo/z v2yQ== X-Gm-Message-State: AJaThX4ebREHcbgU/Ql4HpKJJlQlKeBh7e7fC5avHR8F2Bbk2UyvLBc/ pMqY0SIX+CnMYDF9pu6g9gbYNtEjDkY= X-Google-Smtp-Source: AGs4zMal5KCRAeAdl9jlwljm7xZ2BJszqoHdavcAWTj39fOHyTOkl3SNQ9rhyuEDm9fjNCkCt4iydA== X-Received: by 10.28.34.67 with SMTP id i64mr3675047wmi.57.1511345277487; Wed, 22 Nov 2017 02:07:57 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Date: Wed, 22 Nov 2017 10:07:28 +0000 Message-Id: <20171122100731.24525-12-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171122100731.24525-1-ard.biesheuvel@linaro.org> References: <20171122100731.24525-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v2 11/14] ArmVirtPkg/ArmVirtQemu: add ArmVirtMemInfoLib implementation X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Create a new ArmVirtMemInfoLib for ArmVirtQemuKernel by cloning the existing ArmPlatformGetVirtualMemoryMap () for this platform, (ArmQemuRelocatablePlatformLib *not* ArmVirtPlatformLib), and cleaning it up: - remove support for uncached DRAM mappings - replace EFI_D_xxx with DEBUG_xxx throughout - use a temp variable to hold the top of the physical address space - use AllocatePool () instead of AllocatePages (), given that we use 160 bytes only, and the memory is never freed. In a future patch, we will add this library to the ordinary ArmVirtQemu platform as well. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek --- ArmVirtPkg/ArmVirtQemuKernel.dsc | 1 + ArmVirtPkg/Library/QemuVirtMemInfoLib/AArch64/PhysAddrTop.S | 39 ++++++++ ArmVirtPkg/Library/QemuVirtMemInfoLib/Arm/PhysAddrTop.S | 24 +++++ ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.c | 100 +++++++= +++++++++++++ ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.inf | 54 +++++++= ++++ 5 files changed, 218 insertions(+) diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKerne= l.dsc index 7e5d584344b4..f50d30388cf2 100644 --- a/ArmVirtPkg/ArmVirtQemuKernel.dsc +++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc @@ -49,6 +49,7 @@ [LibraryClasses.common] QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf =20 ArmPlatformLib|ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/ArmQemuR= elocatablePlatformLib.inf + ArmVirtMemInfoLib|ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoL= ib.inf =20 TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf NorFlashPlatformLib|ArmVirtPkg/Library/NorFlashQemuLib/NorFlashQemuLib.i= nf diff --git a/ArmVirtPkg/Library/QemuVirtMemInfoLib/AArch64/PhysAddrTop.S b/= ArmVirtPkg/Library/QemuVirtMemInfoLib/AArch64/PhysAddrTop.S new file mode 100644 index 000000000000..a1f6a194d59b --- /dev/null +++ b/ArmVirtPkg/Library/QemuVirtMemInfoLib/AArch64/PhysAddrTop.S @@ -0,0 +1,39 @@ +# +# 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 B= SD 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 IM= PLIED. +# +# + +#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 =3D=3D 32 bits, 1 =3D=3D 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/QemuVirtMemInfoLib/Arm/PhysAddrTop.S b/ArmV= irtPkg/Library/QemuVirtMemInfoLib/Arm/PhysAddrTop.S new file mode 100644 index 000000000000..9cd81529fb3d --- /dev/null +++ b/ArmVirtPkg/Library/QemuVirtMemInfoLib/Arm/PhysAddrTop.S @@ -0,0 +1,24 @@ +# +# 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 B= SD 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 IM= PLIED. +# +# + +#include + +//EFI_PHYSICAL_ADDRESS +//GetPhysAddrTop ( +// VOID +// ); +ASM_FUNC(ArmGetPhysAddrTop) + mov r0, #0x00000000 + mov r1, #0x10000 + bx lr diff --git a/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.c b/A= rmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.c new file mode 100644 index 000000000000..ea70f2c33b77 --- /dev/null +++ b/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.c @@ -0,0 +1,100 @@ +/** @file + + Copyright (c) 2014-2017, Linaro Limited. All rights reserved. + + This program and the accompanying materials are licensed and made availa= ble + 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 IMP= LIED. + +**/ + +#include +#include +#include +#include +#include + +// Number of Virtual Memory Map Descriptors +#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 5 + +EFI_PHYSICAL_ADDRESS +ArmGetPhysAddrTop ( + VOID + ); + +/** + Return the Virtual Memory Map of your platform + + This Virtual Memory Map is used by MemoryInitPei Module to initialize th= e MMU + on your platform. + + @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR + describing a Physical-to-Virtual Memory + mapping. This array must be ended by a + zero-filled entry. The allocated memory + will not be freed. + +**/ +VOID +ArmVirtGetMemoryMap ( + OUT ARM_MEMORY_REGION_DESCRIPTOR **VirtualMemoryMap + ) +{ + ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable; + UINT64 TopOfMemory; + + ASSERT (VirtualMemoryMap !=3D NULL); + + VirtualMemoryTable =3D AllocatePool (sizeof (ARM_MEMORY_REGION_DESCRIPTO= R) * + MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS); + + if (VirtualMemoryTable =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "%a: Error: Failed AllocatePages()\n", __FUNCTION= __)); + return; + } + + // System DRAM + VirtualMemoryTable[0].PhysicalBase =3D PcdGet64 (PcdSystemMemoryBase); + VirtualMemoryTable[0].VirtualBase =3D VirtualMemoryTable[0].PhysicalBas= e; + VirtualMemoryTable[0].Length =3D PcdGet64 (PcdSystemMemorySize); + VirtualMemoryTable[0].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_WRITE= _BACK; + + DEBUG ((DEBUG_INFO, "%a: Dumping System DRAM Memory Map:\n" + "\tPhysicalBase: 0x%lX\n" + "\tVirtualBase: 0x%lX\n" + "\tLength: 0x%lX\n", + __FUNCTION__, + VirtualMemoryTable[0].PhysicalBase, + VirtualMemoryTable[0].VirtualBase, + VirtualMemoryTable[0].Length)); + + // Peripheral space before DRAM + VirtualMemoryTable[1].PhysicalBase =3D 0x0; + VirtualMemoryTable[1].VirtualBase =3D 0x0; + VirtualMemoryTable[1].Length =3D VirtualMemoryTable[0].PhysicalBas= e; + VirtualMemoryTable[1].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_DEVIC= E; + + // Peripheral space after DRAM + TopOfMemory =3D MIN (1ULL << FixedPcdGet8 (PcdPrePiCpuMemorySize), + ArmGetPhysAddrTop ()); + VirtualMemoryTable[2].PhysicalBase =3D VirtualMemoryTable[0].Length + Vi= rtualMemoryTable[1].Length; + VirtualMemoryTable[2].VirtualBase =3D VirtualMemoryTable[2].PhysicalBas= e; + VirtualMemoryTable[2].Length =3D TopOfMemory - + VirtualMemoryTable[2].PhysicalBase; + VirtualMemoryTable[2].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_DEVIC= E; + + // Remap the FD region as normal executable memory + VirtualMemoryTable[3].PhysicalBase =3D PcdGet64 (PcdFdBaseAddress); + VirtualMemoryTable[3].VirtualBase =3D VirtualMemoryTable[3].PhysicalBas= e; + VirtualMemoryTable[3].Length =3D FixedPcdGet32 (PcdFdSize); + VirtualMemoryTable[3].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_WRITE= _BACK; + + // End of Table + ZeroMem (&VirtualMemoryTable[4], sizeof (ARM_MEMORY_REGION_DESCRIPTOR)); + + *VirtualMemoryMap =3D VirtualMemoryTable; +} diff --git a/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.inf b= /ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.inf new file mode 100644 index 000000000000..c72a97f9e78a --- /dev/null +++ b/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.inf @@ -0,0 +1,54 @@ +#/* @file +# +# Copyright (c) 2011-2015, ARM Limited. All rights reserved. +# Copyright (c) 2014-2017, Linaro Limited. All rights reserved. +# +# This program and the accompanying materials are licensed and made avail= able +# 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 IM= PLIED. +# +#*/ + +[Defines] + INF_VERSION =3D 0x0001001A + BASE_NAME =3D QemuVirtMemInfoLib + FILE_GUID =3D 9b30ca82-6746-4a82-a3e6-11ea79df3b46 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D ArmVirtMemInfoLib + +[Sources] + QemuVirtMemInfoLib.c + +[Sources.ARM] + Arm/PhysAddrTop.S + +[Sources.AARCH64] + AArch64/PhysAddrTop.S + +[Packages] + ArmPkg/ArmPkg.dec + ArmVirtPkg/ArmVirtPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + +[LibraryClasses] + ArmLib + BaseMemoryLib + DebugLib + MemoryAllocationLib + PcdLib + +[Pcd] + gArmTokenSpaceGuid.PcdFdBaseAddress + gArmTokenSpaceGuid.PcdSystemMemoryBase + gArmTokenSpaceGuid.PcdSystemMemorySize + +[FixedPcd] + gArmTokenSpaceGuid.PcdFdSize + gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize --=20 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Tue Dec 24 13:17:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1511345298918273.92394742304066; Wed, 22 Nov 2017 02:08:18 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id DEDF3220C162D; Wed, 22 Nov 2017 02:03:46 -0800 (PST) Received: from mail-wr0-x243.google.com (mail-wr0-x243.google.com [IPv6:2a00:1450:400c:c0c::243]) (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 AA098220C1608 for ; Wed, 22 Nov 2017 02:03:44 -0800 (PST) Received: by mail-wr0-x243.google.com with SMTP id u40so13975820wrf.10 for ; Wed, 22 Nov 2017 02:08:00 -0800 (PST) Received: from localhost.localdomain ([154.145.25.106]) by smtp.gmail.com with ESMTPSA id i192sm2761457wmf.46.2017.11.22.02.07.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:07:58 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::243; helo=mail-wr0-x243.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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=YWMtn2HwEBm2pUd+mGLeBkvf0xEScgLQFEzc32R/E0w=; b=L9XMHVCzUBZgJBPR2EyKpyxXvKWr4TVrEcDYEeONq6TeuJoDcwkIlIkErk4ZDVEIfO cTnZV7pksHAPAnT7BqdZNGt7QnwzzT6kXUvjGauOQ0nZbYDUwzyFuLylqCIKxcD/AF6z psurUVTGK6rkII8qF5oDdVN64SFbXO4wSMvco= 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=YWMtn2HwEBm2pUd+mGLeBkvf0xEScgLQFEzc32R/E0w=; b=m+VnmPyODynQEdLxEMEM+kQHle1ICC8usOx+Euoic9c6X1eKjlNCyHhGXmss1xbQmM o7uQuP11ki6Gme/yyhQH22FQmbq96Jh+H+2/rX/7WxgGGdBsR1n6hd2OgYMiQhLKpRaE LsJ4QypE08m1gCgISasKmuri7gvf8kvL1AV/PtXgHNXDHJ3yg4KRzPRlbWvCI9zWCTMO DRKC7lAJNsPFlgLsrwx2ji9tE5dJlbpSRt835K0IPNpNepkWcCxxw1D/eUPEReF2P7Bn OvxcEgeKqXgnmDPsJFt4tRW9SHiAnMCH65sJpTaTNOfms/RBSBDWg2cUj9jgBb8GQQ4R 1gmw== X-Gm-Message-State: AJaThX4ebV6bbeVRcfDEQOedRX0azcU8j6qyctRHqrxcYvVl+2pa27j0 eiPBnwmIyx7/hBoV0ZbniOR8GZmXL4w= X-Google-Smtp-Source: AGs4zMaBMltzK1Kh5fEsjfB3/a/1BoyDUAgvMJtdPyU31ImiBW64JYglNrGu7n09SXlG9KFY9IPQxQ== X-Received: by 10.223.201.2 with SMTP id m2mr12772731wrh.274.1511345279145; Wed, 22 Nov 2017 02:07:59 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Date: Wed, 22 Nov 2017 10:07:29 +0000 Message-Id: <20171122100731.24525-13-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171122100731.24525-1-ard.biesheuvel@linaro.org> References: <20171122100731.24525-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v2 12/14] ArmVirtPkg: create QemuVirtMemInfoLib version for ArmVirtQemu X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The QemuVirtMemInfoLib ArmVirtMemInfoLib implementation created for ArmVirtQemuKernel does exactly what we need for ArmVirtQemu, the only difference being that the latter is PrePeiCore based, and so it uses a different method to ensure that PcdSystemMemorySize is set when ArmVirtGetMemoryMap() is called. On ArmVirtQemu, we currently abuse the implied ordering guarantees provided by ArmPlatformLib, by implementing this as follows: ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf [ArmVirtPkg/ArmVirtQemu.d= sc] InitializeMemory() [ArmPlatformPkg/MemoryIni= tPei/MemoryInitPeim.c] ArmPlatformInitializeSystemMemory() [ArmVirtPkg/Library/ArmVi= rtPlatformLib/Virt.c] // // set PcdSystemMemorySize from the DT // MemoryPeim() [ArmVirtPkg/Library/ArmVi= rtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c] InitMmu() [ArmVirtPkg/Library/ArmVi= rtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c] ArmPlatformGetVirtualMemoryMap() [ArmVirtPkg/Library/ArmVi= rtPlatformLib/VirtMem.c] // // consume PcdSystemMemorySize // Given that we are trying to get rid of ArmPlatformLib, or at least remove some of these API functions that are never used for their original purpose by any platforms, we need to move the PCD assignment elsewhere. So create a PEIM-only version of QemuVirtMemInfoLib especially for ArmVirtQemu, and add the PCD assignment code to its constructor. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek --- ArmVirtPkg/ArmVirtQemu.dsc |= 3 + ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLib.inf |= 58 +++++++++++ ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLibConstructor.c |= 106 ++++++++++++++++++++ 3 files changed, 167 insertions(+) diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc index d14a0dd0d1d9..519c2ae2e939 100644 --- a/ArmVirtPkg/ArmVirtQemu.dsc +++ b/ArmVirtPkg/ArmVirtQemu.dsc @@ -67,6 +67,9 @@ [LibraryClasses.common] HttpLib|MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.inf !endif =20 +[LibraryClasses.common.PEIM] + ArmVirtMemInfoLib|ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoP= eiLib.inf + [LibraryClasses.common.UEFI_DRIVER] UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf =20 diff --git a/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLib.in= f b/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLib.inf new file mode 100644 index 000000000000..e574a47443d0 --- /dev/null +++ b/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLib.inf @@ -0,0 +1,58 @@ +#/* @file +# +# Copyright (c) 2011-2015, ARM Limited. All rights reserved. +# Copyright (c) 2014-2017, Linaro Limited. All rights reserved. +# +# This program and the accompanying materials are licensed and made avail= able +# 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 IM= PLIED. +# +#*/ + +[Defines] + INF_VERSION =3D 0x0001001A + BASE_NAME =3D QemuVirtMemInfoLib + FILE_GUID =3D 0c4d10cf-d949-49b4-bd13-47a4ae22efce + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D ArmVirtMemInfoLib|PEIM + CONSTRUCTOR =3D QemuVirtMemInfoPeiLibConstructor + +[Sources] + QemuVirtMemInfoLib.c + QemuVirtMemInfoPeiLibConstructor.c + +[Sources.ARM] + Arm/PhysAddrTop.S + +[Sources.AARCH64] + AArch64/PhysAddrTop.S + +[Packages] + ArmPkg/ArmPkg.dec + ArmVirtPkg/ArmVirtPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + +[LibraryClasses] + ArmLib + BaseMemoryLib + DebugLib + FdtLib + PcdLib + MemoryAllocationLib + +[Pcd] + gArmTokenSpaceGuid.PcdFdBaseAddress + gArmTokenSpaceGuid.PcdSystemMemoryBase + gArmTokenSpaceGuid.PcdSystemMemorySize + +[FixedPcd] + gArmTokenSpaceGuid.PcdFdSize + gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress + gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize diff --git a/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLibCon= structor.c b/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLibCon= structor.c new file mode 100644 index 000000000000..ef8ac6e018d1 --- /dev/null +++ b/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLibConstructo= r.c @@ -0,0 +1,106 @@ +/** @file + + Copyright (c) 2014-2017, Linaro Limited. All rights reserved. + + This program and the accompanying materials are licensed and made availa= ble + 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 IMP= LIED. + +**/ + +#include +#include +#include +#include + +RETURN_STATUS +EFIAPI +QemuVirtMemInfoPeiLibConstructor ( + VOID + ) +{ + VOID *DeviceTreeBase; + INT32 Node, Prev; + UINT64 NewBase, CurBase; + UINT64 NewSize, CurSize; + CONST CHAR8 *Type; + INT32 Len; + CONST UINT64 *RegProp; + RETURN_STATUS PcdStatus; + + NewBase =3D 0; + NewSize =3D 0; + + DeviceTreeBase =3D (VOID *)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddr= ess); + ASSERT (DeviceTreeBase !=3D NULL); + + // + // Make sure we have a valid device tree blob + // + ASSERT (fdt_check_header (DeviceTreeBase) =3D=3D 0); + + // + // Look for the lowest memory node + // + for (Prev =3D 0;; Prev =3D Node) { + Node =3D fdt_next_node (DeviceTreeBase, Prev, NULL); + if (Node < 0) { + break; + } + + // + // Check for memory node + // + Type =3D fdt_getprop (DeviceTreeBase, Node, "device_type", &Len); + if (Type && AsciiStrnCmp (Type, "memory", Len) =3D=3D 0) { + // + // Get the 'reg' property of this node. For now, we will assume + // two 8 byte quantities for base and size, respectively. + // + RegProp =3D fdt_getprop (DeviceTreeBase, Node, "reg", &Len); + if (RegProp !=3D 0 && Len =3D=3D (2 * sizeof (UINT64))) { + + CurBase =3D fdt64_to_cpu (ReadUnaligned64 (RegProp)); + CurSize =3D fdt64_to_cpu (ReadUnaligned64 (RegProp + 1)); + + DEBUG ((DEBUG_INFO, "%a: System RAM @ 0x%lx - 0x%lx\n", + __FUNCTION__, CurBase, CurBase + CurSize - 1)); + + if (NewBase > CurBase || NewBase =3D=3D 0) { + NewBase =3D CurBase; + NewSize =3D CurSize; + } + } else { + DEBUG ((DEBUG_ERROR, "%a: Failed to parse FDT memory node\n", + __FUNCTION__)); + } + } + } + + // + // Make sure the start of DRAM matches our expectation + // + ASSERT (FixedPcdGet64 (PcdSystemMemoryBase) =3D=3D NewBase); + PcdStatus =3D PcdSet64S (PcdSystemMemorySize, NewSize); + ASSERT_RETURN_ERROR (PcdStatus); + + // + // We need to make sure that the machine we are running on has at least + // 128 MB of memory configured, and is currently executing this binary f= rom + // NOR flash. This prevents a device tree image in DRAM from getting + // clobbered when our caller installs permanent PEI RAM, before we have a + // chance of marking its location as reserved or copy it to a freshly + // allocated block in the permanent PEI RAM in the platform PEIM. + // + ASSERT (NewSize >=3D SIZE_128MB); + ASSERT ( + (((UINT64)PcdGet64 (PcdFdBaseAddress) + + (UINT64)PcdGet32 (PcdFdSize)) <=3D NewBase) || + ((UINT64)PcdGet64 (PcdFdBaseAddress) >=3D (NewBase + NewSize))); + + return RETURN_SUCCESS; +} --=20 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Tue Dec 24 13:17:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1511345301629889.0844535018514; Wed, 22 Nov 2017 02:08:21 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 22B53220C162B; Wed, 22 Nov 2017 02:03:49 -0800 (PST) Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::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 407AB220C162A for ; Wed, 22 Nov 2017 02:03:46 -0800 (PST) Received: by mail-wm0-x244.google.com with SMTP id r68so9016960wmr.1 for ; Wed, 22 Nov 2017 02:08:02 -0800 (PST) Received: from localhost.localdomain ([154.145.25.106]) by smtp.gmail.com with ESMTPSA id i192sm2761457wmf.46.2017.11.22.02.07.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:08:00 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::244; helo=mail-wm0-x244.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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=6XynX1fltaoVGW4xHBlthzo15rjExl5sfjRKg6E13NI=; b=WHHkP8CLrcuFYrvHvdIFJFtHBCU8YSTCrF6bQB4F3b2OBFstVgfnycpwbpznv7PIpw 4Il1FQPEpz2d7VCINweECG0jMeZ7tIVrkdZlqbMRUtGIRUADFYw82nW2e/5lFw/J8PmR BMShf5j3ucbg0RSKcKrOI+C2vsUhUgo7qVkq8= 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=6XynX1fltaoVGW4xHBlthzo15rjExl5sfjRKg6E13NI=; b=j4tv8DqfBo3mQShMWqe8GiqoKNeN1tXxvS270fFOeVZf83yc0iwNaDcFE/waaTm4+i FSIqK0/4wMuubWmFLpisrUhEwwK7zISB9Jds8nlW+5FQOj8bqNVVNEVIMIHc28EiHGOU utW+34fnV/uWeNisXxE/ABPaa+oSuquEoDCAgHCTol0hdZyhnKsrF2XMPT6sim7KpPz2 oIQU7nfw9eVFB0qPTSkeVYaFDnFSF0YkamI0A0cZBIeODRVJ3Ns76CDZXP1zAOJgM33x D0fEjp8LO2bKw1AqFhrLzx9r6C1AMZ6EOhbhStwrWqffQzZ+YMgF8OqW92Fo2PkqzwWU AB4w== X-Gm-Message-State: AJaThX5PFejw6HuI1p1/LPPu3PB2vlAcSVus44zjYzYgcEdrCwHJUpLf kNp220RrtmSIjWpNlu5Ma00idcP9u1Y= X-Google-Smtp-Source: AGs4zMarGlIrIHCd6H/W42C0rXFP8H6WPaYBsvEadAU1qcxhhKPjTZvKW6aAbRU2ZCR1isATt8HNrA== X-Received: by 10.28.143.212 with SMTP id r203mr3651995wmd.44.1511345280934; Wed, 22 Nov 2017 02:08:00 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Date: Wed, 22 Nov 2017 10:07:30 +0000 Message-Id: <20171122100731.24525-14-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171122100731.24525-1-ard.biesheuvel@linaro.org> References: <20171122100731.24525-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v2 13/14] ArmVirtPkg/ArmVirtMemoryInitPeiLib: move to ArmVirtMemInfoLib X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Move to the new ArmVirtMemInfoLib library to retrieve DRAM information from the platform, so that we can phase out ArmPlatformLib going forward. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek --- ArmVirtPkg/ArmVirtQemu.dsc | 2= +- ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c | 4= ++-- ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.inf | 3= ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc index 519c2ae2e939..f09226671827 100644 --- a/ArmVirtPkg/ArmVirtQemu.dsc +++ b/ArmVirtPkg/ArmVirtQemu.dsc @@ -48,7 +48,7 @@ [LibraryClasses.common] QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf =20 - ArmPlatformLib|ArmVirtPkg/Library/ArmVirtPlatformLib/ArmVirtPlatformLib.= inf + ArmPlatformLib|ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibN= ull.inf =20 TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf NorFlashPlatformLib|ArmVirtPkg/Library/NorFlashQemuLib/NorFlashQemuLib.i= nf diff --git a/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPe= iLib.c b/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib= .c index 6f3e54b7afcb..05afd1282422 100644 --- a/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c +++ b/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c @@ -16,7 +16,7 @@ #include =20 #include -#include +#include #include #include #include @@ -39,7 +39,7 @@ InitMmu ( RETURN_STATUS Status; =20 // Get Virtual Memory Map from the Platform Library - ArmPlatformGetVirtualMemoryMap (&MemoryTable); + ArmVirtGetMemoryMap (&MemoryTable); =20 //Note: Because we called PeiServicesInstallPeiMemory() before to call I= nitMmu() the MMU Page Table resides in // DRAM (even at the top of DRAM as it is the first permanent memor= y allocation) diff --git a/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPe= iLib.inf b/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiL= ib.inf index 028d6fb5ac28..54879d590a8a 100644 --- a/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.inf +++ b/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.inf @@ -29,13 +29,14 @@ [Packages] EmbeddedPkg/EmbeddedPkg.dec ArmPkg/ArmPkg.dec ArmPlatformPkg/ArmPlatformPkg.dec + ArmVirtPkg/ArmVirtPkg.dec =20 [LibraryClasses] DebugLib HobLib ArmLib ArmMmuLib - ArmPlatformLib + ArmVirtMemInfoLib CacheMaintenanceLib =20 [Guids] --=20 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Tue Dec 24 13:17:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1511345305156971.7861470985523; Wed, 22 Nov 2017 02:08:25 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5E5C4220C1629; Wed, 22 Nov 2017 02:03:51 -0800 (PST) Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) (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 73BF7220C1629 for ; Wed, 22 Nov 2017 02:03:49 -0800 (PST) Received: by mail-wm0-x242.google.com with SMTP id 128so8927329wmo.3 for ; Wed, 22 Nov 2017 02:08:05 -0800 (PST) Received: from localhost.localdomain ([154.145.25.106]) by smtp.gmail.com with ESMTPSA id i192sm2761457wmf.46.2017.11.22.02.08.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:08:02 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::242; helo=mail-wm0-x242.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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=cO/QeO486fb8gu5ijAy+QH+yWw2pmBhQ4GO7CFeiOXI=; b=j7vXyjAyPbsGt0FkAeLHwz37r7cxfoPDNGhool5fSPs2g7MFjD1rVH4erN/Jw45kD3 Ekv/aWL4ISXF2C8IwzhWfvTaUbeFnBaJ/ndybLJ/9+C+qSPykF6dLibCEeetwAmOf+xB 9N8TAtTWWGG+gG0M7eTudnQ/LEsVCjHEm0lNU= 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=cO/QeO486fb8gu5ijAy+QH+yWw2pmBhQ4GO7CFeiOXI=; b=sc45yccO2C/5LjKMnEbHInE4WLvyDdOyk0afyWXyPwMReH2ymjEzPoj0w+jIsnO0N+ RJL/7xLYLpJwwOa1wA9/hYi3pmi1s4UfXbO7dYzMWZAUk8H6Qmm9nrCGZGkiWSMkDf4b T//MumkT12RTq9S1SmzNH4hajkV02LBw8sthRjgQf/KYPJWrpkpobbjz0nOXf/9YV4Xy 1p8cMvk8KPXeKZqQz2v42QdlYLUWFbGAiSli4C+eWi/AIOKkaioSswByMNqdc5if4/Ad JpHaTK9K/YW74vzdvcGr9tXO6P+7dWHRNKBxkOM5dRzrf3b/0guyqNsVa7BNCN7xf968 zqNQ== X-Gm-Message-State: AJaThX7wR8HnIfBn/H3fLE35sZoCl3kouxfbz1aqD9DFXQIRkkQA+jo5 M69f8f9+ZL7T+kwsozTqfsBghREKv88= X-Google-Smtp-Source: AGs4zMbOWN+L4ybyIERdc+4/71ZafNtYZJ8OV7vu1qwdKYRwol8yK4ZR8DWf/nzVeXLpmtjWLZBE6Q== X-Received: by 10.28.61.135 with SMTP id k129mr3336246wma.81.1511345282957; Wed, 22 Nov 2017 02:08:02 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Date: Wed, 22 Nov 2017 10:07:31 +0000 Message-Id: <20171122100731.24525-15-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171122100731.24525-1-ard.biesheuvel@linaro.org> References: <20171122100731.24525-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v2 14/14] ArmVirtPkg: remove ArmPlatformLib implementations X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" These libraries are no longer used, so remove them from the tree. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek --- ArmVirtPkg/ArmVirtQemuKernel.dsc = | 1 - ArmVirtPkg/ArmVirtXen.dsc = | 1 - ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/AARCH64/RelocatableVirtHe= lper.S | 141 ----------------- ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/ARM/RelocatableVirtHelper= .S | 123 --------------- ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/ArmQemuRelocatablePlatfor= mLib.inf | 64 -------- ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/FdtParser.c = | 90 ----------- ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/QemuVirtMem.c = | 106 ------------- ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/RelocatableVirt.c = | 70 --------- ArmVirtPkg/Library/ArmVirtPlatformLib/AARCH64/VirtHelper.S = | 70 --------- ArmVirtPkg/Library/ArmVirtPlatformLib/ARM/VirtHelper.S = | 57 ------- ArmVirtPkg/Library/ArmVirtPlatformLib/ARM/VirtHelper.asm = | 71 --------- ArmVirtPkg/Library/ArmVirtPlatformLib/ArmVirtPlatformLib.inf = | 64 -------- ArmVirtPkg/Library/ArmVirtPlatformLib/Virt.c = | 160 -------------------- ArmVirtPkg/Library/ArmVirtPlatformLib/VirtMem.c = | 102 ------------- ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/AARCH64/RelocatableVirtHel= per.S | 140 ----------------- ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/ARM/RelocatableVirtHelper.= S | 123 --------------- ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/ArmXenRelocatablePlatformL= ib.inf | 63 -------- ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/FdtParser.c = | 89 ----------- ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/RelocatableVirt.c = | 70 --------- ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/XenVirtMem.c = | 82 ---------- 20 files changed, 1687 deletions(-) diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKerne= l.dsc index f50d30388cf2..cc2c5a50c925 100644 --- a/ArmVirtPkg/ArmVirtQemuKernel.dsc +++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc @@ -48,7 +48,6 @@ [LibraryClasses.common] QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf =20 - ArmPlatformLib|ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/ArmQemuR= elocatablePlatformLib.inf ArmVirtMemInfoLib|ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoL= ib.inf =20 TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc index 3df684d13cb0..11e073287a84 100644 --- a/ArmVirtPkg/ArmVirtXen.dsc +++ b/ArmVirtPkg/ArmVirtXen.dsc @@ -43,7 +43,6 @@ [LibraryClasses] VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice= Lib.inf =20 - ArmPlatformLib|ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/ArmXenRel= ocatablePlatformLib.inf ArmVirtMemInfoLib|ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib= .inf =20 TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf diff --git a/ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/AARCH64/Reloc= atableVirtHelper.S b/ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/AARCH= 64/RelocatableVirtHelper.S deleted file mode 100644 index ec6955cf0af8..000000000000 --- a/ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/AARCH64/RelocatableV= irtHelper.S +++ /dev/null @@ -1,141 +0,0 @@ -# -# Copyright (c) 2011-2013, ARM Limited. All rights reserved. -# Copyright (c) 2016, Linaro Limited. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the B= SD 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 IM= PLIED. -# -# - -#include -#include - -// VOID -// ArmPlatformPeiBootAction ( -// VOID *DeviceTreeBaseAddress, // passed by loader in x0 -// VOID *ImageBase // passed by FDF trampoline in x1 -// ); -ASM_FUNC(ArmPlatformPeiBootAction) - // - // If we are booting from RAM using the Linux kernel boot protocol, x0 w= ill - // point to the DTB image in memory. Otherwise, use the default value de= fined - // by the platform. - // - cbnz x0, 0f - ldr x0, PcdGet64 (PcdDeviceTreeInitialBaseAddress) - -0:mov x29, x30 // preserve LR - mov x28, x0 // preserve DTB pointer - mov x27, x1 // preserve base of image pointer - - // - // The base of the runtime image has been preserved in x1. Check whether - // the expected magic number can be found in the header. - // - ldr w8, .LArm64LinuxMagic - ldr w9, [x1, #0x38] - cmp w8, w9 - bne .Lout - - // - // - // OK, so far so good. We have confirmed that we likely have a DTB and a= re - // booting via the arm64 Linux boot protocol. Update the base-of-image P= CD - // to the actual relocated value, and add the shift of PcdFdBaseAddress = to - // PcdFvBaseAddress as well - // - adr x8, PcdGet64 (PcdFdBaseAddress) - adr x9, PcdGet64 (PcdFvBaseAddress) - ldr x6, [x8] - ldr x7, [x9] - sub x7, x7, x6 - add x7, x7, x1 - str x1, [x8] - str x7, [x9] - - // - // Discover the memory size and offset from the DTB, and record in the - // respective PCDs. This will also return false if a corrupt DTB is - // encountered. Since we are calling a C function, use the window at the - // beginning of the FD image as a temp stack. - // - adr x1, PcdGet64 (PcdSystemMemoryBase) - adr x2, PcdGet64 (PcdSystemMemorySize) - mov sp, x7 - bl FindMemnode - cbz x0, .Lout - - // - // Copy the DTB to the slack space right after the 64 byte arm64/Linux s= tyle - // image header at the base of this image (defined in the FDF), and reco= rd the - // pointer in PcdDeviceTreeInitialBaseAddress. - // - adr x8, PcdGet64 (PcdDeviceTreeInitialBaseAddress) - add x27, x27, #0x40 - str x27, [x8] - - mov x0, x27 - mov x1, x28 - bl CopyFdt - -.Lout: - ret x29 - -.LArm64LinuxMagic: - .byte 0x41, 0x52, 0x4d, 0x64 - -//UINTN -//ArmPlatformGetPrimaryCoreMpId ( -// VOID -// ); -ASM_FUNC(ArmPlatformGetPrimaryCoreMpId) - MOV32 (w0, FixedPcdGet32 (PcdArmPrimaryCore)) - ret - -//UINTN -//ArmPlatformIsPrimaryCore ( -// IN UINTN MpId -// ); -ASM_FUNC(ArmPlatformIsPrimaryCore) - mov x0, #1 - ret - -//UINTN -//ArmPlatformGetCorePosition ( -// IN UINTN MpId -// ); -// With this function: CorePos =3D (ClusterId * 4) + CoreId -ASM_FUNC(ArmPlatformGetCorePosition) - and x1, x0, #ARM_CORE_MASK - and x0, x0, #ARM_CLUSTER_MASK - add x0, x1, x0, LSR #6 - ret - -//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 =3D=3D 32 bits, 1 =3D=3D 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/ArmQemuRelocatablePlatformLib/ARM/Relocatab= leVirtHelper.S b/ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/ARM/Reloc= atableVirtHelper.S deleted file mode 100644 index 27af98970c16..000000000000 --- a/ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/ARM/RelocatableVirtH= elper.S +++ /dev/null @@ -1,123 +0,0 @@ -# -# Copyright (c) 2011-2013, ARM Limited. All rights reserved. -# Copyright (c) 2014-2016, Linaro Limited. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the B= SD 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 IM= PLIED. -# -# - -#include -#include - -ASM_FUNC(ArmPlatformPeiBootAction) - // - // If we are booting from RAM using the Linux kernel boot protocol, r0 w= ill - // point to the DTB image in memory. Otherwise, use the default value de= fined - // by the platform. - // - teq r0, #0 - bne 0f - LDRL (r0, PcdGet64 (PcdDeviceTreeInitialBaseAddress)) - -0:mov r11, r14 // preserve LR - mov r10, r0 // preserve DTB pointer - mov r9, r1 // preserve base of image pointer - - // - // The base of the runtime image has been preserved in r1. Check whether - // the expected magic number can be found in the header. - // - ldr r8, .LArm32LinuxMagic - ldr r7, [r1, #0x24] - cmp r7, r8 - bne .Lout - - // - // - // OK, so far so good. We have confirmed that we likely have a DTB and a= re - // booting via the ARM Linux boot protocol. Update the base-of-image PCD - // to the actual relocated value, and add the shift of PcdFdBaseAddress = to - // PcdFvBaseAddress as well - // - ADRL (r8, PcdGet64 (PcdFdBaseAddress)) - ADRL (r7, PcdGet64 (PcdFvBaseAddress)) - ldr r6, [r8] - ldr r5, [r7] - sub r5, r5, r6 - add r5, r5, r1 - str r1, [r8] - str r5, [r7] - - // - // Discover the memory size and offset from the DTB, and record in the - // respective PCDs. This will also return false if a corrupt DTB is - // encountered. Since we are calling a C function, use the window at the - // beginning of the FD image as a temp stack. - // - ADRL (r1, PcdGet64 (PcdSystemMemoryBase)) - ADRL (r2, PcdGet64 (PcdSystemMemorySize)) - mov sp, r5 - bl FindMemnode - teq r0, #0 - beq .Lout - - // - // Copy the DTB to the slack space right after the 64 byte arm64/Linux s= tyle - // image header at the base of this image (defined in the FDF), and reco= rd the - // pointer in PcdDeviceTreeInitialBaseAddress. - // - ADRL (r8, PcdGet64 (PcdDeviceTreeInitialBaseAddress)) - add r9, r9, #0x40 - str r9, [r8] - - mov r0, r9 - mov r1, r10 - bl CopyFdt - -.Lout: - bx r11 - -.LArm32LinuxMagic: - .byte 0x18, 0x28, 0x6f, 0x01 - -//UINTN -//ArmPlatformGetPrimaryCoreMpId ( -// VOID -// ); -ASM_FUNC(ArmPlatformGetPrimaryCoreMpId) - MOV32 (r0, FixedPcdGet32 (PcdArmPrimaryCore)) - bx lr - -//UINTN -//ArmPlatformIsPrimaryCore ( -// IN UINTN MpId -// ); -ASM_FUNC(ArmPlatformIsPrimaryCore) - mov r0, #1 - bx lr - -//UINTN -//ArmPlatformGetCorePosition ( -// IN UINTN MpId -// ); -// With this function: CorePos =3D (ClusterId * 4) + CoreId -ASM_FUNC(ArmPlatformGetCorePosition) - and r1, r0, #ARM_CORE_MASK - and r0, r0, #ARM_CLUSTER_MASK - add r0, r1, r0, LSR #6 - bx lr - -//EFI_PHYSICAL_ADDRESS -//GetPhysAddrTop ( -// VOID -// ); -ASM_FUNC(ArmGetPhysAddrTop) - mov r0, #0x00000000 - mov r1, #0x10000 - bx lr diff --git a/ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/ArmQemuReloca= tablePlatformLib.inf b/ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/Arm= QemuRelocatablePlatformLib.inf deleted file mode 100644 index acd523bbd2ce..000000000000 --- a/ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/ArmQemuRelocatablePl= atformLib.inf +++ /dev/null @@ -1,64 +0,0 @@ -#/* @file -# Copyright (c) 2011-2015, ARM Limited. All rights reserved. -# Copyright (c) 2014, Linaro Limited. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the B= SD 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 IM= PLIED. -# -#*/ - -[Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D ArmXenRelocatablePlatformLib - FILE_GUID =3D c8602718-4faa-4119-90ca-cae72509ac4c - MODULE_TYPE =3D BASE - VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D ArmPlatformLib|SEC PEIM - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - EmbeddedPkg/EmbeddedPkg.dec - ArmPkg/ArmPkg.dec - ArmPlatformPkg/ArmPlatformPkg.dec - ArmVirtPkg/ArmVirtPkg.dec - -[LibraryClasses] - IoLib - ArmLib - PrintLib - FdtLib - -[Sources.common] - RelocatableVirt.c - QemuVirtMem.c - FdtParser.c - -[Sources.AARCH64] - AARCH64/RelocatableVirtHelper.S - -[Sources.ARM] - ARM/RelocatableVirtHelper.S - -[FeaturePcd] - gEmbeddedTokenSpaceGuid.PcdCacheEnable - gArmPlatformTokenSpaceGuid.PcdSystemMemoryInitializeInSec - -[PatchPcd] - gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress - gArmTokenSpaceGuid.PcdFdBaseAddress - gArmTokenSpaceGuid.PcdFvBaseAddress - gArmTokenSpaceGuid.PcdSystemMemoryBase - gArmTokenSpaceGuid.PcdSystemMemorySize - -[FixedPcd] - gArmPlatformTokenSpaceGuid.PcdCoreCount - gArmTokenSpaceGuid.PcdArmPrimaryCoreMask - gArmTokenSpaceGuid.PcdArmPrimaryCore - gArmTokenSpaceGuid.PcdFdSize - gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize diff --git a/ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/FdtParser.c b= /ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/FdtParser.c deleted file mode 100644 index afdc81a8839d..000000000000 --- a/ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/FdtParser.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2015, Linaro Ltd. All rights reserved. - * - * This program and the accompanying materials - * are licensed and made available under the terms and conditions of the B= SD 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 IM= PLIED. - */ - -#include -#include - -BOOLEAN -FindMemnode ( - IN VOID *DeviceTreeBlob, - OUT UINT64 *SystemMemoryBase, - OUT UINT64 *SystemMemorySize - ) -{ - INT32 MemoryNode; - INT32 AddressCells; - INT32 SizeCells; - INT32 Length; - CONST INT32 *Prop; - - if (fdt_check_header (DeviceTreeBlob) !=3D 0) { - return FALSE; - } - - // - // Look for a node called "memory" at the lowest level of the tree - // - MemoryNode =3D fdt_path_offset (DeviceTreeBlob, "/memory"); - if (MemoryNode <=3D 0) { - return FALSE; - } - - // - // Retrieve the #address-cells and #size-cells properties - // from the root node, or use the default if not provided. - // - AddressCells =3D 1; - SizeCells =3D 1; - - Prop =3D fdt_getprop (DeviceTreeBlob, 0, "#address-cells", &Length); - if (Length =3D=3D 4) { - AddressCells =3D fdt32_to_cpu (*Prop); - } - - Prop =3D fdt_getprop (DeviceTreeBlob, 0, "#size-cells", &Length); - if (Length =3D=3D 4) { - SizeCells =3D fdt32_to_cpu (*Prop); - } - - // - // Now find the 'reg' property of the /memory node, and read the first - // range listed. - // - Prop =3D fdt_getprop (DeviceTreeBlob, MemoryNode, "reg", &Length); - - if (Length < (AddressCells + SizeCells) * sizeof (INT32)) { - return FALSE; - } - - *SystemMemoryBase =3D fdt32_to_cpu (Prop[0]); - if (AddressCells > 1) { - *SystemMemoryBase =3D (*SystemMemoryBase << 32) | fdt32_to_cpu (Prop[1= ]); - } - Prop +=3D AddressCells; - - *SystemMemorySize =3D fdt32_to_cpu (Prop[0]); - if (SizeCells > 1) { - *SystemMemorySize =3D (*SystemMemorySize << 32) | fdt32_to_cpu (Prop[1= ]); - } - - return TRUE; -} - -VOID -CopyFdt ( - IN VOID *FdtDest, - IN VOID *FdtSource - ) -{ - fdt_pack(FdtSource); - CopyMem (FdtDest, FdtSource, fdt_totalsize (FdtSource)); -} diff --git a/ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/QemuVirtMem.c= b/ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/QemuVirtMem.c deleted file mode 100644 index 2ce5c48d52cf..000000000000 --- a/ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/QemuVirtMem.c +++ /dev/null @@ -1,106 +0,0 @@ -/** @file -* -* Copyright (c) 2014, Linaro Limited. All rights reserved. -* -* This program and the accompanying materials -* are licensed and made available under the terms and conditions of the B= SD 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 IM= PLIED. -* -**/ - -#include -#include -#include -#include -#include -#include - -// Number of Virtual Memory Map Descriptors -#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 5 - -// DDR attributes -#define DDR_ATTRIBUTES_CACHED ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK -#define DDR_ATTRIBUTES_UNCACHED ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBU= FFERED - -EFI_PHYSICAL_ADDRESS -ArmGetPhysAddrTop ( - VOID - ); - -/** - Return the Virtual Memory Map of your platform - - This Virtual Memory Map is used by MemoryInitPei Module to initialize th= e MMU - on your platform. - - @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR - describing a Physical-to-Virtual Memory - mapping. This array must be ended by a - zero-filled entry - -**/ -VOID -ArmPlatformGetVirtualMemoryMap ( - IN ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap - ) -{ - ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable; - - ASSERT (VirtualMemoryMap !=3D NULL); - - VirtualMemoryTable =3D AllocatePages ( - EFI_SIZE_TO_PAGES ( - sizeof (ARM_MEMORY_REGION_DESCRIPTOR) - * MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS - ) - ); - - if (VirtualMemoryTable =3D=3D NULL) { - DEBUG ((EFI_D_ERROR, "%a: Error: Failed AllocatePages()\n", __FUNCTION= __)); - return; - } - - // System DRAM - VirtualMemoryTable[0].PhysicalBase =3D PcdGet64 (PcdSystemMemoryBase); - VirtualMemoryTable[0].VirtualBase =3D VirtualMemoryTable[0].PhysicalBas= e; - VirtualMemoryTable[0].Length =3D PcdGet64 (PcdSystemMemorySize); - VirtualMemoryTable[0].Attributes =3D DDR_ATTRIBUTES_CACHED; - - DEBUG ((EFI_D_INFO, "%a: Dumping System DRAM Memory Map:\n" - "\tPhysicalBase: 0x%lX\n" - "\tVirtualBase: 0x%lX\n" - "\tLength: 0x%lX\n", - __FUNCTION__, - VirtualMemoryTable[0].PhysicalBase, - VirtualMemoryTable[0].VirtualBase, - VirtualMemoryTable[0].Length)); - - // Peripheral space before DRAM - VirtualMemoryTable[1].PhysicalBase =3D 0x0; - VirtualMemoryTable[1].VirtualBase =3D 0x0; - VirtualMemoryTable[1].Length =3D VirtualMemoryTable[0].PhysicalBas= e; - VirtualMemoryTable[1].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_DEVIC= E; - - // Peripheral space after DRAM - VirtualMemoryTable[2].PhysicalBase =3D VirtualMemoryTable[0].Length + Vi= rtualMemoryTable[1].Length; - VirtualMemoryTable[2].VirtualBase =3D VirtualMemoryTable[2].PhysicalBas= e; - VirtualMemoryTable[2].Length =3D MIN (1ULL << FixedPcdGet8 (PcdPre= PiCpuMemorySize), - ArmGetPhysAddrTop ()) - - VirtualMemoryTable[2].PhysicalBase; - VirtualMemoryTable[2].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_DEVIC= E; - - // Remap the FD region as normal executable memory - VirtualMemoryTable[3].PhysicalBase =3D PcdGet64 (PcdFdBaseAddress); - VirtualMemoryTable[3].VirtualBase =3D VirtualMemoryTable[3].PhysicalBas= e; - VirtualMemoryTable[3].Length =3D FixedPcdGet32 (PcdFdSize); - VirtualMemoryTable[3].Attributes =3D DDR_ATTRIBUTES_CACHED; - - // End of Table - ZeroMem (&VirtualMemoryTable[4], sizeof (ARM_MEMORY_REGION_DESCRIPTOR)); - - *VirtualMemoryMap =3D VirtualMemoryTable; -} diff --git a/ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/RelocatableVi= rt.c b/ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/RelocatableVirt.c deleted file mode 100644 index 6df207733ab2..000000000000 --- a/ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/RelocatableVirt.c +++ /dev/null @@ -1,70 +0,0 @@ -/** @file -* -* Copyright (c) 2011-2013, ARM Limited. All rights reserved. -* Copyright (c) 2014, Linaro Limited. All rights reserved. -* Copyright (c) 2014, Red Hat, Inc. -* -* -* This program and the accompanying materials -* are licensed and made available under the terms and conditions of the B= SD 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 IM= PLIED. -* -**/ - -#include -#include -#include -#include - -/** - Return the current Boot Mode - - This function returns the boot reason on the platform - - @return Return the current Boot Mode of the platform - -**/ -EFI_BOOT_MODE -ArmPlatformGetBootMode ( - VOID - ) -{ - return BOOT_WITH_FULL_CONFIGURATION; -} - -/** - This function is called by PrePeiCore, in the SEC phase. -**/ -RETURN_STATUS -ArmPlatformInitialize ( - IN UINTN MpId - ) -{ - // - // We are relying on ArmPlatformInitializeSystemMemory () being called f= rom - // InitializeMemory (), which only occurs if the following feature is di= sabled - // - ASSERT (!FeaturePcdGet (PcdSystemMemoryInitializeInSec)); - return RETURN_SUCCESS; -} - -VOID -ArmPlatformInitializeSystemMemory ( - VOID - ) -{ -} - -VOID -ArmPlatformGetPlatformPpiList ( - OUT UINTN *PpiListSize, - OUT EFI_PEI_PPI_DESCRIPTOR **PpiList - ) -{ - *PpiListSize =3D 0; - *PpiList =3D NULL; -} diff --git a/ArmVirtPkg/Library/ArmVirtPlatformLib/AARCH64/VirtHelper.S b/A= rmVirtPkg/Library/ArmVirtPlatformLib/AARCH64/VirtHelper.S deleted file mode 100644 index 1d8fe25928d8..000000000000 --- a/ArmVirtPkg/Library/ArmVirtPlatformLib/AARCH64/VirtHelper.S +++ /dev/null @@ -1,70 +0,0 @@ -# -# Copyright (c) 2011-2013, ARM Limited. All rights reserved. -# Copyright (c) 2016, Linaro Limited. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the B= SD 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 IM= PLIED. -# -# - -#include -#include - -ASM_FUNC(ArmPlatformPeiBootAction) - ret - -//UINTN -//ArmPlatformGetPrimaryCoreMpId ( -// VOID -// ); -ASM_FUNC(ArmPlatformGetPrimaryCoreMpId) - MOV32 (w0, FixedPcdGet32 (PcdArmPrimaryCore)) - ret - -//UINTN -//ArmPlatformIsPrimaryCore ( -// IN UINTN MpId -// ); -ASM_FUNC(ArmPlatformIsPrimaryCore) - mov x0, #1 - ret - -//UINTN -//ArmPlatformGetCorePosition ( -// IN UINTN MpId -// ); -// With this function: CorePos =3D (ClusterId * 4) + CoreId -ASM_FUNC(ArmPlatformGetCorePosition) - and x1, x0, #ARM_CORE_MASK - and x0, x0, #ARM_CLUSTER_MASK - add x0, x1, x0, LSR #6 - ret - -//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 =3D=3D 32 bits, 1 =3D=3D 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/ArmVirtPlatformLib/ARM/VirtHelper.S b/ArmVi= rtPkg/Library/ArmVirtPlatformLib/ARM/VirtHelper.S deleted file mode 100644 index 4a4db3721072..000000000000 --- a/ArmVirtPkg/Library/ArmVirtPlatformLib/ARM/VirtHelper.S +++ /dev/null @@ -1,57 +0,0 @@ -# -# Copyright (c) 2011-2013, ARM Limited. All rights reserved. -# Copyright (c) 2014-2016, Linaro Limited. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the B= SD 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 IM= PLIED. -# -# - -#include -#include - -ASM_FUNC(ArmPlatformPeiBootAction) - bx lr - -//UINTN -//ArmPlatformGetPrimaryCoreMpId ( -// VOID -// ); -ASM_FUNC(ArmPlatformGetPrimaryCoreMpId) - MOV32 (r0, FixedPcdGet32 (PcdArmPrimaryCore)) - bx lr - -//UINTN -//ArmPlatformIsPrimaryCore ( -// IN UINTN MpId -// ); -ASM_FUNC(ArmPlatformIsPrimaryCore) - mov r0, #1 - bx lr - -//UINTN -//ArmPlatformGetCorePosition ( -// IN UINTN MpId -// ); -// With this function: CorePos =3D (ClusterId * 4) + CoreId -ASM_FUNC(ArmPlatformGetCorePosition) - and r1, r0, #ARM_CORE_MASK - and r0, r0, #ARM_CLUSTER_MASK - add r0, r1, r0, LSR #6 - bx lr - -//EFI_PHYSICAL_ADDRESS -//GetPhysAddrTop ( -// VOID -// ); -ASM_FUNC(ArmGetPhysAddrTop) - mov r0, #0x00000000 - mov r1, #0x10000 - bx lr - -ASM_FUNCTION_REMOVE_IF_UNREFERENCED diff --git a/ArmVirtPkg/Library/ArmVirtPlatformLib/ARM/VirtHelper.asm b/Arm= VirtPkg/Library/ArmVirtPlatformLib/ARM/VirtHelper.asm deleted file mode 100644 index b476516f2115..000000000000 --- a/ArmVirtPkg/Library/ArmVirtPlatformLib/ARM/VirtHelper.asm +++ /dev/null @@ -1,71 +0,0 @@ -// -// Copyright (c) 2011-2014, ARM Limited. All rights reserved. -// Copyright (c) 2014, 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 I= MPLIED. -// - -#include -#include - - INCLUDE AsmMacroIoLib.inc - - EXPORT ArmPlatformPeiBootAction - EXPORT ArmPlatformIsPrimaryCore - EXPORT ArmPlatformGetPrimaryCoreMpId - EXPORT ArmPlatformGetCorePosition - EXPORT ArmGetPhysAddrTop - - AREA VirtHelper, CODE, READONLY - -ArmPlatformPeiBootAction FUNCTION - bx lr - ENDFUNC - -//UINTN -//ArmPlatformGetPrimaryCoreMpId ( -// VOID -// ); -ArmPlatformGetPrimaryCoreMpId FUNCTION - MOV32 r0, FixedPcdGet32 (PcdArmPrimaryCore) - bx lr - ENDFUNC - -//UINTN -//ArmPlatformIsPrimaryCore ( -// IN UINTN MpId -// ); -ArmPlatformIsPrimaryCore FUNCTION - mov r0, #1 - bx lr - ENDFUNC - -//UINTN -//ArmPlatformGetCorePosition ( -// IN UINTN MpId -// ); -// With this function: CorePos =3D (ClusterId * 4) + CoreId -ArmPlatformGetCorePosition FUNCTION - and r1, r0, #ARM_CORE_MASK - and r0, r0, #ARM_CLUSTER_MASK - add r0, r1, r0, LSR #6 - bx lr - ENDFUNC - -//EFI_PHYSICAL_ADDRESS -//GetPhysAddrTop ( -// VOID -// ); -ArmGetPhysAddrTop FUNCTION - mov r0, #0x00000000 - mov r1, #0x10000 - bx lr - ENDFUNC - - END diff --git a/ArmVirtPkg/Library/ArmVirtPlatformLib/ArmVirtPlatformLib.inf b= /ArmVirtPkg/Library/ArmVirtPlatformLib/ArmVirtPlatformLib.inf deleted file mode 100644 index 3cb3fb1f3aea..000000000000 --- a/ArmVirtPkg/Library/ArmVirtPlatformLib/ArmVirtPlatformLib.inf +++ /dev/null @@ -1,64 +0,0 @@ -#/* @file -# Copyright (c) 2011-2014, ARM Limited. All rights reserved. -# Copyright (c) 2014, Linaro Limited. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the B= SD 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 IM= PLIED. -# -#*/ - -[Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D ArmVirtPlatformLib - FILE_GUID =3D 00214cc1-06d1-45fe-9700-dca5726ad7bf - MODULE_TYPE =3D BASE - VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D ArmPlatformLib|SEC PEIM - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - EmbeddedPkg/EmbeddedPkg.dec - ArmPkg/ArmPkg.dec - ArmPlatformPkg/ArmPlatformPkg.dec - ArmVirtPkg/ArmVirtPkg.dec - -[LibraryClasses] - IoLib - MemoryAllocationLib - ArmLib - PrintLib - FdtLib - -[Sources.common] - Virt.c - VirtMem.c - -[Sources.AARCH64] - AARCH64/VirtHelper.S - -[Sources.ARM] - ARM/VirtHelper.S | GCC - ARM/VirtHelper.asm | RVCT - -[FeaturePcd] - gEmbeddedTokenSpaceGuid.PcdCacheEnable - gArmPlatformTokenSpaceGuid.PcdSystemMemoryInitializeInSec - -[Pcd] - gArmTokenSpaceGuid.PcdSystemMemorySize - -[FixedPcd] - gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress - gArmPlatformTokenSpaceGuid.PcdCoreCount - gArmTokenSpaceGuid.PcdSystemMemoryBase - gArmTokenSpaceGuid.PcdArmPrimaryCoreMask - gArmTokenSpaceGuid.PcdArmPrimaryCore - gArmTokenSpaceGuid.PcdFdBaseAddress - gArmTokenSpaceGuid.PcdFdSize - gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize diff --git a/ArmVirtPkg/Library/ArmVirtPlatformLib/Virt.c b/ArmVirtPkg/Libr= ary/ArmVirtPlatformLib/Virt.c deleted file mode 100644 index 140bdde8b2ac..000000000000 --- a/ArmVirtPkg/Library/ArmVirtPlatformLib/Virt.c +++ /dev/null @@ -1,160 +0,0 @@ -/** @file -* -* Copyright (c) 2011-2013, ARM Limited. All rights reserved. -* Copyright (c) 2014, Linaro Limited. All rights reserved. -* Copyright (c) 2014, Red Hat, Inc. -* -* -* This program and the accompanying materials -* are licensed and made available under the terms and conditions of the B= SD 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 IM= PLIED. -* -**/ - -#include -#include -#include -#include -#include -#include -#include -#include - -/** - Return the current Boot Mode - - This function returns the boot reason on the platform - - @return Return the current Boot Mode of the platform - -**/ -EFI_BOOT_MODE -ArmPlatformGetBootMode ( - VOID - ) -{ - return BOOT_WITH_FULL_CONFIGURATION; -} - -/** - This function is called by PrePeiCore, in the SEC phase. -**/ -RETURN_STATUS -ArmPlatformInitialize ( - IN UINTN MpId - ) -{ - // - // We are relying on ArmPlatformInitializeSystemMemory () being called f= rom - // InitializeMemory (), which only occurs if the following feature is di= sabled - // - ASSERT (!FeaturePcdGet (PcdSystemMemoryInitializeInSec)); - return RETURN_SUCCESS; -} - -/** - Initialize the system (or sometimes called permanent) memory - - This memory is generally represented by the DRAM. - - This function is called from InitializeMemory() in MemoryInitPeim, in th= e PEI - phase. -**/ -VOID -ArmPlatformInitializeSystemMemory ( - VOID - ) -{ - VOID *DeviceTreeBase; - INT32 Node, Prev; - UINT64 NewBase, CurBase; - UINT64 NewSize, CurSize; - CONST CHAR8 *Type; - INT32 Len; - CONST UINT64 *RegProp; - RETURN_STATUS PcdStatus; - - NewBase =3D 0; - NewSize =3D 0; - - DeviceTreeBase =3D (VOID *)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddr= ess); - ASSERT (DeviceTreeBase !=3D NULL); - - // - // Make sure we have a valid device tree blob - // - ASSERT (fdt_check_header (DeviceTreeBase) =3D=3D 0); - - // - // Look for the lowest memory node - // - for (Prev =3D 0;; Prev =3D Node) { - Node =3D fdt_next_node (DeviceTreeBase, Prev, NULL); - if (Node < 0) { - break; - } - - // - // Check for memory node - // - Type =3D fdt_getprop (DeviceTreeBase, Node, "device_type", &Len); - if (Type && AsciiStrnCmp (Type, "memory", Len) =3D=3D 0) { - // - // Get the 'reg' property of this node. For now, we will assume - // two 8 byte quantities for base and size, respectively. - // - RegProp =3D fdt_getprop (DeviceTreeBase, Node, "reg", &Len); - if (RegProp !=3D 0 && Len =3D=3D (2 * sizeof (UINT64))) { - - CurBase =3D fdt64_to_cpu (ReadUnaligned64 (RegProp)); - CurSize =3D fdt64_to_cpu (ReadUnaligned64 (RegProp + 1)); - - DEBUG ((EFI_D_INFO, "%a: System RAM @ 0x%lx - 0x%lx\n", - __FUNCTION__, CurBase, CurBase + CurSize - 1)); - - if (NewBase > CurBase || NewBase =3D=3D 0) { - NewBase =3D CurBase; - NewSize =3D CurSize; - } - } else { - DEBUG ((EFI_D_ERROR, "%a: Failed to parse FDT memory node\n", - __FUNCTION__)); - } - } - } - - // - // Make sure the start of DRAM matches our expectation - // - ASSERT (FixedPcdGet64 (PcdSystemMemoryBase) =3D=3D NewBase); - PcdStatus =3D PcdSet64S (PcdSystemMemorySize, NewSize); - ASSERT_RETURN_ERROR (PcdStatus); - - // - // We need to make sure that the machine we are running on has at least - // 128 MB of memory configured, and is currently executing this binary f= rom - // NOR flash. This prevents a device tree image in DRAM from getting - // clobbered when our caller installs permanent PEI RAM, before we have a - // chance of marking its location as reserved or copy it to a freshly - // allocated block in the permanent PEI RAM in the platform PEIM. - // - ASSERT (NewSize >=3D SIZE_128MB); - ASSERT ( - (((UINT64)PcdGet64 (PcdFdBaseAddress) + - (UINT64)PcdGet32 (PcdFdSize)) <=3D NewBase) || - ((UINT64)PcdGet64 (PcdFdBaseAddress) >=3D (NewBase + NewSize))); -} - -VOID -ArmPlatformGetPlatformPpiList ( - OUT UINTN *PpiListSize, - OUT EFI_PEI_PPI_DESCRIPTOR **PpiList - ) -{ - *PpiListSize =3D 0; - *PpiList =3D NULL; -} diff --git a/ArmVirtPkg/Library/ArmVirtPlatformLib/VirtMem.c b/ArmVirtPkg/L= ibrary/ArmVirtPlatformLib/VirtMem.c deleted file mode 100644 index 4368d05f76ef..000000000000 --- a/ArmVirtPkg/Library/ArmVirtPlatformLib/VirtMem.c +++ /dev/null @@ -1,102 +0,0 @@ -/** @file -* -* Copyright (c) 2014, Linaro Limited. All rights reserved. -* -* This program and the accompanying materials -* are licensed and made available under the terms and conditions of the B= SD 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 IM= PLIED. -* -**/ - -#include -#include -#include -#include -#include -#include - -// Number of Virtual Memory Map Descriptors -#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 5 - -EFI_PHYSICAL_ADDRESS -ArmGetPhysAddrTop ( - VOID - ); - -/** - Return the Virtual Memory Map of your platform - - This Virtual Memory Map is used by MemoryInitPei Module to initialize th= e MMU - on your platform. - - @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR - describing a Physical-to-Virtual Memory - mapping. This array must be ended by a - zero-filled entry - -**/ -VOID -ArmPlatformGetVirtualMemoryMap ( - IN ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap - ) -{ - ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable; - - ASSERT (VirtualMemoryMap !=3D NULL); - - VirtualMemoryTable =3D AllocatePages ( - EFI_SIZE_TO_PAGES ( - sizeof (ARM_MEMORY_REGION_DESCRIPTOR) - * MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS - ) - ); - - if (VirtualMemoryTable =3D=3D NULL) { - DEBUG ((EFI_D_ERROR, "%a: Error: Failed AllocatePages()\n", __FUNCTION= __)); - return; - } - - // System DRAM - VirtualMemoryTable[0].PhysicalBase =3D PcdGet64 (PcdSystemMemoryBase); - VirtualMemoryTable[0].VirtualBase =3D VirtualMemoryTable[0].PhysicalBas= e; - VirtualMemoryTable[0].Length =3D PcdGet64 (PcdSystemMemorySize); - VirtualMemoryTable[0].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_WRITE= _BACK; - - DEBUG ((EFI_D_INFO, "%a: Dumping System DRAM Memory Map:\n" - "\tPhysicalBase: 0x%lX\n" - "\tVirtualBase: 0x%lX\n" - "\tLength: 0x%lX\n", - __FUNCTION__, - VirtualMemoryTable[0].PhysicalBase, - VirtualMemoryTable[0].VirtualBase, - VirtualMemoryTable[0].Length)); - - // Peripheral space before DRAM - VirtualMemoryTable[1].PhysicalBase =3D 0x0; - VirtualMemoryTable[1].VirtualBase =3D 0x0; - VirtualMemoryTable[1].Length =3D VirtualMemoryTable[0].PhysicalBas= e; - VirtualMemoryTable[1].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_DEVIC= E; - - // Peripheral space after DRAM - VirtualMemoryTable[2].PhysicalBase =3D VirtualMemoryTable[0].Length + Vi= rtualMemoryTable[1].Length; - VirtualMemoryTable[2].VirtualBase =3D VirtualMemoryTable[2].PhysicalBas= e; - VirtualMemoryTable[2].Length =3D MIN (1ULL << FixedPcdGet8 (PcdPre= PiCpuMemorySize), - ArmGetPhysAddrTop ()) - - VirtualMemoryTable[2].PhysicalBase; - VirtualMemoryTable[2].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_DEVIC= E; - - // Remap the FD region as normal executable memory - VirtualMemoryTable[3].PhysicalBase =3D FixedPcdGet64 (PcdFdBaseAddress); - VirtualMemoryTable[3].VirtualBase =3D VirtualMemoryTable[3].PhysicalBas= e; - VirtualMemoryTable[3].Length =3D FixedPcdGet32 (PcdFdSize); - VirtualMemoryTable[3].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_WRITE= _BACK; - - // End of Table - ZeroMem (&VirtualMemoryTable[4], sizeof (ARM_MEMORY_REGION_DESCRIPTOR)); - - *VirtualMemoryMap =3D VirtualMemoryTable; -} diff --git a/ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/AARCH64/Reloca= tableVirtHelper.S b/ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/AARCH64= /RelocatableVirtHelper.S deleted file mode 100644 index ce886378eae6..000000000000 --- a/ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/AARCH64/RelocatableVi= rtHelper.S +++ /dev/null @@ -1,140 +0,0 @@ -# -# Copyright (c) 2011-2013, ARM Limited. All rights reserved. -# Copyright (c) 2016, Linaro Limited. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the B= SD 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 IM= PLIED. -# -# - -#include -#include - -// VOID -// ArmPlatformPeiBootAction ( -// VOID *DeviceTreeBaseAddress, // passed by loader in x0 -// VOID *ImageBase // passed by FDF trampoline in x1 -// ); -ASM_FUNC(ArmPlatformPeiBootAction) - mov x29, x30 // preserve LR - mov x28, x0 // preserve DTB pointer - mov x27, x1 // preserve base of image pointer - - // - // If we are booting from RAM using the Linux kernel boot protocol, x0 w= ill - // point to the DTB image in memory. Otherwise, we are just coming out of - // reset, and x0 will be 0. - // - cbz x0, .Lout - - // - // The base of the runtime image has been preserved in x1. Check whether - // the expected magic number can be found in the header. - // - ldr w8, .LArm64LinuxMagic - ldr w9, [x1, #0x38] - cmp w8, w9 - bne .Lout - - // - // - // OK, so far so good. We have confirmed that we likely have a DTB and a= re - // booting via the arm64 Linux boot protocol. Update the base-of-image P= CD - // to the actual relocated value, and add the shift of PcdFdBaseAddress = to - // PcdFvBaseAddress as well - // - adr x8, PcdGet64 (PcdFdBaseAddress) - adr x9, PcdGet64 (PcdFvBaseAddress) - ldr x6, [x8] - ldr x7, [x9] - sub x7, x7, x6 - add x7, x7, x1 - str x1, [x8] - str x7, [x9] - - // - // Discover the memory size and offset from the DTB, and record in the - // respective PCDs. This will also return false if a corrupt DTB is - // encountered. Since we are calling a C function, use the window at the - // beginning of the FD image as a temp stack. - // - adr x1, PcdGet64 (PcdSystemMemoryBase) - adr x2, PcdGet64 (PcdSystemMemorySize) - mov sp, x7 - bl FindMemnode - cbz x0, .Lout - - // - // Copy the DTB to the slack space right after the 64 byte arm64/Linux s= tyle - // image header at the base of this image (defined in the FDF), and reco= rd the - // pointer in PcdDeviceTreeInitialBaseAddress. - // - adr x8, PcdGet64 (PcdDeviceTreeInitialBaseAddress) - add x27, x27, #0x40 - str x27, [x8] - - mov x0, x27 - mov x1, x28 - bl CopyFdt - -.Lout: - ret x29 - -.LArm64LinuxMagic: - .byte 0x41, 0x52, 0x4d, 0x64 - -//UINTN -//ArmPlatformGetPrimaryCoreMpId ( -// VOID -// ); -ASM_FUNC(ArmPlatformGetPrimaryCoreMpId) - MOV32 (w0, FixedPcdGet32 (PcdArmPrimaryCore)) - ret - -//UINTN -//ArmPlatformIsPrimaryCore ( -// IN UINTN MpId -// ); -ASM_FUNC(ArmPlatformIsPrimaryCore) - mov x0, #1 - ret - -//UINTN -//ArmPlatformGetCorePosition ( -// IN UINTN MpId -// ); -// With this function: CorePos =3D (ClusterId * 4) + CoreId -ASM_FUNC(ArmPlatformGetCorePosition) - and x1, x0, #ARM_CORE_MASK - and x0, x0, #ARM_CLUSTER_MASK - add x0, x1, x0, LSR #6 - ret - -//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 =3D=3D 32 bits, 1 =3D=3D 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/ArmXenRelocatablePlatformLib/ARM/Relocatabl= eVirtHelper.S b/ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/ARM/Relocat= ableVirtHelper.S deleted file mode 100644 index f264fa1cf731..000000000000 --- a/ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/ARM/RelocatableVirtHe= lper.S +++ /dev/null @@ -1,123 +0,0 @@ -# -# Copyright (c) 2011-2013, ARM Limited. All rights reserved. -# Copyright (c) 2014-2016, Linaro Limited. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the B= SD 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 IM= PLIED. -# -# - -#include -#include - -ASM_FUNC(ArmPlatformPeiBootAction) - mov r11, r14 // preserve LR - mov r10, r0 // preserve DTB pointer - mov r9, r1 // preserve base of image pointer - - // - // If we are booting from RAM using the Linux kernel boot protocol, r0 w= ill - // point to the DTB image in memory. Otherwise, we are just coming out of - // reset, and r0 will be 0. - // - teq r0, #0 - beq .Lout - - // - // The base of the runtime image has been preserved in r1. Check whether - // the expected magic number can be found in the header. - // - ldr r8, .LArm32LinuxMagic - ldr r7, [r1, #0x24] - cmp r7, r8 - bne .Lout - - // - // - // OK, so far so good. We have confirmed that we likely have a DTB and a= re - // booting via the ARM Linux boot protocol. Update the base-of-image PCD - // to the actual relocated value, and add the shift of PcdFdBaseAddress = to - // PcdFvBaseAddress as well - // - ADRL (r8, PcdGet64 (PcdFdBaseAddress)) - ADRL (r7, PcdGet64 (PcdFvBaseAddress)) - ldr r6, [r8] - ldr r5, [r7] - sub r5, r5, r6 - add r5, r5, r1 - str r1, [r8] - str r5, [r7] - - // - // Discover the memory size and offset from the DTB, and record in the - // respective PCDs. This will also return false if a corrupt DTB is - // encountered. Since we are calling a C function, use the window at the - // beginning of the FD image as a temp stack. - // - ADRL (r1, PcdGet64 (PcdSystemMemoryBase)) - ADRL (r2, PcdGet64 (PcdSystemMemorySize)) - mov sp, r5 - bl FindMemnode - teq r0, #0 - beq .Lout - - // - // Copy the DTB to the slack space right after the 64 byte arm64/Linux s= tyle - // image header at the base of this image (defined in the FDF), and reco= rd the - // pointer in PcdDeviceTreeInitialBaseAddress. - // - ADRL (r8, PcdGet64 (PcdDeviceTreeInitialBaseAddress)) - add r9, r9, #0x40 - str r9, [r8] - - mov r0, r9 - mov r1, r10 - bl CopyFdt - -.Lout: - bx r11 - -.LArm32LinuxMagic: - .byte 0x18, 0x28, 0x6f, 0x01 - -//UINTN -//ArmPlatformGetPrimaryCoreMpId ( -// VOID -// ); -ASM_FUNC(ArmPlatformGetPrimaryCoreMpId) - MOV32 (r0, FixedPcdGet32 (PcdArmPrimaryCore)) - bx lr - -//UINTN -//ArmPlatformIsPrimaryCore ( -// IN UINTN MpId -// ); -ASM_FUNC(ArmPlatformIsPrimaryCore) - mov r0, #1 - bx lr - -//UINTN -//ArmPlatformGetCorePosition ( -// IN UINTN MpId -// ); -// With this function: CorePos =3D (ClusterId * 4) + CoreId -ASM_FUNC(ArmPlatformGetCorePosition) - and r1, r0, #ARM_CORE_MASK - and r0, r0, #ARM_CLUSTER_MASK - add r0, r1, r0, LSR #6 - bx lr - -//EFI_PHYSICAL_ADDRESS -//GetPhysAddrTop ( -// VOID -// ); -ASM_FUNC(ArmGetPhysAddrTop) - mov r0, #0x00000000 - mov r1, #0x10000 - bx lr - diff --git a/ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/ArmXenRelocata= blePlatformLib.inf b/ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/ArmXen= RelocatablePlatformLib.inf deleted file mode 100644 index b8cb24514d4c..000000000000 --- a/ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/ArmXenRelocatablePlat= formLib.inf +++ /dev/null @@ -1,63 +0,0 @@ -#/* @file -# Copyright (c) 2011-2015, ARM Limited. All rights reserved. -# Copyright (c) 2014, Linaro Limited. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the B= SD 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 IM= PLIED. -# -#*/ - -[Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D ArmXenRelocatablePlatformLib - FILE_GUID =3D c8602718-4faa-4119-90ca-cae72509ac4c - MODULE_TYPE =3D BASE - VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D ArmPlatformLib|SEC PEIM - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - EmbeddedPkg/EmbeddedPkg.dec - ArmPkg/ArmPkg.dec - ArmPlatformPkg/ArmPlatformPkg.dec - ArmVirtPkg/ArmVirtPkg.dec - -[LibraryClasses] - IoLib - ArmLib - PrintLib - FdtLib - -[Sources.common] - RelocatableVirt.c - XenVirtMem.c - FdtParser.c - -[Sources.AARCH64] - AARCH64/RelocatableVirtHelper.S - -[Sources.ARM] - ARM/RelocatableVirtHelper.S - -[FeaturePcd] - gEmbeddedTokenSpaceGuid.PcdCacheEnable - gArmPlatformTokenSpaceGuid.PcdSystemMemoryInitializeInSec - -[PatchPcd] - gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress - gArmTokenSpaceGuid.PcdFdBaseAddress - gArmTokenSpaceGuid.PcdFvBaseAddress - gArmTokenSpaceGuid.PcdSystemMemoryBase - gArmTokenSpaceGuid.PcdSystemMemorySize - -[FixedPcd] - gArmPlatformTokenSpaceGuid.PcdCoreCount - gArmTokenSpaceGuid.PcdArmPrimaryCoreMask - gArmTokenSpaceGuid.PcdArmPrimaryCore - gArmTokenSpaceGuid.PcdFdSize diff --git a/ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/FdtParser.c b/= ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/FdtParser.c deleted file mode 100644 index 38fd5d3ed00c..000000000000 --- a/ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/FdtParser.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2015, Linaro Ltd. All rights reserved. - * - * This program and the accompanying materials - * are licensed and made available under the terms and conditions of the B= SD 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 IM= PLIED. - */ - -#include -#include - -BOOLEAN -FindMemnode ( - IN VOID *DeviceTreeBlob, - OUT UINT64 *SystemMemoryBase, - OUT UINT64 *SystemMemorySize - ) -{ - INT32 MemoryNode; - INT32 AddressCells; - INT32 SizeCells; - INT32 Length; - CONST INT32 *Prop; - - if (fdt_check_header (DeviceTreeBlob) !=3D 0) { - return FALSE; - } - - // - // Look for a node called "memory" at the lowest level of the tree - // - MemoryNode =3D fdt_path_offset (DeviceTreeBlob, "/memory"); - if (MemoryNode <=3D 0) { - return FALSE; - } - - // - // Retrieve the #address-cells and #size-cells properties - // from the root node, or use the default if not provided. - // - AddressCells =3D 1; - SizeCells =3D 1; - - Prop =3D fdt_getprop (DeviceTreeBlob, 0, "#address-cells", &Length); - if (Length =3D=3D 4) { - AddressCells =3D fdt32_to_cpu (*Prop); - } - - Prop =3D fdt_getprop (DeviceTreeBlob, 0, "#size-cells", &Length); - if (Length =3D=3D 4) { - SizeCells =3D fdt32_to_cpu (*Prop); - } - - // - // Now find the 'reg' property of the /memory node, and read the first - // range listed. - // - Prop =3D fdt_getprop (DeviceTreeBlob, MemoryNode, "reg", &Length); - - if (Length < (AddressCells + SizeCells) * sizeof (INT32)) { - return FALSE; - } - - *SystemMemoryBase =3D fdt32_to_cpu (Prop[0]); - if (AddressCells > 1) { - *SystemMemoryBase =3D (*SystemMemoryBase << 32) | fdt32_to_cpu (Prop[1= ]); - } - Prop +=3D AddressCells; - - *SystemMemorySize =3D fdt32_to_cpu (Prop[0]); - if (SizeCells > 1) { - *SystemMemorySize =3D (*SystemMemorySize << 32) | fdt32_to_cpu (Prop[1= ]); - } - - return TRUE; -} - -VOID -CopyFdt ( - IN VOID *FdtDest, - IN VOID *FdtSource - ) -{ - CopyMem (FdtDest, FdtSource, fdt_totalsize (FdtSource)); -} diff --git a/ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/RelocatableVir= t.c b/ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/RelocatableVirt.c deleted file mode 100644 index 6df207733ab2..000000000000 --- a/ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/RelocatableVirt.c +++ /dev/null @@ -1,70 +0,0 @@ -/** @file -* -* Copyright (c) 2011-2013, ARM Limited. All rights reserved. -* Copyright (c) 2014, Linaro Limited. All rights reserved. -* Copyright (c) 2014, Red Hat, Inc. -* -* -* This program and the accompanying materials -* are licensed and made available under the terms and conditions of the B= SD 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 IM= PLIED. -* -**/ - -#include -#include -#include -#include - -/** - Return the current Boot Mode - - This function returns the boot reason on the platform - - @return Return the current Boot Mode of the platform - -**/ -EFI_BOOT_MODE -ArmPlatformGetBootMode ( - VOID - ) -{ - return BOOT_WITH_FULL_CONFIGURATION; -} - -/** - This function is called by PrePeiCore, in the SEC phase. -**/ -RETURN_STATUS -ArmPlatformInitialize ( - IN UINTN MpId - ) -{ - // - // We are relying on ArmPlatformInitializeSystemMemory () being called f= rom - // InitializeMemory (), which only occurs if the following feature is di= sabled - // - ASSERT (!FeaturePcdGet (PcdSystemMemoryInitializeInSec)); - return RETURN_SUCCESS; -} - -VOID -ArmPlatformInitializeSystemMemory ( - VOID - ) -{ -} - -VOID -ArmPlatformGetPlatformPpiList ( - OUT UINTN *PpiListSize, - OUT EFI_PEI_PPI_DESCRIPTOR **PpiList - ) -{ - *PpiListSize =3D 0; - *PpiList =3D NULL; -} diff --git a/ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/XenVirtMem.c b= /ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/XenVirtMem.c deleted file mode 100644 index 63090586cf8b..000000000000 --- a/ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/XenVirtMem.c +++ /dev/null @@ -1,82 +0,0 @@ -/** @file -* -* Copyright (c) 2014, Linaro Limited. All rights reserved. -* -* This program and the accompanying materials -* are licensed and made available under the terms and conditions of the B= SD 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 IM= PLIED. -* -**/ - -#include -#include -#include -#include -#include -#include - -// Number of Virtual Memory Map Descriptors -#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 2 - -// DDR attributes -#define DDR_ATTRIBUTES_CACHED ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK -#define DDR_ATTRIBUTES_UNCACHED ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBU= FFERED - -EFI_PHYSICAL_ADDRESS -ArmGetPhysAddrTop ( - VOID - ); - -/** - Return the Virtual Memory Map of your platform - - This Virtual Memory Map is used by MemoryInitPei Module to initialize th= e MMU - on your platform. - - @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR - describing a Physical-to-Virtual Memory - mapping. This array must be ended by a - zero-filled entry - -**/ -VOID -ArmPlatformGetVirtualMemoryMap ( - IN ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap - ) -{ - ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable; - - ASSERT (VirtualMemoryMap !=3D NULL); - - VirtualMemoryTable =3D AllocatePages ( - EFI_SIZE_TO_PAGES ( - sizeof (ARM_MEMORY_REGION_DESCRIPTOR) - * MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS - ) - ); - - if (VirtualMemoryTable =3D=3D NULL) { - DEBUG ((EFI_D_ERROR, "%a: Error: Failed AllocatePages()\n", __FUNCTION= __)); - return; - } - - // - // 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 - // by the hypervisor, which will override the cached mapping we install - // here. - // - VirtualMemoryTable[0].PhysicalBase =3D 0x0; - VirtualMemoryTable[0].VirtualBase =3D 0x0; - VirtualMemoryTable[0].Length =3D ArmGetPhysAddrTop (); - VirtualMemoryTable[0].Attributes =3D DDR_ATTRIBUTES_CACHED; - - // End of Table - ZeroMem (&VirtualMemoryTable[1], sizeof (ARM_MEMORY_REGION_DESCRIPTOR)); - - *VirtualMemoryMap =3D VirtualMemoryTable; -} --=20 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel