From patchwork Wed Nov 22 10:07:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 119444 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp6489109qgn; Wed, 22 Nov 2017 02:07:45 -0800 (PST) X-Google-Smtp-Source: AGs4zMZCz3EjJP2QvTYQ16HZXMys80DhnTQSv4dJLM9wUiu2EBKx4gdQvpT81yo+zofTfKd7bT/v X-Received: by 10.159.240.138 with SMTP id p10mr20738930plr.360.1511345265877; Wed, 22 Nov 2017 02:07:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511345265; cv=none; d=google.com; s=arc-20160816; b=mhMQ8iJe255Dp86UdoA9pTjwDY3OE4tsDg2aO87DFnuA4W5PuSNnTOK71IRWQ5Yr4R LopJI7pPkX54wkccStk6KS1HtYl1Kyj/WJRNiNbL9e+9F+NN3JARokCprjSCe9Aoi0CW ZCHyQnmGulWhIotHVIORtP8nIAhV5NhDJKT0sIKYDFjoFH43P5K+1vHXaXizHiWwZ9x3 AvvCuEv3DZEBei+XvtHkxoku9Yz/eOuDVypJGK6pLAPaoTFDu8+z5ZMrowNXCF+N8vsD taCoi7gUfyJ+yGEYrIZQe4G7xCTN16vDKaCAuxk+SUjr77SZ2utyF5sKS1e9KMdlxXTp YsNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=DmWFXnOPwxlBMLycyfSRvwejXeIKTM9e3cgwJDblYlg=; b=CkLZcUXHE4VIA1i4s/MiI3Wxk2MO8CeSU5bV3MwaVJw+eG6imuHibw3vKDkB1NSIvr 2P6Bxte5YIWuc1Kir7m0+XxKdQrx8V7+Y4KggqcQIO/zpOoTil+OGEJBY6JsNgSZmI2G 8KCYwnnRjKrY+1RIOMyxqPqx1b7Lu/ilOhYp9THGyQZim0wlmt8kGQ95Y5MshZKPwz0Q ZLUxUmjSwDziCmOShOst3QOHSCwlhVCcXGfMevuWQ4GbvWUYpfTmRtIJtB0mRa8FJy7A uC5cKUrYx46a6kw7pQeZ4sY+8TLS0Y1pfOfpuMQqn7JgsTSTfMM7PJbyWU+PlLHi1LY7 igqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=EWh6nELf; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id l63si8870610plb.82.2017.11.22.02.07.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:07:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=EWh6nELf; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 52CC4220C160B; Wed, 22 Nov 2017 02:03:28 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::243; helo=mail-wm0-x243.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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) 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-Received: by 10.28.34.67 with SMTP id i64mr3674271wmi.57.1511345260856; Wed, 22 Nov 2017 02:07:40 -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) 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 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(-) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel 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" -EFI_STATUS -EFIAPI -ExtractGuidedSectionLibConstructor ( - VOID - ); - -EFI_STATUS +VOID EFIAPI -LzmaDecompressLibConstructor ( +ProcessLibraryConstructorList ( VOID ); @@ -125,8 +119,7 @@ PrePiMain ( PERF_START (NULL, "PEI", NULL, StartTimeStamp); // SEC phase needs to run library constructors by hand. - ExtractGuidedSectionLibConstructor (); - LzmaDecompressLibConstructor (); + ProcessLibraryConstructorList (); // Build HOBs to pass up our version of stuff the DXE Core needs to save space BuildPeCoffLoaderHob (); From patchwork Wed Nov 22 10:07:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 119445 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp6489148qgn; Wed, 22 Nov 2017 02:07:48 -0800 (PST) X-Google-Smtp-Source: AGs4zMbD5ta62gR0WcSeaSmr8+UZuQOtP7kmjHscoGWC/wL6i6s+z0yw7jkaWjHTzYt7W3yhtaGW X-Received: by 10.84.234.9 with SMTP id m9mr21326924plk.3.1511345268092; Wed, 22 Nov 2017 02:07:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511345268; cv=none; d=google.com; s=arc-20160816; b=WTPDyuIWqZRYHvDJJouVjSssd18jPMW92Q33fARmIRFfY/qK/BzvwuVe55bjXuEM+L z7/as8WW3fsvtkPtcCwf0G/PyG+i5ZV9tqHwkNwso86t5bRSqiBgaGkckGLPm+oXBEaW d3wqV1x4yj/JdWKM9gVY4sVQFKxh4l3zQEcflXDmOVSruDjHuYsYyeiAKC6i93hC8gf6 2+lML1zf5DhOZ53+J41MJQ1H1OaejBUASOeg+R/drHK86KR6YbL1G7huQN+AH3VSoyQR gHwWwdDkkbW7ELxtrHaMX0+u4fCSRoe5Cv+N7PO1KruHblXF6dhvqsLYOJoituw6JHPE Ikxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=yeP8bGf7j+AsSK8FKmycbCNvRB0RdtbSVSXcQOnBETs=; b=GJil+QDgySE/r5BFu+4GhMGAg83VGN0T8h875MXruyP3apRcVdJoMEPWi0P4WH0f9t KffGihpAAO6CcK71E3GEjakkye2lVzcR55uc6o7BzBylIrd53QZxAtq50KL0+PSttN33 LkoqGBmsEuMIU32PZVu3TPBDWTEZOcnf/vMN9kt85xdh03CKFmgG1RpClwBDeBM9obpj ft+S9HqGSVkCuPtgEyykv6qSv5EuX6XbuV8PJrfm1b40gbuyoqcbIUVZAj9EDQ+/xeDe uR+Bo8ap7p7Yl6+8UKOTGGxv5v8Q32HOtpDnAWQgTYsRf3k7KYND4dUn8fY9BdBRRKCQ xpEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=R+QOaWWF; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id 102si13214089pld.614.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) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=R+QOaWWF; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 8C1A1220C1610; Wed, 22 Nov 2017 02:03:29 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::243; helo=mail-wr0-x243.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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) 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-Received: by 10.223.129.35 with SMTP id 32mr16082250wrm.271.1511345262419; 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.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:07:41 -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 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(-) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel 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 ); -EFI_STATUS -GetPlatformPpi ( - IN EFI_GUID *PpiGuid, - OUT VOID **Ppi - ) -{ - UINTN PpiListSize; - UINTN PpiListCount; - EFI_PEI_PPI_DESCRIPTOR *PpiList; - UINTN Index; - - PpiListSize = 0; - ArmPlatformGetPlatformPpiList (&PpiListSize, &PpiList); - PpiListCount = PpiListSize / sizeof(EFI_PEI_PPI_DESCRIPTOR); - for (Index = 0; Index < PpiListCount; Index++, PpiList++) { - if (CompareGuid (PpiList->Guid, PpiGuid) == TRUE) { - *Ppi = 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 ); -EFI_STATUS -GetPlatformPpi ( - IN EFI_GUID *PpiGuid, - OUT VOID **Ppi - ); - // Initialize the Architecture specific controllers VOID ArchInitialize ( From patchwork Wed Nov 22 10:07:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 119446 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp6489200qgn; Wed, 22 Nov 2017 02:07:50 -0800 (PST) X-Google-Smtp-Source: AGs4zMYmz0DXD3NRxzR27NYM0foLGfY/8can6Y5FEjXCbPu02hKBAxE9UbD2ibDRT6l6H1JQFDxh X-Received: by 10.101.101.216 with SMTP id y24mr14655218pgv.236.1511345270508; Wed, 22 Nov 2017 02:07:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511345270; cv=none; d=google.com; s=arc-20160816; b=yD9CgyF3ZYxJ09yR5g9uKFF74jKp5cibCE4NPqXc1UmjSYLSYUqrESehQBd4FZt+Oa Xz/lr0bAfwRqpSiMnzVwqatxQCoUQ3n1byvYHEROeOclxHiHF3pN+8xCBRKZu7JdR/xp pTbREY7dr6gb5kWCz6ooYJ2r+JPp86WsspAnETfZK3/lK6Zj6MuO49WIFqeQhpY2U4n3 KN/OoGDzO795GISosaqkRRldR7eMZcfGgS2Jcax/4sgR7d/WmnpUDuGOW5fydfY0G/cs 0Xn6rmIKbjr33DjYF4RNDK1s1ICwJISj+dmmdV+UMo0nvW5+gZjgQBWcFJ6g+l/teIQ5 a1NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=D7EkiIxK8jlRG/8xCHIL9dxGl99QCX1nJOT945z88pc=; b=rKskyUxURhCaUJ4DvGTIv37IwukIJBp++5RoLtx2kilyWOtNH3n31VbCZTLEsXoPvE +G7YAWFoLUA0nQ1n20FQ9/uFQph/M+oD0SngJ1wfSUgy7DvbbSqGZgacRFlDr3Mfw2X7 BIwR1y72MTdOywllRWQM1lPGye85UfniUs6TvZMSiu4s4qx0ztax//++IzVtucDvDCwf DpZhs92sNO3gbhenUcsIA/2T1ZqZ2+vaGe0oMMEtWm4OxaEu43tAFBQsoyYM7kcEP3cJ vTGopefheIUUiLs8IquIEeqKs1ZJEVasFWB+AMIM7cvKDkxs/CuFVw4QUtSkSvqykcLA zDjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=bskAeTBV; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id t12si13186305pgn.395.2017.11.22.02.07.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:07:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=bskAeTBV; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id C951C220C1612; Wed, 22 Nov 2017 02:03:30 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::244; helo=mail-wr0-x244.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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) 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-Received: by 10.223.172.245 with SMTP id o108mr18733698wrc.122.1511345263974; Wed, 22 Nov 2017 02:07:43 -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) 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 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(-) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel 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) - // 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) - // 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 From patchwork Wed Nov 22 10:07:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 119447 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp6489263qgn; Wed, 22 Nov 2017 02:07:53 -0800 (PST) X-Google-Smtp-Source: AGs4zMYzZ0pde6ko7hAhAGI6emyf4huBqOOkc9W4/AriRNtwU9Ir0H/MbEpuMn0TIVmVJHfOX1JV X-Received: by 10.84.201.6 with SMTP id u6mr20557529pld.51.1511345273630; Wed, 22 Nov 2017 02:07:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511345273; cv=none; d=google.com; s=arc-20160816; b=VH/KkReULHu2N1uYa8HycIF+Hh/wFqfVpxfmmCymMatyyEgUg8Llo5EjPpfrl0ulXd bP4smR38rasyt18g2ki2b9et5ek790kqXBv4WfdBMYaLaD/9kyEq2rnvk89Kj/nQ8322 GmGpmMbdztwTCnzPAKD5X9NcaUjIe8pe/Pl6CiCp1l2I7+Y4XJqHqZ84yT1WXCL5O/oQ O5TwqKtve54XXtjI794Vq4mDN2lykkwh7i0JI9KVS3r58EekfJQcro3C9YLXoMyo5t3A hFEynhZ/fYR6j4WLZqIiKsB3ZKH73gXHkmeqQibVKVSVui+chAeqa0prDrZbklfAeFO5 czOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=2aikhq6/2SGQ4nPJzD0rWIu0v+Km0Koa0fhba5cjX0A=; b=HjHnxm4uNN1G9j3WgHOzjmLiTRP2fVt131L+q9exmFazjSm2MTteHHVMNPl2qgedff pzufRY2sI5CYiBhEwdbiGn8DmuCQ9zYLEPYXVug3k2+ahc07/4b/5FWQwL+RQGer+CFW 6BtjzOEw8sc+ow00+99oqXUtOemtNFSjZr/A4BY/OmQwMJVio190itnvBnDrYyAy8AYZ es/CsLLFKunfwctcNifAtQEd+7pyeh8g/jUYhICbxhPSiFyv4HSQm27vwA+0K+xc1WSk 2UiATZJdnwhvdA4pSe2dvVqIfqb/cS5e/plIzanHPTQ3YC4qYEEOFder+PRqcr4cc3jd qH6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=emIV1mFE; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id k4si13020641pgn.596.2017.11.22.02.07.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:07:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=emIV1mFE; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 0BCC7220C1616; Wed, 22 Nov 2017 02:03:34 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::243; helo=mail-wr0-x243.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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) 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-Received: by 10.223.128.162 with SMTP id 31mr17574735wrl.258.1511345265569; 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.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:07:44 -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 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(-) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel 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: - // Do early platform specific actions - bl ASM_PFX(ArmPlatformPeiBootAction) + bl ASM_PFX(DiscoverDramFromDt) // Get ID of this CPU in Multicore system bl ASM_PFX(ArmReadMpidr) @@ -140,3 +139,77 @@ _GetStackBase: _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 will + // point to the DTB image in memory. Otherwise, use the default value defined + // 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 are + // booting via the arm64 Linux boot protocol. Update the base-of-image PCD + // 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 style + // image header at the base of this image (defined in the FDF), and record 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: _NeverReturn: b _NeverReturn + +ASM_PFX(ArmPlatformPeiBootAction): + // + // If we are booting from RAM using the Linux kernel boot protocol, r0 will + // point to the DTB image in memory. Otherwise, use the default value defined + // 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 are + // 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 style + // image header at the base of this image (defined in the FDF), and record 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/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf index 5e706934f69f..789a896857aa 100755 --- a/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf +++ b/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf @@ -23,6 +23,7 @@ [Defines] [Sources] PrePi.c + FdtParser.c [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 BSD License + * which accompanies this distribution. The full text of the license may be found at + * http://opensource.org/licenses/bsd-license.php + * + * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + */ + +#include +#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) != 0) { + return FALSE; + } + + // + // Look for a node called "memory" at the lowest level of the tree + // + MemoryNode = fdt_path_offset (DeviceTreeBlob, "/memory"); + if (MemoryNode <= 0) { + return FALSE; + } + + // + // Retrieve the #address-cells and #size-cells properties + // from the root node, or use the default if not provided. + // + AddressCells = 1; + SizeCells = 1; + + Prop = fdt_getprop (DeviceTreeBlob, 0, "#address-cells", &Length); + if (Length == 4) { + AddressCells = fdt32_to_cpu (*Prop); + } + + Prop = fdt_getprop (DeviceTreeBlob, 0, "#size-cells", &Length); + if (Length == 4) { + SizeCells = fdt32_to_cpu (*Prop); + } + + // + // Now find the 'reg' property of the /memory node, and read the first + // range listed. + // + Prop = fdt_getprop (DeviceTreeBlob, MemoryNode, "reg", &Length); + + if (Length < (AddressCells + SizeCells) * sizeof (INT32)) { + return FALSE; + } + + *SystemMemoryBase = fdt32_to_cpu (Prop[0]); + if (AddressCells > 1) { + *SystemMemoryBase = (*SystemMemoryBase << 32) | fdt32_to_cpu (Prop[1]); + } + Prop += AddressCells; + + *SystemMemorySize = fdt32_to_cpu (Prop[0]); + if (SizeCells > 1) { + *SystemMemorySize = (*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)); +} From patchwork Wed Nov 22 10:07:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 119448 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp6489317qgn; Wed, 22 Nov 2017 02:07:57 -0800 (PST) X-Google-Smtp-Source: AGs4zMbgLSGjfKgyh5CG0QjvsOp1Pz5aitD8J9ct0Y4orLWLlCV2CE4LXo2U3ttluSXoINeuoODp X-Received: by 10.84.246.194 with SMTP id j2mr20618618plt.7.1511345277299; Wed, 22 Nov 2017 02:07:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511345277; cv=none; d=google.com; s=arc-20160816; b=dSx0t853Jn/i27XSwaIg0490j5WdU1xJe/jobf0zlQD57It5+Mpcs1a59J5twS0Xh0 I3CgPhO1m0os+iPBVS3OGi5w2Z5tBvont7ifAWgVI1Kyudjj1jIz51f4l9lt3lEZ3kZd XTU99QwAjr+7XgPEOzDYFDxK6M7C99zTv2TJeekYRNcY0u5COEMzrBzab8Sp4v1J627p hrVcy4e7i1zm0mFppPX1Gbch6DmSyGGOfVcNB0pfpzWbmz95jTSUgVL8/ufkdKb7o6cS aDs9mNYi39MYgp+ck4gIp8Rgu01BKHEimlYn5522n60rRaVNrr30va0x3El+2/gwGkUQ kNdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=PekHIC1f3rntD4NExBH13IPhRNnzAwFw8l+CTPygZCY=; b=PhpJ3qxZL4afD9BaLB7xRUbhsOcgOFrCmbjJ8PY5womZsHxx2ulpLKkxZvK/Ke6Tf1 1NIZcnyR5GMFi330BNC0Yf4OkngIePwhYQ93Lq8weyJRqJVbkUIv9J947Zh3/uDReuhF joPCCPb4xmHVSD1MzSSPyEhdala/85kmsgodU0E4ovoliLKXHLlFdXhv8ezXP5aDRQ7C Iaec87DoT1r83+35tNPHwagfoBu4CYSdUULTlSv4CeJYIuv5SigHNGjEZ3cx3pTjAOUd Vj8N7Hg/zQoiwNhHMElvdljFpFdZ64lQqRwXP38s/2ErZjnvtwaGCnSeSCFFyCzuk7ew PlyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=csbM0+bv; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id x4si12852341plw.539.2017.11.22.02.07.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:07:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=csbM0+bv; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 47494220C1619; Wed, 22 Nov 2017 02:03:36 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::241; helo=mail-wm0-x241.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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) 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-Received: by 10.28.14.85 with SMTP id 82mr3386948wmo.120.1511345267331; 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.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:07:46 -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 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(-) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf b/ArmVirtPkg/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 @@ **/ #include +#include #include #include @@ -85,7 +86,7 @@ PrePiMain ( BuildCpuHob (PcdGet8 (PcdPrePiCpuMemorySize), PcdGet8 (PcdPrePiCpuIoSize)); // Set the Boot Mode - SetBootMode (ArmPlatformGetBootMode ()); + SetBootMode (BOOT_WITH_FULL_CONFIGURATION); // Initialize Platform HOBs (CpuHob and FvHob) Status = PlatformPeim (); @@ -123,9 +124,6 @@ CEntryPoint ( { UINT64 StartTimeStamp; - // 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 #define SerialPrint(txt) SerialPortWrite (txt, AsciiStrLen(txt)+1); From patchwork Wed Nov 22 10:07:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 119449 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp6489369qgn; Wed, 22 Nov 2017 02:08:00 -0800 (PST) X-Google-Smtp-Source: AGs4zMbLBh5B00mUULgShJSR07QMSdCG7pg8jJnWOqziqnVbiqLhEjcxVEgQ8VxknkZomWWorFyA X-Received: by 10.159.197.67 with SMTP id d3mr20850776plo.409.1511345280313; Wed, 22 Nov 2017 02:08:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511345280; cv=none; d=google.com; s=arc-20160816; b=bvPmwEmZyA7jQO1bwRRX+sgmkG2JANFc0O/MC3t0cAiTxpWLu9FagCfeDJMHzXBNyr ZhpdibQX2BHaeaUWKRi84Ow/1lRVImD6vPNkDcLPTWXLsUmTLVvOzG4lTDdIyvp41QSF SR/JBDVklzDV51e626sXFFujOXBJ3s5+KSu4anNeKMFnjyNph0/8aJZyfD5JH2Tb/kEn LP656YA37TGA83lxxEniWUuAz5CCTC+gEmUGRakAEXUXUbm60i7FLkbSb+bIq5N+T6Mt awQPw5WhX8Un9NM6jneyR1cJFKnlLqF7Kh7eoCnOjtNbh8EoH7pyfp3Gs/Toqn1yWRAi s8Sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=j52vPsfZUt1CUKfBrL+2Z60ujIduXSQjYkUBVafcuP0=; b=niSavMTVEKfv7Y7wx7HCM8rCm06PkwNGpnQHo9Tu6FE7fzCDSGDG3i8SmJ0o5c7Thr l6omH4HjpO2WFghBhm/xX9jo77RHWbD39beAGvW1P6n0+MbG7S4FbFlAsktb5Ojk5NU+ MOVAzV7e3E5SeHdZqk7h59HFjEcELyc96C20HtBJvXA0pd/I2lnKG/K+PqntFRN87yqx Uc+Ki1ce6tWJju7mkBr8YEhPmB3JOuY6j6CKJ0eqSpGlTfWLnnRQ/c01fdgbBj+9xLtD XCEYQhOnIdXVs+eOJPa9Da/GXvOv/OCzSGGUtZg+3FlHavKgLx1B3N6mJDL+lThMnNAi ufZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=kN0ISdKY; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id y8si12772890pln.146.2017.11.22.02.08.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:08:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=kN0ISdKY; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 8452C220C161C; Wed, 22 Nov 2017 02:03:36 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::241; helo=mail-wm0-x241.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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) 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-Received: by 10.28.211.213 with SMTP id k204mr3311007wmg.68.1511345268996; 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.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); 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 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(-) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel 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/ArmPlatformStackLib.inf ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf ArmHvcLib|ArmPkg/Library/ArmHvcLib/ArmHvcLib.inf ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerVirtCounterLib/ArmGenericTimerVirtCounterLib.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: _GetStackBase: // r1 = The top of the Mpcore Stacks + mov sp, x1 + // Stack for the primary core = PrimaryCoreStack MOV32 (x2, FixedPcdGet32(PcdCPUCorePrimaryStackSize)) sub x22, x1, x2 - // Stack for the secondary core = Number of Cores - 1 - MOV32 (x1, (FixedPcdGet32(PcdCoreCount) - 1) * FixedPcdGet32(PcdCPUCoreSecondaryStackSize)) - sub x22, x22, x1 - - // x22 = The base of the MpCore Stacks (primary stack & secondary stacks) - mov x0, x22 - mov x1, x20 - //ArmPlatformStackSet(StackBase, MpId, PrimaryStackSize, SecondaryStackSize) - 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: _GetStackBase: // r1 = The top of the Mpcore Stacks + mov sp, r1 + // Stack for the primary core = PrimaryCoreStack MOV32 (r2, FixedPcdGet32(PcdCPUCorePrimaryStackSize)) sub r9, r1, r2 - // Stack for the secondary core = Number of Cores - 1 - MOV32 (r1, (FixedPcdGet32(PcdCoreCount) - 1) * FixedPcdGet32(PcdCPUCoreSecondaryStackSize)) - sub r9, r9, r1 - - // r9 = The base of the MpCore Stacks (primary stack & secondary stacks) - mov r0, r9 - mov r1, r10 - //ArmPlatformStackSet(StackBase, MpId, PrimaryStackSize, SecondaryStackSize) - 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/ArmVirtPkg/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 From patchwork Wed Nov 22 10:07:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 119450 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp6489404qgn; Wed, 22 Nov 2017 02:08:03 -0800 (PST) X-Google-Smtp-Source: AGs4zMbiadSNAVbLTlJG5ZfVLVJ9FhOq10SzCU0ZlzudlQkp72du1m92n/0ANEB6IE9fmwiteau3 X-Received: by 10.84.241.15 with SMTP id a15mr21358652pll.103.1511345283544; Wed, 22 Nov 2017 02:08:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511345283; cv=none; d=google.com; s=arc-20160816; b=MsRmrhYffYoufpD4ih42pieENMYcCzAMozAuCjfZ3wQATJ//SLocNl43/XHTgIGiWZ V9LFRb5N+kbHiDZQgdHiD+BR2qAFRic8VcBn5UUnmX8yaXqqz88CVsSysuauNnOWMwKT YFF1dFgofrJ5FSkWkNnhNJ1CX5XHz8jbdhXJvYK7e8ckpemPMz2AvjKX7POmtJ+aVqFG 1KJZUXu8Lisjh7UXtF5PLdHilwEBn5iEMZeSMqGqqw6RqAabGOcMU5d9O9z9dJPa3JSY sCamG0+yIqQD/RcXmUNoLt7WWWzCJXkiGTsxomIUlshAitd8zek10YNfPXtoKgpmcO7K zhtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=yXszB0HoXpFuX649IdR7vvgN9QFiupVK7tMq2rG5C5M=; b=iseFDYt26j96X299B1dtaBVhjVq/Y1VXxydhlHkrZ4DQmkLJw8+bNmPujFap8NqQUN 4nwv4Z2Dqgm+rfSTwoo9UvkbeeHWbVBB7viPxyGYGwxQ7lsb0THOlh24CCOPZyzDOTRp 1AvPM+sLuJuRAOA88Fuq3vzwQoVj4opmtzl1fEXjvQV7IAY8hM2PQbF7UqFdOGhq+cGD 4whbbxXuHPsiegg0w5Vx0y81I9NBwDjfb7NsdWgWOGu2z4/h0YPOKdsIuJU4F1IkmG6+ b/CSnI0verBkdLGEuMvHmK3SV9czMXmmpHb7YSY0ffnAd0vS1qYSx3pn4+GN2BNE6eyG KtLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=GqykdHjD; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id h1si6156829pgf.354.2017.11.22.02.08.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:08:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=GqykdHjD; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id C29C0220C160F; Wed, 22 Nov 2017 02:03:39 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::242; helo=mail-wr0-x242.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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) 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-Received: by 10.223.170.143 with SMTP id h15mr18975275wrc.49.1511345270532; 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.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:07:49 -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 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(-) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf b/ArmVirtPkg/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 [LibraryClasses] BaseLib From patchwork Wed Nov 22 10:07:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 119451 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp6489440qgn; Wed, 22 Nov 2017 02:08:06 -0800 (PST) X-Google-Smtp-Source: AGs4zMaVZ9N/VNr6H3LrWOv4JjRBQcDljp6RM732GOQ9BwVdv0qlGb1MlD7ewpNVzq8yoDMss05G X-Received: by 10.99.113.72 with SMTP id b8mr20392603pgn.42.1511345286507; Wed, 22 Nov 2017 02:08:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511345286; cv=none; d=google.com; s=arc-20160816; b=io+MOhrmZ/ysmwqbTFWtTLNYKHwX7rmKYJShDCUEKXBYBtTsED4iTbiHio5c+7yeFr A1QxzQdxyYyOuclJbvIjafP7avsSXDv8Cb77lCAsDOHxEL3wwSH7bKWXqvkmLbjfWAdO TAD3h3JGZaQZDqrRLzPT21Rs1bsZ9XC+qrrmVWO44hJkoFqK3JjkcV1IzJs7yMIMQg2r pUpFARph3agWC9rtW2QU7+flgbp77fDOIHe6BQs+1jKwrxyeHsaq8kDYJF20KczeN+vi U4nie48biSiqi5QP+S07DV0bPJrCy+zjhAlCuKrMR5IH9Y3q8jDQQHrqeaA5oHADUGv8 ZZoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=QUigfp/vur4tz4V6Ire43Wctlg8SJ7DjLlyZLwZ0wkA=; b=hYdClzZlUNQV6Hx0QPH2rjzj/s6Y2WN2V/M/2ayrcIrfR8noS8mLKuqn5Pq0SBH96a OqGmY6IVd7baF59i0xYt2QtIQTLv3MAJb4ZqudKhxr6QLKJx2dW5qPf5/gwCrSQZIfVN 31Zh90rZb3o9SQd/K2tcQJXPOmVJG8D/WHXIBQMkiC32QaaXlHyBhqFhW8tXwDMIid/x 4yT1DIi2cvsjH3qUtivmkI1yLUaMX6yPVVEaaEX2a7aSD4z1P8ldttVz8jpQBwsdIcUC UPvDR5yDECWEn6cxQyS0vVSmoXDqyJuGnJ7wrU8ZRVP50E+Pj2pzDWzHqTQIh7//M2U9 EKzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=FYf7VMMm; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id g92si13051064plg.247.2017.11.22.02.08.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:08:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=FYf7VMMm; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 03F09220C1620; Wed, 22 Nov 2017 02:03:40 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::241; helo=mail-wm0-x241.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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) 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-Received: by 10.28.67.68 with SMTP id q65mr3364838wma.26.1511345272133; 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.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:07:51 -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 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(-) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/ArmVirtPkg/Library/ArmVirtPlatformLib/VirtMem.c b/ArmVirtPkg/Library/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 -// DDR attributes -#define DDR_ATTRIBUTES_CACHED ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK -#define DDR_ATTRIBUTES_UNCACHED ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED - 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; ASSERT (VirtualMemoryMap != NULL); @@ -65,17 +60,11 @@ ArmPlatformGetVirtualMemoryMap ( return; } - if (FeaturePcdGet (PcdCacheEnable) == TRUE) { - CacheAttributes = DDR_ATTRIBUTES_CACHED; - } else { - CacheAttributes = DDR_ATTRIBUTES_UNCACHED; - } - // System DRAM VirtualMemoryTable[0].PhysicalBase = PcdGet64 (PcdSystemMemoryBase); VirtualMemoryTable[0].VirtualBase = VirtualMemoryTable[0].PhysicalBase; VirtualMemoryTable[0].Length = PcdGet64 (PcdSystemMemorySize); - VirtualMemoryTable[0].Attributes = CacheAttributes; + VirtualMemoryTable[0].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK; DEBUG ((EFI_D_INFO, "%a: Dumping System DRAM Memory Map:\n" "\tPhysicalBase: 0x%lX\n" @@ -104,7 +93,7 @@ ArmPlatformGetVirtualMemoryMap ( VirtualMemoryTable[3].PhysicalBase = FixedPcdGet64 (PcdFdBaseAddress); VirtualMemoryTable[3].VirtualBase = VirtualMemoryTable[3].PhysicalBase; VirtualMemoryTable[3].Length = FixedPcdGet32 (PcdFdSize); - VirtualMemoryTable[3].Attributes = CacheAttributes; + VirtualMemoryTable[3].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK; // End of Table ZeroMem (&VirtualMemoryTable[4], sizeof (ARM_MEMORY_REGION_DESCRIPTOR)); From patchwork Wed Nov 22 10:07:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 119452 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp6489501qgn; Wed, 22 Nov 2017 02:08:09 -0800 (PST) X-Google-Smtp-Source: AGs4zMaBO04tjXNBsrFgcD50yHkuhubOnO6rQyI9jU7f/fK3QHDBWgJFp9enXnbKTAG2Tu1WiLbH X-Received: by 10.99.3.88 with SMTP id 85mr20614423pgd.111.1511345289277; Wed, 22 Nov 2017 02:08:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511345289; cv=none; d=google.com; s=arc-20160816; b=jBcBZrTjei6kLRsleXzkkDrMPByCP9Fe+E/gmusFPsb/ILzJn/9zj0TVbSOUuetd19 Nvioa+R0MtOwpqi5rS794+TzaY3q5n2KF/b9qfqGpTbqlqyhh/9mf9hqtivEZNhyEPYC b99BZ8TLKJXzfijORPnLm3VNln/fVXPmgDdBZLbO9Tk/ScJobv6R4ES/zfiKsDDIkxJ7 sZAZDOo/ra00t89Lfxyz+9H2M+Zv2+1iu7h4a72gOtWDeDlL/VR7JP/OYmYVEiSRtHbv RKEmOvtewnlDSXPSc0j2Z8+m8ipSxqEaqYJFv1DMqiBBwemqZq6Kw0Jnjp2w0Bbywhxa Lo4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=KFKFXHJsPgk+ntma8GzHNyktsdGEu0b3lfq8fviepKM=; b=Zj4qhNv4MaMV5YyyFO3kFWCoXEe7aDFuM28NW5maQtOCjp5ZT7Xs/MWUVlQ9K7KiD8 buLX/whkz2bQeMpn9uDQQRJ/bsjI4RY+8GXXBU6h9+nW9vkxkAH0EVSvhwSv/2/fAbIu DzW4vQow36ZuVJxiS8PpFQrsFewNH57EL+AC8XNVRnngGHb2HIjVXrv2b1OFy5B9BH63 JySr45pAGT7bEP0hY/+UL5+MOx09pxJwoz0U9//VPgQtOuJe0cAgcgNTKgO9buunmGCv Q3lMCWy978eHGoDBZfvzQIZ3yg12LXqE24r6ycMXY0o4hmkxFUqazc+15y9LGWKPi8xy DReA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=MkHfWT5o; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id d126si14372489pfg.11.2017.11.22.02.08.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:08:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=MkHfWT5o; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 3B853220C1623; Wed, 22 Nov 2017 02:03:44 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::243; helo=mail-wm0-x243.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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) 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-Received: by 10.28.217.75 with SMTP id q72mr3517998wmg.9.1511345273803; 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.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); 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: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 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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 --- ArmVirtPkg/ArmVirtPkg.dec | 3 ++ ArmVirtPkg/Include/Library/ArmVirtMemInfoLib.h | 41 ++++++++++++++++++++ 2 files changed, 44 insertions(+) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Laszlo Ersek 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 +[LibraryClasses] + ArmVirtMemInfoLib|Include/Library/ArmVirtMemInfoLib.h + [Guids.common] gArmVirtTokenSpaceGuid = { 0x0B6F5CA7, 0x4F53, 0x445A, { 0xB7, 0x6E, 0x2E, 0x36, 0x5B, 0x80, 0x63, 0x66 } } gEarlyPL011BaseAddressGuid = { 0xB199DEA9, 0xFD5C, 0x4A84, { 0x80, 0x82, 0x2F, 0x41, 0x70, 0x78, 0x03, 0x05 } } diff --git a/ArmVirtPkg/Include/Library/ArmVirtMemInfoLib.h b/ArmVirtPkg/Include/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 available + under the terms and conditions of the BSD License which accompanies this + distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#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 the 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 From patchwork Wed Nov 22 10:07:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 119453 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp6489560qgn; Wed, 22 Nov 2017 02:08:12 -0800 (PST) X-Google-Smtp-Source: AGs4zMbOnKFpWcdm7cYraAsf91wl+V+iaBdFN4AvPxe5dKD5bU6NH8vgP+ffgURXfIIR9oFO70fn X-Received: by 10.84.130.97 with SMTP id 88mr21339736plc.131.1511345292105; Wed, 22 Nov 2017 02:08:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511345292; cv=none; d=google.com; s=arc-20160816; b=MoJY6Cfj1YBrsW7UxYSBYybN+Rh/JaJODCVazbHq50mHzg9PyvUhDQM22OLexeF2PS mQVjC48cav66Uog+XAi+Uudw74EmUW3/7r/++gooLyHTMRwuuNT31RA5xSK5gkdHlTzF ijwhyvuguSLdu0xL8gu0eNiY377ouSVJElyIEWSG9q3UvamSjHXSYtD5IFVNLODkxNS/ dgszk2wpMN77o0DRVv4Nb39yp/vLBr7L/ILs09di37krpMiqevRpPuY/S42XBc+lwbDB 4DQ6tZo6G+3ss9ntCEofHxYNzYfOg6+7swnXX9Lq5DAqhMqbjIjRE3My/aBnhZjdM6eO 4sng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=sHs6kbZH04Dzq51J9JMtEygKFgG2OR9V64to4xlWfeY=; b=w6tZvPAPEM5EiCw5Cp4aUew2GJDj/bpLknzWyQZGRDBryf+ZZzoKrJr3HSBveym+zr 9HHXpzZIN2pAoNKhOGELvDUJoyzOADtbBQ77f9YnefSVlhDAeXlw7qvscdGvxUb5WWpo ZnL/QikyW0QjMtbesa7e0338T4/+i0bG290IOpWqnvnwbh3EpLAPn4l6aiL5asIYsR2c Y8NZA5a7EpYi5TFju1/AejQ8utjLc3/ul2QfBYxxAxqjB2CHyY4rmH4ZEim0X+8MVwkq w9jwtr1C+26VWGalEXoaX81SZ9eQWvaZ/8Qxm5OZFpy8uO82n72fpEajIFV+eDIs22Ls e1Hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=FYUaRdqW; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id v13si13009346plo.273.2017.11.22.02.08.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:08:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=FYUaRdqW; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 706F6220C1626; Wed, 22 Nov 2017 02:03:44 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::243; helo=mail-wm0-x243.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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) 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-Received: by 10.28.211.213 with SMTP id k204mr3311281wmg.68.1511345275653; 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.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:07:54 -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 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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 --- 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(+) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Tested-by: Julien Grall 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/VirtioMmioDeviceLib.inf ArmPlatformLib|ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/ArmXenRelocatablePlatformLib.inf + ArmVirtMemInfoLib|ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.inf TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf diff --git a/ArmVirtPkg/Library/XenVirtMemInfoLib/AArch64/PhysAddrTop.S b/ArmVirtPkg/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 BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# + +#include + +//EFI_PHYSICAL_ADDRESS +//GetPhysAddrTop ( +// VOID +// ); +ASM_FUNC(ArmGetPhysAddrTop) + mrs x0, id_aa64mmfr0_el1 + adr x1, .LPARanges + and x0, x0, #7 + ldrb w1, [x1, x0] + mov x0, #1 + lsl x0, x0, x1 + ret + +// +// Bits 0..2 of the AA64MFR0_EL1 system register encode the size of the +// physical address space support on this CPU: +// 0 == 32 bits, 1 == 36 bits, etc etc +// 6 and 7 are reserved +// +.LPARanges: + .byte 32, 36, 40, 42, 44, 48, -1, -1 + +ASM_FUNCTION_REMOVE_IF_UNREFERENCED diff --git a/ArmVirtPkg/Library/XenVirtMemInfoLib/Arm/PhysAddrTop.S b/ArmVirtPkg/Library/XenVirtMemInfoLib/Arm/PhysAddrTop.S 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 BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# + +#include + +//EFI_PHYSICAL_ADDRESS +//GetPhysAddrTop ( +// VOID +// ); +ASM_FUNC(ArmGetPhysAddrTop) + mov r0, #0x00000000 + mov r1, #0x10000 + bx lr diff --git a/ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.c b/ArmVirtPkg/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 available + under the terms and conditions of the BSD License which accompanies this + distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include +#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 the 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 != 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 = 0x0; + mVirtualMemoryTable[0].VirtualBase = 0x0; + mVirtualMemoryTable[0].Length = ArmGetPhysAddrTop (); + mVirtualMemoryTable[0].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK; + + mVirtualMemoryTable[1].PhysicalBase = 0x0; + mVirtualMemoryTable[1].VirtualBase = 0x0; + mVirtualMemoryTable[1].Length = 0x0; + mVirtualMemoryTable[1].Attributes = 0x0; + + *VirtualMemoryMap = mVirtualMemoryTable; +} diff --git a/ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.inf b/ArmVirtPkg/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 available +# under the terms and conditions of the BSD License which accompanies this +# distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +#*/ + +[Defines] + INF_VERSION = 0x0001001A + BASE_NAME = XenVirtMemInfoLib + FILE_GUID = 40d1f8f5-4dfe-4e0f-9a15-b1de9dc9f4ed + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = 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 From patchwork Wed Nov 22 10:07:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 119454 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp6489614qgn; Wed, 22 Nov 2017 02:08:15 -0800 (PST) X-Google-Smtp-Source: AGs4zMbxBKxNXslNRdLSRUyaa3E5CAAsyYY7rBxgqokv3nx9+vNG1ibVWVJAFqe6NAHcRFyr6Rgl X-Received: by 10.98.200.20 with SMTP id z20mr18588234pff.108.1511345295412; Wed, 22 Nov 2017 02:08:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511345295; cv=none; d=google.com; s=arc-20160816; b=CTXc18yaK3UFiiNtXFfOjnmQrDX+muTZcceDjD2AX1w4ptS7tbROVMpxPlMbCPDmsB 83/ehcDNRxQKc8xb4ZLqkukROahMjpQ6mPLh4HCcbdDZIL7kYbEW4b+KZ0W9G10n0RfA ZR5mp3qFUnrj8tw2tpWe24ECNGRgmjvoTmnzsAtSPTkjYgNKsoEe4TcX7PGytVW26CwB PJuHXoLXAxmvF3JyqwDNq02karPVLWwinwdKPEUt/URD+QzEilO3U7IO4vy484Ce0R4D I/gICy41wBicvfBy0M9eBrk+3hzsnYmbR9ACobKpWQB6NuBIjgEAKT2AyYTD1z7mYvnG Bh3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=RZqyoXlwL6E1/9+A39dCPcz8wXa+PtfbcaCrjQlwNrg=; b=DlV3esnxZD9D6pp/J8qFZvOAEii9o1RGzKTkH7svMn37BGruD94uPimujJ7XYTCk+K IAOFrY5bU5akBjGTtAkgMIW6o9eEBiK6+RSiJr4VKyvRt1YY5S9InnPeqm1zBWGtjYnL /dg2Yb41G/VO0Ocy3qym8XW3wRp6/EDhvsp1/jab4JDGaWNckM3BGH4Qxywlv4uPv0Yj 9Z/O9PHv9Sme123CIQkjtWpSlsB2BPJ842/XnQmJJWAN3MTzgkxc2+BXVlkMYDgVWLaS uzjoypvflVCeSSfGEexwm0pgbzNGYTK0kTuW8InH99wiGTvZi/qzeR4zI5ygI78U8jMB yE7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=X9Y76jUc; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id r17si13185674pgu.439.2017.11.22.02.08.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:08:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=X9Y76jUc; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id A1D43220C162C; Wed, 22 Nov 2017 02:03:46 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::242; helo=mail-wm0-x242.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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) 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-Received: by 10.28.34.67 with SMTP id i64mr3675047wmi.57.1511345277487; 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.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:07:56 -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 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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 --- 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(+) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Laszlo Ersek diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.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 ArmPlatformLib|ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/ArmQemuRelocatablePlatformLib.inf + ArmVirtMemInfoLib|ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.inf TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf NorFlashPlatformLib|ArmVirtPkg/Library/NorFlashQemuLib/NorFlashQemuLib.inf 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 BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# + +#include + +//EFI_PHYSICAL_ADDRESS +//GetPhysAddrTop ( +// VOID +// ); +ASM_FUNC(ArmGetPhysAddrTop) + mrs x0, id_aa64mmfr0_el1 + adr x1, .LPARanges + and x0, x0, #7 + ldrb w1, [x1, x0] + mov x0, #1 + lsl x0, x0, x1 + ret + +// +// Bits 0..2 of the AA64MFR0_EL1 system register encode the size of the +// physical address space support on this CPU: +// 0 == 32 bits, 1 == 36 bits, etc etc +// 6 and 7 are reserved +// +.LPARanges: + .byte 32, 36, 40, 42, 44, 48, -1, -1 + +ASM_FUNCTION_REMOVE_IF_UNREFERENCED diff --git a/ArmVirtPkg/Library/QemuVirtMemInfoLib/Arm/PhysAddrTop.S b/ArmVirtPkg/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 BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# + +#include + +//EFI_PHYSICAL_ADDRESS +//GetPhysAddrTop ( +// VOID +// ); +ASM_FUNC(ArmGetPhysAddrTop) + mov r0, #0x00000000 + mov r1, #0x10000 + bx lr diff --git a/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.c b/ArmVirtPkg/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 available + under the terms and conditions of the BSD License which accompanies this + distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include +#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 the 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 != NULL); + + VirtualMemoryTable = AllocatePool (sizeof (ARM_MEMORY_REGION_DESCRIPTOR) * + MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS); + + if (VirtualMemoryTable == NULL) { + DEBUG ((DEBUG_ERROR, "%a: Error: Failed AllocatePages()\n", __FUNCTION__)); + return; + } + + // System DRAM + VirtualMemoryTable[0].PhysicalBase = PcdGet64 (PcdSystemMemoryBase); + VirtualMemoryTable[0].VirtualBase = VirtualMemoryTable[0].PhysicalBase; + VirtualMemoryTable[0].Length = PcdGet64 (PcdSystemMemorySize); + VirtualMemoryTable[0].Attributes = 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 = 0x0; + VirtualMemoryTable[1].VirtualBase = 0x0; + VirtualMemoryTable[1].Length = VirtualMemoryTable[0].PhysicalBase; + VirtualMemoryTable[1].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + // Peripheral space after DRAM + TopOfMemory = MIN (1ULL << FixedPcdGet8 (PcdPrePiCpuMemorySize), + ArmGetPhysAddrTop ()); + VirtualMemoryTable[2].PhysicalBase = VirtualMemoryTable[0].Length + VirtualMemoryTable[1].Length; + VirtualMemoryTable[2].VirtualBase = VirtualMemoryTable[2].PhysicalBase; + VirtualMemoryTable[2].Length = TopOfMemory - + VirtualMemoryTable[2].PhysicalBase; + VirtualMemoryTable[2].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + // Remap the FD region as normal executable memory + VirtualMemoryTable[3].PhysicalBase = PcdGet64 (PcdFdBaseAddress); + VirtualMemoryTable[3].VirtualBase = VirtualMemoryTable[3].PhysicalBase; + VirtualMemoryTable[3].Length = FixedPcdGet32 (PcdFdSize); + VirtualMemoryTable[3].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK; + + // End of Table + ZeroMem (&VirtualMemoryTable[4], sizeof (ARM_MEMORY_REGION_DESCRIPTOR)); + + *VirtualMemoryMap = 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 available +# under the terms and conditions of the BSD License which accompanies this +# distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +#*/ + +[Defines] + INF_VERSION = 0x0001001A + BASE_NAME = QemuVirtMemInfoLib + FILE_GUID = 9b30ca82-6746-4a82-a3e6-11ea79df3b46 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = 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 From patchwork Wed Nov 22 10:07:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 119455 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp6489658qgn; Wed, 22 Nov 2017 02:08:18 -0800 (PST) X-Google-Smtp-Source: AGs4zMbfu9kt9SqDE39da629hBQ5xdbPQ4wvbREUNYjAMfEnyBdG4ydMbyIPCdGIPPbm0FMTUd8k X-Received: by 10.98.51.6 with SMTP id z6mr13701662pfz.34.1511345298260; Wed, 22 Nov 2017 02:08:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511345298; cv=none; d=google.com; s=arc-20160816; b=QPCrZu8TvMVleilwAWW5mayO8yXT4Nqg6TXm0b7RSCWN+lia/r7OV9/X06QYHiOkuy dX0yBJZWv7Bx4Up0xW47f9x3XEx+7VW00E4qOzLGRlcdYydIbB0vvUTpCTgPzGiRFW/t nq54wajm223Hx5WbNmdR0gCiZWQo7IJJ8dEYpTNqdrZOpELQd6EpcWAuwyDmTKfJKa9J zOgmsBUVOm3c5kzjbIsnViTPGgEWCeM+BX3boT3+nKZP/pmxpZ2RdAe9vvGDSjIa9Bsn ifQj3apPfo1bVo0KBBY/swpw2iwnzpybdK212kBM+yQ3uJ+m+UllWHkcTA2W1O4ME0Ag qceg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=9T2fDsgQI1cKo4kR04laEtkMZ/tRf9vWvVwaMnOnm/Y=; b=jG49hf72ABbCHvPAgrmJGWjJND12sUe+cE8euqGBw9g9vAuo6/5P4nQ5/iTQpjh4ru /pvY6RaJQZpfFiqtjf1dqdasLpcUuFqJBPMrLwrkCXBGgbld+JxIJHwBWPhVHReD6OIE 9zgcIvKeBeFNW4Xz5J1IcT32KLYno6FwYIH6aIsLz5ZMywdPkb6CWo0e8oV9Jz1bY4H0 vEjxV4qimnI+cF5UFqr7M8Vk80SbE9Px8PRonUyIQA1TDzuhBxxuz/jgde1faZYsxVnj UY5opBXfSnSKoRkNF4PUXTBTey6rrLzIbX/i6NWWGKPvjiqesFz7yLhGgWFYRqtqzHMR MgVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=L9XMHVCz; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id d8si13259161pgt.286.2017.11.22.02.08.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:08:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=L9XMHVCz; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id DEDF3220C162D; Wed, 22 Nov 2017 02:03:46 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::243; helo=mail-wr0-x243.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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) 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-Received: by 10.223.201.2 with SMTP id m2mr12772731wrh.274.1511345279145; 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.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:07:58 -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 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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.dsc] InitializeMemory() [ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c] ArmPlatformInitializeSystemMemory() [ArmVirtPkg/Library/ArmVirtPlatformLib/Virt.c] // // set PcdSystemMemorySize from the DT // MemoryPeim() [ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c] InitMmu() [ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c] ArmPlatformGetVirtualMemoryMap() [ArmVirtPkg/Library/ArmVirtPlatformLib/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 --- ArmVirtPkg/ArmVirtQemu.dsc | 3 + ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLib.inf | 58 +++++++++++ ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLibConstructor.c | 106 ++++++++++++++++++++ 3 files changed, 167 insertions(+) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Laszlo Ersek 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 +[LibraryClasses.common.PEIM] + ArmVirtMemInfoLib|ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLib.inf + [LibraryClasses.common.UEFI_DRIVER] UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf diff --git a/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLib.inf 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 available +# under the terms and conditions of the BSD License which accompanies this +# distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +#*/ + +[Defines] + INF_VERSION = 0x0001001A + BASE_NAME = QemuVirtMemInfoLib + FILE_GUID = 0c4d10cf-d949-49b4-bd13-47a4ae22efce + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = ArmVirtMemInfoLib|PEIM + CONSTRUCTOR = 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/QemuVirtMemInfoPeiLibConstructor.c b/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLibConstructor.c new file mode 100644 index 000000000000..ef8ac6e018d1 --- /dev/null +++ b/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLibConstructor.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 available + under the terms and conditions of the BSD License which accompanies this + distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include +#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 = 0; + NewSize = 0; + + DeviceTreeBase = (VOID *)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress); + ASSERT (DeviceTreeBase != NULL); + + // + // Make sure we have a valid device tree blob + // + ASSERT (fdt_check_header (DeviceTreeBase) == 0); + + // + // Look for the lowest memory node + // + for (Prev = 0;; Prev = Node) { + Node = fdt_next_node (DeviceTreeBase, Prev, NULL); + if (Node < 0) { + break; + } + + // + // Check for memory node + // + Type = fdt_getprop (DeviceTreeBase, Node, "device_type", &Len); + if (Type && AsciiStrnCmp (Type, "memory", Len) == 0) { + // + // Get the 'reg' property of this node. For now, we will assume + // two 8 byte quantities for base and size, respectively. + // + RegProp = fdt_getprop (DeviceTreeBase, Node, "reg", &Len); + if (RegProp != 0 && Len == (2 * sizeof (UINT64))) { + + CurBase = fdt64_to_cpu (ReadUnaligned64 (RegProp)); + CurSize = 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 == 0) { + NewBase = CurBase; + NewSize = 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) == NewBase); + PcdStatus = 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 from + // 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 >= SIZE_128MB); + ASSERT ( + (((UINT64)PcdGet64 (PcdFdBaseAddress) + + (UINT64)PcdGet32 (PcdFdSize)) <= NewBase) || + ((UINT64)PcdGet64 (PcdFdBaseAddress) >= (NewBase + NewSize))); + + return RETURN_SUCCESS; +} From patchwork Wed Nov 22 10:07:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 119456 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp6489699qgn; Wed, 22 Nov 2017 02:08:21 -0800 (PST) X-Google-Smtp-Source: AGs4zMaFAWAki4m7FGd11AdHxtEOPHvhOOTBX25k4pkAgPPKXCSREqjJHZe7s8iHFOUrVujyvaQO X-Received: by 10.159.231.23 with SMTP id w23mr21167337plq.436.1511345301121; Wed, 22 Nov 2017 02:08:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511345301; cv=none; d=google.com; s=arc-20160816; b=uN2VjOSXC3aS4FflSKNadTrCNQowFmWUDIXBsiOIWq2K7j4iQ57tnVdNzL7jV1LIIl rRpoZo9bdjX1Pp2CMv0pqeRDnqMsJljgk8V9C7Jocw8WY8s4dPChpqYRyfkwrmE+foc9 HqEM80zgoR9mk3kbDztIdE2B7I5YFASn/HrUUBnWKk1xAsDaFoX1Cu6mfmLf74/wE5iF NF9lPdYPBi8wkbEAY2fE2IOcrUmeehvf6PRhixGiITn8fJ2rZ5P4iCZOqxjehxFbdeZ+ PWOdJB6wL4b1EvJwTSQS/QCpbv0AKf14sJpgnHAbY+azsUT8EYyPjLjrvGRKzJg7JrU9 yeaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=+Zr+9LQ6B1BNoSD8rGIKkGC/lHWfEsVVXUXxyZgzmno=; b=s4aLDP+TsOdkTURwx9ttIfL6p9ug0fAxS2c2bDe2p1Yi1qJ62TMEilOtqKdNHJIZID m20FQ+7EdNPLAHYzAX2fZDrC71j2jHuxkY0mHxQh2UDHBJbAaihb7iBUdt8FvlbPpnaD VDb6vQF/d2kl8HpgJ8vddd5Z2zJ84FofC+cavj2iYJXUnWpxJ2fm8Wla+4d/QajdO//g +DEtLNGHNWIJE9cxUmBF89vrctmHPWHZIzz9lNTb1s45fj2jC2Y1kgKUmSFbIDJywKV2 DcQ3SmqTyUpLlYy7ljQJx6e1P1NZpqPDP1ODPiAx5VJ4HAPWR2GVHGvEkvw0B99Q7kMy PzRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=WHHkP8CL; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id y7si12858885pgp.694.2017.11.22.02.08.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:08:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=WHHkP8CL; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 22B53220C162B; Wed, 22 Nov 2017 02:03:49 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::244; helo=mail-wm0-x244.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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) 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-Received: by 10.28.143.212 with SMTP id r203mr3651995wmd.44.1511345280934; 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.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); 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 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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 --- ArmVirtPkg/ArmVirtQemu.dsc | 2 +- ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c | 4 ++-- ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.inf | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Laszlo Ersek 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 - ArmPlatformLib|ArmVirtPkg/Library/ArmVirtPlatformLib/ArmVirtPlatformLib.inf + ArmPlatformLib|ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.inf TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf NorFlashPlatformLib|ArmVirtPkg/Library/NorFlashQemuLib/NorFlashQemuLib.inf diff --git a/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.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 #include -#include +#include #include #include #include @@ -39,7 +39,7 @@ InitMmu ( RETURN_STATUS Status; // Get Virtual Memory Map from the Platform Library - ArmPlatformGetVirtualMemoryMap (&MemoryTable); + ArmVirtGetMemoryMap (&MemoryTable); //Note: Because we called PeiServicesInstallPeiMemory() before to call InitMmu() the MMU Page Table resides in // DRAM (even at the top of DRAM as it is the first permanent memory allocation) diff --git a/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.inf b/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.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 [LibraryClasses] DebugLib HobLib ArmLib ArmMmuLib - ArmPlatformLib + ArmVirtMemInfoLib CacheMaintenanceLib [Guids] From patchwork Wed Nov 22 10:07:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 119457 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp6489745qgn; Wed, 22 Nov 2017 02:08:24 -0800 (PST) X-Google-Smtp-Source: AGs4zMZupW0FpW/d0chUTVe05wZ9rMVGbAGpZHTC9wAAxmqgqBj+X44uwxQSrpJAYoclGmWGpzsS X-Received: by 10.101.101.205 with SMTP id y13mr11974212pgv.249.1511345304459; Wed, 22 Nov 2017 02:08:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511345304; cv=none; d=google.com; s=arc-20160816; b=COsmZ263ieFC0r0aYaVgfQIdc+J/fSx1qE7j/JwEvRYYcVk3zjgH8MydbscoRh8LU1 VSLmeQb4dj572PXJk+yNVWL8jwdeOGjMItoGzyFSDwICv/wasi9Jvq28V7IoWDD6Ff4f vodDIUxj7TXnXxF/YczXYylqD5g9/ay7USS1MzqIoI81M2KUKCa3rp7g4gto1d1mbbBG Ap4EW5SE3G46C4dft8H8mJJ2njt0m4MBF9aQXiuXc6Tb7xHOEAKpYWg8XEUWY1HZGAaH NocZov2ceayN/s/c4I2GIO5tpmxyOtjrPjRO/KY84mfxx5djgly/3Tuvq0EG2o2kMyt+ sMEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=DD0xqeMilo9HN1R4CBjJzgdP3zugzagy6gpP1UAXl/Y=; b=iQ3G/mcWLTTDFT2bodVC20fO/c2XRnA99vNpUsX45NbAmNol5cTe81gxvHaoXvJgwI ob09mAKcjsNz9bop4GBB8hSQLMjBNhwNZGBzGY2cJ0SwZhO2TmdRX+GpPOcyMkmrXKoo CZlpkllQksLVw9rC6f6DWD+H8sjynsR9Oe/VTt8uh5UHuH4ma4hdnf852b2H9pSFxtgJ n5cRPQ2BlZkVaM/dcSiVKcVF7q5wEx2BP2VFSxFCOjQvQ71XDPvLaIIzrnqgCOWTH7vI uYIfRJAVK+sVuittgP4a6VqxS+1GAjIsZnaHgIJeUUaszN2ZP2qbAqCBKHvfMS3fa5cz dPxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=j7vXyjAy; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id i185si13086428pgc.175.2017.11.22.02.08.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 02:08:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=j7vXyjAy; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5E5C4220C1629; Wed, 22 Nov 2017 02:03:51 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::242; helo=mail-wm0-x242.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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) 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-Received: by 10.28.61.135 with SMTP id k129mr3336246wma.81.1511345282957; 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.08.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); 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 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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/RelocatableVirtHelper.S | 141 ----------------- ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/ARM/RelocatableVirtHelper.S | 123 --------------- ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/ArmQemuRelocatablePlatformLib.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/RelocatableVirtHelper.S | 140 ----------------- ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/ARM/RelocatableVirtHelper.S | 123 --------------- ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/ArmXenRelocatablePlatformLib.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(-) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.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 - ArmPlatformLib|ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/ArmQemuRelocatablePlatformLib.inf ArmVirtMemInfoLib|ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.inf 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/VirtioMmioDeviceLib.inf - ArmPlatformLib|ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/ArmXenRelocatablePlatformLib.inf ArmVirtMemInfoLib|ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.inf TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf diff --git a/ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/AARCH64/RelocatableVirtHelper.S b/ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/AARCH64/RelocatableVirtHelper.S deleted file mode 100644 index ec6955cf0af8..000000000000 --- a/ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/AARCH64/RelocatableVirtHelper.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 BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# - -#include -#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 will - // point to the DTB image in memory. Otherwise, use the default value defined - // 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 are - // booting via the arm64 Linux boot protocol. Update the base-of-image PCD - // 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 style - // image header at the base of this image (defined in the FDF), and record 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 = (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 == 32 bits, 1 == 36 bits, etc etc -// 6 and 7 are reserved -// -.LPARanges: - .byte 32, 36, 40, 42, 44, 48, -1, -1 - -ASM_FUNCTION_REMOVE_IF_UNREFERENCED diff --git a/ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/ARM/RelocatableVirtHelper.S b/ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/ARM/RelocatableVirtHelper.S deleted file mode 100644 index 27af98970c16..000000000000 --- a/ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/ARM/RelocatableVirtHelper.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 BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# - -#include -#include - -ASM_FUNC(ArmPlatformPeiBootAction) - // - // If we are booting from RAM using the Linux kernel boot protocol, r0 will - // point to the DTB image in memory. Otherwise, use the default value defined - // 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 are - // 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 style - // image header at the base of this image (defined in the FDF), and record 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 = (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/ArmQemuRelocatablePlatformLib.inf b/ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/ArmQemuRelocatablePlatformLib.inf deleted file mode 100644 index acd523bbd2ce..000000000000 --- a/ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/ArmQemuRelocatablePlatformLib.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 BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#*/ - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = ArmXenRelocatablePlatformLib - FILE_GUID = c8602718-4faa-4119-90ca-cae72509ac4c - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = 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 BSD License - * which accompanies this distribution. The full text of the license may be found at - * http://opensource.org/licenses/bsd-license.php - * - * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - */ - -#include -#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) != 0) { - return FALSE; - } - - // - // Look for a node called "memory" at the lowest level of the tree - // - MemoryNode = fdt_path_offset (DeviceTreeBlob, "/memory"); - if (MemoryNode <= 0) { - return FALSE; - } - - // - // Retrieve the #address-cells and #size-cells properties - // from the root node, or use the default if not provided. - // - AddressCells = 1; - SizeCells = 1; - - Prop = fdt_getprop (DeviceTreeBlob, 0, "#address-cells", &Length); - if (Length == 4) { - AddressCells = fdt32_to_cpu (*Prop); - } - - Prop = fdt_getprop (DeviceTreeBlob, 0, "#size-cells", &Length); - if (Length == 4) { - SizeCells = fdt32_to_cpu (*Prop); - } - - // - // Now find the 'reg' property of the /memory node, and read the first - // range listed. - // - Prop = fdt_getprop (DeviceTreeBlob, MemoryNode, "reg", &Length); - - if (Length < (AddressCells + SizeCells) * sizeof (INT32)) { - return FALSE; - } - - *SystemMemoryBase = fdt32_to_cpu (Prop[0]); - if (AddressCells > 1) { - *SystemMemoryBase = (*SystemMemoryBase << 32) | fdt32_to_cpu (Prop[1]); - } - Prop += AddressCells; - - *SystemMemorySize = fdt32_to_cpu (Prop[0]); - if (SizeCells > 1) { - *SystemMemorySize = (*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 BSD License -* which accompanies this distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ - -#include -#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_UNBUFFERED - -EFI_PHYSICAL_ADDRESS -ArmGetPhysAddrTop ( - VOID - ); - -/** - Return the Virtual Memory Map of your platform - - This Virtual Memory Map is used by MemoryInitPei Module to initialize the 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 != NULL); - - VirtualMemoryTable = AllocatePages ( - EFI_SIZE_TO_PAGES ( - sizeof (ARM_MEMORY_REGION_DESCRIPTOR) - * MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS - ) - ); - - if (VirtualMemoryTable == NULL) { - DEBUG ((EFI_D_ERROR, "%a: Error: Failed AllocatePages()\n", __FUNCTION__)); - return; - } - - // System DRAM - VirtualMemoryTable[0].PhysicalBase = PcdGet64 (PcdSystemMemoryBase); - VirtualMemoryTable[0].VirtualBase = VirtualMemoryTable[0].PhysicalBase; - VirtualMemoryTable[0].Length = PcdGet64 (PcdSystemMemorySize); - VirtualMemoryTable[0].Attributes = 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 = 0x0; - VirtualMemoryTable[1].VirtualBase = 0x0; - VirtualMemoryTable[1].Length = VirtualMemoryTable[0].PhysicalBase; - VirtualMemoryTable[1].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; - - // Peripheral space after DRAM - VirtualMemoryTable[2].PhysicalBase = VirtualMemoryTable[0].Length + VirtualMemoryTable[1].Length; - VirtualMemoryTable[2].VirtualBase = VirtualMemoryTable[2].PhysicalBase; - VirtualMemoryTable[2].Length = MIN (1ULL << FixedPcdGet8 (PcdPrePiCpuMemorySize), - ArmGetPhysAddrTop ()) - - VirtualMemoryTable[2].PhysicalBase; - VirtualMemoryTable[2].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; - - // Remap the FD region as normal executable memory - VirtualMemoryTable[3].PhysicalBase = PcdGet64 (PcdFdBaseAddress); - VirtualMemoryTable[3].VirtualBase = VirtualMemoryTable[3].PhysicalBase; - VirtualMemoryTable[3].Length = FixedPcdGet32 (PcdFdSize); - VirtualMemoryTable[3].Attributes = DDR_ATTRIBUTES_CACHED; - - // End of Table - ZeroMem (&VirtualMemoryTable[4], sizeof (ARM_MEMORY_REGION_DESCRIPTOR)); - - *VirtualMemoryMap = VirtualMemoryTable; -} diff --git a/ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/RelocatableVirt.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 BSD License -* which accompanies this distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ - -#include -#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 from - // InitializeMemory (), which only occurs if the following feature is disabled - // - ASSERT (!FeaturePcdGet (PcdSystemMemoryInitializeInSec)); - return RETURN_SUCCESS; -} - -VOID -ArmPlatformInitializeSystemMemory ( - VOID - ) -{ -} - -VOID -ArmPlatformGetPlatformPpiList ( - OUT UINTN *PpiListSize, - OUT EFI_PEI_PPI_DESCRIPTOR **PpiList - ) -{ - *PpiListSize = 0; - *PpiList = NULL; -} diff --git a/ArmVirtPkg/Library/ArmVirtPlatformLib/AARCH64/VirtHelper.S b/ArmVirtPkg/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 BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# - -#include -#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 = (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 == 32 bits, 1 == 36 bits, etc etc -// 6 and 7 are reserved -// -.LPARanges: - .byte 32, 36, 40, 42, 44, 48, -1, -1 - -ASM_FUNCTION_REMOVE_IF_UNREFERENCED diff --git a/ArmVirtPkg/Library/ArmVirtPlatformLib/ARM/VirtHelper.S b/ArmVirtPkg/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 BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# - -#include -#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 = (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/ArmVirtPkg/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 IMPLIED. -// - -#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 = (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 BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#*/ - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = ArmVirtPlatformLib - FILE_GUID = 00214cc1-06d1-45fe-9700-dca5726ad7bf - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = 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/Library/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 BSD License -* which accompanies this distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ - -#include -#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 from - // InitializeMemory (), which only occurs if the following feature is disabled - // - 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 the 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 = 0; - NewSize = 0; - - DeviceTreeBase = (VOID *)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress); - ASSERT (DeviceTreeBase != NULL); - - // - // Make sure we have a valid device tree blob - // - ASSERT (fdt_check_header (DeviceTreeBase) == 0); - - // - // Look for the lowest memory node - // - for (Prev = 0;; Prev = Node) { - Node = fdt_next_node (DeviceTreeBase, Prev, NULL); - if (Node < 0) { - break; - } - - // - // Check for memory node - // - Type = fdt_getprop (DeviceTreeBase, Node, "device_type", &Len); - if (Type && AsciiStrnCmp (Type, "memory", Len) == 0) { - // - // Get the 'reg' property of this node. For now, we will assume - // two 8 byte quantities for base and size, respectively. - // - RegProp = fdt_getprop (DeviceTreeBase, Node, "reg", &Len); - if (RegProp != 0 && Len == (2 * sizeof (UINT64))) { - - CurBase = fdt64_to_cpu (ReadUnaligned64 (RegProp)); - CurSize = 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 == 0) { - NewBase = CurBase; - NewSize = 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) == NewBase); - PcdStatus = 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 from - // 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 >= SIZE_128MB); - ASSERT ( - (((UINT64)PcdGet64 (PcdFdBaseAddress) + - (UINT64)PcdGet32 (PcdFdSize)) <= NewBase) || - ((UINT64)PcdGet64 (PcdFdBaseAddress) >= (NewBase + NewSize))); -} - -VOID -ArmPlatformGetPlatformPpiList ( - OUT UINTN *PpiListSize, - OUT EFI_PEI_PPI_DESCRIPTOR **PpiList - ) -{ - *PpiListSize = 0; - *PpiList = NULL; -} diff --git a/ArmVirtPkg/Library/ArmVirtPlatformLib/VirtMem.c b/ArmVirtPkg/Library/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 BSD License -* which accompanies this distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ - -#include -#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 the 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 != NULL); - - VirtualMemoryTable = AllocatePages ( - EFI_SIZE_TO_PAGES ( - sizeof (ARM_MEMORY_REGION_DESCRIPTOR) - * MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS - ) - ); - - if (VirtualMemoryTable == NULL) { - DEBUG ((EFI_D_ERROR, "%a: Error: Failed AllocatePages()\n", __FUNCTION__)); - return; - } - - // System DRAM - VirtualMemoryTable[0].PhysicalBase = PcdGet64 (PcdSystemMemoryBase); - VirtualMemoryTable[0].VirtualBase = VirtualMemoryTable[0].PhysicalBase; - VirtualMemoryTable[0].Length = PcdGet64 (PcdSystemMemorySize); - VirtualMemoryTable[0].Attributes = 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 = 0x0; - VirtualMemoryTable[1].VirtualBase = 0x0; - VirtualMemoryTable[1].Length = VirtualMemoryTable[0].PhysicalBase; - VirtualMemoryTable[1].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; - - // Peripheral space after DRAM - VirtualMemoryTable[2].PhysicalBase = VirtualMemoryTable[0].Length + VirtualMemoryTable[1].Length; - VirtualMemoryTable[2].VirtualBase = VirtualMemoryTable[2].PhysicalBase; - VirtualMemoryTable[2].Length = MIN (1ULL << FixedPcdGet8 (PcdPrePiCpuMemorySize), - ArmGetPhysAddrTop ()) - - VirtualMemoryTable[2].PhysicalBase; - VirtualMemoryTable[2].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; - - // Remap the FD region as normal executable memory - VirtualMemoryTable[3].PhysicalBase = FixedPcdGet64 (PcdFdBaseAddress); - VirtualMemoryTable[3].VirtualBase = VirtualMemoryTable[3].PhysicalBase; - VirtualMemoryTable[3].Length = FixedPcdGet32 (PcdFdSize); - VirtualMemoryTable[3].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK; - - // End of Table - ZeroMem (&VirtualMemoryTable[4], sizeof (ARM_MEMORY_REGION_DESCRIPTOR)); - - *VirtualMemoryMap = VirtualMemoryTable; -} diff --git a/ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/AARCH64/RelocatableVirtHelper.S b/ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/AARCH64/RelocatableVirtHelper.S deleted file mode 100644 index ce886378eae6..000000000000 --- a/ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/AARCH64/RelocatableVirtHelper.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 BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# - -#include -#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 will - // 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 are - // booting via the arm64 Linux boot protocol. Update the base-of-image PCD - // 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 style - // image header at the base of this image (defined in the FDF), and record 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 = (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 == 32 bits, 1 == 36 bits, etc etc -// 6 and 7 are reserved -// -.LPARanges: - .byte 32, 36, 40, 42, 44, 48, -1, -1 - -ASM_FUNCTION_REMOVE_IF_UNREFERENCED diff --git a/ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/ARM/RelocatableVirtHelper.S b/ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/ARM/RelocatableVirtHelper.S deleted file mode 100644 index f264fa1cf731..000000000000 --- a/ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/ARM/RelocatableVirtHelper.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 BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# - -#include -#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 will - // 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 are - // 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 style - // image header at the base of this image (defined in the FDF), and record 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 = (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/ArmXenRelocatablePlatformLib.inf b/ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/ArmXenRelocatablePlatformLib.inf deleted file mode 100644 index b8cb24514d4c..000000000000 --- a/ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/ArmXenRelocatablePlatformLib.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 BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#*/ - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = ArmXenRelocatablePlatformLib - FILE_GUID = c8602718-4faa-4119-90ca-cae72509ac4c - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = 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 BSD License - * which accompanies this distribution. The full text of the license may be found at - * http://opensource.org/licenses/bsd-license.php - * - * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - */ - -#include -#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) != 0) { - return FALSE; - } - - // - // Look for a node called "memory" at the lowest level of the tree - // - MemoryNode = fdt_path_offset (DeviceTreeBlob, "/memory"); - if (MemoryNode <= 0) { - return FALSE; - } - - // - // Retrieve the #address-cells and #size-cells properties - // from the root node, or use the default if not provided. - // - AddressCells = 1; - SizeCells = 1; - - Prop = fdt_getprop (DeviceTreeBlob, 0, "#address-cells", &Length); - if (Length == 4) { - AddressCells = fdt32_to_cpu (*Prop); - } - - Prop = fdt_getprop (DeviceTreeBlob, 0, "#size-cells", &Length); - if (Length == 4) { - SizeCells = fdt32_to_cpu (*Prop); - } - - // - // Now find the 'reg' property of the /memory node, and read the first - // range listed. - // - Prop = fdt_getprop (DeviceTreeBlob, MemoryNode, "reg", &Length); - - if (Length < (AddressCells + SizeCells) * sizeof (INT32)) { - return FALSE; - } - - *SystemMemoryBase = fdt32_to_cpu (Prop[0]); - if (AddressCells > 1) { - *SystemMemoryBase = (*SystemMemoryBase << 32) | fdt32_to_cpu (Prop[1]); - } - Prop += AddressCells; - - *SystemMemorySize = fdt32_to_cpu (Prop[0]); - if (SizeCells > 1) { - *SystemMemorySize = (*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/RelocatableVirt.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 BSD License -* which accompanies this distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ - -#include -#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 from - // InitializeMemory (), which only occurs if the following feature is disabled - // - ASSERT (!FeaturePcdGet (PcdSystemMemoryInitializeInSec)); - return RETURN_SUCCESS; -} - -VOID -ArmPlatformInitializeSystemMemory ( - VOID - ) -{ -} - -VOID -ArmPlatformGetPlatformPpiList ( - OUT UINTN *PpiListSize, - OUT EFI_PEI_PPI_DESCRIPTOR **PpiList - ) -{ - *PpiListSize = 0; - *PpiList = 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 BSD License -* which accompanies this distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ - -#include -#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_UNBUFFERED - -EFI_PHYSICAL_ADDRESS -ArmGetPhysAddrTop ( - VOID - ); - -/** - Return the Virtual Memory Map of your platform - - This Virtual Memory Map is used by MemoryInitPei Module to initialize the 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 != NULL); - - VirtualMemoryTable = AllocatePages ( - EFI_SIZE_TO_PAGES ( - sizeof (ARM_MEMORY_REGION_DESCRIPTOR) - * MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS - ) - ); - - if (VirtualMemoryTable == 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 = 0x0; - VirtualMemoryTable[0].VirtualBase = 0x0; - VirtualMemoryTable[0].Length = ArmGetPhysAddrTop (); - VirtualMemoryTable[0].Attributes = DDR_ATTRIBUTES_CACHED; - - // End of Table - ZeroMem (&VirtualMemoryTable[1], sizeof (ARM_MEMORY_REGION_DESCRIPTOR)); - - *VirtualMemoryMap = VirtualMemoryTable; -}