2 Initialize Debug Agent in DXE by invoking Debug Agent Library.
4 Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include <Guid/EventGroup.h>
17 #include <Library/UefiBootServicesTableLib.h>
18 #include <Library/DebugAgentLib.h>
19 #include <Library/UefiLib.h>
21 EFI_EVENT mExitBootServiceEvent
;
24 One notified function to disable Debug Timer interrupt when gBS->ExitBootServices() called.
26 @param[in] Event Pointer to this event
27 @param[in] Context Event handler private data
32 DisableDebugTimerExitBootService (
38 SaveAndSetDebugTimerInterrupt (FALSE
);
42 The Entry Point for Debug Agent Dxe driver.
44 It will invoke Debug Agent Library to enable source debugging feature in DXE phase.
46 @param[in] ImageHandle The firmware allocated handle for the EFI image.
47 @param[in] SystemTable A pointer to the EFI System Table.
49 @retval EFI_SUCCESS The entry point is executed successfully.
50 @retval other Some error occurs when initialzed Debug Agent.
55 DebugAgentDxeInitialize(
56 IN EFI_HANDLE ImageHandle
,
57 IN EFI_SYSTEM_TABLE
*SystemTable
62 if (gST
->ConOut
!= NULL
) {
63 Print (L
"If the Debug Port is serial port, please make sure this serial port isn't connected by");
64 Print (L
" ISA Serial driver\r\n");
65 Print (L
"You could do the following steps to disconnect the serial port:\r\n");
66 Print (L
"1: Shell> drivers\r\n");
68 Print (L
" V VERSION E G G #D #C DRIVER NAME IMAGE NAME\r\n");
69 Print (L
" == ======== = = = == == =================================== ===================\r\n");
70 Print (L
" 8F 0000000A B - - 1 14 PCI Bus Driver PciBusDxe\r\n");
71 Print (L
" 91 00000010 ? - - - - ATA Bus Driver AtaBusDxe\r\n");
73 Print (L
" A7 0000000A B - - 1 1 ISA Serial Driver IsaSerialDxe\r\n");
75 Print (L
"2: Shell> dh -d A7\r\n");
76 Print (L
" A7: Image(IsaSerialDxe) ImageDevPath (..9FB3-11D4-9A3A-0090273FC14D))DriverBinding");
77 Print (L
" ComponentName ComponentName2\r\n");
78 Print (L
" Driver Name : ISA Serial Driver\r\n");
79 Print (L
" Image Name : FvFile(93B80003-9FB3-11D4-9A3A-0090273FC14D)\r\n");
80 Print (L
" Driver Version : 0000000A\r\n");
81 Print (L
" Driver Type : BUS\r\n");
82 Print (L
" Configuration : NO\r\n");
83 Print (L
" Diagnostics : NO\r\n");
84 Print (L
" Managing :\r\n");
85 Print (L
" Ctrl[EA] : PciRoot(0x0)/Pci(0x1F,0x0)/Serial(0x0)\r\n");
86 Print (L
" Child[EB] : PciRoot(0x0)/Pci(0x1F,0x0)/Serial(0x0)/Uart(115200,8,N,1)\r\n");
87 Print (L
"3: Shell> disconnect EA\r\n");
88 Print (L
"4: Shell> load -nc DebugAgentDxe.efi\r\n\r\n");
90 Status
= EFI_UNSUPPORTED
;
91 InitializeDebugAgent (DEBUG_AGENT_INIT_DXE_LOAD
, &Status
, NULL
);
92 if (EFI_ERROR (Status
)) {
95 if (gST
->ConOut
!= NULL
) {
96 Print (L
"Debug Agent: Initialized successfully!\r\n\r\n");
99 // Create event to disable Debug Timer interrupt when exit boot service.
101 Status
= gBS
->CreateEventEx (
104 DisableDebugTimerExitBootService
,
106 &gEfiEventExitBootServicesGuid
,
107 &mExitBootServiceEvent
113 This is the unload handle for Debug Agent Dxe driver.
115 It will invoke Debug Agent Library to disable source debugging feature.
117 @param[in] ImageHandle The drivers' driver image.
119 @retval EFI_SUCCESS The image is unloaded.
120 @retval Others Failed to unload the image.
125 DebugAgentDxeUnload (
126 IN EFI_HANDLE ImageHandle
131 Status
= EFI_UNSUPPORTED
;
132 InitializeDebugAgent (DEBUG_AGENT_INIT_DXE_UNLOAD
, &Status
, NULL
);
134 case EFI_ACCESS_DENIED
:
135 Print (L
"Debug Agent: Host is still connected, please de-attach TARGET firstly!\r\n");
137 case EFI_NOT_STARTED
:
138 Print (L
"Debug Agent: It hasn't been initialized, cannot unload it!\r\n");