From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Cc: leif.lindholm@linaro.org, Ard Biesheuvel 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: [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: , X-List-Received-Date: Thu, 19 Oct 2017 19:18:48 -0000 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(+) 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 -- 2.11.0