From nobody Sun May 19 15:58:46 2024 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+87522+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+87522+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1647225195; cv=none; d=zohomail.com; s=zohoarc; b=RFRNdpSHO/NSMe/okOaHQePWdI+BktP4VALt1ECWTMsi+QaR8JNtw6tCaHgciiqBwfnSOmLcLPzj2NP3hx/Jt9NWCaVDOB5GaOaPZjvNZutIZOe+VLf6hg6W64GgVX88rlBtIkQlBrYsai6TBoqNH61oKQMKXyFJEkOc6KI5AAU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1647225195; h=Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To; bh=ane35tjtTGKKHm6mOZYE4JVJZvSEvfR/qOe5fbJ4vOQ=; b=WJA8NbhhScZC7U5iq6jGGd0fn+oIFmHkAmd3bFNWmnsOXiUZSNCskcxDFdMeQggxyWip2QsxoFTM4Xb005AzMJcFc/DOhdgPVul416o/YD2xDPGF9o/0t8+tmkir5v+OGzFTjeZKppLq+WKG3Sx0sUGoud3NJEZiQrMOf1VdCP8= 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+87522+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1647225195082550.3937880419728; Sun, 13 Mar 2022 19:33:15 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 8FxmYY1788612xZUexGdVMqc; Sun, 13 Mar 2022 19:33:14 -0700 X-Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web10.22272.1647225193856931418 for ; Sun, 13 Mar 2022 19:33:14 -0700 X-IronPort-AV: E=McAfee;i="6200,9189,10285"; a="243368607" X-IronPort-AV: E=Sophos;i="5.90,179,1643702400"; d="scan'208";a="243368607" X-Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Mar 2022 19:33:13 -0700 X-IronPort-AV: E=Sophos;i="5.90,179,1643702400"; d="scan'208";a="634032961" X-Received: from tedkuo1-win10.gar.corp.intel.com ([10.5.215.13]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Mar 2022 19:33:11 -0700 From: "Kuo, Ted" To: devel@edk2.groups.io Cc: Chasel Chiu , Nate DeSimone , Star Zeng , Ashraf Ali S Subject: [edk2-devel][PATCH v2] IntelFsp2Pkg: BaseFspDebugLibSerialPort Support for X64 Date: Mon, 14 Mar 2022 10:32:42 +0800 Message-Id: <36aaf49894b82a5db9f359e08e10057f9ea14922.1647225139.git.ted.kuo@intel.com> 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,ted.kuo@intel.com X-Gm-Message-State: LnPsUtyVCLmHtjBgtpqT1TqMx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1647225194; bh=0RmytPyhYV4TR3nU4UHVfbmiiHcZt9YEm9U96afvch0=; h=Cc:Date:From:Reply-To:Subject:To; b=qOoJkFPw1arW1zaqwrXZ7vArPjVWuKUXz7PQyGNT4c4r+zRwHLGEa7xTIh6o2BdprH7 XnTGaHBD57UaFmu0e3rCbWHUZe9Dj2eRVOGZWOtJP94Iaqa6sFo7GT7xNREGnOdDHNKYK nqvWtcGlf6srqcLozuKjHKVHjWOwqWxn2zU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1647225196016100002 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3833 Add BaseFspDebugLibSerialPort Support for X64. Cc: Chasel Chiu Cc: Nate DeSimone Cc: Star Zeng Cc: Ashraf Ali S Cc: Ted Kuo Signed-off-by: Ted Kuo Reviewed-by: Chasel Chiu --- .../BaseFspDebugLibSerialPort.inf | 5 ++- .../Library/BaseFspDebugLibSerialPort/DebugLib.c | 39 +++++++++++++-----= ---- .../BaseFspDebugLibSerialPort/X64/FspDebug.nasm | 25 ++++++++++++++ 3 files changed, 53 insertions(+), 16 deletions(-) create mode 100644 IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/X64/FspD= ebug.nasm diff --git a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/BaseFspDebugLib= SerialPort.inf b/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/BaseFspDebu= gLibSerialPort.inf index 14b1899e6c..395def57c3 100644 --- a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/BaseFspDebugLibSerialP= ort.inf +++ b/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/BaseFspDebugLibSerialP= ort.inf @@ -16,7 +16,7 @@ LIBRARY_CLASS =3D DebugLib =20 # -# VALID_ARCHITECTURES =3D IA32 +# VALID_ARCHITECTURES =3D IA32 X64 # =20 [Sources] @@ -25,6 +25,9 @@ [Sources.Ia32] Ia32/FspDebug.nasm =20 +[Sources.X64] + X64/FspDebug.nasm + [Packages] MdePkg/MdePkg.dec IntelFsp2Pkg/IntelFsp2Pkg.dec diff --git a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/DebugLib.c b/In= telFsp2Pkg/Library/BaseFspDebugLibSerialPort/DebugLib.c index c8824cde7f..cb2317bfb2 100644 --- a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/DebugLib.c +++ b/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/DebugLib.c @@ -33,7 +33,7 @@ VA_LIST mVaListNull; =20 @return StackFramePointer stack frame pointer of function call. **/ -UINT32 * +UINTN * EFIAPI GetStackFramePointer ( VOID @@ -193,13 +193,13 @@ DebugBPrint ( **/ VOID FillHex ( - UINT32 Value, + UINTN Value, CHAR8 *Buffer ) { INTN Idx; =20 - for (Idx =3D 7; Idx >=3D 0; Idx--) { + for (Idx =3D (sizeof (UINTN) * 2) - 1; Idx >=3D 0; Idx--) { Buffer[Idx] =3D mHexTable[Value & 0x0F]; Value >>=3D 4; } @@ -228,26 +228,35 @@ DebugAssertInternal ( ) { CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH]; - UINT32 *Frame; + UINTN *Frame; =20 - Frame =3D (UINT32 *)GetStackFramePointer (); + Frame =3D (UINTN *)GetStackFramePointer (); =20 // // Generate the ASSERT() message in Ascii format // - AsciiStrnCpyS ( - Buffer, - sizeof (Buffer) / sizeof (CHAR8), - "-> EBP:0x00000000 EIP:0x00000000\n", - sizeof (Buffer) / sizeof (CHAR8) - 1 - ); + if (sizeof (UINTN) =3D=3D sizeof (UINT32)) { + AsciiStrnCpyS ( + Buffer, + sizeof (Buffer) / sizeof (CHAR8), + "-> EBP:0x00000000 EIP:0x00000000\n", + sizeof (Buffer) / sizeof (CHAR8) - 1 + ); + } else { + AsciiStrnCpyS ( + Buffer, + sizeof (Buffer) / sizeof (CHAR8), + "-> RBP:0x0000000000000000 RIP:0x0000000000000000\n", + sizeof (Buffer) / sizeof (CHAR8) - 1 + ); + } SerialPortWrite ((UINT8 *)"ASSERT DUMP:\n", 13); while (Frame !=3D NULL) { - FillHex ((UINT32)Frame, Buffer + 9); - FillHex (Frame[1], Buffer + 9 + 8 + 8); + FillHex ((UINTN)Frame, Buffer + 9); + FillHex (Frame[1], Buffer + 9 + (sizeof (UINTN) * 2) + 8); SerialPortWrite ((UINT8 *)Buffer, AsciiStrLen (Buffer)); - if ((Frame[0] > (UINT32)Frame) && (Frame[0] < (UINT32)Frame + 0x001000= 00)) { - Frame =3D (UINT32 *)Frame[0]; + if ((Frame[0] > (UINTN)Frame) && (Frame[0] < (UINTN)Frame + 0x00100000= )) { + Frame =3D (UINTN *)Frame[0]; } else { Frame =3D NULL; } diff --git a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/X64/FspDebug.na= sm b/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/X64/FspDebug.nasm new file mode 100644 index 0000000000..6cf0f0af8b --- /dev/null +++ b/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/X64/FspDebug.nasm @@ -0,0 +1,25 @@ +;-------------------------------------------------------------------------= ----- +; +; Copyright (c) 2022, Intel Corporation. All rights reserved.
+; SPDX-License-Identifier: BSD-2-Clause-Patent +; +; Abstract: +; +; FSP Debug functions +; +;-------------------------------------------------------------------------= ----- + + SECTION .text + +;-------------------------------------------------------------------------= ----- +; UINT32 * +; EFIAPI +; GetStackFramePointer ( +; VOID +; ); +;-------------------------------------------------------------------------= ----- +global ASM_PFX(GetStackFramePointer) +ASM_PFX(GetStackFramePointer): + mov rax, rbp + ret + --=20 2.16.2.windows.1 -=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 (#87522): https://edk2.groups.io/g/devel/message/87522 Mute This Topic: https://groups.io/mt/89765496/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-