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 3C16874003C for ; Thu, 21 Dec 2023 02:21:37 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=KRejAWUysWr4mZWBjFqEDdqP9qLBLvN1E4/qEYy0vAY=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe; s=20140610; t=1703125295; v=1; b=iU/Gxsf8tG5oaxY0PfuV3euYt34iI31JNGRGQkPPa8HOrbFPRuh5D2CKVyObf4r43jLjRI4L wYniTgAkvrFwW39S7P+afRiv+bjArYSXlK5Ny1GI1TmkpFfS1C2zc4gVlkACuz8Yg4hJhyK7j4Y 6GnhwaOCh9PcaFNmSHL0CZ28= X-Received: by 127.0.0.2 with SMTP id dMh3YY7687511xn8a3b9UH4E; Wed, 20 Dec 2023 18:21:35 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by mx.groups.io with SMTP id smtpd.web10.43419.1703125294908514900 for ; Wed, 20 Dec 2023 18:21:35 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10930"; a="14591361" X-IronPort-AV: E=Sophos;i="6.04,292,1695711600"; d="scan'208";a="14591361" X-Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2023 18:21:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10930"; a="920172797" X-IronPort-AV: E=Sophos;i="6.04,292,1695711600"; d="scan'208";a="920172797" X-Received: from sh1gapp1009.ccr.corp.intel.com ([10.239.189.219]) by fmsmga001.fm.intel.com with ESMTP; 20 Dec 2023 18:21:25 -0800 From: "Wu, Jiaxin" To: devel@edk2.groups.io Cc: Ray Ni Subject: [edk2-devel] [PATCH v1 1/6] SourceLevelDebugPkg/Library: Indicate SMM Debug Agent support or not Date: Thu, 21 Dec 2023 10:21:16 +0800 Message-Id: <20231221022121.12224-2-jiaxin.wu@intel.com> In-Reply-To: <20231221022121.12224-1-jiaxin.wu@intel.com> References: <20231221022121.12224-1-jiaxin.wu@intel.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,jiaxin.wu@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: pRV62AdMzSRo51UqomSY4Eyax7686176AA= X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b="iU/Gxsf8"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.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 This patch use the Context to indicate SMM Debug Agent support or not if InitFlag is DEBUG_AGENT_INIT_SMM. Context must be the pointer to the BOOLEAN value if it's not NULL. Cc: Ray Ni Signed-off-by: Jiaxin Wu --- .../Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c b/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c index f49a592d27..1648c2b33e 100644 --- a/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c +++ b/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c @@ -157,12 +157,13 @@ RestoreDebugRegister ( in SMM code. If InitFlag is DEBUG_AGENT_INIT_SMM, it will override IDT table entries and initialize debug port. It will get debug agent Mailbox from GUIDed HOB, it it exists, debug agent wiil copied it into the local Mailbox in SMM space. - it will override IDT table entries and initialize debug port. Context will be - NULL. + it will override IDT table entries and initialize debug port. Context must be + the pointer to the BOOLEAN value if it's not NULL, which indicates SMM Debug + Agent supported or not. If InitFlag is DEBUG_AGENT_INIT_ENTER_SMI, debug agent will save Debug Registers and get local Mailbox in SMM space. Context will be NULL. If InitFlag is DEBUG_AGENT_INIT_EXIT_SMI, debug agent will restore Debug Registers. Context will be NULL. @@ -203,29 +204,32 @@ InitializeDebugAgent ( (VOID *)&mVectorHandoffInfoDebugAgent[0], sizeof (EFI_VECTOR_HANDOFF_INFO) * mVectorHandoffInfoCount ); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "DebugAgent: Cannot install configuration table for persisted vector handoff info!\n")); + *(BOOLEAN *)Context = FALSE; CpuDeadLoop (); } // // Check if Debug Agent initialized in DXE phase // Status = EfiGetSystemConfigurationTable (&gEfiDebugAgentGuid, (VOID **)&Mailbox); if ((Status == EFI_SUCCESS) && (Mailbox != NULL)) { VerifyMailboxChecksum (Mailbox); - mMailboxPointer = Mailbox; + mMailboxPointer = Mailbox; + *(BOOLEAN *)Context = TRUE; break; } // // Check if Debug Agent initialized in SEC/PEI phase // Mailbox = GetMailboxFromHob (); if (Mailbox != NULL) { - mMailboxPointer = Mailbox; + mMailboxPointer = Mailbox; + *(BOOLEAN *)Context = TRUE; break; } // // Debug Agent was not initialized before, use the local mailbox. @@ -273,10 +277,12 @@ InitializeDebugAgent ( // // Restore saved IDT entries // CopyMem ((VOID *)IdtDescriptor.Base, &IdtEntry, 33 * sizeof (IA32_IDT_GATE_DESCRIPTOR)); + *(BOOLEAN *)Context = TRUE; + break; case DEBUG_AGENT_INIT_ENTER_SMI: SaveDebugRegister (); if (!mSmmDebugIdtInitFlag) { -- 2.16.2.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112792): https://edk2.groups.io/g/devel/message/112792 Mute This Topic: https://groups.io/mt/103293798/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-