]> git.proxmox.com Git - mirror_edk2.git/commitdiff
SourceLevelDebugPkg/DebugAgentDxe: Move help info from DxeDebugAgent
authorJeff Fan <jeff.fan@intel.com>
Mon, 18 May 2015 01:21:30 +0000 (01:21 +0000)
committervanjeff <vanjeff@Edk2>
Mon, 18 May 2015 01:21:30 +0000 (01:21 +0000)
Now DxeDebugAgent Library instance will print help information on how to load
DebugAgentDxe.efi in UEFI shell. But it is printed after Target connected to
Host side. This fix is to move help info print to DebugAgentDxe module before
Target tries to connect HOST. It could help developer to get useful information
as early as possible.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17458 6f19259b-4bc3-4df7-8a09-765794883524

SourceLevelDebugPkg/DebugAgentDxe/DebugAgentDxe.c
SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgent/DxeDebugAgentLib.c

index a55c5eb49e467c14ec74f5ebf545738616ddec57..f5ae59fcb453376243cb357756e8f66af71f0e69 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Initialize Debug Agent in DXE by invoking Debug Agent Library.\r
 \r
-Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2013 - 2015, 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
@@ -16,6 +16,7 @@ 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
 \r
@@ -58,11 +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
@@ -98,6 +130,14 @@ DebugAgentDxeUnload (
 \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
index f1cb7d5601b2e74f74cf4e6f14092c7dd0c8d188..8fa0f5c545b8136837a9012bc294ce3862aaec07 100644 (file)
@@ -437,39 +437,11 @@ InitializeDebugAgent (
 \r
     *(EFI_STATUS *)Context = EFI_SUCCESS;\r
 \r
-    if (gST->ConOut != NULL) {\r
-      Print (L"Debug Agent: Initialized successfully!\r\n");\r
-      Print (L"If the Debug Port is serial port, please make sure this serial port isn't connected by 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 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
     break;\r
 \r
   case DEBUG_AGENT_INIT_DXE_UNLOAD:\r
     if (mDebugAgentInitialized) {\r
       if (IsHostAttached ()) {\r
-        Print (L"Debug Agent: Host is still connected, please de-attach TARGET firstly!\r\n");\r
         *(EFI_STATUS *)Context = EFI_ACCESS_DENIED;\r
         //\r
         // Enable Debug Timer interrupt again\r
@@ -488,7 +460,6 @@ InitializeDebugAgent (
         *(EFI_STATUS *)Context = EFI_SUCCESS;\r
       }\r
     } else {\r
-      Print (L"Debug Agent: It hasn't been initialized, cannot unload it!\r\n");\r
       *(EFI_STATUS *)Context = EFI_NOT_STARTED;\r
     }\r
 \r