]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SourceLevelDebugPkg/DebugAgentDxe/DebugAgentDxe.c
BaseTools Conf: Update tools_def and build_rule to remove IPF setting
[mirror_edk2.git] / SourceLevelDebugPkg / DebugAgentDxe / DebugAgentDxe.c
index 99bb2fdedbf0556417c89180f0726885a74d17b2..304c53dfaa557de53c01805310e79473b057a5a3 100644 (file)
@@ -1,14 +1,14 @@
 /** @file\r
   Initialize Debug Agent in DXE by invoking Debug Agent Library.\r
 \r
-Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials                          \r
-are licensed and made available under the terms and conditions of the BSD License         \r
-which accompanies this distribution.  The full text of the license may be found at        \r
-http://opensource.org/licenses/bsd-license.php                                            \r
-                                                                                          \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 **/\r
 \r
@@ -16,14 +16,15 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Guid/EventGroup.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/DebugAgentLib.h>\r
+#include <Library/UefiLib.h>\r
 \r
-EFI_EVENT       mExitBootServiceEvent; \r
+EFI_EVENT       mExitBootServiceEvent;\r
 \r
 /**\r
   One notified function to disable Debug Timer interrupt when gBS->ExitBootServices() called.\r
 \r
   @param[in]  Event              Pointer to this event\r
-  @param[in]  Context            Event hanlder private data\r
+  @param[in]  Context            Event handler private data\r
 \r
 **/\r
 VOID\r
@@ -58,10 +59,42 @@ DebugAgentDxeInitialize(
 {\r
   EFI_STATUS      Status;\r
 \r
+  if (gST->ConOut != NULL) {\r
+    Print (L"If the Debug Port is serial port, please make sure this serial port isn't connected by");\r
+    Print (L" ISA Serial driver\r\n");\r
+    Print (L"You could do the following steps to disconnect the serial port:\r\n");\r
+    Print (L"1: Shell> drivers\r\n");\r
+    Print (L"   ...\r\n");\r
+    Print (L"   V  VERSION  E G G #D #C DRIVER NAME                         IMAGE NAME\r\n");\r
+    Print (L"   == ======== = = = == == =================================== ===================\r\n");\r
+    Print (L"   8F 0000000A B - -  1 14 PCI Bus Driver                      PciBusDxe\r\n");\r
+    Print (L"   91 00000010 ? - -  -  - ATA Bus Driver                      AtaBusDxe\r\n");\r
+    Print (L"   ...\r\n");\r
+    Print (L"   A7 0000000A B - -  1  1 ISA Serial Driver                   IsaSerialDxe\r\n");\r
+    Print (L"   ...\r\n");\r
+    Print (L"2: Shell> dh -d A7\r\n");\r
+    Print (L"   A7: Image(IsaSerialDxe) ImageDevPath (..9FB3-11D4-9A3A-0090273FC14D))DriverBinding");\r
+    Print (L" ComponentName ComponentName2\r\n");\r
+    Print (L"        Driver Name    : ISA Serial Driver\r\n");\r
+    Print (L"        Image Name     : FvFile(93B80003-9FB3-11D4-9A3A-0090273FC14D)\r\n");\r
+    Print (L"        Driver Version : 0000000A\r\n");\r
+    Print (L"        Driver Type    : BUS\r\n");\r
+    Print (L"        Configuration  : NO\r\n");\r
+    Print (L"        Diagnostics    : NO\r\n");\r
+    Print (L"        Managing       :\r\n");\r
+    Print (L"          Ctrl[EA] : PciRoot(0x0)/Pci(0x1F,0x0)/Serial(0x0)\r\n");\r
+    Print (L"            Child[EB] : PciRoot(0x0)/Pci(0x1F,0x0)/Serial(0x0)/Uart(115200,8,N,1)\r\n");\r
+    Print (L"3: Shell> disconnect EA\r\n");\r
+    Print (L"4: Shell> load -nc DebugAgentDxe.efi\r\n\r\n");\r
+  }\r
+  Status = EFI_UNSUPPORTED;\r
   InitializeDebugAgent (DEBUG_AGENT_INIT_DXE_LOAD, &Status, NULL);\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
+  if (gST->ConOut != NULL) {\r
+    Print (L"Debug Agent: Initialized successfully!\r\n\r\n");\r
+  }\r
   //\r
   // Create event to disable Debug Timer interrupt when exit boot service.\r
   //\r
@@ -95,7 +128,16 @@ DebugAgentDxeUnload (
 {\r
   EFI_STATUS          Status;\r
 \r
+  Status = EFI_UNSUPPORTED;\r
   InitializeDebugAgent (DEBUG_AGENT_INIT_DXE_UNLOAD, &Status, NULL);\r
+  switch (Status) {\r
+  case EFI_ACCESS_DENIED:\r
+    Print (L"Debug Agent: Host is still connected, please de-attach TARGET firstly!\r\n");\r
+    break;\r
+  case EFI_NOT_STARTED:\r
+    Print (L"Debug Agent: It hasn't been initialized, cannot unload it!\r\n");\r
+    break;\r
+  }\r
 \r
   return Status;\r
 }\r