Received: by 2002:a25:1104:0:0:0:0:0 with SMTP id 4csp498569ybr; Fri, 22 May 2020 11:34:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3IzHuSBmI55ECRSn/B5XOrC63tJA6oY2jFw1t8sqPBNUQrLd6AGoe8KgH3xuRcqLRqq45 X-Received: by 2002:a05:6402:144a:: with SMTP id d10mr4012126edx.67.1590172470898; Fri, 22 May 2020 11:34:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590172470; cv=none; d=google.com; s=arc-20160816; b=URbTZDANnmpLL4qE9DSWacPlRWF0WCC/hfh9MT5KSPu44qPBjdX1iWJkAdy0QgLBUw GhOwQlQVY/SPT7JZgyCJ1kgzC/3vJ5ej43kxDl92DFm+ewVa8hxrLMAUbCOUbt1ZpGPq wW7z3vBRrowaZpMRRtGCoWQOYmiEBUgc/uVlMMJqXgjxHIeYUv03r63BcQYTN6sAB8cJ AEy8kFpWq6RlcARnkQ8Z79UKFShVAwxxRzzeF3I10KVcQZSD08iwdlOMUiBM+R50KaM+ U2hHsJuLf4NEetVrnn13x3RA76zXCP5ooYLhly0AG8ONIPVPD7wGrzYaba7o+0e35h0H Ah0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=KhY6xKS5LhFulj223rkGusiCMg3LSICFCzyWBKQB4ss=; b=oL3dgl+rS49inizGr9UOcqsN5V+aXiNeMajW7NN29F9A+6z8RrTv+SMjHagHpQtN+H pxT0uGSdTfKE09aoZSHtXoKGKAadJX9BNO0FnGfBFAUj9m0pqVMJs2tqQVPTxvfqIIly 8vHgmWyG7/qf5YISmdwKf+KX+Q7ZdvOQZcu0oaGHRBsqnGkTSzZm4agYgXTd5kx1T9v6 k0TKcxBef2s0h6eJ6+3IVbDDykSUeaRSPkAQCo/8TI7013jx6E3WHTp4YphvmLyq/0Y5 lT3J2HprT7dj6Vir5w2jSGHplALS7M4BSnLMYo+3STFNci8MC95RDCxZ7OwRzY5ZYQNE nVRQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e18si5509542ejh.211.2020.05.22.11.34.08; Fri, 22 May 2020 11:34:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730958AbgEVSac (ORCPT + 99 others); Fri, 22 May 2020 14:30:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730904AbgEVSaV (ORCPT ); Fri, 22 May 2020 14:30:21 -0400 Received: from Galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D259C061A0E; Fri, 22 May 2020 11:30:21 -0700 (PDT) Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jcCR0-0002lu-2u; Fri, 22 May 2020 20:30:18 +0200 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 99DB21C0475; Fri, 22 May 2020 20:30:17 +0200 (CEST) Date: Fri, 22 May 2020 18:30:17 -0000 From: "tip-bot2 for Dave Young" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: efi/urgent] efi/earlycon: Fix early printk for wider fonts Cc: Dave Young , Ard Biesheuvel , x86 , LKML In-Reply-To: <20200412024927.GA6884@dhcp-128-65.nay.redhat.com> References: <20200412024927.GA6884@dhcp-128-65.nay.redhat.com> MIME-Version: 1.0 Message-ID: <159017221747.17951.10521608377233608958.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the efi/urgent branch of tip: Commit-ID: 8f592ada59b321d248391bae175cd78a12972223 Gitweb: https://git.kernel.org/tip/8f592ada59b321d248391bae175cd78a12972223 Author: Dave Young AuthorDate: Sun, 12 Apr 2020 10:49:27 +08:00 Committer: Ard Biesheuvel CommitterDate: Tue, 12 May 2020 12:29:45 +02:00 efi/earlycon: Fix early printk for wider fonts When I play with terminus fonts I noticed the efi early printk does not work because the earlycon code assumes font width is 8. Here add the code to adapt with larger fonts. Tested with all kinds of kernel built-in fonts on my laptop. Also tested with a local draft patch for 14x28 !bold terminus font. Signed-off-by: Dave Young Link: https://lore.kernel.org/r/20200412024927.GA6884@dhcp-128-65.nay.redhat.com Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/earlycon.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/firmware/efi/earlycon.c b/drivers/firmware/efi/earlycon.c index 5d4f847..a52236e 100644 --- a/drivers/firmware/efi/earlycon.c +++ b/drivers/firmware/efi/earlycon.c @@ -114,14 +114,16 @@ static void efi_earlycon_write_char(u32 *dst, unsigned char c, unsigned int h) const u32 color_black = 0x00000000; const u32 color_white = 0x00ffffff; const u8 *src; - u8 s8; - int m; + int m, n, bytes; + u8 x; - src = font->data + c * font->height; - s8 = *(src + h); + bytes = BITS_TO_BYTES(font->width); + src = font->data + c * font->height * bytes + h * bytes; - for (m = 0; m < 8; m++) { - if ((s8 >> (7 - m)) & 1) + for (m = 0; m < font->width; m++) { + n = m % 8; + x = *(src + m / 8); + if ((x >> (7 - n)) & 1) *dst = color_white; else *dst = color_black;