From patchwork Wed Aug 4 10:22:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Art Nikpal X-Patchwork-Id: 1513373 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=T9KxCGD5; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GfnrM69cgz9sT6 for ; Wed, 4 Aug 2021 20:23:15 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B542C82E0D; Wed, 4 Aug 2021 12:23:01 +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="T9KxCGD5"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7E0BD82E0D; Wed, 4 Aug 2021 12:22:58 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) (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 29A8180725 for ; Wed, 4 Aug 2021 12:22:53 +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-x1033.google.com with SMTP id l19so2338071pjz.0 for ; Wed, 04 Aug 2021 03:22:53 -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=2BbqpnXI744V9HMyXrSMa6EXY7Liq4H/Y1osRLZgn+g=; b=T9KxCGD5JTvfa0yojrz/KJ52u4NUIlLtfNTc1QooJf5O6jXo7ZefrijrSJMZV6VVRp KzXKJNevz4eYCW3AiI8delMrkkOnEpV3onyd00xvTrAveeP+1F/VUyNNitIqXGrRTaQV eD9SmGk43Z/I88MCa/hGwBlOWV97+V+AH2H1KkTvNMKzMmRUKsbSM14KLKlzi8+Dyd7d mufx5313nbizzoBAaB61BNOMaw4t2tuy9ICEErqmA8g6drFzikcRlAncQaHJA9WXsRU/ ZaRl30yCvk1GcFnSJ+n5A+wKCpCizZtQdw/JUsgBJwOJp93L+ws/pnvUoikuRacDKfdu P+YQ== 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=2BbqpnXI744V9HMyXrSMa6EXY7Liq4H/Y1osRLZgn+g=; b=gXO7hc0B7P+7qvSFyFjHCMUugJlA7eJh7boB+vOpf62K8VUSKou9tlls5R6r5j62Zu 6zSFQjFBuD2j/Mo0Y0PvFtkVKItEL+st3Fd+nSdgSlzZyRKcIPfUP6e5wjVx/x+5fb/A ZPbQZ+wE/sXoHEH2U0Ku422dYswtuoQ1McJ2ffYnQgpWK/K+CsrhS+gf0FIqQgwh+tNS BmgfNylSGkPxqpli/LAksO5HqhICDh/aKYOufK0hRM8DqrvfnjBahRpPr0Mpou3bU7CV highi6+bDUYajdlh6cCQifsiG5lhp4TPHkbpnOXKoPiSwXu5VFaNAn78SHN4TRu2rZXp tmUA== X-Gm-Message-State: AOAM530E0WDtKs//OhNoAbcHI8f3Hvhsvimfrf+R/s69UkSa3h1Bi/At D0g1Mpr6GnLc7R3ite8+2l8= X-Google-Smtp-Source: ABdhPJyzgivBJBEq1lm17fjD85Vgzd7HVCWXmKSykWy2lzejxlvkI77x0B+5sGFHiB6YpJLzz9bYnA== X-Received: by 2002:a17:90b:1d8c:: with SMTP id pf12mr8816752pjb.130.1628072571620; Wed, 04 Aug 2021 03:22:51 -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.22.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Aug 2021 03:22:51 -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 1/4] EFI: console: query_vidconsole: multiplex adaptation Date: Wed, 4 Aug 2021 18:22:14 +0800 Message-Id: <20210804102217.2419510-2-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 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 Fixed detection of vidconsole from within a multiplexed stdout string. As you know, a user can use a comma-separated list of devices to set stdin, stdout and stderr. For example, "setenv stdout serial,vidconsole" is a multiplexed string. Signed-off-by: Artem Lapkin --- lib/efi_loader/efi_console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c index 3b012e1a66..2d03285f82 100644 --- a/lib/efi_loader/efi_console.c +++ b/lib/efi_loader/efi_console.c @@ -314,7 +314,7 @@ static int __maybe_unused query_vidconsole(int *rows, int *cols) struct udevice *dev; struct vidconsole_priv *priv; - if (!stdout_name || strncmp(stdout_name, "vidconsole", 10)) + if (!stdout_name || !strstr(stdout_name, "vidconsole")) return -ENODEV; stdout_dev = stdio_get_by_name("vidconsole"); if (!stdout_dev) From patchwork Wed Aug 4 10:22:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Art Nikpal X-Patchwork-Id: 1513374 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=ll4QHd2p; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GfnrW5f9Mz9sT6 for ; Wed, 4 Aug 2021 20:23:23 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 44F0F82E55; Wed, 4 Aug 2021 12:23:10 +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="ll4QHd2p"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 01BA582E4A; Wed, 4 Aug 2021 12:23:05 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) (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 96B6382E04 for ; Wed, 4 Aug 2021 12:22:57 +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-pl1-x62f.google.com with SMTP id u2so2471202plg.10 for ; Wed, 04 Aug 2021 03:22:57 -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=zKRubqZnYx/JmQ+n0KDGIIktmrqsEZ/WxL0gZj1bEKg=; b=ll4QHd2pl1U9jhlpYS/MdUIahRoeBTV1NmrAParOa+qTW/V9uTua3Rst6/VyIRCHjL vMmLciW1nxBc3UJjZCuoRTGD4m3qaxEiqPGYbyPEhfOUPN6mUzyr9Tv9/CM88Q4t6/5J lEJym50MWRZ7eINMHP+7imXEtbdHxy5a2mFzok4gmjLhExm7UfzBbZfor7yFzBlcAip3 6ubPOL/2s34PAvr5Eg3h9i7KwXANtexjD/VxtdFJwr27lgWhCMoHvRHwJ7JZ5AQsssfa XKOB3In6i0DpgWaxw2NuCdNb/GvtXlUgMTzxiwxfe3NFKPN2TnUzDgzQqAXOeqwzEMzB jZwQ== 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=zKRubqZnYx/JmQ+n0KDGIIktmrqsEZ/WxL0gZj1bEKg=; b=nYaP4aB7polJ8FaAk9BSsHfUNYntw1iCjMEaBCkmKhg+XjLxiUNPnvPDd72KDChOuO +8Yw7gwpvN8CG4BPNaqeImOxV0FFlAROMI9d9BAC9zi40+KgWztVHwmqdqxmfWjF8Eo0 CcPThdVPKcEpoQ6hETzDRcqyS7DtrH3bnAb66WrQJ008tb+y4wkijJ0vLyQggETba8yB FaSxP9XTq4LGPPD2j3V0frDaYcNOObA1eV+RrtO30Zc0TCNWQbXAZu78A9C7IGMmxG8l 8RPBQaGXJHE2WNckTpKcQPCuUZ7xaGLs8C3DVT8D1yR1booygbxthQKkI5oFPexnrlRb aTcg== X-Gm-Message-State: AOAM533kZARa+1qGEKLe3GarcZNQ8Am3OIeYX+1gVuVmfGHiqmKYJuT4 6jkXFmwlirSc6u7Qf++3avk= X-Google-Smtp-Source: ABdhPJxxrg71NYqj9JmpDilG5LIKU03tj1xciLNOZ9+LS1mB6jPFAD7osNeYjCYZVDL3DR/ZuDJpeQ== X-Received: by 2002:a17:90b:212:: with SMTP id fy18mr28353175pjb.52.1628072576096; Wed, 04 Aug 2021 03:22:56 -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.22.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Aug 2021 03:22:55 -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 2/4] EFI: console: query_console_size: multiplex adaptation Date: Wed, 4 Aug 2021 18:22:15 +0800 Message-Id: <20210804102217.2419510-3-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 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 Multiplexed adaptation of the query_console_size() function; automatically determine the minimal console area that will fit all outputs properly. Signed-off-by: Artem Lapkin --- lib/efi_loader/efi_console.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c index 3b012e1a66..ef5cf21bf7 100644 --- a/lib/efi_loader/efi_console.c +++ b/lib/efi_loader/efi_console.c @@ -340,14 +340,18 @@ static int __maybe_unused query_vidconsole(int *rows, int *cols) static void query_console_size(void) { int rows = 25, cols = 80; - int ret = -ENODEV; - if (IS_ENABLED(CONFIG_DM_VIDEO)) - ret = query_vidconsole(&rows, &cols); - if (ret) - ret = query_console_serial(&rows, &cols); - if (ret) + if (IS_ENABLED(CONFIG_DM_VIDEO) && + !query_vidconsole(&rows, &cols)) { + int rows_serial, cols_serial; + + if (!query_console_serial(&rows_serial, &cols_serial)) { + rows = min(rows, rows_serial); + cols = min(cols, cols_serial); + } + } else if (query_console_serial(&rows, &cols)) { return; + } /* Test if we can have Mode 1 */ if (cols >= 80 && rows >= 50) { From patchwork Wed Aug 4 10:22:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Art Nikpal X-Patchwork-Id: 1513375 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=t96t04kL; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Gfnrj5KZZz9sW5 for ; Wed, 4 Aug 2021 20:23:33 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D43FA82E1E; Wed, 4 Aug 2021 12:23:15 +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="t96t04kL"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 834F482E7D; Wed, 4 Aug 2021 12:23:12 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) (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 9094382E1E for ; Wed, 4 Aug 2021 12:23:02 +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-x1031.google.com with SMTP id l19so2338560pjz.0 for ; Wed, 04 Aug 2021 03:23:02 -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=55Yfyg0FWF5oM+GUEHTp/Ta8y5jG6AmDuBYZbgDAnqY=; b=t96t04kLq9xXdyR3L2gXxAd7OhjDcwgTZF8F22pad2sSurHWp+EoKejMD5IDM5ui+s 0xaOdvecyjqZXt65Ho+pXaBCus7XxQbDY8sMu8bVBX3JFhW1AfuswSfeXhbPd6yK+vcO 8Kkn0nHWH/HB78u0kOZWTGiysi9ZTKQaLENNahBhbJrTvzpbASW0qrqcHzFxi2By+UCW uVKdsJ0MfjHsoknTquSjD98rCIco9mJm7sX0BGyL4LEwvDyXC9bn/qpJTFH2O6x7oJt3 nWiVEFF7dIqKxPU7AB/SIj9SMeLDIAtZhb5MvTOJPd5CLsuW+zK+2HjcS5KzRyIRR0YW wWpA== 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=55Yfyg0FWF5oM+GUEHTp/Ta8y5jG6AmDuBYZbgDAnqY=; b=It9LP9wyjg3knG0DghV8/cAfnumetLbPtkU4XxCfd14UU/f3p2E9FdW36TbMdmEsr3 xB4XBTJFv6+5+ST2AaOoIRG947KgPfb/nIT1u4ADCTNnd2gqJpVNAJmVVxerlt33zzra tNKkeLBEXeFkzceJEJB6D7HoACTd+WFebS5VRQ8m7Mh9SEJVErn6M4drENkmzQEwh1ZB jurFKvdpW19Vt47JdID69g3gN9HwngCmj2VIof3cU0yv8jmDRKnBlP9RMbooZP3dEnp1 Inlrx26UVn8BlBItPvZjrqJtCw+TOi2u0Oppwyq5ZiXsgWA4SWjDCNFGNzvGdZ/YXrbB +zMQ== X-Gm-Message-State: AOAM532afESzcE0iIH8MeUJx4zD3JfxlK/vGLU5DuLrQZ/bIwRhaT1sg N+k1F6a1F1Pn85Y8NVkCrpA= X-Google-Smtp-Source: ABdhPJx5aOnqEyTXGfBsNnOYc7BKX8TccGNeSiP10BYFyQkKCWh39MaSWprMb+1DZ9W3KLaqfoKluQ== X-Received: by 2002:a17:903:2352:b029:12c:afb8:fadb with SMTP id c18-20020a1709032352b029012cafb8fadbmr9389145plh.34.1628072580974; Wed, 04 Aug 2021 03:23:00 -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.22.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Aug 2021 03:23:00 -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 3/4] EFI: console: max rows and cols user limit Date: Wed, 4 Aug 2021 18:22:16 +0800 Message-Id: <20210804102217.2419510-4-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 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 Setup the max rows and columns limit for the EFI console output. Signed-off-by: Artem Lapkin --- lib/efi_loader/Kconfig | 12 ++++++++++++ lib/efi_loader/efi_console.c | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index dacc3b5881..7d00d6cde5 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -381,4 +381,16 @@ config EFI_ESRT help Enabling this option creates the ESRT UEFI system table. +config EFI_CONSOLE_MAX_ROWS + int "setup console max rows" + default 0 + help + Set console max rows limit or set to zero to disable limit. + +config EFI_CONSOLE_MAX_COLS + int "setup console max cols" + default 0 + help + Set console max rows limit or set to zero to disable limit. + endif diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c index 847069212e..b5d79d788f 100644 --- a/lib/efi_loader/efi_console.c +++ b/lib/efi_loader/efi_console.c @@ -351,6 +351,11 @@ static void query_console_size(void) } else if (query_console_serial(&rows, &cols)) return; + if (CONFIG_EFI_CONSOLE_MAX_ROWS > 0) + rows = min(rows, CONFIG_EFI_CONSOLE_MAX_ROWS); + if (CONFIG_EFI_CONSOLE_MAX_COLS > 0) + cols = min(cols, CONFIG_EFI_CONSOLE_MAX_COLS); + /* Test if we can have Mode 1 */ if (cols >= 80 && rows >= 50) { efi_cout_modes[1].present = 1; From patchwork Wed Aug 4 10:22:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Art Nikpal X-Patchwork-Id: 1513376 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=cJKNlGAG; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Gfnrv6Swvz9sT6 for ; Wed, 4 Aug 2021 20:23:43 +1000 (AEST) 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) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 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 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; }