From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by mx.groups.io with SMTP id smtpd.web11.6836.1575024431358874380 for ; Fri, 29 Nov 2019 02:47:11 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=DK/fj761; spf=pass (domain: linaro.org, ip: 209.85.128.68, mailfrom: ard.biesheuvel@linaro.org) Received: by mail-wm1-f68.google.com with SMTP id p17so8612225wma.1 for ; Fri, 29 Nov 2019 02:47:11 -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=yh9s5Gi/mM56AOabOAxTqSLf+ZIHwWb7/4KlASudH2E=; b=DK/fj761stzGT0h1K+QySkJwyuAlI0DCBFsRsrxJUiF/7rwuv9dIs8qSFuUPV7p9ao vhIQQhF/N6pHFiJ6vJPG8/x42vIXoQMuOjZ8sjYo8oS4FSU2zgGFbg1P3T3YUrR18kx/ 00V2LdCvAp/0r+c5OvFFBwIMGAXr6j/wd86kNfbkX1GiGu/5UcP0U3xEybjCMJTMdZ9T pgtSYh1rp0+dUF/mqYFaW6S+FUyvbwVvSl6GueqfGi6uYDkZaDYxOu9aMqp/eH+klGH0 CcvhtOSoEkotzITaAfPcET5l4qK25hWKKk6G2EUTNTz1OYPK0SayDbOFwcCoh5RQCs3o 8tTA== 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=yh9s5Gi/mM56AOabOAxTqSLf+ZIHwWb7/4KlASudH2E=; b=CnJe3KRA5bPX4uESGHEWZxylp4K9on89tUZhxMST2j8207xkxxQHJScN7i8ymPrMP1 KCMjxFgXesvr1cCIGkPzQ17J3OWMTXbdyKVWWojunpgMfPLgQfRgAA76mavYsKV8dCho C9caX6zg+n9+n5YtOLFf1MX9oMsARIliUPQG5YlN8CDrnKPskuF4I/u+akC0PQ2BewaR mNYo27xtNqHgF5GWus2FN7RtzuFV+zAkgxGUapYjt3uQrXq1pSIKyWWJdjeXkho8JMJC MlMew8rzm+pDSbYZIGUzZD7BeGL5Jkx7vTkuOmHCHmeXuFNZZMF9/4nlJ/6u5HmWOwKt RJDA== X-Gm-Message-State: APjAAAWuv4Vvr5VwJT2Zdf3ed42H24xiWMeh6oNktAsGHBwsfLv4zWmM 32U1GdQZMckOxDNRgVzYL2odIgEnMdyiDg== X-Google-Smtp-Source: APXvYqyerc80rdbtn9LDQ9iRRTHIBH+2FQVbAnGt7ywYMixcEypHL6o5tcZOaSJMpL238uLpy1sgHA== X-Received: by 2002:a1c:49c3:: with SMTP id w186mr13899681wma.53.1575024429468; Fri, 29 Nov 2019 02:47:09 -0800 (PST) Return-Path: Received: from e123331-lin.home (amontpellier-657-1-18-247.w109-210.abo.wanadoo.fr. [109.210.65.247]) by smtp.gmail.com with ESMTPSA id 60sm27186170wrn.86.2019.11.29.02.47.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Nov 2019 02:47:08 -0800 (PST) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: leif.lindholm@linaro.org, Ard Biesheuvel Subject: [PATCH edk2-platforms 2/2] Silicon/SynQuacer/PlatformDxe: add ACPI device node for OP-TEE if present Date: Fri, 29 Nov 2019 11:47:16 +0100 Message-Id: <20191129104716.819-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191129104716.819-1-ard.biesheuvel@linaro.org> References: <20191129104716.819-1-ard.biesheuvel@linaro.org> In order to allow the OS to discover the presence of OP-TEE also when booting via ACPI, expose a PRP0001 ACPI device node in this case with OP-TEE's DT compatible string attached. Signed-off-by: Ard Biesheuvel --- Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc | 1 + Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Optee.asl | 23 ++++++++++++++++++++ Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c | 20 ++++++++++++++++- Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.h | 2 ++ Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf | 2 ++ 5 files changed, 47 insertions(+), 1 deletion(-) diff --git a/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc b/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc index ab1ab6f2de60..968378d5ee5b 100644 --- a/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc +++ b/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc @@ -68,6 +68,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/Drivers/PlatformDxe/Optee.asl b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Optee.asl new file mode 100644 index 000000000000..cd506211ab1e --- /dev/null +++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/Optee.asl @@ -0,0 +1,23 @@ +/** @file + Copyright (c) 2019, Linaro Ltd. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +DefinitionBlock ("SsdtTOS0.aml", "SSDT", 1, "SNI", "SynQTOS0", + FixedPcdGet32 (PcdAcpiDefaultOemRevision)) { + Scope (_SB) { + Device (TOS0) { + Name (_HID, "PRP0001") + Name (_UID, 0x0) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { "compatible", "linaro,optee-tz" }, + Package (2) { "method", "smc" }, + } + }) + } + } // Scope (_SB) +} diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c index c9cc37dd2478..138030135986 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c +++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c @@ -116,6 +116,9 @@ STATIC EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR mI2c1Desc[] = { STATIC EFI_ACPI_DESCRIPTION_HEADER *mEmmcSsdt; STATIC UINTN mEmmcSsdtSize; +STATIC EFI_ACPI_DESCRIPTION_HEADER *mTos0Ssdt; +STATIC UINTN mTos0SsdtSize; + STATIC VOID *mAcpiTableEventRegistration; STATIC @@ -285,6 +288,13 @@ InstallAcpiTables ( DEBUG ((DEBUG_WARN, "%a: failed to install SSDT table for eMMC - %r\n", __FUNCTION__, Status)); } + + Status = AcpiTable->InstallAcpiTable (AcpiTable, mTos0Ssdt, mTos0SsdtSize, + &TableKey); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_WARN, "%a: failed to install SSDT table for OP-TEE - %r\n", + __FUNCTION__, Status)); + } } EFI_STATUS @@ -397,10 +407,18 @@ PlatformDxeEntryPoint ( mEmmcSsdt = Ssdt; mEmmcSsdtSize = SsdtSize; break; + + case TOS0_TABLE_ID: + if (!IsOpteePresent ()) { + break; + } + mTos0Ssdt = Ssdt; + mTos0SsdtSize = SsdtSize; + break; } } - if (mEmmcSsdtSize > 0) { + if (mEmmcSsdtSize > 0 || mTos0SsdtSize > 0) { // // Register for the ACPI table protocol if we found any SSDTs to install // diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.h b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.h index c08659f7a796..692654687869 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.h +++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.h @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -36,6 +37,7 @@ #include #define EMMC_TABLE_ID SIGNATURE_64('S','y','n','Q','e','M','M','C') +#define TOS0_TABLE_ID SIGNATURE_64('S','y','n','Q','T','O','S','0') extern UINT8 PlatformDxeHiiBin[]; extern UINT8 PlatformDxeStrings[]; diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf index ae9f8712f0d2..57f2d071c14e 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf +++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf @@ -19,6 +19,7 @@ [Defines] [Sources] Emmc.asl Emmc.c + Optee.asl Pci.c PlatformDxe.c PlatformDxeHii.uni @@ -46,6 +47,7 @@ [LibraryClasses] IoLib MemoryAllocationLib NonDiscoverableDeviceRegistrationLib + OpteeLib PcdLib UefiBootServicesTableLib UefiDriverEntryPoint -- 2.17.1