From nobody Tue Feb 10 16:18:53 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+90075+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+90075+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1653619443; cv=none; d=zohomail.com; s=zohoarc; b=RQrXUY5Dl8ppoc9dSAnUAyru3cTu7KeM8E43cHaIVTknmNB7hHCOpoSBp/Ioc0eXCLighlaWesaL2IHSW5x6C44Nc8QJ6G6IApWx3yIWqMvDwDAIOfMqbsUvIE0J8bgLaQxhYi++44KUDg5/lA3a23/gzGmTjh//DHz5BanYzn0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653619443; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=VLltoSEa15iH2WUEY9+Afh0LTIlzoHcLMbEeLb0aJ8E=; b=J1krwOZlxbEaCtOs8mVwapslfqOUhe87pTDf0H5OjZCcxVqQ2T7DQimJliSWe+PYzjowsEEw6657NrNlJURdVEk4xVjGwnDrK+GM6N6wBmkQ1QbEwSH9X6m4ThvQcPdnIGjOkGrBlmyLosCSAlkVRRRvqHGHzOGdOw3NUU86h70= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+90075+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 165361944396637.73706302342043; Thu, 26 May 2022 19:44:03 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id vcQ7YY1788612xFmVgpusUQ5; Thu, 26 May 2022 19:44:03 -0700 X-Received: from smtp-fw-80006.amazon.com (smtp-fw-80006.amazon.com [99.78.197.217]) by mx.groups.io with SMTP id smtpd.web08.3197.1653619443043458813 for ; Thu, 26 May 2022 19:44:03 -0700 X-IronPort-AV: E=Sophos;i="5.91,254,1647302400"; d="scan'208";a="92377818" X-Received: from pdx4-co-svc-p1-lb2-vlan3.amazon.com (HELO email-inbound-relay-iad-1e-b69ea591.us-east-1.amazon.com) ([10.25.36.214]) by smtp-border-fw-80006.pdx80.corp.amazon.com with ESMTP; 27 May 2022 02:44:02 +0000 X-Received: from EX13MTAUWC001.ant.amazon.com (iad12-ws-svc-p26-lb9-vlan2.iad.amazon.com [10.40.163.34]) by email-inbound-relay-iad-1e-b69ea591.us-east-1.amazon.com (Postfix) with ESMTPS id 8000FC098D; Fri, 27 May 2022 02:44:01 +0000 (UTC) X-Received: from EX13D20UWC001.ant.amazon.com (10.43.162.244) by EX13MTAUWC001.ant.amazon.com (10.43.162.135) with Microsoft SMTP Server (TLS) id 15.0.1497.36; Fri, 27 May 2022 02:44:00 +0000 X-Received: from u79c5a0a55de558.ant.amazon.com (10.43.160.26) by EX13D20UWC001.ant.amazon.com (10.43.162.244) with Microsoft SMTP Server (TLS) id 15.0.1497.36; Fri, 27 May 2022 02:43:58 +0000 From: "Alexander Graf via groups.io" To: CC: Ard Biesheuvel , Leif Lindholm , Dandan Bi , Zhichao Gao , Liming Gao Subject: [edk2-devel] [PATCH 11/12] BaseDebugLibSerialPort: Emit messages to boot log Date: Fri, 27 May 2022 04:43:16 +0200 Message-ID: <20220527024317.13476-12-graf@amazon.com> In-Reply-To: <20220527024317.13476-1-graf@amazon.com> References: <20220527024317.13476-1-graf@amazon.com> MIME-Version: 1.0 X-Originating-IP: [10.43.160.26] X-ClientProxiedBy: EX13D38UWB004.ant.amazon.com (10.43.161.30) To EX13D20UWC001.ant.amazon.com (10.43.162.244) Precedence: Bulk List-Unsubscribe: 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,graf@amazon.com X-Gm-Message-State: 2zEZ6AK8ANtq6pFE504NPuphx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1653619443; bh=qL8OlYRBV48M0loaYD1uDYduR1IOfoTFyUkD0YGyadw=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=D/LNytnZcL3dRLjda8kkQPKzkuPpGHnELfOYOdNEnQXEfA16UomYOlppZfY3GJdEvuQ Hk4Gkfvd3aN9atEUV43W8qci4dmnmmzVkxbSzRynQjRrn1wdrOpd06gJICm8Cw6ol8iUi C9htwuEPb80uvlmNQbrIUkuAqoIHd+M+QnA= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1653619444662100007 Content-Type: text/plain; charset="utf-8" Now that we have the bootlog infrastructure in place and link against it with all in tree consumers of BaseDebugLibSerialPort, let's emit log lines to the bootlog in addition to serial. The existing PcdDebugBootlogErrorLevel still defines which messages end up on serial. However, in addition the new PcdDebugBootlogErrorLevel defines which ones go into the bootlog. The latter may be more verbose. Signed-off-by: Alexander Graf --- .../BaseDebugLibSerialPort.inf | 1 + .../Library/BaseDebugLibSerialPort/DebugLib.c | 22 +++++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.i= nf b/MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf index 7504faee67..dd22fbeb4a 100644 --- a/MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf +++ b/MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf @@ -36,6 +36,7 @@ PrintLib BaseLib DebugPrintErrorLevelLib + DebugBootlogLib =20 [Pcd] gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue ## SOMETIMES_CONSUMES diff --git a/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c b/MdePkg/Libr= ary/BaseDebugLibSerialPort/DebugLib.c index bd56869477..ea2611228d 100644 --- a/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c +++ b/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c @@ -20,6 +20,7 @@ #include #include #include +#include =20 // // Define the maximum debug and assert message length that this library su= pports @@ -103,16 +104,20 @@ DebugPrintMarker ( ) { CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH]; + UINT32 DebugPrintLevel, DebugBootlogLevel, Length; =20 // // If Format is NULL, then ASSERT(). // ASSERT (Format !=3D NULL); =20 + DebugPrintLevel =3D GetDebugPrintErrorLevel (); + DebugBootlogLevel =3D GetDebugBootlogErrorLevel (); + // // Check driver debug mask value and global mask // - if ((ErrorLevel & GetDebugPrintErrorLevel ()) =3D=3D 0) { + if ((ErrorLevel & (DebugPrintLevel | DebugBootlogLevel)) =3D=3D 0) { return; } =20 @@ -120,15 +125,24 @@ DebugPrintMarker ( // Convert the DEBUG() message to an ASCII String // if (BaseListMarker =3D=3D NULL) { - AsciiVSPrint (Buffer, sizeof (Buffer), Format, VaListMarker); + Length =3D AsciiVSPrint (Buffer, sizeof (Buffer), Format, VaListMarker= ); } else { - AsciiBSPrint (Buffer, sizeof (Buffer), Format, BaseListMarker); + Length =3D AsciiBSPrint (Buffer, sizeof (Buffer), Format, BaseListMark= er); } =20 // // Send the print string to a Serial Port // - SerialPortWrite ((UINT8 *)Buffer, AsciiStrLen (Buffer)); + if (ErrorLevel & DebugPrintLevel) { + SerialPortWrite ((UINT8 *)Buffer, Length); + } + + // + // Append the print string to the Boot Log + // + if (ErrorLevel & DebugBootlogLevel) { + DebugBootlogAppend (Buffer, Length, ErrorLevel); + } } =20 /** --=20 2.28.0.394.ge197136389 Amazon Development Center Germany GmbH Krausenstr. 38 10117 Berlin Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B Sitz: Berlin Ust-ID: DE 289 237 879 -=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 (#90075): https://edk2.groups.io/g/devel/message/90075 Mute This Topic: https://groups.io/mt/91368917/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-