From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-x22b.google.com (mail-wr0-x22b.google.com [IPv6:2a00:1450:400c:c0c::22b]) (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 3E37121939317 for ; Tue, 4 Apr 2017 06:24:24 -0700 (PDT) Received: by mail-wr0-x22b.google.com with SMTP id w11so213100656wrc.3 for ; Tue, 04 Apr 2017 06:24:24 -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=a/g2tRzhOk+EOcTc80xL+b/lb5M7bN469eVd7A7iaN8=; b=BHVrLZi6lrHiB5NRr1c9lQFRMmQ209LYij4nH10Nle5GJcAfJhA+CWSFyqLIQovFze z4/J/BvrEUYiXsDJsBAfaiGJMtKk1juEF+ebYQnTDemQsdR61l4jjhJ0G1RJoZvOcj4b YZsUyon3F5NFfTc9TgVonI+pD8Wl3w3bDwFp4= 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=a/g2tRzhOk+EOcTc80xL+b/lb5M7bN469eVd7A7iaN8=; b=V8+H+w2R9XxaTIqmcT9O+ILsvKKbUwxANmLTfvMdSarfLuQ9i9BWRhwPpo9AZHYdCy 29WBZKrT9MCU42sn1FRvY4DlM7GZ3gVcsbShJimg3BIYOYKOM2iFbACYN1GQCV9Lj9pw YgBW+3AShMacjmPZoLzsO7FWio4160i6VYnhSDSWcX/A2KKAqNzVJPPY2c6qQBuxecf2 ihHhO0vjgLU63ivy+Vn+gI5HAyjXcx7Q3wt6uZX+YasKRUN2Kmiv2u/SwWDEbGK81QVS 0LcU+4pM8wATQkTj+wOPGqBbzdw2ImGZq1sYVot9m/eUjrOy7J44Ls3FszhRtbY3s4f3 3dkw== X-Gm-Message-State: AFeK/H1f9Yf2Vwn/hP6SXaWQmn/09eMyXRZ9Z4A67Iamwt4bSE7nmxmlsPkl2j7BdcTTkk9X X-Received: by 10.28.9.15 with SMTP id 15mr15457191wmj.83.1491312262085; Tue, 04 Apr 2017 06:24:22 -0700 (PDT) Received: from localhost.localdomain ([160.163.145.113]) by smtp.gmail.com with ESMTPSA id g10sm13773778wrb.56.2017.04.04.06.24.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Apr 2017 06:24:21 -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:09 +0100 Message-Id: <20170404132409.20422-4-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 3/3] ArmVirtPkg/PlatformPeiLib: take DT 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:24 -0000 In some cases, (e.g., when running QEMU with TrustZone emulation), the DT may contain DT 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/Library/PlatformPeiLib/PlatformPeiLib.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c b/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c index bdf2b57fcb1e..df52d3653360 100644 --- a/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c +++ b/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c @@ -39,7 +39,9 @@ PlatformPeim ( INT32 Node, Prev; CONST CHAR8 *Compatible; CONST CHAR8 *CompItem; + CONST CHAR8 *NodeStatus; INT32 Len; + INT32 StatusLen; CONST UINT64 *RegProp; UINT64 UartBase; @@ -83,6 +85,11 @@ PlatformPeim ( CompItem += 1 + AsciiStrLen (CompItem)) { if (AsciiStrCmp (CompItem, "arm,pl011") == 0) { + NodeStatus = fdt_getprop (Base, Node, "status", &StatusLen); + if (NodeStatus != NULL && AsciiStrCmp (NodeStatus, "okay") != 0) { + continue; + } + RegProp = fdt_getprop (Base, Node, "reg", &Len); ASSERT (Len == 16); -- 2.9.3