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 9659A74003A for ; Mon, 25 Dec 2023 16:20:41 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=nBBWwCLRUUdLsjs3TFa2VjDzUmd9zyr/iaq2xj84Dlo=; 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=1703521240; v=1; b=ep4y77Ttw5SOQH4wH3/YCpJVfNdESUdl8/ejigxFJaN+KQ28dwxI4JgDlFir7Zpm7Fz9z9Fy HuFzP92tGkdh7f1zIFIi6mqoSr1WVoC9QD2pbmoBSG9akbZdr+/Q0dOpss3VS5tWArvw/W/X+kj roLU4ML2QLCHk3cUzUQA2UvA= X-Received: by 127.0.0.2 with SMTP id KnC3YY7687511xKpHdse66oL; Mon, 25 Dec 2023 08:20:40 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web11.61867.1703521238683254667 for ; Mon, 25 Dec 2023 08:20:39 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10934"; a="375789608" X-IronPort-AV: E=Sophos;i="6.04,303,1695711600"; d="scan'208";a="375789608" X-Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Dec 2023 08:20:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,303,1695711600"; d="scan'208";a="26085421" X-Received: from sh1gapp1009.ccr.corp.intel.com ([10.239.189.219]) by orviesa001.jf.intel.com with ESMTP; 25 Dec 2023 08:20:38 -0800 From: "Wu, Jiaxin" To: devel@edk2.groups.io Cc: Ray Ni Subject: [edk2-devel] [PATCH v2 1/6] SourceLevelDebugPkg/Library: Indicate SMM Debug Agent support or not Date: Tue, 26 Dec 2023 00:20:29 +0800 Message-Id: <20231225162034.2052-2-jiaxin.wu@intel.com> In-Reply-To: <20231225162034.2052-1-jiaxin.wu@intel.com> References: <20231225162034.2052-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: AIuCOIpHYFW77jICDRiDZr0wx7686176AA= X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=ep4y77Tt; 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 is to use the Context to indicate SMM Debug Agent support or not if InitFlag is DEBUG_AGENT_INIT_SMM. Context must point to a BOOLEAN 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..1f34a0edc8 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 + point to a BOOLEAN 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 (#112886): https://edk2.groups.io/g/devel/message/112886 Mute This Topic: https://groups.io/mt/103360802/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-