2 Initialize Debug Agent in DXE by invoking Debug Agent Library.
4 Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #include <Guid/EventGroup.h>
11 #include <Library/UefiBootServicesTableLib.h>
12 #include <Library/DebugAgentLib.h>
13 #include <Library/UefiLib.h>
15 EFI_EVENT mExitBootServiceEvent
;
18 One notified function to disable Debug Timer interrupt when gBS->ExitBootServices() called.
20 @param[in] Event Pointer to this event
21 @param[in] Context Event handler private data
26 DisableDebugTimerExitBootService (
32 SaveAndSetDebugTimerInterrupt (FALSE
);
36 The Entry Point for Debug Agent Dxe driver.
38 It will invoke Debug Agent Library to enable source debugging feature in DXE phase.
40 @param[in] ImageHandle The firmware allocated handle for the EFI image.
41 @param[in] SystemTable A pointer to the EFI System Table.
43 @retval EFI_SUCCESS The entry point is executed successfully.
44 @retval other Some error occurs when initialized Debug Agent.
49 DebugAgentDxeInitialize (
50 IN EFI_HANDLE ImageHandle
,
51 IN EFI_SYSTEM_TABLE
*SystemTable
56 if (gST
->ConOut
!= NULL
) {
57 Print (L
"If the Debug Port is serial port, please make sure this serial port isn't connected by");
58 Print (L
" ISA Serial driver\r\n");
59 Print (L
"You could do the following steps to disconnect the serial port:\r\n");
60 Print (L
"1: Shell> drivers\r\n");
62 Print (L
" V VERSION E G G #D #C DRIVER NAME IMAGE NAME\r\n");
63 Print (L
" == ======== = = = == == =================================== ===================\r\n");
64 Print (L
" 8F 0000000A B - - 1 14 PCI Bus Driver PciBusDxe\r\n");
65 Print (L
" 91 00000010 ? - - - - ATA Bus Driver AtaBusDxe\r\n");
67 Print (L
" A7 0000000A B - - 1 1 ISA Serial Driver IsaSerialDxe\r\n");
69 Print (L
"2: Shell> dh -d A7\r\n");
70 Print (L
" A7: Image(IsaSerialDxe) ImageDevPath (..9FB3-11D4-9A3A-0090273FC14D))DriverBinding");
71 Print (L
" ComponentName ComponentName2\r\n");
72 Print (L
" Driver Name : ISA Serial Driver\r\n");
73 Print (L
" Image Name : FvFile(93B80003-9FB3-11D4-9A3A-0090273FC14D)\r\n");
74 Print (L
" Driver Version : 0000000A\r\n");
75 Print (L
" Driver Type : BUS\r\n");
76 Print (L
" Configuration : NO\r\n");
77 Print (L
" Diagnostics : NO\r\n");
78 Print (L
" Managing :\r\n");
79 Print (L
" Ctrl[EA] : PciRoot(0x0)/Pci(0x1F,0x0)/Serial(0x0)\r\n");
80 Print (L
" Child[EB] : PciRoot(0x0)/Pci(0x1F,0x0)/Serial(0x0)/Uart(115200,8,N,1)\r\n");
81 Print (L
"3: Shell> disconnect EA\r\n");
82 Print (L
"4: Shell> load -nc DebugAgentDxe.efi\r\n\r\n");
85 Status
= EFI_UNSUPPORTED
;
86 InitializeDebugAgent (DEBUG_AGENT_INIT_DXE_LOAD
, &Status
, NULL
);
87 if (EFI_ERROR (Status
)) {
91 if (gST
->ConOut
!= NULL
) {
92 Print (L
"Debug Agent: Initialized successfully!\r\n\r\n");
96 // Create event to disable Debug Timer interrupt when exit boot service.
98 Status
= gBS
->CreateEventEx (
101 DisableDebugTimerExitBootService
,
103 &gEfiEventExitBootServicesGuid
,
104 &mExitBootServiceEvent
110 This is the unload handle for Debug Agent Dxe driver.
112 It will invoke Debug Agent Library to disable source debugging feature.
114 @param[in] ImageHandle The drivers' driver image.
116 @retval EFI_SUCCESS The image is unloaded.
117 @retval Others Failed to unload the image.
122 DebugAgentDxeUnload (
123 IN EFI_HANDLE ImageHandle
128 Status
= EFI_UNSUPPORTED
;
129 InitializeDebugAgent (DEBUG_AGENT_INIT_DXE_UNLOAD
, &Status
, NULL
);
131 case EFI_ACCESS_DENIED
:
132 Print (L
"Debug Agent: Host is still connected, please de-attach TARGET firstly!\r\n");
134 case EFI_NOT_STARTED
:
135 Print (L
"Debug Agent: It hasn't been initialized, cannot unload it!\r\n");