From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-x234.google.com (mail-lf0-x234.google.com [IPv6:2a00:1450:4010:c07::234]) (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 1D84221939316 for ; Tue, 4 Apr 2017 06:24:20 -0700 (PDT) Received: by mail-lf0-x234.google.com with SMTP id h125so92849641lfe.0 for ; Tue, 04 Apr 2017 06:24:20 -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=aMlPIe03HJfx1J4NCyrXnJw3s0w++wWCHV0yjHvz3+0=; b=KgtNMGnGdW3Ixnlhehs42m4OHRaDrP64ibLQL5MvrPRi7swFTEmYw5iGyIcyNX0ZKg lOfKD8GQ9QM33scRz8X0UfgdyUFY4zGodHyZLo935nlv/6GShmomxq8SVEVvrXnGtlxE 5dbJkMNF3iN7wShpqghXrg8LtcxvqSL7OElEU= 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=aMlPIe03HJfx1J4NCyrXnJw3s0w++wWCHV0yjHvz3+0=; b=UObv2c9ltP/sr2pqEmDtXXn89nImxxAlzFjnrpx9bzUD6MveVX8jWtJyLXX1VhZfyc 9jQgJhVnJmCnXqewP1U8IDrw8sg5rt0yhpYdrgeGDzYycbu/ziZVAAm/Uk4p67cwFKtR 1FtJAUgUnyKjIfEOK4DM+VHyDGwqbeYhI4GCP0M2f0gVXJfWHByy7tG732RdFPBF/A/P xJr+5mS7juTeEVs1TvAy3YGgvLUtul/jHXal07jor8UAKic6PTuRDKPWn6RUZ5MOYuZp WePkwWh18B3mlphPTyeEKdOOgMIV+Av6G6jmbRgzedFc2v8JzA52gA1DtRQ1iNIgdXGy iCMw== X-Gm-Message-State: AFeK/H2breUUwKOiGQ6BZ1dEPIBi6zDvkWqvoiFrp3XGqVXmjfFtTbgR4vNnt2v+ua3YCvp3 X-Received: by 10.28.109.214 with SMTP id b83mr15060163wmi.21.1491312258360; Tue, 04 Apr 2017 06:24:18 -0700 (PDT) Received: from localhost.localdomain ([160.163.145.113]) by smtp.gmail.com with ESMTPSA id g10sm13773778wrb.56.2017.04.04.06.24.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Apr 2017 06:24:17 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Cc: jens.wiklander@linaro.org, Ard Biesheuvel Date: Tue, 4 Apr 2017 14:24:07 +0100 Message-Id: <20170404132409.20422-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170404132409.20422-1-ard.biesheuvel@linaro.org> References: <20170404132409.20422-1-ard.biesheuvel@linaro.org> Subject: [PATCH 1/3] ArmVirtPkg/FdtClientDxe: take DT memory node 'status' property into account 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: , X-List-Received-Date: Tue, 04 Apr 2017 13:24:20 -0000 In some cases, (e.g., when running QEMU with TrustZone emulation), the DT may contain memory nodes whose status is set to 'secure'. Similarly, the status may be set to 'disabled' if the consumer of the DT image is expected to treat it as if it weren't there. So check whether a 'status' property is present, and if so, ignore the node if the status is not 'okay'. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- ArmVirtPkg/FdtClientDxe/FdtClientDxe.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c index 2d867b16fda8..fb6e0aeb9215 100644 --- a/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c +++ b/ArmVirtPkg/FdtClientDxe/FdtClientDxe.c @@ -210,6 +210,7 @@ FindNextMemoryNodeReg ( { INT32 Prev, Next; CONST CHAR8 *DeviceType; + CONST CHAR8 *NodeStatus; INT32 Len; EFI_STATUS Status; @@ -222,6 +223,13 @@ FindNextMemoryNodeReg ( break; } + NodeStatus = fdt_getprop (mDeviceTreeBase, Next, "status", &Len); + if (NodeStatus != NULL && AsciiStrCmp (NodeStatus, "okay") != 0) { + DEBUG ((DEBUG_WARN, "%a: ignoring memory node with status \"%a\"\n", + __FUNCTION__, NodeStatus)); + continue; + } + DeviceType = fdt_getprop (mDeviceTreeBase, Next, "device_type", &Len); if (DeviceType != NULL && AsciiStrCmp (DeviceType, "memory") == 0) { // -- 2.9.3