From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:400e:c01::241; helo=mail-pl0-x241.google.com; envelope-from=sumit.garg@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pl0-x241.google.com (mail-pl0-x241.google.com [IPv6:2607:f8b0:400e:c01::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 C0F102097FA8F for ; Thu, 2 Aug 2018 23:42:10 -0700 (PDT) Received: by mail-pl0-x241.google.com with SMTP id z7-v6so2131989plo.9 for ; Thu, 02 Aug 2018 23:42:10 -0700 (PDT) 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=sYNdrocr3d2RIZqKYvvA+BDzw7sOhd06MQNo+Ea5E6s=; b=ENJwD+AVSdqQpbtIJUb9xGhI+TBJ26Ura73INtyY34/tipBnK7G9ooAIGLg8X5zs3u C9Jut1mgF4ARbLPijitW5Bpn6Cp2yjOqTWNw5JH17C7tHl310q6bmQHt8JVGfAONAd/D 6ePlbcDMrR/T4/S4RioqooVF+rYUfOypHt6g0= 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=sYNdrocr3d2RIZqKYvvA+BDzw7sOhd06MQNo+Ea5E6s=; b=fC4Bqo1OjzYG55ECAqtcDVz6ZoOR/+UposckoJ9i0NJjisMj3HnwzYACMeEH3Hrfj0 l2XzNe8tKq2fP0/sBdjYVV1C/Q4DsPb1QIGaKTR3wr0oWg8X28WI3tRWsoA0lCt7DXv6 L5xuvQSZCIbL7Yi1ItB3VA2gAaX7My7PPeF+fMoN430ct2GDnvr6MUsR+s0cXAQLtvsd s7SLRA+aRWUN0UlJ8e+gJNwGmuc4GSYOMTqkIdJxDjHc2z2eiQjeX8BInFvV2f/Pzsni JX4S70I2jHo7QqCR7zaEsallpTj3b5HUFvreexb53MZEF7dCvVBgszlxFsPNexggORKJ Y+aw== X-Gm-Message-State: AOUpUlH6CEXGB2+a5PXmKtRYDgkKhKvX07pwb2zm7FGz4dYpqdpjEiyq SzoAiif8pcoI1g0lceNCy7GLlaWD3bs= X-Google-Smtp-Source: AAOMgpd4xyRHW6hdQLwZzX4gFmyaEy1nPJMDpA5AR1sBevdwk73LJyEilD6R+iIDbSRS2ri4g9F0Ug== X-Received: by 2002:a17:902:4906:: with SMTP id u6-v6mr2344410pld.44.1533278530161; Thu, 02 Aug 2018 23:42:10 -0700 (PDT) Received: from localhost.localdomain ([117.197.43.141]) by smtp.gmail.com with ESMTPSA id t88-v6sm10505465pfg.10.2018.08.02.23.42.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 02 Aug 2018 23:42:09 -0700 (PDT) From: Sumit Garg To: edk2-devel@lists.01.org Date: Fri, 3 Aug 2018 12:11:34 +0530 Message-Id: <1533278495-25323-2-git-send-email-sumit.garg@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533278495-25323-1-git-send-email-sumit.garg@linaro.org> References: <1533278495-25323-1-git-send-email-sumit.garg@linaro.org> Subject: [PATCH edk2-platforms 1/2] Silicon/SynQuacer: add optional OP-TEE DT node X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Aug 2018 06:42:10 -0000 OP-TEE is optional on Developerbox controlled via SCP firmware. To check if we need to enable OP-TEE DT node, we use "IsOpteePresent" OpteeLib api. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Sumit Garg Cc: Leif Lindholm Reviewed-by: Ard Biesheuvel --- Platform/Socionext/DeveloperBox/DeveloperBox.dsc | 1 + .../Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi | 8 +++++++ .../SynQuacerDtbLoaderLib/SynQuacerDtbLoaderLib.c | 28 ++++++++++++++++++++++ .../SynQuacerDtbLoaderLib.inf | 2 ++ 4 files changed, 39 insertions(+) diff --git a/Platform/Socionext/DeveloperBox/DeveloperBox.dsc b/Platform/Socionext/DeveloperBox/DeveloperBox.dsc index fc498eb65217..4ff5df978e8e 100644 --- a/Platform/Socionext/DeveloperBox/DeveloperBox.dsc +++ b/Platform/Socionext/DeveloperBox/DeveloperBox.dsc @@ -76,6 +76,7 @@ [LibraryClasses.common] ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf + OpteeLib|ArmPkg/Library/OpteeLib/OpteeLib.inf BaseLib|MdePkg/Library/BaseLib/BaseLib.inf BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf diff --git a/Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi b/Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi index 37d642e4b237..d6a5f013e58c 100644 --- a/Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi +++ b/Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi @@ -574,6 +574,14 @@ #address-cells = <1>; #size-cells = <0>; }; + + firmware { + optee { + compatible = "linaro,optee-tz"; + method = "smc"; + status = "disabled"; + }; + }; }; #include "SynQuacerCaches.dtsi" diff --git a/Silicon/Socionext/SynQuacer/Library/SynQuacerDtbLoaderLib/SynQuacerDtbLoaderLib.c b/Silicon/Socionext/SynQuacer/Library/SynQuacerDtbLoaderLib/SynQuacerDtbLoaderLib.c index 897d06743708..77db30c204fe 100644 --- a/Silicon/Socionext/SynQuacer/Library/SynQuacerDtbLoaderLib/SynQuacerDtbLoaderLib.c +++ b/Silicon/Socionext/SynQuacer/Library/SynQuacerDtbLoaderLib/SynQuacerDtbLoaderLib.c @@ -19,6 +19,7 @@ #include #include #include +#include #include // add enough space for three instances of 'status = "disabled"' @@ -47,6 +48,29 @@ DisableDtNode ( } } +STATIC +VOID +EnableDtNode ( + IN VOID *Dtb, + IN CONST CHAR8 *NodePath + ) +{ + INT32 Node; + INT32 Rc; + + Node = fdt_path_offset (Dtb, NodePath); + if (Node < 0) { + DEBUG ((DEBUG_ERROR, "%a: failed to locate DT path '%a': %a\n", + __FUNCTION__, NodePath, fdt_strerror (Node))); + return; + } + Rc = fdt_setprop_string (Dtb, Node, "status", "okay"); + if (Rc < 0) { + DEBUG ((DEBUG_ERROR, "%a: failed to set status to 'disabled' on '%a': %a\n", + __FUNCTION__, NodePath, fdt_strerror (Rc))); + } +} + /** Return a pool allocated copy of the DTB image that is appropriate for booting the current platform via DT. @@ -107,6 +131,10 @@ DtPlatformLoadDtb ( DisableDtNode (CopyDtb, "/sdhci@52300000"); } + if (IsOpteePresent()) { + EnableDtNode (CopyDtb, "/firmware/optee"); + } + *Dtb = CopyDtb; *DtbSize = CopyDtbSize; diff --git a/Silicon/Socionext/SynQuacer/Library/SynQuacerDtbLoaderLib/SynQuacerDtbLoaderLib.inf b/Silicon/Socionext/SynQuacer/Library/SynQuacerDtbLoaderLib/SynQuacerDtbLoaderLib.inf index 548d62fd5c0a..fd21f7c376ce 100644 --- a/Silicon/Socionext/SynQuacer/Library/SynQuacerDtbLoaderLib/SynQuacerDtbLoaderLib.inf +++ b/Silicon/Socionext/SynQuacer/Library/SynQuacerDtbLoaderLib/SynQuacerDtbLoaderLib.inf @@ -24,6 +24,7 @@ [Sources] SynQuacerDtbLoaderLib.c [Packages] + ArmPkg/ArmPkg.dec MdePkg/MdePkg.dec EmbeddedPkg/EmbeddedPkg.dec Silicon/Socionext/SynQuacer/SynQuacer.dec @@ -34,6 +35,7 @@ [LibraryClasses] DxeServicesLib FdtLib MemoryAllocationLib + OpteeLib [Pcd] gSynQuacerTokenSpaceGuid.PcdPcieEnableMask -- 2.7.4