From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 09DB2AC19C2 for ; Wed, 24 Jan 2024 16:47:25 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=FMLQ4kvlGIi1+usSskH4eN1IFzrRMJOxF6A5EZ7O3vA=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1706114844; v=1; b=FE6UE/f8XL9fUunMeSD0hN5ADxKEhjQikYfFLKyUii2HT2MclwHdMMbYvfo9qyfxOcwxyU/9 dl1f/jnYUBjAB30kvYTOVhxEzV0PQgkxBQXfa1q5XMWcWqKInYGvh+RpRcPnEB4nM9q+OLI3ceT GzMBGDr6XGHoiqbg9bgJbYlI= X-Received: by 127.0.0.2 with SMTP id MV9mYY7687511xdEv6dyCPHJ; Wed, 24 Jan 2024 08:47:24 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web10.27883.1706114843794943170 for ; Wed, 24 Jan 2024 08:47:23 -0800 X-Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-593-p1nDj0NlPj-r6dIkKPdlYA-1; Wed, 24 Jan 2024 11:47:19 -0500 X-MC-Unique: p1nDj0NlPj-r6dIkKPdlYA-1 X-Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 46B75282476C; Wed, 24 Jan 2024 16:47:19 +0000 (UTC) X-Received: from [10.39.195.127] (unknown [10.39.195.127]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F20A8492C25; Wed, 24 Jan 2024 16:47:17 +0000 (UTC) Message-ID: <67da33f7-5038-6732-455a-2576f641f1c0@redhat.com> Date: Wed, 24 Jan 2024 17:47:16 +0100 MIME-Version: 1.0 Subject: Re: [edk2-devel] [PATCH 1/1] OvmfPkg/ResetVector: send post codes to qemu debug console To: devel@edk2.groups.io, kraxel@redhat.com Cc: Jiewen Yao , Erdem Aktas , Ard Biesheuvel , Michael Roth , Min Xu , Tom Lendacky , Oliver Steffen References: <20240124153107.2112760-1-kraxel@redhat.com> From: "Laszlo Ersek" In-Reply-To: <20240124153107.2112760-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: JsgzaS9Ocdbmmi43f0eQ9viYx7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b="FE6UE/f8"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io On 1/24/24 16:31, Gerd Hoffmann wrote: > Neat when doing ResetVector coding. >=20 > Signed-off-by: Gerd Hoffmann > --- > OvmfPkg/ResetVector/DebugCon.asm | 43 +++++++++++++++++++++++++++ > OvmfPkg/ResetVector/ResetVector.nasmb | 2 +- > 2 files changed, 44 insertions(+), 1 deletion(-) > create mode 100644 OvmfPkg/ResetVector/DebugCon.asm >=20 > diff --git a/OvmfPkg/ResetVector/DebugCon.asm b/OvmfPkg/ResetVector/Debug= Con.asm > new file mode 100644 > index 000000000000..9c57d1a52c75 > --- /dev/null > +++ b/OvmfPkg/ResetVector/DebugCon.asm > @@ -0,0 +1,43 @@ > +;-----------------------------------------------------------------------= ------- > +; @file > +; qemu debug console support macros (based on serial port macros) > +; > +; Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
> +; SPDX-License-Identifier: BSD-2-Clause-Patent > +; > +;-----------------------------------------------------------------------= ------- > + > +%macro outToDebugPort 1 > + mov dx, 0x402 > + mov al, %1 > + out dx, al > +%endmacro > + > +%macro debugShowCharacter 1 > + outToDebugPort %1 > +%endmacro > + > +%macro debugShowHexDigit 1 > + %if (%1 < 0xa) > + debugShowCharacter BYTE ('0' + (%1)) > + %else > + debugShowCharacter BYTE ('a' + ((%1) - 0xa)) > + %endif > +%endmacro > + > +%macro debugNewline 0 > + debugShowCharacter `\r` > + debugShowCharacter `\n` > +%endmacro > + > +%macro debugShowPostCode 1 > + debugShowHexDigit (((%1) >> 4) & 0xf) > + debugShowHexDigit ((%1) & 0xf) > + debugNewline > +%endmacro > + > +BITS 16 > + > +%macro debugInitialize 0 > + ; not required > +%endmacro > diff --git a/OvmfPkg/ResetVector/ResetVector.nasmb b/OvmfPkg/ResetVector/= ResetVector.nasmb > index 5832aaa8abf7..f1655ddfcde3 100644 > --- a/OvmfPkg/ResetVector/ResetVector.nasmb > +++ b/OvmfPkg/ResetVector/ResetVector.nasmb > @@ -41,7 +41,7 @@ > %elifdef DEBUG_SERIAL > %include "SerialDebug.asm" > %else > - %include "DebugDisabled.asm" > + %include "DebugCon.asm" > %endif > =20 > %include "Ia32/SearchForBfvBase.asm" (1) How much output does this produce? Trapping to QEMU for every single character written to the debug console is very slow. If it only produces a few bytes, that should be OK. (2) debugInitialize could actually be put to use; the presence of the QEMU debug console is detectable. We'd need to allocate a single byte somewhere, detect the console in debugInitialize, save the result in that byte, then check the byte in debugShowPostCode. Eliminates even those few (?) traps if there is no debug console configured. (3) I'm already hating myself for asking about this, but... is there a way for only customizing debugInitialize and debugShowCharacter? The rest is common with "SerialDebug.asm", and I wish I hadn't had to review those (unchanged) macros, they make my eyes bleed :/ Anyway, if you think any of these (or all of these!) means too much work, I'm OK with the patch going-in as is. I'm a bit concerned about (1), TBH. Laszlo -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114331): https://edk2.groups.io/g/devel/message/114331 Mute This Topic: https://groups.io/mt/103933942/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/19134562= 12/xyzzy [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-