[edk2-devel] [PATCH v2 2/6] MdeModulePkg/DebugAgentLibNull: Indicate SMM Debug Agent support or not

Wu, Jiaxin posted 6 patches 2 years, 1 month ago
[edk2-devel] [PATCH v2 2/6] MdeModulePkg/DebugAgentLibNull: Indicate SMM Debug Agent support or not
Posted by Wu, Jiaxin 2 years, 1 month ago
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 <ray.ni@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
---
 MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.c b/MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.c
index 8e70705eb6..5596ee3bf9 100644
--- a/MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.c
+++ b/MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.c
@@ -22,10 +22,13 @@
   passing in the Context to be its parameter.
 
   If Function() is NULL, Debug Agent Library instance will return after setup debug
   environment.
 
+  If InitFlag is DEBUG_AGENT_INIT_SMM, Context must point to a BOOLEAN if it's not
+  NULL, which indicates SMM Debug Agent supported or not.
+
   @param[in] InitFlag     Init flag is used to decide the initialize process.
   @param[in] Context      Context needed according to InitFlag; it was optional.
   @param[in] Function     Continue function called by debug agent library; it was
                           optional.
 
@@ -36,10 +39,16 @@ InitializeDebugAgent (
   IN UINT32                InitFlag,
   IN VOID                  *Context  OPTIONAL,
   IN DEBUG_AGENT_CONTINUE  Function  OPTIONAL
   )
 {
+  switch (InitFlag) {
+    case DEBUG_AGENT_INIT_SMM:
+      *(BOOLEAN *)Context = FALSE;
+      return;
+  }
+
   if (Function != NULL) {
     Function (Context);
   }
 }
 
-- 
2.16.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112887): https://edk2.groups.io/g/devel/message/112887
Mute This Topic: https://groups.io/mt/103360803/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH v2 2/6] MdeModulePkg/DebugAgentLibNull: Indicate SMM Debug Agent support or not
Posted by Ni, Ray 2 years, 1 month ago
Similar comments as #1.
Context could be NULL. Please add check before the assignment.
With that, Reviewed-by: Ray Ni <ray.ni@intel.com>

Thanks,
Ray
> -----Original Message-----
> From: Wu, Jiaxin <jiaxin.wu@intel.com>
> Sent: Tuesday, December 26, 2023 12:21 AM
> To: devel@edk2.groups.io
> Cc: Ni, Ray <ray.ni@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>
> Subject: [PATCH v2 2/6] MdeModulePkg/DebugAgentLibNull: Indicate SMM
> Debug Agent support or not
> 
> 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 <ray.ni@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
> ---
>  MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.c | 9
> +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.c
> b/MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.c
> index 8e70705eb6..5596ee3bf9 100644
> --- a/MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.c
> +++ b/MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.c
> @@ -22,10 +22,13 @@
>    passing in the Context to be its parameter.
> 
>    If Function() is NULL, Debug Agent Library instance will return after setup
> debug
>    environment.
> 
> +  If InitFlag is DEBUG_AGENT_INIT_SMM, Context must point to a BOOLEAN
> if it's not
> +  NULL, which indicates SMM Debug Agent supported or not.
> +
>    @param[in] InitFlag     Init flag is used to decide the initialize process.
>    @param[in] Context      Context needed according to InitFlag; it was optional.
>    @param[in] Function     Continue function called by debug agent library; it
> was
>                            optional.
> 
> @@ -36,10 +39,16 @@ InitializeDebugAgent (
>    IN UINT32                InitFlag,
>    IN VOID                  *Context  OPTIONAL,
>    IN DEBUG_AGENT_CONTINUE  Function  OPTIONAL
>    )
>  {
> +  switch (InitFlag) {
> +    case DEBUG_AGENT_INIT_SMM:
> +      *(BOOLEAN *)Context = FALSE;
> +      return;
> +  }
> +
>    if (Function != NULL) {
>      Function (Context);
>    }
>  }
> 
> --
> 2.16.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112900): https://edk2.groups.io/g/devel/message/112900
Mute This Topic: https://groups.io/mt/103360803/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076/xyzzy [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-