From patchwork Fri Nov 17 16:08:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 119173 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp703020qgn; Fri, 17 Nov 2017 08:09:28 -0800 (PST) X-Google-Smtp-Source: AGs4zMah7ITre3Wyi1MUOY7Nrk4vC8cN6skas9RtkdOWZSbOFU/tWjmGhcTI12chijVPJ7YDBEyk X-Received: by 10.84.248.142 with SMTP id q14mr5645022pll.102.1510934968096; Fri, 17 Nov 2017 08:09:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510934968; cv=none; d=google.com; s=arc-20160816; b=NyKj1JT6d/3Vpv3sQ2JyS9MruJQ9exTBsUtv4CPjTBX8QrCSE0ggOkkB2F6VQNX5/+ 603pDNRS/+KsRC+Bixg66TEbf5bBJsCxE7KAV68v5XTxlyya4ED7bi0iofjV6GI8GtL7 8pB0I8722/B544E9oarf7bOAL/2iG554+f7TDADLKO7/WxoKsZ6O2Mauq9ry0N6Jg7MF UBdnBE9qi9AGk1fD3fjuy7LJ71nhlwB+yQtSi0Hv2BkXMqyAhER/SXpfSxHheBVNTzTa o6hdtjC/ngVYGlHXP3BeZUf8WXVyX6QBS47oelfzXrWP1Xg9HJQe+k1XErKrsmrko1hD 0h2w== 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=9P5hBbHOqdQhHgxWMko9EXPheqdIViwk+bjhTjeRhZU=; b=JFSSYBNNZrFsQdX+CuN5wZqrwAqhOJou+lXQIDvmI5gLk0nwomlQ7pHeW512YEE8Ax n0SuQuPduHpIzhc80GEBick8Ndxtv9fqfHjMCvBnXKtRFu96EZhMCaK+zBSWBrD5ZkzG vh7ny26aQX4rF2o/cgHx/lFR0Wf92Y61j5COjZik6BeaeY+PTOQ5DLglKd777QckfrBp SInLY1nsP8FqvNiw7SkIEMahQIGXwZXI2I15Fjax4PSL6JGhaew6uFLwOwqaTG1ycArX edF8jZlIX4giq7g+9S6gxYi17oOeRyVtFs91+UeEL58HFFsUc+urq7eetReZd5cNlB9e XMXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=NEsXJ+Z4; 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 i71si2931492pge.619.2017.11.17.08.09.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 08:09:28 -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=NEsXJ+Z4; 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 B6B292035BB1E; Fri, 17 Nov 2017 08:05:16 -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 4E4502035BB1C for ; Fri, 17 Nov 2017 08:05:14 -0800 (PST) Received: by mail-wm0-x244.google.com with SMTP id v186so7405319wma.2 for ; Fri, 17 Nov 2017 08:09:25 -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=gN89ZOUtoJ0kYY2bMYNYhMXMhYxbPHNRw1Qq6SkO0mk=; b=NEsXJ+Z4rXtFyD/GT5xcpdvPs7bgFDKy7ul52mlR6Q/oOojTHVTtyboumnVq3oters aQ3kpaKk4baw+rUAx7XUTXGkQFIW17wis6pbX+rZd38/UOwMBY7gx9dLWUoD9WF/Dd77 euAiwlmE5zWNxXQjAuc+B0QG7ME/J1a2bi2ys= 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=gN89ZOUtoJ0kYY2bMYNYhMXMhYxbPHNRw1Qq6SkO0mk=; b=dhmgFrP5ZFtU3sXhWG8dmOj8e0lTM4o/gBFN0NAX5cispmXAEAMnMIdNIUSVY92qsx lf8t9VAfYt235VvWL4F/AZC+XSCjtEWVUozHzaO9TBnDDvBaRIoMCvX/8yZwn3ly0Ow2 NABWOzU5OA8NyGS8rNV211g94+uvf8vZ+eg6Ki1CsHgQQZgWup32D/csszaYyUSrfJEF e8vnhTuHDnWSCEeZXSw2w58TdCVZDWkxV1G+BnzAkqX4ACNdhlUf3eiynQ3zMYcD9NBI EqCOkkg8S+rCh52hcIAaO52RG+u7BHuPyLqPQZx9OV+zoqruUMj+g/jeRMco3gwFqIWi LFhg== X-Gm-Message-State: AJaThX7ZujBWKaXGyppcqGC79sjl/zdUxNiNtJEDSlEn/YzOTGEmubvU MMbsnQrsRt7OM+70x9+WhT5TFu5gVKo= X-Received: by 10.28.134.73 with SMTP id i70mr4323053wmd.107.1510934963621; Fri, 17 Nov 2017 08:09:23 -0800 (PST) Received: from localhost.localdomain ([160.167.170.128]) by smtp.gmail.com with ESMTPSA id p42sm5575959wrb.28.2017.11.17.08.09.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 08:09:22 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Date: Fri, 17 Nov 2017 16:08:59 +0000 Message-Id: <20171117160913.17292-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171117160913.17292-1-ard.biesheuvel@linaro.org> References: <20171117160913.17292-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 01/15] ArmPlatformPkg/ArmPlatformLibNull: remove bogus PCD dependencies 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: leif.lindholm@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Remove dependencies on gArmTokenSpaceGuid.PcdSystemMemoryBase and gArmTokenSpaceGuid.PcdSystemMemorySize, the presence of which in a [FixedPcd] section makes this module unusable for ArmVirtQemu. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.inf | 3 --- 1 file changed, 3 deletions(-) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Leif Lindholm diff --git a/ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.inf b/ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.inf index 97b2a4b6e495..e59aef611a3c 100644 --- a/ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.inf +++ b/ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.inf @@ -41,9 +41,6 @@ [Sources.AArch64] AArch64/ArmPlatformHelper.S [FixedPcd] - gArmTokenSpaceGuid.PcdSystemMemoryBase - gArmTokenSpaceGuid.PcdSystemMemorySize - gArmTokenSpaceGuid.PcdArmPrimaryCoreMask gArmTokenSpaceGuid.PcdArmPrimaryCore From patchwork Fri Nov 17 16:09:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 119174 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp703066qgn; Fri, 17 Nov 2017 08:09:30 -0800 (PST) X-Google-Smtp-Source: AGs4zMY178UckdKt4gBLdDIa80acLq5rlJodFz2TLqdpgs4re45LIe8XdrLhwblFkhubk/0Smzud X-Received: by 10.99.8.5 with SMTP id 5mr5592876pgi.28.1510934970051; Fri, 17 Nov 2017 08:09:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510934970; cv=none; d=google.com; s=arc-20160816; b=nOjqBMJrCZR6IDnPPGiKZZwwmAg2Rh7l5KA5rc7EhhOGmTt2KOEBpe53c2Z8KViI6m 07ISE6831GT6tW66RCHsnH58YGrnIcJJCZ45JJwvRuPzrkrWcV6eJWmTvWW3I31A5CrX QNkC47GYO4nUuxZLoOHb3BwW6l+aSj9srPBViQjlqfz9KsRjQTVGlSGKDZjwLLFuG8iD 9nbcL9dEt4vyXMJOHXEpnoYz1mbSY20YpUwGe0z9762cSWxyS4pvFaZaSSZ6PuN3/VYN BzzCGtsOU+JtXelAgxY3Oh4wEK9rrZZO5feR+odQLUAV2OIh6191qp46XhpS2gPx8Oj8 UCww== 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=FdCa1wp/ouHixoykV4Nnwj8ftjxp8ODWYsszlevGz7s=; b=JHR3gxDerxnoEzwU/XxJL3crSJnwIjpf2eBpx9+TvYQscd9mDoY6xu6O23QRv47X7K tcX3dU8zvNWIRCauaEfneEuUUqXy5ZyoOadtnZ0CHoHD0Ne8WBFpfXHohCBIvroMACfX wWLg73HKPJOOpQ+VNwyBb9eE3T5ReCgptgg0icfFwSe3swkuAshtC+f5nTjxJUn9Zd6N iyLrf4NRwGFXQEF7XX3auEMj8ySER+7hS1dAisvlVol1bYxH57vUdUtIfaBxbzwzRXYY oNLsa9D+rHOPaU7kmtYWRRUcH4dngEnvcrcxNlWXQ6l+mNmAjqDfVLGjp7YNREG3d5YT jfMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=IOeipAys; 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 h185si3284987pfb.382.2017.11.17.08.09.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 08:09:30 -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=IOeipAys; 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 0241921B00DDB; Fri, 17 Nov 2017 08:05:18 -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 12A2D21B00DD4 for ; Fri, 17 Nov 2017 08:05:15 -0800 (PST) Received: by mail-wm0-x241.google.com with SMTP id r68so7494262wmr.3 for ; Fri, 17 Nov 2017 08:09:26 -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=/ZFPBiJLG3sYptaNjreo3zpVKelVxQrCTQmswfFSSo0=; b=IOeipAys4uBe8dL1a8YGTk6pbLnrXRSvoXElBYsSO/h5CMvPYKEi5PAfIZtcL+oPVk JmuGE7Y/Et3V60fpd4nXtJIp6eSZvEZ7rWr2qK3Q9k4ZAVhBHwh16r2uGtJg6BJb4vfI ZrPbd6sLL9hgh5AVZ7Q4/JLnSV6wewsnyXzQs= 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=/ZFPBiJLG3sYptaNjreo3zpVKelVxQrCTQmswfFSSo0=; b=jOZqslx8cgUqCMJKzcSd1arsNFvNycME+m4bnipg6FLAto8dopNd6UhFovK22sEvFx iB9QdXet1wrTuq8WqgMnvxFF4PTfTVR+yAjpMKYjPUWJ+hDYyoG5ABUDu4wlArYBQYDB AoB0q5g7Czj2IZ55EqYs23LG2zpUcybIQDE5ZFXa664sXZrjs05Uu43zCoH7DxmaapHr QWwRYC26+23BHWjgz89Ne/A1LOv/4qzwDRwZZXfFr/8/pGlSFgvUjdxtFfPvpRzFm64L MfoQQ/A9Etjhht5SK/lgwI6KXWOySpnofsn8ze+9jx/5ElqoG+l5WXEEmAUZIR3VhryF QuXA== X-Gm-Message-State: AJaThX4OLFzysXM++cugtMSzEwSRunSS3hvUUjvrMCDxzB1JCrmehk0K +Fw9BjQaHDnctn4zEJPlMChmZAPfgaI= X-Received: by 10.28.131.2 with SMTP id f2mr4207961wmd.137.1510934965358; Fri, 17 Nov 2017 08:09:25 -0800 (PST) Received: from localhost.localdomain ([160.167.170.128]) by smtp.gmail.com with ESMTPSA id p42sm5575959wrb.28.2017.11.17.08.09.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 08:09:24 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Date: Fri, 17 Nov 2017 16:09:00 +0000 Message-Id: <20171117160913.17292-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171117160913.17292-1-ard.biesheuvel@linaro.org> References: <20171117160913.17292-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 02/15] 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: leif.lindholm@linaro.org, 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 --- 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 Reviewed-by: Laszlo Ersek 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 Fri Nov 17 16:09:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 119175 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp703135qgn; Fri, 17 Nov 2017 08:09:33 -0800 (PST) X-Google-Smtp-Source: AGs4zMabmlP70/10EKDBtyqhZhra9VmCN4a03c7uiD9SGH2ZI4V16LNTbj1akidf+Y0utPwu38oZ X-Received: by 10.84.163.75 with SMTP id n11mr5669372plg.287.1510934972963; Fri, 17 Nov 2017 08:09:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510934972; cv=none; d=google.com; s=arc-20160816; b=uQmzrrOvVr2RL0KypqUHFMaFfqnJFGF4PQegtfP0jQBUCZiSv3twp7tWsG+BdcmEGM FLD3+a8BFQtDDqyDRbnBq2j5EQstIYAdCmQTreVv3ygynBEFnL7I5ZQWbx6/OXXZUNck c+p7jm5RYV3dim4+6yso/GvDe2xCFU4qHAHP699o+ErB96doE64BYW9SOrhACWuqSEpk g33q7gEz6Km0y6X9ABFm/NG+dX5aLPz/LAzOI4yVmOxKMrrWVW+26N9Q/fHVS+jALAKG ls5pNtGivwtQd61gpdAXto1cSL04VnVIOFeSk60qrf8zr46/rJq/ufIdDBvzEzwdxgy2 y4dA== 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=L3iEqoy+/Ir+lvGptyfwP2Jf0NH1JGqSwc8qBV8jt80=; b=OyaVhIchfpMlN2iA00eWfCVu1Aj1Jf4CC2G44x2eMbLUcSw5t/a86rExlExpGV3Ve2 RcDR+VirBr78qZa6Xgxi4WWzXpyEAOwkp1cr+/Jv+DJmcNyHDgwGIX4OdC5vR4yXpWML JzpQzLpeD8WgnOdRRVm6RhN7i6Go3uvSQUIOvsMTlvs6qPWheNLeHSjEGImOlBTNWGjV Kf/5FNJcHEZxBZtUafz+R2ihXtBnyFlnKzqqVaPtBLK6Qm3G1G7Ykq43upNmZuqE8aWC YUex+WtVxZZb1S0P6OyHcgT3gCLGDbmZOsl4zYJoiEe49WC/zvH1FlESqW06CTZkQaO/ v6hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=c3fU9vrW; 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 k91si2990896pld.242.2017.11.17.08.09.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 08:09:32 -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=c3fU9vrW; 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 3BCE821B00DE6; Fri, 17 Nov 2017 08:05:20 -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 D50682035BB1D for ; Fri, 17 Nov 2017 08:05:17 -0800 (PST) Received: by mail-wr0-x244.google.com with SMTP id w95so2548990wrc.2 for ; Fri, 17 Nov 2017 08:09:28 -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=vRyNhqyzKprfA8ce0aaw0Mtf7qTWwAZkGmqp6Lxp4ms=; b=c3fU9vrWp6hrxSQ3Am8pzRvT45WlkGAVzqE06igVPhTuka9FgNCep7fYT1SzgeEkz0 kvzQ6oLw2o0A9CDMI/WKoSU9W+tOFK4ab7pqezAWMGJX9fCu62rcMqWI5QFS0PbX/13h Z0neJ+rc51Xe/0BYHRKDX72Y+fcQnOBkb7RWo= 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=vRyNhqyzKprfA8ce0aaw0Mtf7qTWwAZkGmqp6Lxp4ms=; b=Xsb1sBZNsBy2WMMIkBvY6gyXPvjhNZUqQY3Y1aSDAqcYd3yKF/A0myf3Eklwp0EYG7 6IkrgXNX9YTJbMUTUeaYVDxGQyclSe/r8dcdc3TNPHZ8rD1cCzsA9xOs2w8pOWVGVvth +9UlfpgmxgxUVOYJ+IJ/Kj2qm1c54dhdv6iKR1za0SnL9vNk01TenhIWGpM1jtdvahvw 5OcNVfUdoh/PNIIUSg2ue7hHXoKLd6T8BPBBs1cXehWBYu7I+KObLFmnT5prg0IvK0EG NFcQahF2dknrbQ+ZmpSqFwnBHG8CGqTYL/EKUEbjFWx83Y74NZB5M/3R+jcj7GgHso1P KbXA== X-Gm-Message-State: AJaThX7caqE1Z0EfYyArlyCs4YY28Gs2TjtHtT28uKVu2raATAIqYfT6 GyjSWNoZxa0C6vKmyf+e65NTfL39ZmA= X-Received: by 10.223.165.67 with SMTP id j3mr5147961wrb.181.1510934967092; Fri, 17 Nov 2017 08:09:27 -0800 (PST) Received: from localhost.localdomain ([160.167.170.128]) by smtp.gmail.com with ESMTPSA id p42sm5575959wrb.28.2017.11.17.08.09.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 08:09:26 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Date: Fri, 17 Nov 2017 16:09:01 +0000 Message-Id: <20171117160913.17292-4-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171117160913.17292-1-ard.biesheuvel@linaro.org> References: <20171117160913.17292-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 03/15] 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: leif.lindholm@linaro.org, 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 --- ArmVirtPkg/PrePi/PrePi.c | 24 -------------------- 1 file changed, 24 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/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, From patchwork Fri Nov 17 16:09:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 119176 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp703180qgn; Fri, 17 Nov 2017 08:09:35 -0800 (PST) X-Google-Smtp-Source: AGs4zMZx/9kh4qKF2OlzFCGR4LgzDKwGXklKFdOY0wzNIM5T22Fpd8e2wl6Rr02EbRdaoZmJsP+o X-Received: by 10.84.235.8 with SMTP id o8mr2276689plk.354.1510934975790; Fri, 17 Nov 2017 08:09:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510934975; cv=none; d=google.com; s=arc-20160816; b=NSP/NPiLDjWtXw3RJcFb0N47/0w59S6GbF7SctdP036fKViPvaLr+QuO47+sr2DDUx PbEZUEdPZytuAPolHB/coXapkT9tNLanRiQaHqROjQ2A3EULOXnT2LFl7HtXSL4cKtT0 S9lJzN7GcdzlMaXSsHwOmLRVmh4mBVX9nhHZfmuKRNiCVfzdyn/a1Fb4iB/P0DJaSRyl Y6UrtbrrtwkSUqVQnvmeLab+pUhQgWO0ZxzrxlWZDeH0WFpXAczercFKYMB60oJ8U0NO 6LL6KrVFnP8R1D41hPQWz5dSjnQ7w79r7eveNpb2GU0YJ2ZCilHXVircG7rcsmEafP5e 75eQ== 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=MxFQUVFA1dnUkdxB1XmcN3DsrvntSZZOUrViUFq93ho=; b=mLPeXSSDf4IFlGsNMT5XQedlhZs4C7zVzAf5PEqK1RK8Uh68jK1HjJck7QQuLhHtYJ emAXD5h5+7KD8iI84tKi3/49O2m0qK77inTUZ96IaR8NDe92BslQtlme2VCpLLwDMXf0 HoH/49370eevmKJpzLjKh6gMCVvJ0NuF9Y0YH+xK47JCkPZ+thXEKwGE/6b1cgLeRtcY uD2uDux6dMbHvqo5T2q0dz03t2umF6yYD/Bo/HwDrce1RCgkQDOdjsSvBJUSZN4A+VkW e8pbpkUs1rlGXLOw1/K9jM4q91/iy/0H4hLNM6H8EHCexYSRtumNiRbqMMrtLKpFknmy FgXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Elga6eon; 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 f29si3272109pfj.387.2017.11.17.08.09.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 08:09:35 -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=Elga6eon; 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 7C33321B00DEB; Fri, 17 Nov 2017 08:05:21 -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 B2BFA2035BB1C for ; Fri, 17 Nov 2017 08:05:19 -0800 (PST) Received: by mail-wm0-x241.google.com with SMTP id g130so3957053wme.0 for ; Fri, 17 Nov 2017 08:09:30 -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=fmr6hK/LcgcK41uLIDdd13QraJfHkDsodJP7FpJYPe4=; b=Elga6eon/xYbu/q3Rnap8PhQgu6AyNzjQYqJQdgG2edQrNTwMXRUA2KrK04kdl6UfI quACD9efYd9B1uFls8DNh2ILkmzfCtt0SJ5fgHXbdeRzSuwRxBQG47bYI/3J8YhZuGzG VcY5Z9KrOdzMlhiuKljPQ7lkDf79zZ2++6HUM= 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=fmr6hK/LcgcK41uLIDdd13QraJfHkDsodJP7FpJYPe4=; b=RIEBDjrMcSv6mbNaVH/cRhpzOHXMr4JALGZuZKKVItND2NMF3NwcBEi4XLIpLNooPm 3gtdJqVsbyOhfAIgwgTViVBMzRYCHLZRQmNt6fG480sVg44sI4ST8MqWfIvNFdozQMt1 +XjlzZzjIW+4KMlsldOj5obCfYpy9iGEbw7aMoCje3+aADYYoQsyOhOBwR8D4EFQzl5S GCGB76GDMQfU/Wkjt7QAdPRNj3kegTP9Fx5tGMMpiXO1/RE0wQgkvbaxbHzC+M59OrtQ E8LUOJDI0GOUuGwIcNsxqxsg9eaIM/9fdrhkQ2UOkyKsosvohTd4pX6Z7K/1i6l35QPy z7RA== X-Gm-Message-State: AJaThX6EB8VFaZFdbWEKQ9i0yyME7Gpm7JFayiF1AgBQA+KDysqa0YUu EINU+s/T48GJ7cVUGriv1WKG0Vfcv0g= X-Received: by 10.28.72.9 with SMTP id v9mr4762300wma.102.1510934969059; Fri, 17 Nov 2017 08:09:29 -0800 (PST) Received: from localhost.localdomain ([160.167.170.128]) by smtp.gmail.com with ESMTPSA id p42sm5575959wrb.28.2017.11.17.08.09.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 08:09:28 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Date: Fri, 17 Nov 2017 16:09:02 +0000 Message-Id: <20171117160913.17292-5-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171117160913.17292-1-ard.biesheuvel@linaro.org> References: <20171117160913.17292-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 04/15] 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: leif.lindholm@linaro.org, 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 --- 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 Reviewed-by: Laszlo Ersek 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 Fri Nov 17 16:09:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 119177 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp703238qgn; Fri, 17 Nov 2017 08:09:39 -0800 (PST) X-Google-Smtp-Source: AGs4zMZ5ZRX1lDmh8hItHKZGwW9DOHHT6NfvrKiBnS20iXWcxAx5WT9t1KVJqo9jj3q9ZjmQcY5d X-Received: by 10.84.130.98 with SMTP id 89mr5803413plc.232.1510934979407; Fri, 17 Nov 2017 08:09:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510934979; cv=none; d=google.com; s=arc-20160816; b=gg+MBGxvwDCnNRNZ3kvmMnoCtpfOmaX0u+7ne960fzI5+PZurOKaJukBb1/tKLDIVX PMb9MO7AmYt0DTimELW64vMGk5HgqZRHdndC49RMohASB4OwZhNTq+3RDnXPhu7i2WaL H8iB1hUojzzbfOVzeWdI20y9tygBP9po7I6wtObpPLMl74QZ7xfJGWw4bsj0z+QDX8e3 1vBnhO3CKixyKx/5RXSPA6sYxAHoYpKJPUniA3l7BunahdxyCvC7byrQaBpOQOlhZcZb Gc36UE5WLzNWJSakqntxGc0M/zH9oit831HAtmw6rAytDVbjap39N0sqY3Fwiu9f/qyU QnXg== 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=iXhDBzuVtLVsTsxuqPicApl+QKwQDXmJvt6BwlT9ZsY=; b=UzAw3hDecpGiHrzSOU56+gGgL2M/A1SUSQSyEyfhBZuknL/OGaNOoyPF/y3JA2P6Ne Lu8IjUIMDEEIJN6Cys22gME2vFBixhjpYNSQZU6mU3XlG4k4BldwCSBLewb+6Xatwh90 e25vpn4MYfbc5dSDzbBr5nh9NcRbooCrqNbh8chGM9z0FfydsBfBq95qv4kc1QOFjYRs c2HpZWRND/PeQ4YGol9r5xbhC1142FLj6zlk6ZO8rKphD706AtFYL1HFgI0Yh5EEPUAw NPBMcdcgZf82xUTLtft7An1E7x4C4QwSwJjzswaUjYH6GSZGq5t7ldR380Sv/24SyPkm kH+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=APpzHszJ; 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 u62si2925638pgc.457.2017.11.17.08.09.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 08:09:39 -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=APpzHszJ; 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 BB52321B00DEE; Fri, 17 Nov 2017 08:05:23 -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 C85482035BB1B for ; Fri, 17 Nov 2017 08:05:21 -0800 (PST) Received: by mail-wm0-x244.google.com with SMTP id z3so7449277wme.5 for ; Fri, 17 Nov 2017 08:09:32 -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=oL0wDEvRjCDBiSTHsLQ65UUjTXVVm3EPcmMG3kQua9Q=; b=APpzHszJdU4HyzCVdILG99gG5wvsKNVJSctTw3Qj2VdHHEKTkh3Zf6yBAcRjGBFsx8 ibpKaYnoILW80E9RmCcWJD1eDvnHs8G6tziJRYxpiUmp8M4O0AXhu4Aprq8dYhjQnIvk mVHLTJUlFoqzptV/0lVFSsKV6J6+mzeiD8tR0= 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=oL0wDEvRjCDBiSTHsLQ65UUjTXVVm3EPcmMG3kQua9Q=; b=fN8zAuX25IY5DvNOnpaho2+qpeqZKZfzQo5S/IFaB+uaw0LgarN4QFLbIZe4nMDuLF 2fGiHkcmiGEQ0xrL9o/n2T73xvt48kXi99lmKM8gs+pTfdNmJMY1ewKwuv9pThb4EXZ/ ugaE2IIQiRVYN+soSgqqhzGN+P2xKLY1Er+BS6oaKauCWykXX/5OYeVZ9Fx+4bXl9h4O 0xGklzH/CHHwjZcXZIe2DiaMcQQAUqW4AxOiCdJqGrKxRQFrnK/GSqY+/sT2XmzBaKky TsChPIY1CeAR8mop7XvFNhVzwxFgBKLFo0+MS+DqvJm6veB3U0RXfQNWUFY84zxZo3m3 Kn+g== X-Gm-Message-State: AJaThX4ILZxb1XL9cumhPPS8lyHGBDTYF2QULw+ZPrbj0+r/rM8rQDpn RwGCMoq49AqcvC+XVU8LNNJGjAyEPrQ= X-Received: by 10.28.167.86 with SMTP id q83mr4422268wme.102.1510934971082; Fri, 17 Nov 2017 08:09:31 -0800 (PST) Received: from localhost.localdomain ([160.167.170.128]) by smtp.gmail.com with ESMTPSA id p42sm5575959wrb.28.2017.11.17.08.09.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 08:09:30 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Date: Fri, 17 Nov 2017 16:09:03 +0000 Message-Id: <20171117160913.17292-6-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171117160913.17292-1-ard.biesheuvel@linaro.org> References: <20171117160913.17292-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 05/15] 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: leif.lindholm@linaro.org, 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 --- 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 Reviewed-by: Laszlo Ersek diff --git a/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf b/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf index 5e706934f69f..1d79b1360c22 100755 --- a/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf +++ b/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf @@ -52,7 +52,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 d3189c0b8a6f..1ba88e0506cb 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 Fri Nov 17 16:09:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 119178 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp703303qgn; Fri, 17 Nov 2017 08:09:42 -0800 (PST) X-Google-Smtp-Source: AGs4zMZW5RnnNNBEbT3+zoBisqQT5VQlqtPhKBbakKvS6SxrY+7YhwZuQ7phWlx+4r6Thds0hRa4 X-Received: by 10.99.191.69 with SMTP id i5mr5566374pgo.13.1510934982552; Fri, 17 Nov 2017 08:09:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510934982; cv=none; d=google.com; s=arc-20160816; b=ONeQ9/voBHkPR6TNrWAkBk8M5fU31Hra1Z5sxjxyKwwEdy0/qbWHCW19t6a1EI5n6u WmZ4GRarBVU9RBllTn28v6i6iSWjrpmc5hboe8AcRHMO2BiH4vr5QT69F/gpQ56zdBBu 0a9cWuEVwJW40OkRZ3ThLmO23wQQ4smlbqoJcQr12x0UNk25ZH5Hf3UsYvOkPrC6R3z+ s4W2sgCdYeaWQJqQTDK1NthcTBG+P/pbNMEQP9pgV0xh0CDB+S8vqtzwXea3IR0yS1g7 n2o30Pi13+MqIQ2satrbsRKOEMJ2P5NuT8aNqYJyY5RaABgWbXp5CTW8JWFyeGlqpAUu c/uQ== 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=RiETZP8GgYtv3ZWFdh42oInpp5xhiWEvym4JRAU73Iw=; b=QJsoPRzrOzhzlQpqebVo96wo/QZ+v0oUjAZ2XB6HVJmOffIIiB541OcMaRUd65KGhG emdqpcP/hfjz4yj1p8TlAHXJvdDVmJtTl0jHhc3ccS2CaFGH2Hz4xckE1ekdO9LGmgh3 iXwVw3WQ8dstr1tAalHN7be6uwUZXQnT4/zcwZ0ovV3OclkYwBorH092UlvKv98BHp9h kkBuQvlKupcpxMd0T/BMxDtwMbHgyXD74CyQlTO5zOYS7s6QWTqBBD1WWhGYZBGrHMQS Oy3DslxmrSETQ79YYU+m2Lp+WIoWaBtq8pn5So90q2OqF6SQey+QmU7Bgjht3uCamqX1 R8zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=O3xXEDEg; 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 l7si2963058pgn.364.2017.11.17.08.09.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 08:09:42 -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=O3xXEDEg; 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 037FE21B00DEF; Fri, 17 Nov 2017 08:05:26 -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::241; helo=mail-wr0-x241.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x241.google.com (mail-wr0-x241.google.com [IPv6:2a00:1450:400c:c0c::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 C0B8D21B00DEF for ; Fri, 17 Nov 2017 08:05:23 -0800 (PST) Received: by mail-wr0-x241.google.com with SMTP id u40so2513188wrf.10 for ; Fri, 17 Nov 2017 08:09:34 -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=JJFCtmCP2dUBYG/+mXY5uNl/YF1w85LZWnWs/Onula8=; b=O3xXEDEgChI1q9Xj1nmPI2qC3bgar4mH6zCKtQocZwdWK5iGlh0VSIEIRzKkqlGrIQ Cflgf0fe1pMtOLn/yS2zUx6ZocOa/qVjZQByMeWomkRBuzWwUJrvn90pDHBRGASgERtZ AU/YgD7uJ/o5w9ebnrxgbhwxJWGe+oaHo9nWs= 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=JJFCtmCP2dUBYG/+mXY5uNl/YF1w85LZWnWs/Onula8=; b=ubQWaB8M6oN7ajTDUOnAiFjrbFtBV6TLyVXCejyurJqp1ZB2YD2lejLLvXFO95BSGZ satIIlSXJMyjeSRy8XqLaWPKhqFWUO2kQrOL452cxtmGA76pbMcSeq6V3/4ecFlveGcu 6di1AxMLdWslU8uoUXilx77k1YXQuoag90gAXAjP3CFymR197Uj4S/bWhyG8T5bEXhzN T7TTjxGOWAXk7DxDTAeFUEm0JDOyMFxoVNrrSb4yCwDd5PLCmgjRed9hf/HWpK3kUjR0 4qd3UzPVAoHF/blWsEn3uNRiwqpJpSCMnVgphV4gs6/Eh68Rq1RpGqhmEFLDXWOgiwy6 6MUQ== X-Gm-Message-State: AJaThX4/bMGETos0/QoPSFeNxW4cWJodzp+e3igvV/G5BdIm3JsiA9S+ cf4VYCkvn8e+/D0aPWhRs+hRgHZd6bI= X-Received: by 10.223.177.220 with SMTP id r28mr4729032wra.83.1510934972900; Fri, 17 Nov 2017 08:09:32 -0800 (PST) Received: from localhost.localdomain ([160.167.170.128]) by smtp.gmail.com with ESMTPSA id p42sm5575959wrb.28.2017.11.17.08.09.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 08:09:32 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Date: Fri, 17 Nov 2017 16:09:04 +0000 Message-Id: <20171117160913.17292-7-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171117160913.17292-1-ard.biesheuvel@linaro.org> References: <20171117160913.17292-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 06/15] 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: leif.lindholm@linaro.org, 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 --- 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 Acked-by: Laszlo Ersek 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 1d79b1360c22..e816e9583da8 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 Fri Nov 17 16:09:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 119179 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp703370qgn; Fri, 17 Nov 2017 08:09:46 -0800 (PST) X-Google-Smtp-Source: AGs4zMYDmGBhI0AQu4AcdpSiAE4+WAafqmYjKgqeDSsAWggPCEEXaQpEjKXDn/G0Ku775R5FAgwS X-Received: by 10.98.204.10 with SMTP id a10mr2619221pfg.18.1510934985931; Fri, 17 Nov 2017 08:09:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510934985; cv=none; d=google.com; s=arc-20160816; b=NRFPAT+P8TJsCNvuH1omIEIxy6BQ2i1zXIw8TaF1+kL0qg22tvJCRWYrSb3mM+bhcW EC2nTam63WU8uzRzzAkN+uuLuNa8hv/F6JPwQtTvTjhgxoWDiuKGpauRdW4R6J32Xp2l FG7+3xpLaPGT7mzVGGlvnGXi1UQQSo046hfzyNR5Xaq8y9RRKYkI4ubQtOM0SqT9IWE8 LHb7nFzHO1T+hKs+8Q5iIfw8tCR19Dx8ICWgKDhUJnOwjM7KrSzre/nQ4yGm1ZDM1QC/ 7y3+abFaQX66+UL7aCcQ6cEqw2669IvfgXWPAca5kXNbhESP5y56R6kplFj+oQCGV2nn r4zQ== 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=GBMs49XX9v03ITCxOTip1xp9nOLlK+4ko7FA+91C+j0=; b=t3Ao2qoHM3LaXW//YKGVGrgumV+WP/2CYB+TFqKVDIpxZrkhGQ8sz7zgXcJOvfKGcC rx5psEZdm45GzwArequ5oq+idf58wgIDapLDbchVk8Nsv13LXi6yNiBrbvSCtpfnTcg+ VrERwK4rhQ0LOVvvwm/m8L7o9hqK98O6JrKXvMY6qOVXGc30LYlpJgDTej8Lq6V7rOn0 PK6PYR1/d4SBwLNy8VHi4sTgEGvWDk3TGvQvGdaklvzLVDgRVvYwcDwd48olAF0p2DVc BjxzaOKBOT8di+XimSoI8zSbTBju6JPVzB3RIBuC82GXH9u6K5ctkbQpDBt8aPXPdo17 QOrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=HtVIksdY; 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 bd7si2930885plb.577.2017.11.17.08.09.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 08:09:45 -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=HtVIksdY; 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 3CA202035BB20; Fri, 17 Nov 2017 08:05:27 -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 B83F72035BB1C for ; Fri, 17 Nov 2017 08:05:25 -0800 (PST) Received: by mail-wr0-x244.google.com with SMTP id z14so2530923wrb.8 for ; Fri, 17 Nov 2017 08:09:36 -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=XJFbcnUCBr1r0ybPAXKexlcLPJ13uvXfBjk2LpmwhyI=; b=HtVIksdYrGB9bxUV7X2PuWV03SXlp1aSs/1z2m02Po+wR3P51Ve743AzFcJuvaVs9l rA2OMl9G7oYbtqIHq8aE5S0aNHLDQtKZOf2f7eg+3B9X96buBsBPtKyudz03t1XHTMdA wayD9RFfWpLVPedzsWFOa8f2S/vHiMV8TQ3G8= 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=XJFbcnUCBr1r0ybPAXKexlcLPJ13uvXfBjk2LpmwhyI=; b=bnHZ5nlolKtWHvzMyJZtxSzpdO6PMze8nlP+UKvZ7B2Km/daJlCPfyqTwtfoCABMwn I/nkce6qvTjOItqGvxrkZdrjgokGneffDYgZX0ilW9NMj1cvkY9u7kyLhnqHdGY6KfJK D6XkIvOhYxOw5t0g2Qfi9ac7JBCvz3Lg2IbkPrezTH5VXEQjBXZkDxsP0ekJ+NYEbuu7 uT8PvgGjySk6F2LCOtfmA4dzsIX/05n5MFN2kC3ef42Dtdq8xYLudAFB+zqArsoF7MNz DqKnn+GAapa7kmLAOTDr83pGWXrb3kOSZasXSm+8uf2rCO2l8nnElnewVCPcXAWH0/9d jm2w== X-Gm-Message-State: AJaThX4BAjPIjSafG1PH1znZIUZENQFCpOPqXHkijQCB7nOSQhU8qoTv VJOtcFoWgDUsolRiUj4tMqcRoSCW33s= X-Received: by 10.223.162.152 with SMTP id s24mr5140095wra.151.1510934974977; Fri, 17 Nov 2017 08:09:34 -0800 (PST) Received: from localhost.localdomain ([160.167.170.128]) by smtp.gmail.com with ESMTPSA id p42sm5575959wrb.28.2017.11.17.08.09.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 08:09:34 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Date: Fri, 17 Nov 2017 16:09:05 +0000 Message-Id: <20171117160913.17292-8-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171117160913.17292-1-ard.biesheuvel@linaro.org> References: <20171117160913.17292-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 07/15] 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: leif.lindholm@linaro.org, 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 --- 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 Acked-by: Laszlo Ersek 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 Fri Nov 17 16:09:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 119180 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp703434qgn; Fri, 17 Nov 2017 08:09:49 -0800 (PST) X-Google-Smtp-Source: AGs4zMaJ8LSAtPUREpVrTh5fKI5AMFWyf3bGJHa0cKmIyYPGstsxziI+KaozYyU27ZISjd9FkaLN X-Received: by 10.84.176.65 with SMTP id u59mr5761124plb.21.1510934989248; Fri, 17 Nov 2017 08:09:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510934989; cv=none; d=google.com; s=arc-20160816; b=URg13ipCW5ftpwbyW4Rz6n15z66KH1+xm+vJKyraMcmCLf63LODZvgtqoxAKqV3wMV NLk09Xzu6CStdn6zp79RScvK1MM85BJTT3spQMAw/V0G0VT0gK4iUkhoPj9F8SNFh3JO h9JHnh5yFlHhJkCI514N6XVox/BchKIQ+8s8dwDlci+v4nbwGkrG4IJdUQgVO7GK6MyM h5H5Yn7xgTs3S/lYpcFivJJkE1J7qDlJbsrnyfUkpTRiHoBBFjLZz8N4ZyCr80N9MNGz aKES0U2c5mUDmktTTBBGLQ17EGzu4J2sjNEnuDjH/fmqTTCKHuxksX7IC+A0lFFpR7Yw XMBQ== 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=jEKldEuaO5ib3SiR9QRvqLc10ckmR8BXqfvKxgT5tXA=; b=Zv6wvFj1MkkyLI3lor/XJR1Ij7XOY0L2WT44RkWXBWgmCcDt2jh5tHb0pEG2COIWI0 sg0PUx5T6lDlMYL50ps8HbjFoXCTgL9Eu5EePWZQeQkpspTX552WWRU/9QK8TP3s41nV RUFLee2oD09ZSLy08XJu1/tmQvYU2mrMTDCOCleqsM2GgFhUEbULzgp6xvaWuUDeFIX7 kb9V0/4r4aclYArCdpwVm3488VISZdyNO/UB6p3Drg2cz5qqqpDNmFDOd4uBNEtB+/ix d8BBJa88LtZa9SXL/TkRFkXbNrTfqrpZ1jzNVhOgkItIoyEV3tplbzE7F8oFF6MBiMeh oIwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=NFQ9Z5ae; 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 p7si1058780pll.156.2017.11.17.08.09.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 08:09:49 -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=NFQ9Z5ae; 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 893092035BB22; Fri, 17 Nov 2017 08:05: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: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 9237121967BFF for ; Fri, 17 Nov 2017 08:05:27 -0800 (PST) Received: by mail-wr0-x242.google.com with SMTP id z75so1190681wrc.5 for ; Fri, 17 Nov 2017 08:09:38 -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=VJrH5RxIrJVOnhVNXhVJF+xedCI6iip9i3X9zBpJkWg=; b=NFQ9Z5aeFMcs2/RAPnNJ+XyyKY96uhqOZ174pzYBZHUjb4/yA2oo7Txz99niP/gwVX SwOPgZXEQKe1CATIBUni6lKVdwUgsnQ35NQi/5cyiAjtnzA3jiqRUjmu7VG1ULKtVgwP Lx3t9+AH/QFgJRCYKTUamVt7+cQ5h3xe3uDJg= 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=VJrH5RxIrJVOnhVNXhVJF+xedCI6iip9i3X9zBpJkWg=; b=hkG140uSfnf5bxSdJqE0Q4L7v2Klv5G6gShR1q0lMc9DFbg3uJCfAib+y5p125TJbv frRkB9vz+wU0Mluvss8df4RXalfp69/ipEquEKRkgE+7IMeHBMf9sD+acAkYe2uOxRiR RZpn8B/VfDydVEK8V+ehWhrLeLeGlM3tU6VjqpdOS6R62NMVBEWwhvTdwQgldpx+Wkn/ hGx+q07rsUBKEXywtejsMAvno5bzkkdxQFswV9QPP0ILY6N1Pht6WEPjE9j1BWDFqJ6e 0m4UoXps7TW7lUTCf45nkrxvSjiB8FpqwzPykVQCIxyYvXeLdqjVAeQd+OvKFELltBIy 9qgQ== X-Gm-Message-State: AJaThX7EF701rRZ7pgUnNeLc5EklzNQn1QBePVXxwMAszcEH1+TSs0ZO hNb5K7WSSmCnjoyD897y5w3FfwJ7mnY= X-Received: by 10.223.142.49 with SMTP id n46mr4698612wrb.279.1510934976916; Fri, 17 Nov 2017 08:09:36 -0800 (PST) Received: from localhost.localdomain ([160.167.170.128]) by smtp.gmail.com with ESMTPSA id p42sm5575959wrb.28.2017.11.17.08.09.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 08:09:36 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Date: Fri, 17 Nov 2017 16:09:06 +0000 Message-Id: <20171117160913.17292-9-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171117160913.17292-1-ard.biesheuvel@linaro.org> References: <20171117160913.17292-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 08/15] 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: leif.lindholm@linaro.org, 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 --- 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 Reviewed-by: Laszlo Ersek 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 Fri Nov 17 16:09:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 119181 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp703503qgn; Fri, 17 Nov 2017 08:09:52 -0800 (PST) X-Google-Smtp-Source: AGs4zMYz8+48URPmf/wNJPIiZYb5lrB1uPDj/ulw8Gk5FrH7VnV7g/SrTSuYmES/CwYRI7mdWdgD X-Received: by 10.99.55.92 with SMTP id g28mr5638356pgn.293.1510934992621; Fri, 17 Nov 2017 08:09:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510934992; cv=none; d=google.com; s=arc-20160816; b=lhn6Ozcs6i7XPl1JelouobS7oVG/3ZqZh/p8oHIF3lgPdymZYJHT0OdpzXs28x8/CG QU5G1BB4PvX0JYXqxcWC9elkt1HWL5co4RK/Ed5J9mwJMwpoFy4At4DyixKMPsSnaaii 0Vyi6yN5rRYIOWkrQtXNbjMnaH4Wrwod5e0toICvY+XfneG3odOO5gfKR3nx/hoO/6jx 0r39hoiFJv95SRd/VE+dR986LXlI+b7YhTBjZ+5N43UiRJe2Tn1CTBhBgO7gttGasB25 JBq0QmwU8BybGCfKyMBZKHrWe7LidcOmIbx1KgxrnpnxmJE8VwOv03nNxVRn/az226qM TN0Q== 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=/gZF15cWuK4inD2ZJmb0Q1KBh8RSTHjJEBjHeM1W3vc=; b=m+nv9ETQ7wHsMNmgjL28380t+Q0Pig8b7yURDhNj4/JyQWlBmQM951saE8Ts0cWIHZ qAZKdAEW8m2hPlYEENtiGJk5Ua0fRc+yk5FOfHc/wrLTWvjK+8Bpe8v2Am4vY/d9Msoz LimkPO1Ej7xMksgnrh8D5JSHhKw83YEf6igbYqPz6dLul5shz+PJj3wqXpqvQORbV21/ /7E9tZUlRpsGsYjd5UHTRIo/IoInCjGwyx3tRLYhSbq9obDt+ycb+SfNRjxyaEWx6yS4 Ffa7g+/rpUibdIQwBz+wlThfnt0gZB8MvykWKINaAYw+Usua9jG+pigx6ROx/y1aKhc1 w77A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ZomGUXMU; 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 e8si2915776pgs.480.2017.11.17.08.09.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 08:09:52 -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=ZomGUXMU; 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 C44E42035BB21; Fri, 17 Nov 2017 08:05: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: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 623DD2035BB1C for ; Fri, 17 Nov 2017 08:05:29 -0800 (PST) Received: by mail-wm0-x244.google.com with SMTP id r68so7495636wmr.3 for ; Fri, 17 Nov 2017 08:09:40 -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=aAe7bvypbVrUcCBMsziDXYOI2cMdEGHa3FLlqUVBDp0=; b=ZomGUXMUemmzPkQJZTH5MrahoproY6WnAcxGCnp8I99ImPTs7LreC+0YFflUs9JBWg +rP/0eLmabYI1yATxwq7PSMkAxd/IalotUpF7WC3D8hWqZENTN425HjJFPKbL04WS3uE qInyvsQfVjctfxqrB/awB2A98KL2+BW6IA6vI= 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=aAe7bvypbVrUcCBMsziDXYOI2cMdEGHa3FLlqUVBDp0=; b=MKXuPJ7MlkVgEIKUMKcYsHZjO2Duq9laFolIKU6GBlp/3mgV5CGehDyCfefh5Ifcda Zvt54rwuc+ZqyoItsv4OM8iw+26XPHdOPCgRTxA7VFB1+U3W+Za9zpQFxTgWFrF/3HYk fqw3juWhG32emO2IR2xZ7P5KmsluLZmkVA664OsIN6e/jUy4ASkNwul7hVDJaNd0r+aX 0DSHF4XQSUxGgB86JUg0ReuGtwNLqLoMU3II/j31xkIbf/jNNpqLZqRGOsig5iT9uCuX LBY1SxNCvWIhlQZ925ZPHE6SzvYJHZnDPuuCh2d9/B3lel7vMj9kLEmt8OlixcdU8ltV 9nIg== X-Gm-Message-State: AJaThX4C9CY2NLRaDEkzm9D/GdHxY1nKslB3vn1jJcuhg020dgzh2Lvo mnqSmUFi2iW+stI0CIrHO1anHatJo+c= X-Received: by 10.28.232.130 with SMTP id f2mr2903852wmi.46.1510934978651; Fri, 17 Nov 2017 08:09:38 -0800 (PST) Received: from localhost.localdomain ([160.167.170.128]) by smtp.gmail.com with ESMTPSA id p42sm5575959wrb.28.2017.11.17.08.09.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 08:09:37 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Date: Fri, 17 Nov 2017 16:09:07 +0000 Message-Id: <20171117160913.17292-10-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171117160913.17292-1-ard.biesheuvel@linaro.org> References: <20171117160913.17292-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 09/15] 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: leif.lindholm@linaro.org, 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 --- 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 Reviewed-by: Laszlo Ersek 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 Fri Nov 17 16:09:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 119182 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp703570qgn; Fri, 17 Nov 2017 08:09:56 -0800 (PST) X-Google-Smtp-Source: AGs4zMamFIfgn0QodikZ/Bxh8/O8xeukvb/RqCR1BVIuxXlvVz6F6DW3bUjlVrKiKl0s1ewAYmzv X-Received: by 10.159.245.148 with SMTP id a20mr5641981pls.202.1510934996245; Fri, 17 Nov 2017 08:09:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510934996; cv=none; d=google.com; s=arc-20160816; b=NIe152rxqLTzuCcv5cP/iUPzkSPA0jWG5+jgc/u/PJasRKUKhTXfw8yARIdsLV/jyP SSXF3nRB/9Sy6BsKc7cAtyOTSXNKTV2D9AJDpZvk4YlqdBOa54Lv4IhO8ylbCJFrvlaV RjDZaJjZWMCEhqaSWZxRgavzDQYcRHeOCKlnmfzVNb2hpGqIqnkd7HLLFu9B4gQMSiuh BX8+9Ci8Cx4QWd7orU4KwM/Um+GoSTAV588AiS1T7oZ7qdF9EVN1EeLt1gGFQdDuHgbv wFmcie05rI/Zx1km2WI92PMLMioHNgICCtK++lQ0/mJsb3FYAw1IyEFaL4mKsTMws5WM Bx7A== 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=1Xy1pHc+vKBewIe2J+lJM6ppxXMY3q0sq+thWQJobbM=; b=fW0GE4Ej6kxAC7YT2Uc1XuJvVH6JjeX4Fme4fkp3uqD2KCzXC0toS1IFmUq/LNwN5H Bdx8JlhHNisLgvujzDCB1p47mXAHaaigtkN7GuiLFffZBALQIKJ7HsbrqOIO+DxqbVwA uc/h/OvClryiDkoppNaXS/tM8CqfmcDEDRICwuIJC8FcqnOZcU04i+E0aGcqIS9VibjO NcTyzBMUeyivUKcmSlHeCEUwDyK8Lj17vDwZjeq6EM+DYx/UV3KK0SNphXzOld12LKWP Oeyg6VpYnZzdD3vWLTW7ugw2aJUNbqsQ2JcjiMXqAjaKkGypeH/YkDVJd6ixu7iG6r1T BMtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=X0XpSckf; 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 r66si3270104pfi.217.2017.11.17.08.09.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 08:09:56 -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=X0XpSckf; 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 0AB7B2035BB26; Fri, 17 Nov 2017 08:05:33 -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 024E92035BB24 for ; Fri, 17 Nov 2017 08:05:30 -0800 (PST) Received: by mail-wm0-x243.google.com with SMTP id b189so7481340wmd.0 for ; Fri, 17 Nov 2017 08:09:41 -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=czegQEplayVd6OVuFpEeJbO+lbibqGWFW6iKBUYI4a0=; b=X0XpSckfG8fqBcHPjfGSIpdFWFv9pnWnGA5b0SReivt+YJGeYUn8k9Kdk2fNNC0Gyk rqW3mnD2o1RbZyWYw1qkXkR/m7+WAyES4s7VAedy6hqN06Ye2VALf1tA8afbO2fOF316 T5qhPn4MTECcub2nbbZTwhUuvoqgVOcyW5X7I= 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=czegQEplayVd6OVuFpEeJbO+lbibqGWFW6iKBUYI4a0=; b=Xp+l2p8NWAy7GgBHFCqjjaVcjenjHWQIwDU0qzmR1A5z1xRe+m0U961xwS+kFwS8WW YMjfE1ms09/JLV6zmMDgScsTVd+WJCdG8k3cQ7KX5QseiXtrQ2A0GM1E2Fb+3idAXxLL Eovndff/MDSi5rNzpmm1K89QAfPfRZ1mhQGeyydi4bPjGmpit9pF38qlA2bxbOscYJoV sEV6xIH4AMVOuIlSw3Ai1+O+o/Uwylexrt4V7ZFNo9CjZJcx2gyEmlm23Omudc+hzsBR //udr+fcqqouy697Nc9R5wXvU6FxSHIG8tvidgBFTurq1iOm2ytoc35J8Vjb1VMFSKIS NTYg== X-Gm-Message-State: AJaThX58+ggbaHwO+u2ZSlGC84Wj5alM70VhOZWr+1hdiAF/+t61boQe Asjn9o8JSJpdiJr35lWiOUfR6k9cups= X-Received: by 10.28.30.151 with SMTP id e145mr4274632wme.8.1510934980218; Fri, 17 Nov 2017 08:09:40 -0800 (PST) Received: from localhost.localdomain ([160.167.170.128]) by smtp.gmail.com with ESMTPSA id p42sm5575959wrb.28.2017.11.17.08.09.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 08:09:39 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Date: Fri, 17 Nov 2017 16:09:08 +0000 Message-Id: <20171117160913.17292-11-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171117160913.17292-1-ard.biesheuvel@linaro.org> References: <20171117160913.17292-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 10/15] 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: leif.lindholm@linaro.org, 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 | 39 ++++++++++++++++++++ 2 files changed, 42 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..65be2cbd8082 --- /dev/null +++ b/ArmVirtPkg/Include/Library/ArmVirtMemInfoLib.h @@ -0,0 +1,39 @@ +/** @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 + +**/ +VOID +ArmVirtGetMemoryMap ( + OUT ARM_MEMORY_REGION_DESCRIPTOR **VirtualMemoryMap + ); + +#endif From patchwork Fri Nov 17 16:09:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 119183 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp703639qgn; Fri, 17 Nov 2017 08:10:00 -0800 (PST) X-Google-Smtp-Source: AGs4zMZB+o/kTKyhfFpFMUIORZIwRKilxf8qi3ucRJe4stHmcOL44vbj8HxvF01TrzFAJHLYHn03 X-Received: by 10.99.165.79 with SMTP id r15mr5575926pgu.280.1510935000680; Fri, 17 Nov 2017 08:10:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510935000; cv=none; d=google.com; s=arc-20160816; b=n9la4pP0UODhMwlIjdo/2Fkeu3aSPtIoEb14mJg9tXcOuZKDSdfjk1OLHp8asik20t sa4WQ0Z7FPVz8GWUppNzbxFj//obnWwkNWxFtGWHgatX75Ojp5LFECIfDt0jq4M18mDG yohcwWv0JjfPS3jdyKXqy47emlYT4Q1nCWRSvtt7DDWnB6qcmyiS64wf8oMErwImfneT ilLOqn2ACOtgadBeh1D4Pe43cfoFYkalt0ww9UeRvBKfMuibuSm3+cb/WWpP7qkXcr8V krBuHR++vcGqehLe8UznnZDB5v8KrQu34ZNxe6QmT2GZ8wllXgoAFSJRnCbkKrPby9WT rXfw== 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=bY1yAg0DynvE7hoIZq7czJuHmFGHwQNCCdgd+HXZPOU=; b=xfcET6E0JbT9sF+v/JWnsAUJfHOaaQv7KUl7lidsh/h4gaa7bc/xfNgNtuy2b0LSVf CsAdTHzuR+ivAKBdonF/q1CWsaL2ejMyas8tbPgCYlrzAoAUc7wPWshbaD/5e7mkFmbo ipfBbRizcSG7KVGikb8p9G1Rj0pFMUJxy5iWFFqKhO4sR5ytK6Hf+wr104oRw/3wIfe+ lvAOQE6n7WPX0lnIEDdbHv4ICLbBfEovPGRwkm6gIy2nMFSv3eZmgrxrZKtBmrpBZcpt aELpY6wxcQt/LillZi1WiBxRDcuFkCjdZZ+g/uaog71HBDI96n5gJ/GA/nMOWs5wFNnM l/CA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=O0FtIFAE; 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 g5si1881737plk.466.2017.11.17.08.10.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 08:10: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=O0FtIFAE; 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 45D472035BB2A; Fri, 17 Nov 2017 08:05: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::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 3F26A2035BB1B for ; Fri, 17 Nov 2017 08:05:33 -0800 (PST) Received: by mail-wr0-x242.google.com with SMTP id o14so2527074wrf.9 for ; Fri, 17 Nov 2017 08:09: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=DHYPsHUyJnkXwOtAyJVkdHe735EJ8P/Ym8cSrOQOGYU=; b=O0FtIFAEB3M9otyY/w30bgialXYQGMaKjz6LTNDhwJX5ule4iDBe3Pqjw9xM3Ie2ET gZbVEG/oT+2bZ1kPYzgLQOkEoGyz5zn4hOWQ1QTLdKT+ho1TP5vbBS+Tq5W2LQaGdm8S syOxwG7nh4bKjvc+0eI8nLWVa31hyv0xudhrk= 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=DHYPsHUyJnkXwOtAyJVkdHe735EJ8P/Ym8cSrOQOGYU=; b=dhUrwtpGckDxVgYDArrJO7OCVFARyNqKyz13S6U0bhX9hCkoOfS+40Bn+U9OzaTQ5U ffby7a+7VZEj/N5U3vlvOt+BRbcGtB7zNpau8OjYM7za5h0AcOiBvT6Wea/sdL8y9tZX m8r5OUac4kyJnKQDYBi5U4KccEig6wwXH4ph/kFxYGFPuF78pzb77QF2iV6oXgpzybAM rUsvr4Ltuty5+ZN22jQB//Cc/V0Zv6SScG5jUV1pgxDCSki7Z6UVuzUl5d35PvcwISul w8WGT/H0j3BzeTaXNE42C60tSHgAxB0NIhieKRbgxoHDi3Mu9uZVK0A7Sh73vGwVK3sb EthQ== X-Gm-Message-State: AJaThX4n/aPuq8tsJOBLPZ9zgZIQ/TN14agAOulw2MEWVxMWzBvqe32f kg1GBKIXojrnuCMy+GDylcnEfQ194ik= X-Received: by 10.223.172.245 with SMTP id o108mr5329765wrc.122.1510934982411; Fri, 17 Nov 2017 08:09:42 -0800 (PST) Received: from localhost.localdomain ([160.167.170.128]) by smtp.gmail.com with ESMTPSA id p42sm5575959wrb.28.2017.11.17.08.09.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 08:09:41 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Date: Fri, 17 Nov 2017 16:09:09 +0000 Message-Id: <20171117160913.17292-12-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171117160913.17292-1-ard.biesheuvel@linaro.org> References: <20171117160913.17292-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 11/15] 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: leif.lindholm@linaro.org, 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 --- ArmVirtPkg/ArmVirtXen.dsc | 1 + ArmVirtPkg/Library/XenVirtMemInfoLib/AArch64/PhysAddrTop.S | 39 +++++++++++++ ArmVirtPkg/Library/XenVirtMemInfoLib/Arm/PhysAddrTop.S | 24 ++++++++ ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.c | 61 ++++++++++++++++++++ ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.inf | 41 +++++++++++++ 5 files changed, 166 insertions(+) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Acked-by: Laszlo Ersek 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..cc806b474560 --- /dev/null +++ b/ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.c @@ -0,0 +1,61 @@ +/** @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 + +**/ +VOID +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 Fri Nov 17 16:09:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 119184 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp703752qgn; Fri, 17 Nov 2017 08:10:06 -0800 (PST) X-Google-Smtp-Source: AGs4zMbT864ySkvrqw/2zrikQk8JdF/HeC6Wszu66tIcxUMv9Minb85AV2CS9PaGjIbV07Z2d/OS X-Received: by 10.98.159.210 with SMTP id v79mr2553026pfk.162.1510935005929; Fri, 17 Nov 2017 08:10:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510935005; cv=none; d=google.com; s=arc-20160816; b=uLlceh60Nqf/JD8DciAVD31oyhrrqCzBC42lmwL7VWekhPqtuYu1vS3XE6W9LceXTZ OXKb07VP1DUWv+jhlOWJtor5IJN3kotdK/fCbwPP5XmslRpPuYJnaXSTYJGJec58nXrV aybCvmyaY5AG89g7L1KPwY5BcegljbTgyeHOZdAjnWCQejQ05QusBTuLBVb+vLvpqQGk O7ZF922W/2rNOWmpOhdselxPcQejVJx7fv1rUXTMBL9+1ORv1Q4WTlu6BMSqi5myu4uU rB4xsoUWFrMZDYUVuE6+//H6yp3rL3yQt/g/KvMiUTMPA2Wkik1zgwxp5DASBaPf8GU7 NeLg== 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=H1HZlg4dm0/WnObmRBCXpc6mAEh5uZXJ8xui2ONLZhA=; b=hKfZEBlTPGEpONxQt/1pMdL9G71x+bh1o7OLmn6qMcgFhY2+T6x1sxup7c9GOOJJCi QgDE+xKZwvGcmAOxwvAZztQeCpwgFS4fRtwP/zrvNwOyBekH/fx9ASiCm/GmDnebjRzQ jt2sa1E6zzEKzy+9dVokPYSJjcvIUTnwEu16wI8oyb4ZJ3nxEJ8PDzIHRD+US8Xj5Kty Eo6Er4P5Zy7p9+ir2+JMqtJu8wEgR13hLPC/5uhHqLjBAPAXEniXebCFyNHnCEo870/m PJ6eXMuPjw4ASw/yrt0L5Jfk4C1RLM9iB72IZejAph2rf8rJHNLAGUeGBJ/Q9S0VOiNW 1oYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=gyHS8oFA; 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 y12si2981506plt.175.2017.11.17.08.10.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 08:10:05 -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=gyHS8oFA; 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 7FAF72035BB24; Fri, 17 Nov 2017 08:05: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::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 CF9DB2035BB1B for ; Fri, 17 Nov 2017 08:05:34 -0800 (PST) Received: by mail-wm0-x243.google.com with SMTP id x63so7455921wmf.2 for ; Fri, 17 Nov 2017 08:09: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=C+BFjaiJILBKPy0g98gmJQ77ngSoX4OhYhbCR3enxGw=; b=gyHS8oFAzcsr/4zy4wSjDejEul//0B5OjfjhqpZc6EgAhX9Mx788soVPFdONPwGHix loPQIKaJ+h8p0dQrVcjBEnZChaJvpE9c3jDIefFLIiLW3X6FDf0JUmWqIsFlORXBhujr MomIgnBYB4PJYfzb8ybXK9cM6HJg25GZ9fjpM= 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=C+BFjaiJILBKPy0g98gmJQ77ngSoX4OhYhbCR3enxGw=; b=MoHxnTvtElKGdzfQU+AdSezbo9NaO8XchFJLZ5LhD9SsI15SRzrg1VzLuf4sxav4r3 h6ds4r0m5aqJB3tRR9a2Xqp3tgtZEn8ZnxpVJNV5vw9AGXTmKMMbw2u+D9aosgc7250M QvK9dLWZnwxYXW5UDf1gS1JB0i3LVLMqLSOKFWpwIkb1ehqwhELMSmZ1CQmnogfuWewD VAuyL6suk0eTmVDyXZpU/JxJ9PhJ7YNid52GHNrSG73/jKmAvQddHNoiGezMSSZMqIIb 2OcMAtMBeN2DdsYeVEsGJHbOn76Y2NSqar+m4RcCc+6MMIdUBIH30Lc71+vnIEfNGdYx KsVA== X-Gm-Message-State: AJaThX57L9+8lsB/3dPdrXAbx8VDrdnCJCM9Rc1W7aKDgPpEvS416geX ryk8HcRlNBWHKAbPtxjz30FArgyjoq8= X-Received: by 10.28.45.214 with SMTP id t205mr4626624wmt.94.1510934984047; Fri, 17 Nov 2017 08:09:44 -0800 (PST) Received: from localhost.localdomain ([160.167.170.128]) by smtp.gmail.com with ESMTPSA id p42sm5575959wrb.28.2017.11.17.08.09.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 08:09:43 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Date: Fri, 17 Nov 2017 16:09:10 +0000 Message-Id: <20171117160913.17292-13-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171117160913.17292-1-ard.biesheuvel@linaro.org> References: <20171117160913.17292-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 12/15] 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: leif.lindholm@linaro.org, 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 removing the support for uncached DRAM mappings), and turn it into a new ArmVirtMemInfoLib implementation. 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 | 101 ++++++++++++++++++++ ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.inf | 53 ++++++++++ 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..b08305fe4a4f --- /dev/null +++ b/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.c @@ -0,0 +1,101 @@ +/** @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 + +**/ +VOID +ArmVirtGetMemoryMap ( + OUT ARM_MEMORY_REGION_DESCRIPTOR **VirtualMemoryMap + ) +{ + ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable; + UINT64 TopOfMemory; + UINTN TableSize; + + ASSERT (VirtualMemoryMap != NULL); + + TableSize = sizeof (ARM_MEMORY_REGION_DESCRIPTOR) * + MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS; + VirtualMemoryTable = AllocatePages (EFI_SIZE_TO_PAGES (TableSize)); + + 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..8f6ba006fdfd --- /dev/null +++ b/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.inf @@ -0,0 +1,53 @@ +#/* @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 + +[Pcd] + gArmTokenSpaceGuid.PcdFdBaseAddress + gArmTokenSpaceGuid.PcdSystemMemoryBase + gArmTokenSpaceGuid.PcdSystemMemorySize + +[FixedPcd] + gArmTokenSpaceGuid.PcdFdSize + gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize From patchwork Fri Nov 17 16:09:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 119185 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp703841qgn; Fri, 17 Nov 2017 08:10:11 -0800 (PST) X-Google-Smtp-Source: AGs4zMb5aBv3HCzzSTKUWg8zLFz1OLE70R/6c0jJMx6hlg4Bv90v8W/KPPxrM2lDry361497CCP6 X-Received: by 10.98.59.139 with SMTP id w11mr2608632pfj.188.1510935011139; Fri, 17 Nov 2017 08:10:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510935011; cv=none; d=google.com; s=arc-20160816; b=eyLwfNxLDHCsOek8enGeFuz4DdHEAPbMzDMhVBhUQvg+A7KWWVI7C7M8fV8IktwTNc 9LqQ5GdgLjTbAXaMzINjjXE3YxgaHudqhwXC5hYNomJTV9n/nU2O1oOOEsZ0eHoD4y61 RD+o3g4SkSD9GhQIEK2v8HNw3YLEElnhNMsrVt562w/IhfamXYt8PYhFmPcTyy0zQIrz neCUJrDGGBwaREv0yTz2lVnSXbP7DYl+SCNDYyARwUqsxBL3NtHgc/YWF3z/SsXadcry g7vaLEmdt7QE75ovAy3bhsdWLhFe/gHAArYdprtJbN2FSsowMqZ0PLe59KEpzEhtOZgN pbyA== 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=czgY0b77H57+/LbtfMoxSHphuLOvymNobeAKt70oepQ=; b=TWUai/9ndklBLZwB/qGLoSIzH83Ks5HHwl8Fz9S8W+BwYvkfk2L9ToHTcJlcdlC1b1 DRCQBh833lvbNr5g1QoXmC3OneUMrZjZTf9bft+aKBLkf3xM3pLf9wwaLiB5bpXMtlQC hT4rnEKuwFEjx11Yjuc82ckfUO1OcHUPiNSMnE+rkZ6j0hTRf5eMWzeYDHAkYc40/Q5n fKFAPVF4+NI+LrY5HMtIYbmqMtwM4AB4kWLlGwALRRLfp1+bGldbFyXPNvXC7AI9FW6M 3SltYllMHZO7RQyEJfF7ut7dyYXqqlNif/YJxOXUy4oJ/VyVv8isdEd4VKfdExV5XMXI TLaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=BOlCG2vf; 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 y8si3053912pli.714.2017.11.17.08.10.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 08:10:11 -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=BOlCG2vf; 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 BB11A2035BB2F; Fri, 17 Nov 2017 08:05:38 -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 0F2F52035BB1B for ; Fri, 17 Nov 2017 08:05:37 -0800 (PST) Received: by mail-wr0-x242.google.com with SMTP id y42so2547599wrd.3 for ; Fri, 17 Nov 2017 08:09: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=elXGuBIDcJQpuC57Kto6kn/sPbmenb3984UQ8RqD/bw=; b=BOlCG2vfwf5sl4MtPd+7r3nbKqxTL+kOLaDVQ+e32qDq5vLm9w+6eBX8KstezYtI+E 4KNQ22wIiQsyc2pQ1kM6/OhtESxEDe121Sdktrig5z2KqPstfmxDcakxzALdQxss8ajz SHM7amW9qcYHc98qCQsotGrzIA7sb3CMn1w14= 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=elXGuBIDcJQpuC57Kto6kn/sPbmenb3984UQ8RqD/bw=; b=qgZue1D7pg3FmTl0lkITgXqhBHgCyKLMTlAThuhx+LYawR9SZo49pnr42Br4GRJN6a fRozqnyCcu6m8LQsjSiBapl3xwuRDB1Z79/jXtFYa4bb3cxAedW1U5MvxsAMiG9uOuTB OwygQw0qJ0nofWzoCnZ1XsJurdhUd/XoI1tpSTUz+2wt4lUO13QVRWP3hzfAMMYSyOlv /TFYhspzf5bhvHUp8VU3JOD+J2XqKVoY2tYL2/SJP1SlyjBJ44gvn9oIU/nK8tvGJ8yH zVlhIpZj2m3C4tsbPNZFloTb+GGk7rjXxNzigNevTRt7ttbyInp0Yz3gb1FP9MCZgplH hSrA== X-Gm-Message-State: AJaThX5Umb4VvtB5PSK68RnusHlXxv5prPPTvPdgrkP4Kd5fN0eGcndx KpQKgyZCr6DH7Hhq63WqV2IbLeELBxo= X-Received: by 10.223.199.205 with SMTP id y13mr5095023wrg.71.1510934986176; Fri, 17 Nov 2017 08:09:46 -0800 (PST) Received: from localhost.localdomain ([160.167.170.128]) by smtp.gmail.com with ESMTPSA id p42sm5575959wrb.28.2017.11.17.08.09.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 08:09:45 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Date: Fri, 17 Nov 2017 16:09:11 +0000 Message-Id: <20171117160913.17292-14-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171117160913.17292-1-ard.biesheuvel@linaro.org> References: <20171117160913.17292-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 13/15] ArmVirtPkg: implement ArmVirtMemInfo PPI, PEIM and library 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: leif.lindholm@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Equivalent to the PrePi based platforms, this patch implements the newly introduced ArmVirtMemInfo library class via a separate PEIM and PPI. The reason is that ArmVirtPlatformLib has populated the ArmPlatformLib API function ArmPlatformInitializeSystemMemory () to retrieve memory information from the DT, ensuring that it will be present when MemoryPeim() is executed. This is a bit of a hack, and someting we will need to get rid of if we want to reduce our dependency on ArmPlatformLib altogether. Putting this code in a ArmVirtMemInfo library constructor is problematic as well, given that the implementation uses other libraries, among which PcdLib, and so we need to find another way to run it before MemoryPeim() So instead, create a separate PEIM that encapsulates the ArmVirtMemInfo code and exposes it via a PPI. Another ArmVirtMemInfo library class implementation is also provided that depexes on the PPI, which ensures that the code is called in the correct order. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- ArmVirtPkg/ArmVirtPkg.dec | 3 + ArmVirtPkg/Include/Ppi/ArmVirtMemInfo.h | 48 ++++++++ ArmVirtPkg/Library/PeiVirtMemInfoLib/PeiVirtMemInfoLib.c | 46 ++++++++ ArmVirtPkg/Library/PeiVirtMemInfoLib/PeiVirtMemInfoLib.inf | 42 +++++++ ArmVirtPkg/QemuVirtMemInfoPeim/QemuVirtMemInfoPeim.c | 121 ++++++++++++++++++++ ArmVirtPkg/QemuVirtMemInfoPeim/QemuVirtMemInfoPeim.inf | 60 ++++++++++ 6 files changed, 320 insertions(+) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/ArmVirtPkg/ArmVirtPkg.dec b/ArmVirtPkg/ArmVirtPkg.dec index 8f656fd2739d..260849dc845c 100644 --- a/ArmVirtPkg/ArmVirtPkg.dec +++ b/ArmVirtPkg/ArmVirtPkg.dec @@ -39,6 +39,9 @@ [Guids.common] gArmVirtVariableGuid = { 0x50bea1e5, 0xa2c5, 0x46e9, { 0x9b, 0x3a, 0x59, 0x59, 0x65, 0x16, 0xb0, 0x0a } } +[Ppis] + gArmVirtMemInfoPpiGuid = { 0x3b060b72, 0x8696, 0x4393, { 0xa8, 0x93, 0x34, 0x25, 0x1e, 0x3f, 0x8a, 0x6b } } + [Protocols] gFdtClientProtocolGuid = { 0xE11FACA0, 0x4710, 0x4C8E, { 0xA7, 0xA2, 0x01, 0xBA, 0xA2, 0x59, 0x1B, 0x4C } } diff --git a/ArmVirtPkg/Include/Ppi/ArmVirtMemInfo.h b/ArmVirtPkg/Include/Ppi/ArmVirtMemInfo.h new file mode 100644 index 000000000000..46885d02c384 --- /dev/null +++ b/ArmVirtPkg/Include/Ppi/ArmVirtMemInfo.h @@ -0,0 +1,48 @@ +/** @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_PPI_H_ +#define _ARM_VIRT_MEMINFO_PPI_H_ + +#include + +#define ARM_VIRT_MEMINFO_PPI_GUID \ + { 0x3b060b72, 0x8696, 0x4393, { 0xa8, 0x93, 0x34, 0x25, 0x1e, 0x3f, 0x8a, 0x6b } } + +/** + 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 + +**/ +typedef +VOID +(EFIAPI * GET_MEMORY_MAP) ( + OUT ARM_MEMORY_REGION_DESCRIPTOR **VirtualMemoryMap + ); + +typedef struct { + GET_MEMORY_MAP GetMemoryMap; +} ARM_VIRT_MEMINFO_PPI; + +extern EFI_GUID gArmVirtMemInfoPpiGuid; + +#endif diff --git a/ArmVirtPkg/Library/PeiVirtMemInfoLib/PeiVirtMemInfoLib.c b/ArmVirtPkg/Library/PeiVirtMemInfoLib/PeiVirtMemInfoLib.c new file mode 100644 index 000000000000..ad27b246f980 --- /dev/null +++ b/ArmVirtPkg/Library/PeiVirtMemInfoLib/PeiVirtMemInfoLib.c @@ -0,0 +1,46 @@ +/** @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 + +/** + 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 +ArmVirtGetMemoryMap ( + OUT ARM_MEMORY_REGION_DESCRIPTOR **VirtualMemoryMap + ) +{ + ARM_VIRT_MEMINFO_PPI *MemInfo; + EFI_STATUS Status; + + Status = PeiServicesLocatePpi (&gArmVirtMemInfoPpiGuid, 0, NULL, + (VOID **)&MemInfo); + ASSERT_EFI_ERROR (Status); + + MemInfo->GetMemoryMap (VirtualMemoryMap); +} diff --git a/ArmVirtPkg/Library/PeiVirtMemInfoLib/PeiVirtMemInfoLib.inf b/ArmVirtPkg/Library/PeiVirtMemInfoLib/PeiVirtMemInfoLib.inf new file mode 100644 index 000000000000..b661c2f43faf --- /dev/null +++ b/ArmVirtPkg/Library/PeiVirtMemInfoLib/PeiVirtMemInfoLib.inf @@ -0,0 +1,42 @@ +#/* @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 = PeiVirtMemInfoLib + FILE_GUID = 1d7bae0f-9674-4a4b-8d85-9804968cb12b + MODULE_TYPE = PEIM + VERSION_STRING = 1.0 + LIBRARY_CLASS = ArmVirtMemInfoLib|PEIM + +[Sources] + PeiVirtMemInfoLib.c + +[Packages] + ArmPkg/ArmPkg.dec + ArmVirtPkg/ArmVirtPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + +[LibraryClasses] + ArmLib + DebugLib + PeiServicesLib + +[Ppis] + gArmVirtMemInfoPpiGuid + +[Depex] + gArmVirtMemInfoPpiGuid diff --git a/ArmVirtPkg/QemuVirtMemInfoPeim/QemuVirtMemInfoPeim.c b/ArmVirtPkg/QemuVirtMemInfoPeim/QemuVirtMemInfoPeim.c new file mode 100644 index 000000000000..90ee552bdba0 --- /dev/null +++ b/ArmVirtPkg/QemuVirtMemInfoPeim/QemuVirtMemInfoPeim.c @@ -0,0 +1,121 @@ +/**@file + + 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. + +**/ + +#include +#include +#include +#include +#include +#include +#include +#include + +STATIC ARM_VIRT_MEMINFO_PPI mArmVirtMeminfoPpi = { + ArmVirtGetMemoryMap +}; + +STATIC CONST EFI_PEI_PPI_DESCRIPTOR mArmVirtMeminfoPpiTable = { + EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST, + &gArmVirtMemInfoPpiGuid, + &mArmVirtMeminfoPpi +}; + +EFI_STATUS +EFIAPI +QemuVirtMemInfoPeimEntryPoint ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ) +{ + 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 PeiServicesInstallPpi (&mArmVirtMeminfoPpiTable); +} diff --git a/ArmVirtPkg/QemuVirtMemInfoPeim/QemuVirtMemInfoPeim.inf b/ArmVirtPkg/QemuVirtMemInfoPeim/QemuVirtMemInfoPeim.inf new file mode 100644 index 000000000000..ac91e065be57 --- /dev/null +++ b/ArmVirtPkg/QemuVirtMemInfoPeim/QemuVirtMemInfoPeim.inf @@ -0,0 +1,60 @@ +## @file +# +# 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. +# +## + +[Defines] + INF_VERSION = 0x0001001A + BASE_NAME = QemuVirtMemInfoPeim + FILE_GUID = 91da13af-d0ff-4810-b9b9-b095a9ee6b09 + MODULE_TYPE = PEIM + VERSION_STRING = 1.0 + ENTRY_POINT = QemuVirtMemInfoPeimEntryPoint + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = ARM AARCH64 +# + +[Sources] + QemuVirtMemInfoPeim.c + +[Packages] + ArmPkg/ArmPkg.dec + ArmVirtPkg/ArmVirtPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + +[LibraryClasses] + ArmLib + ArmVirtMemInfoLib + DebugLib + FdtLib + PeimEntryPoint + PeiServicesLib + +[Pcd] + gArmTokenSpaceGuid.PcdSystemMemorySize + +[Ppis] + gArmVirtMemInfoPpiGuid + +[FixedPcd] + gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress + gArmTokenSpaceGuid.PcdSystemMemoryBase + gArmTokenSpaceGuid.PcdFdBaseAddress + gArmTokenSpaceGuid.PcdFdSize + gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize + +[Depex] + TRUE From patchwork Fri Nov 17 16:09:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 119186 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp703949qgn; Fri, 17 Nov 2017 08:10:15 -0800 (PST) X-Google-Smtp-Source: AGs4zMYU1dnJGvFzPAhbMkeyM2QWNNYoxrhqqUiDiUKIqZ5TndiA1o6hTFtqTf70fLzzzg6XTNaC X-Received: by 10.99.108.67 with SMTP id h64mr5615475pgc.119.1510935015170; Fri, 17 Nov 2017 08:10:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510935015; cv=none; d=google.com; s=arc-20160816; b=t4yB4XpW/MO5UsbTvFnuZdsXvI7K1n4oMB2MG6xnzUhyYtPnsmiA7c0luEb9dM9fSG fDdVcJdkakNkPfrXquLv5K3iGDP5wlxLQryVNjN7BmlqrwBdSgMFiFP17rx97n5aL4S3 kowaGmEqZeZXUQZqb1SY0CDs+cB6LKOUz7ElHKNBHwLaOLCZK6/QGZmIyDELIx4LIQTy M8cpXIgHGEy7HmtEHK/pvOB853I1mUA1VYc38+Sfur6VFau3uIK/0BJLkaFSxEBGmfDv cjEmlCJ0nOHZoQ5uyCfBgFm2DZhovcWjC3ZQ6NwBKabr2YACBhFmwBUdEll4zADzvzK4 y7AQ== 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=cgkzFDxfYnZumeLqLYhd+A4MQT0NRgRlRiHXiwVttNo=; b=LrhkouSalvXKTU3Mj9NUbYXic8Ojf8KrpBPMQmlYTGo3hQZO1SXaQwUU8B5wU5plJ+ gFICdfO0PGPRio/mpZN7nhq/bVyTRJy7zGyyzvbLRyEntiQxyGYb3NK59lWPXWkXDDL9 wo/OFkuvlke0L5sx23eO7QNLSN85PQhLwafVmQzSu+8gMs6vEcZcJC2b5YWeq4ZE73sq rxQG2eWpIw1XUm8fP99CI/ikMVXqDERA2Po2HJ/6z+BY0KMdxcOp7eFQXhtsohJfDmUE XmUR4qg1sdp3vnz1K0IKF/zx3pBdD3Vdn6vOMfcQz2bbFYx4QuhZnZsa/Xs92/2ieThn kf8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=VM4qIGaQ; 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 a8si3041581pll.474.2017.11.17.08.10.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 08:10: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=VM4qIGaQ; 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 03C922035BB33; Fri, 17 Nov 2017 08:05:41 -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 DE6252035BB31 for ; Fri, 17 Nov 2017 08:05:38 -0800 (PST) Received: by mail-wm0-x243.google.com with SMTP id z3so7449220wme.3 for ; Fri, 17 Nov 2017 08:09:49 -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=vA20VwNwe0y6VHpl3NvFP1xiJXbZcXkE8iHeycZQow8=; b=VM4qIGaQhvV6xM+h2M3KCXcAoBmBf5N7QMiskLwUpIJFFDWxFwTvh1JQBefkQMBGBh vsQf6mXBtdprofYc5R/Zuvg6P9jc+8zoqnPn4V5PKTCc1IKPiOROw8FRHEGGaLlnDV15 iJKZgnJ5XiJFoanaRe2rcnVPvtMuBFkSs5J1I= 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=vA20VwNwe0y6VHpl3NvFP1xiJXbZcXkE8iHeycZQow8=; b=E0VRX09h379ZDBQbvgKFk12J/+hiJaApOh2ZOp/oF5y7Ni4BtnY7sOSSrpCHPmKhwR DwHie2EbEy0VaMr159wHSiXg1KzjT6cIAuwfWRHFTGRtTb6VHjYNTJcEcaJe5vWxwF2b b7NxOOSyoEUY6AwB4bqbzufac1LYn49r3bjXdoB6NEEX+VjES2cr3MTyZmK5b69qYHWD qltBBeEYVv6ieDq3LzCaY8tUaR7RQm4CZIZwZGQJYbM8SICebfW7gLdVFdtfGkO+cTKg AZT8TmXvBhPFJzAGQwfs4oJLATFdTyYnmoC2TwpN4ULdIYiRdvKKwCuqAw8ys0so51U4 wWPA== X-Gm-Message-State: AJaThX5DqsJ/Yu2YojH/8p6r0Seyu2ipt8EHtpxk2zxmaQIQjmEYx+Sw CErLmYbhIGGvWlKfMZNC9EvfgJTg89g= X-Received: by 10.28.132.66 with SMTP id g63mr4354495wmd.22.1510934988198; Fri, 17 Nov 2017 08:09:48 -0800 (PST) Received: from localhost.localdomain ([160.167.170.128]) by smtp.gmail.com with ESMTPSA id p42sm5575959wrb.28.2017.11.17.08.09.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 08:09:47 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Date: Fri, 17 Nov 2017 16:09:12 +0000 Message-Id: <20171117160913.17292-15-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171117160913.17292-1-ard.biesheuvel@linaro.org> References: <20171117160913.17292-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 14/15] 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: leif.lindholm@linaro.org, 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 | 7 ++++++- ArmVirtPkg/ArmVirtQemu.fdf | 1 + ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c | 4 ++-- ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.inf | 3 ++- 4 files changed, 11 insertions(+), 4 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/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc index d14a0dd0d1d9..5c59f05187fa 100644 --- a/ArmVirtPkg/ArmVirtQemu.dsc +++ b/ArmVirtPkg/ArmVirtQemu.dsc @@ -48,7 +48,8 @@ [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 + ArmVirtMemInfoLib|ArmVirtPkg/Library/PeiVirtMemInfoLib/PeiVirtMemInfoLib.inf TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf NorFlashPlatformLib|ArmVirtPkg/Library/NorFlashQemuLib/NorFlashQemuLib.inf @@ -233,6 +234,10 @@ [Components.common] NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf } + ArmVirtPkg/QemuVirtMemInfoPeim/QemuVirtMemInfoPeim.inf { + + ArmVirtMemInfoLib|ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.inf + } # # DXE diff --git a/ArmVirtPkg/ArmVirtQemu.fdf b/ArmVirtPkg/ArmVirtQemu.fdf index c6a22dc018f3..696dec264639 100644 --- a/ArmVirtPkg/ArmVirtQemu.fdf +++ b/ArmVirtPkg/ArmVirtQemu.fdf @@ -109,6 +109,7 @@ [FV.FVMAIN_COMPACT] INF ArmPkg/Drivers/CpuPei/CpuPei.inf INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf + INF ArmVirtPkg/QemuVirtMemInfoPeim/QemuVirtMemInfoPeim.inf INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 { 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 Fri Nov 17 16:09:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 119187 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp704072qgn; Fri, 17 Nov 2017 08:10:20 -0800 (PST) X-Google-Smtp-Source: AGs4zMb4xSGG884GxX1T1UhjUF14PZ9dAUt2C9WGbZX49/2o6fm9eCMk3cLOVqPZp2rJH+iGYwAT X-Received: by 10.84.164.165 with SMTP id w34mr5694190pla.308.1510935020846; Fri, 17 Nov 2017 08:10:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510935020; cv=none; d=google.com; s=arc-20160816; b=JttuRlJTl8lbbaV1FxHKlh4GOzP/gQgOY8XSn+OqBAHfNKFOxJXuZsZjSVnp6jjPtH wAh3hzjxKtpMHRuV20sGFUVkh54619BwCxolYTMW5l8dg0luVuu9TrZVP7Ujo8VUf9L/ CpbrEp+eF/Zw6pWwju4cQQ25WJK8dTr5YBItdjyHrJ17wOETBsc2ckhPk9GinbikipyF N0+PRSoSL7iML69ICHUXW27RxO46xK6X4KwoBFdSoXr2vCuLTg3g5S1ox6XHLKysZE63 asVtF/iG8LBMqRNFscKNva7Uyma3MpwHgybaJbD2lby4E5VkV7oqWKva+42RBNzuMQ4H BiXw== 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=/T3p3Alx1wErtyShyPeEs7f2VfXT43edbFl/VybT5wU=; b=ZwALh9ILBKihZhHoQ+SN+6H8DcMxt8eHRahNCwdKMA9k5SL/QIMjnX+UR3570bALnd of5C7QIohszxCKNY22X6L1ak06+4mr6+cqbRcKpruDJx6Aj9FRz1eX3kSAvSHImZ6p5i OMzz7Hox9YNJbZfKTfxM37YkbuX6RL6+KDypDeAh/8i+PhQ7RFvcNYxzuMoqDtiOO7cJ /kuhNTgkdNYOgb3kMjdM7cvKvi65HDp7n00ILIKHXwIk973nBGhWAM4yXeU7IQ7gqhZ4 G2j+TXDp9/oET1xMj7xBmFQ0SGKJxPgkHQvR3MZBkeQkGkX04D9gIMYkYNlfmIyYqPIY oQ3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=O7F4S/dX; 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 c21si1265197pfk.314.2017.11.17.08.10.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 08:10:20 -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=O7F4S/dX; 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 3B8952035BB38; Fri, 17 Nov 2017 08:05: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::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 79CA92035BB1B for ; Fri, 17 Nov 2017 08:05:42 -0800 (PST) Received: by mail-wm0-x242.google.com with SMTP id b189so7338923wmd.5 for ; Fri, 17 Nov 2017 08:09: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=dTLeBM1XHPyo5Em7d9tjbwDoi60GczgvZfxMHfRGbVo=; b=O7F4S/dXNJQslmdFPdibBAU+EYzupdiVO/qcbclB8Dke1zHG9PSQVlhqQenT5RNy4q KgIKA16w0KqSh3AQFwYsgsxZR/HRgmpdIPuSorg40m5b4fw+iDTnfrVUA4b4z2JVTGDZ VqJt1LZlwLRS2t5NVKZ+Emtl2eLuSziGreUXA= 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=dTLeBM1XHPyo5Em7d9tjbwDoi60GczgvZfxMHfRGbVo=; b=OqgCVWspT9MCAPOD9T9AvN3U0sAQ1xdHlfZM4BrGAUW2dyW4GfrSkuE613xwJ+TlVk +3ViyYWvkxxyrm/ESz5vSzOdfhetvBcqqeldeRRTypZQw9ECOv4knV11e5I7GvJEg/2w cg1EISI5Whb28RRgxy9G5SigaA0mB+gL1eS0S7IRodhT2RAPyjhDVDOmsLT/T6USS2c2 A+xpuBC3tZ3/86c5+ZzoI/msGBpTdFUJUWtbBSBTtmZtY5O4vvUkirq36KiLAf6+WqcE v33LOqL4BYbYdGYm2Kzs9bn+mYfdByc9SqqUECFXz81GRh0y4rvlbGaYfAfb+mwz2dRv AIUg== X-Gm-Message-State: AJaThX4LDOi+L2TNRgJmDHeBUwxvEhKIMedblQ89ZMBlA3aMe0E8oqUn GEoRwTd8twNE9U4r25xaiQArJyWDjPI= X-Received: by 10.28.43.5 with SMTP id r5mr4454342wmr.72.1510934990533; Fri, 17 Nov 2017 08:09:50 -0800 (PST) Received: from localhost.localdomain ([160.167.170.128]) by smtp.gmail.com with ESMTPSA id p42sm5575959wrb.28.2017.11.17.08.09.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 08:09:49 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Date: Fri, 17 Nov 2017 16:09:13 +0000 Message-Id: <20171117160913.17292-16-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171117160913.17292-1-ard.biesheuvel@linaro.org> References: <20171117160913.17292-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 15/15] 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: leif.lindholm@linaro.org, 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 --- 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 Reviewed-by: Laszlo Ersek 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; -}