From patchwork Thu Oct 19 19:21:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 116434 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp848712qgn; Thu, 19 Oct 2017 12:22:30 -0700 (PDT) X-Received: by 10.98.210.5 with SMTP id c5mr2491108pfg.181.1508440949920; Thu, 19 Oct 2017 12:22:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508440949; cv=none; d=google.com; s=arc-20160816; b=VaWIT/Klv/FrK8qxRa2xC4vm7FTNhk0iVo7bUWLeZMAf2ow8w4arEtrFjX1Dix9Hob gN0aJ7cJOGvDqcg/WN2y0ibYF3Ugwgu20PVIgQkgDAe8RnfE+aF74fHFGTB3Xv3CqW9C Ed35j+ZnDov8xul9KCbKH1rmUy3e/q8pO1TTZEwRuOCD3erH4ySx2q5g3+bEHuT9htHs QJ7E2tTRkTy3y2Bvu81kUsb0VjEYUVzvhc9Mwu8HfE6c2skn2iGECUCHZiRMXakZvjQJ 0dXjzDHkFLK63xlPKaJVrO4fKQenYHbe7CvHn9KOetvE7F0p3g8R8TbMzRz7pHjCHJxl 8bXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=WxJHCaZGgWNhYC49HRO1ggCp1nSyE68bYLjsxmeAQtc=; b=JMsMD/xPmqE3jTC9F2Bu32zoCDv7UgQgf/l4qXIHLPtYYb6KYSsxENxtfg9IJiStgn 8/BmdhlJsSXIOXafHcFP337sc1WqiAipBR+2mtuOSIkMJWfWnlhE/giCYqM98TkTCTN0 q5SJwdNfykfwgqBEv1rdC+2swQK/wr/2Zb9YgpLqMs1kEJTvmzqf2V2NWfr6apptDjqj ULXF/dkckhpcbuS06uzo8BTLvGoqXKimI4JwxRqwohB3Gy+DaN5TN763wpMlHXTRDkry 4Wh8BszRBIUrp4o7PByLFTyQQG3NvL8i9MuxBXxOMTyEpTbCHgGxGjqvMZrNFdSyCKBt HHtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=U66A7QMU; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id p13si391911pll.609.2017.10.19.12.22.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Oct 2017 12:22:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=U66A7QMU; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id E90772034C0B7; Thu, 19 Oct 2017 12:18:49 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::243; helo=mail-wr0-x243.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x243.google.com (mail-wr0-x243.google.com [IPv6:2a00:1450:400c:c0c::243]) (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 CE01D2034C085 for ; Thu, 19 Oct 2017 12:18:47 -0700 (PDT) Received: by mail-wr0-x243.google.com with SMTP id w105so56720wrc.0 for ; Thu, 19 Oct 2017 12:22:26 -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; bh=00cISmFpUxauso3yZl1YH0kTdmWj7DAy172LbMNIjvI=; b=U66A7QMUiDnkhE0CPlTP5Ht2BzdihZ23qv5QDpcrYZjjysNGIrrMuq7cMDxJaHl9lm ijImwERd4rLXx4Ix2tF5HgeU1Ks6NtEhiFYNS8PZ3zMVpCFvdZaoD4zKmy/eQ/5ToLrS Njts7FailZSDAbiWBn1RWOUFLShPpXTKfqAqs= 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; bh=00cISmFpUxauso3yZl1YH0kTdmWj7DAy172LbMNIjvI=; b=LFTpA05iuSa4SyqEN9rTL0h6Xjeg4YeAYOP2Wq50W1Y0pASNC0t9BO6nDSunmsI8Zx rUldo6UXalH+acy9rIvNrH18VYgqf1nnLXcrHvNkel3DR6nTz++A5YSLet6DAD2u0sO9 mKW5QllohUHLdDjPj6KBaJ4Ax0MUry1fBjFZiB5r6tB+vI2eW5FtVySZczAvqUewC/Nn pzu+6QETJLn2Yt7Q9JcsU6R6v7cQAW9x8XfaYZAEaNYzk+m5MqrDsx/0SbAtzZKdvVPP 0sS92zvtxi+NACCtERO8CDvUpmsacGs4769oTEfdRNFS+dWDl+bLxkW43sIl9E3BrKQg QlxA== X-Gm-Message-State: AMCzsaXyf9IsrMO3ZPUvKIujnxDZ5udMJdY0Ej0evzmLMxQJT8R+5RYY X0es8o0owHBorHJnrqv3CkeLIrPsQrw= X-Google-Smtp-Source: ABhQp+QhiQ9IpJB0juYB6DIGxbSVC5OjLSr7RdOe3jJUKUoi5NII81jYYmL7MC3JB3siSosqQxYoZA== X-Received: by 10.223.163.141 with SMTP id l13mr2558539wrb.54.1508440943975; Thu, 19 Oct 2017 12:22:23 -0700 (PDT) Received: from localhost.localdomain ([154.145.244.244]) by smtp.gmail.com with ESMTPSA id m8sm11718524wrg.55.2017.10.19.12.22.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Oct 2017 12:22:23 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Thu, 19 Oct 2017 20:21:41 +0100 Message-Id: <20171019192141.4782-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 Subject: [edk2] [PATCH] EmbeddedPkg/DtPlatformDxe: remove /chosen/stdout-path on GOP registration 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: , Cc: leif.lindholm@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" The presence of a /chosen/stdout-path property will force Linux to use the serial port as the primary console, even if a graphical console is available as well. But the presence of the Graphics Output Protocol (GOP) is a strong indication that the user may prefer to use his keyboard and mouse rather than his terminal emulator to interact with the system, so let's remove /chosen/stdout-path as soon as a GOP instance is registered. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c | 41 ++++++++++++++++++++ EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf | 4 ++ 2 files changed, 45 insertions(+) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c index 1014be2281d4..4f9ac8090fac 100644 --- a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c +++ b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c @@ -12,6 +12,7 @@ * **/ +#include #include #include #include @@ -54,6 +55,9 @@ STATIC HII_VENDOR_DEVICE_PATH mDtPlatformDxeVendorDevicePath = { } }; +STATIC EFI_EVENT mRegisterGopEvent; +STATIC VOID *mGopRegistration; + STATIC EFI_STATUS InstallHiiPages ( @@ -89,6 +93,32 @@ InstallHiiPages ( return EFI_SUCCESS; } +STATIC +VOID +OnRegisterGop ( + IN EFI_EVENT Event, + IN VOID *Dtb + ) +{ + INT32 Node; + INT32 Error; + + DEBUG ((DEBUG_INFO, + "%a: a GOP has been registered, removing /chosen/stdout-path from DT\n", + __FUNCTION__)); + + Node = fdt_path_offset (Dtb, "/chosen"); + if (Node < 0) { + return; + } + + Error = fdt_delprop (Dtb, Node, "stdout-path"); + if (Error) { + DEBUG ((DEBUG_INFO, "%a: Failed to delete 'stdout-path' property: %a\n", + __FUNCTION__, fdt_strerror (Error))); + } +} + /** The entry point for DtPlatformDxe driver. @@ -181,6 +211,17 @@ DtPlatformDxeEntryPoint ( __FUNCTION__)); goto FreeDtb; } + + Status = gBS->CreateEvent (EVT_NOTIFY_SIGNAL, TPL_CALLBACK, + OnRegisterGop, Dtb, &mRegisterGopEvent); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: failed to create event - %r\n", + __FUNCTION__, Status)); + } + + Status = gBS->RegisterProtocolNotify (&gEfiGraphicsOutputProtocolGuid, + mRegisterGopEvent, &mGopRegistration); + ASSERT_EFI_ERROR (Status); } else { ASSERT (FALSE); } diff --git a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf index 45dfd9088bf0..6b331294df8a 100644 --- a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf +++ b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.inf @@ -41,6 +41,7 @@ [LibraryClasses] BaseLib DebugLib DtPlatformDtbLoaderLib + FdtLib HiiLib MemoryAllocationLib UefiBootServicesTableLib @@ -53,6 +54,9 @@ [Guids] gEdkiiPlatformHasAcpiGuid gFdtTableGuid +[Protocols] + gEfiGraphicsOutputProtocolGuid + [Depex] gEfiVariableArchProtocolGuid AND gEfiVariableWriteArchProtocolGuid