summaryrefslogtreecommitdiff
path: root/Silicon/Socionext/SynQuacer/Library
diff options
context:
space:
mode:
authorSumit Garg <sumit.garg@linaro.org>2018-08-02 16:22:38 +0530
committerArd Biesheuvel <ard.biesheuvel@linaro.org>2018-08-02 21:19:11 +0200
commit02daa58c21f89628b4d8c76f95f3a554289149bc (patch)
treef46bc8dce6fea2e82d20acc0b95af7dc1afb3c27 /Silicon/Socionext/SynQuacer/Library
parent9f02ebc19bb31ad793188cd39912c394115bbb38 (diff)
Silicon/SynQuacer: Add status property in PCIe & SDHC DT nodes
Add status = "disabled" property by default for PCIe and SDHC DT nodes. If required, update them at runtime with status = "okay". Using this method we don't need extra DTB_PADDING. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Diffstat (limited to 'Silicon/Socionext/SynQuacer/Library')
-rw-r--r--Silicon/Socionext/SynQuacer/Library/SynQuacerDtbLoaderLib/SynQuacerDtbLoaderLib.c40
1 files changed, 7 insertions, 33 deletions
diff --git a/Silicon/Socionext/SynQuacer/Library/SynQuacerDtbLoaderLib/SynQuacerDtbLoaderLib.c b/Silicon/Socionext/SynQuacer/Library/SynQuacerDtbLoaderLib/SynQuacerDtbLoaderLib.c
index 77db30c2..96090c20 100644
--- a/Silicon/Socionext/SynQuacer/Library/SynQuacerDtbLoaderLib/SynQuacerDtbLoaderLib.c
+++ b/Silicon/Socionext/SynQuacer/Library/SynQuacerDtbLoaderLib/SynQuacerDtbLoaderLib.c
@@ -22,32 +22,6 @@
#include <Library/OpteeLib.h>
#include <Platform/VarStore.h>
-// add enough space for three instances of 'status = "disabled"'
-#define DTB_PADDING 64
-
-STATIC
-VOID
-DisableDtNode (
- 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", "disabled");
- if (Rc < 0) {
- DEBUG ((DEBUG_ERROR, "%a: failed to set status to 'disabled' on '%a': %a\n",
- __FUNCTION__, NodePath, fdt_strerror (Rc)));
- }
-}
-
STATIC
VOID
EnableDtNode (
@@ -105,7 +79,7 @@ DtPlatformLoadDtb (
return EFI_NOT_FOUND;
}
- CopyDtbSize = OrigDtbSize + DTB_PADDING;
+ CopyDtbSize = OrigDtbSize;
CopyDtb = AllocatePool (CopyDtbSize);
if (CopyDtb == NULL) {
return EFI_OUT_OF_RESOURCES;
@@ -118,17 +92,17 @@ DtPlatformLoadDtb (
return EFI_NOT_FOUND;
}
- if (!(PcdGet8 (PcdPcieEnableMask) & BIT0)) {
- DisableDtNode (CopyDtb, "/pcie@60000000");
+ if (PcdGet8 (PcdPcieEnableMask) & BIT0) {
+ EnableDtNode (CopyDtb, "/pcie@60000000");
}
- if (!(PcdGet8 (PcdPcieEnableMask) & BIT1)) {
- DisableDtNode (CopyDtb, "/pcie@70000000");
+ if (PcdGet8 (PcdPcieEnableMask) & BIT1) {
+ EnableDtNode (CopyDtb, "/pcie@70000000");
}
SettingsVal = PcdGet64 (PcdPlatformSettings);
Settings = (SYNQUACER_PLATFORM_VARSTORE_DATA *)&SettingsVal;
- if (Settings->EnableEmmc == EMMC_DISABLED) {
- DisableDtNode (CopyDtb, "/sdhci@52300000");
+ if (Settings->EnableEmmc == EMMC_ENABLED) {
+ EnableDtNode (CopyDtb, "/sdhci@52300000");
}
if (IsOpteePresent()) {