Silicon/SynQuacer: add optional OP-TEE DT node

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 <sumit.garg@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
This commit is contained in:
Sumit Garg
2018-08-02 16:22:37 +05:30
committed by Ard Biesheuvel
parent 9dae9a0c79
commit 9f02ebc19b
4 changed files with 39 additions and 0 deletions

View File

@@ -76,6 +76,7 @@
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

View File

@@ -574,6 +574,14 @@
#address-cells = <1>;
#size-cells = <0>;
};
firmware {
optee {
compatible = "linaro,optee-tz";
method = "smc";
status = "disabled";
};
};
};
#include "SynQuacerCaches.dtsi"

View File

@@ -19,6 +19,7 @@
#include <Library/DebugLib.h>
#include <Library/DxeServicesLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/OpteeLib.h>
#include <Platform/VarStore.h>
// 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;

View File

@@ -24,6 +24,7 @@
SynQuacerDtbLoaderLib.c
[Packages]
ArmPkg/ArmPkg.dec
MdePkg/MdePkg.dec
EmbeddedPkg/EmbeddedPkg.dec
Silicon/Socionext/SynQuacer/SynQuacer.dec
@@ -34,6 +35,7 @@
DxeServicesLib
FdtLib
MemoryAllocationLib
OpteeLib
[Pcd]
gSynQuacerTokenSpaceGuid.PcdPcieEnableMask