--- /dev/null
+/** @file\r
+ Produce "MpProtocolUnitTest" shell dynamic command.\r
+\r
+ Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>\r
+\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Protocol/ShellDynamicCommand.h>\r
+#include "EfiMpServicesUnitTestCommom.h"\r
+\r
+CHAR16 *mMpProtocolUnitTestCommandHelp = L".TH MpProtocolUnitTest 0\r\n.SH NAME\r\nDisplay unit test results of EFI MP services protocol.\r\n";\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+EfiMpServiceProtocolUnitTest (\r
+ VOID\r
+ );\r
+\r
+/**\r
+ This is the shell command handler function pointer callback type. This\r
+ function handles the command when it is invoked in the shell.\r
+\r
+ @param[in] This The instance of the EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.\r
+ @param[in] SystemTable The pointer to the system table.\r
+ @param[in] ShellParameters The parameters associated with the command.\r
+ @param[in] Shell The instance of the shell protocol used in the context\r
+ of processing this command.\r
+\r
+ @return EFI_SUCCESS the operation was successful\r
+ @return other the operation failed.\r
+**/\r
+SHELL_STATUS\r
+EFIAPI\r
+MpProtocolUnitTestCommandHandler (\r
+ IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,\r
+ IN EFI_SYSTEM_TABLE *SystemTable,\r
+ IN EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters,\r
+ IN EFI_SHELL_PROTOCOL *Shell\r
+ )\r
+{\r
+ return EfiMpServiceProtocolUnitTest ();\r
+}\r
+\r
+/**\r
+ This is the command help handler function pointer callback type. This\r
+ function is responsible for displaying help information for the associated\r
+ command.\r
+\r
+ @param[in] This The instance of the EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.\r
+ @param[in] Language The pointer to the language string to use.\r
+\r
+ @return string Pool allocated help string, must be freed by caller\r
+**/\r
+CHAR16 *\r
+EFIAPI\r
+MpProtocolUnitTestCommandGetHelp (\r
+ IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,\r
+ IN CONST CHAR8 *Language\r
+ )\r
+{\r
+ return AllocateCopyPool (StrSize (mMpProtocolUnitTestCommandHelp), mMpProtocolUnitTestCommandHelp);\r
+}\r
+\r
+EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mMpProtocolUnitTestDynamicCommand = {\r
+ L"MpProtocolUnitTest",\r
+ MpProtocolUnitTestCommandHandler,\r
+ MpProtocolUnitTestCommandGetHelp\r
+};\r
+\r
+/**\r
+ Entry point of MpProtocolUnitTest Dynamic Command.\r
+\r
+ Produce the DynamicCommand protocol to handle "MpProtocolUnitTest" command.\r
+\r
+ @param ImageHandle The image handle of the process.\r
+ @param SystemTable The EFI System Table pointer.\r
+\r
+ @retval EFI_SUCCESS Tftp command is executed successfully.\r
+ @retval EFI_ABORTED HII package was failed to initialize.\r
+ @retval others Other errors when executing MpProtocolUnitTest command.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+MpProtocolUnitTestCommandInitialize (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+\r
+ Status = gBS->InstallProtocolInterface (\r
+ &ImageHandle,\r
+ &gEfiShellDynamicCommandProtocolGuid,\r
+ EFI_NATIVE_INTERFACE,\r
+ &mMpProtocolUnitTestDynamicCommand\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ return Status;\r
+}\r
+\r
+/**\r
+ Driver unload handler.\r
+\r
+ @param ImageHandle The image handle of the process.\r
+\r
+ @retval EFI_SUCCESS The image is unloaded.\r
+ @retval Others Failed to unload the image.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+MpProtocolUnitTestUnload (\r
+ IN EFI_HANDLE ImageHandle\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+\r
+ Status = gBS->UninstallProtocolInterface (\r
+ ImageHandle,\r
+ &gEfiShellDynamicCommandProtocolGuid,\r
+ &mMpProtocolUnitTestDynamicCommand\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ return Status;\r
+}\r