Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88553C4338F for ; Wed, 4 Aug 2021 10:23:41 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EB26560FC3 for ; Wed, 4 Aug 2021 10:23:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org EB26560FC3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0634782E94; Wed, 4 Aug 2021 12:23:20 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="cJKNlGAG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AD7A282E85; Wed, 4 Aug 2021 12:23:14 +0200 (CEST) Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0774982E04 for ; Wed, 4 Aug 2021 12:23:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=email2tema@gmail.com Received: by mail-pj1-x1035.google.com with SMTP id j1so2270475pjv.3 for ; Wed, 04 Aug 2021 03:23:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9lY9e+oB9KSRG4/rFbOtb8Kx7Rs89gzp7FUyh4xRG80=; b=cJKNlGAG8mLpTTUWMzDGoVSVUrQ0JHkymEpw7/ROCiVhc1AdXVf8okC+Md8acWLveS MkaikqxsGkkYJPVkOBYzZKBfHRxV4QDeql0J74X0u3dbPztLIK8OV++kT3XVTqttpPln 4p24pDKBNqcndUaQHBfoYPK5CueBezk1Lzjf0FEW67IJyef5MSCutIfUh6saRvFL3w2t 6OUIi/BmDI2yyiUxXBbg9BZJwA9lXNr8ycYT8ahXUdJtu/UhMyqTG/xtoubnA5GBf1wF foCth/PRpnT340rMp3z3eqpmYKe8phImY60y2eQGBnAMAe43mRS2MPvDb1Ekov2PVEsh umSA== 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:mime-version:content-transfer-encoding; bh=9lY9e+oB9KSRG4/rFbOtb8Kx7Rs89gzp7FUyh4xRG80=; b=JL0BFf1ks5rMsoH9Ad2ZDEW2VjyeKZzfbVxEvNgBUcjOEWf8C/GG3ILamPy/YV4Eyp 5JXjrGR2wD6OKBr1Yx0ntqMxYYalKIQMBILqI0zooXmUC0Ndsw3eLJpfgP5OC1qbDLgF beU1/egJ2QRknQcY0Kz3rypKoy4AAZ5V7fSyAlptHAP6lzABu7k5c31IfxoNkWkrznLh WYkfVZVAV5eD5uWxflQ+F2uBt8fB8Q+DYHhQTM/2HlmXMLHbExuJQ7pyO9J45gjCtRYo MX5JMw5FC4FWQ38LaEy4Eag3bpuJxeWN45H+1xKrCQ8RA9Bipl2RugjsoXMmn8u+DrfN YzuQ== X-Gm-Message-State: AOAM531P6/gIw+67mC7i8E7EIZr0VdnYZA+m9TJsluvIKLbQPIIz+4tD xxXRi0aJSzVf4RLmGChvU+A= X-Google-Smtp-Source: ABdhPJxm7A4BFoM6RukiOwZBgFrj4z3Q4jyRRoizF+McLSfDI6uxSyS+Bf4yBVzbUpnaG8KUBf/4lQ== X-Received: by 2002:a17:90b:3905:: with SMTP id ob5mr27987679pjb.211.1628072585374; Wed, 04 Aug 2021 03:23:05 -0700 (PDT) Received: from localhost.localdomain (104.194.74.249.16clouds.com. [104.194.74.249]) by smtp.gmail.com with ESMTPSA id z14sm2291976pfr.121.2021.08.04.03.23.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Aug 2021 03:23:05 -0700 (PDT) From: Artem Lapkin X-Google-Original-From: Artem Lapkin To: narmstrong@baylibre.com Cc: u-boot@lists.denx.de, u-boot-amlogic@groups.io, xypron.glpk@gmx.de, agraf@csgraf.de, trini@konsulko.com, christianshewitt@gmail.com, art@khadas.com, nick@khadas.com, gouwa@khadas.com Subject: [PATCH 4/4] EFI: console: improve vidconsole unicode output Date: Wed, 4 Aug 2021 18:22:17 +0800 Message-Id: <20210804102217.2419510-5-art@khadas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210804102217.2419510-1-art@khadas.com> References: <20210804102217.2419510-1-art@khadas.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean If EFI_CONSOLE_UTF_SAFE is enabled and vidconsole is active, unicode characters will be replaced with "." for all console outputs. Vidconsole does not support unicode output, and your console will suffer display issues if EFI_CONSOLE_UTF_SAFE is disabled. Signed-off-by: Artem Lapkin --- lib/efi_loader/Kconfig | 9 +++++++++ lib/efi_loader/efi_console.c | 6 +++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index 7d00d6cde5..886e0ce111 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -393,4 +393,13 @@ config EFI_CONSOLE_MAX_COLS help Set console max rows limit or set to zero to disable limit. +config EFI_CONSOLE_UTF_SAFE + bool "If vidconsole is active, unicode characters will be replaced with '.'" + default n + help + If EFI_CONSOLE_UTF_SAFE is enabled and vidconsole is active, unicode + characters will be replaced with "." for all console outputs. + Vidconsole does not support unicode output, and your console will + suffer display issues if EFI_CONSOLE_UTF_SAFE is disabled. + endif diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c index b5d79d788f..bd1c14995d 100644 --- a/lib/efi_loader/efi_console.c +++ b/lib/efi_loader/efi_console.c @@ -19,6 +19,8 @@ #define EFI_COUT_MODE_2 2 #define EFI_MAX_COUT_MODE 3 +static int vidconsole_active; + struct cout_mode { unsigned long columns; unsigned long rows; @@ -163,7 +165,8 @@ static efi_status_t EFIAPI efi_cout_output_string( } pos = buf; utf16_utf8_strcpy(&pos, string); - fputs(stdout, buf); + fputs(stdout, IS_ENABLED(CONFIG_EFI_CONSOLE_UTF_SAFE) && + strlen(buf) > 1 && vidconsole_active ? "." : buf); free(buf); /* @@ -327,6 +330,7 @@ static int __maybe_unused query_vidconsole(int *rows, int *cols) return -ENODEV; *rows = priv->rows; *cols = priv->cols; + vidconsole_active = 1; return 0; } -- 2.25.1