]> git.proxmox.com Git - mirror_edk2.git/blob - SourceLevelDebugPkg/DebugAgentDxe/DebugAgentDxe.c
EmbeddedPkg/MmcDxe: Fix mixed EOL
[mirror_edk2.git] / SourceLevelDebugPkg / DebugAgentDxe / DebugAgentDxe.c
1 /** @file
2 Initialize Debug Agent in DXE by invoking Debug Agent Library.
3
4 Copyright (c) 2013, 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
9
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.
12
13 **/
14
15 #include <PiDxe.h>
16 #include <Guid/EventGroup.h>
17 #include <Library/UefiBootServicesTableLib.h>
18 #include <Library/DebugAgentLib.h>
19
20 EFI_EVENT mExitBootServiceEvent;
21
22 /**
23 One notified function to disable Debug Timer interrupt when gBS->ExitBootServices() called.
24
25 @param[in] Event Pointer to this event
26 @param[in] Context Event hanlder private data
27
28 **/
29 VOID
30 EFIAPI
31 DisableDebugTimerExitBootService (
32 EFI_EVENT Event,
33 VOID *Context
34 )
35
36 {
37 SaveAndSetDebugTimerInterrupt (FALSE);
38 }
39
40 /**
41 The Entry Point for Debug Agent Dxe driver.
42
43 It will invoke Debug Agent Library to enable source debugging feature in DXE phase.
44
45 @param[in] ImageHandle The firmware allocated handle for the EFI image.
46 @param[in] SystemTable A pointer to the EFI System Table.
47
48 @retval EFI_SUCCESS The entry point is executed successfully.
49 @retval other Some error occurs when initialzed Debug Agent.
50
51 **/
52 EFI_STATUS
53 EFIAPI
54 DebugAgentDxeInitialize(
55 IN EFI_HANDLE ImageHandle,
56 IN EFI_SYSTEM_TABLE *SystemTable
57 )
58 {
59 EFI_STATUS Status;
60
61 InitializeDebugAgent (DEBUG_AGENT_INIT_DXE_LOAD, &Status, NULL);
62 if (EFI_ERROR (Status)) {
63 return Status;
64 }
65 //
66 // Create event to disable Debug Timer interrupt when exit boot service.
67 //
68 Status = gBS->CreateEventEx (
69 EVT_NOTIFY_SIGNAL,
70 TPL_NOTIFY,
71 DisableDebugTimerExitBootService,
72 NULL,
73 &gEfiEventExitBootServicesGuid,
74 &mExitBootServiceEvent
75 );
76 return Status;
77 }
78
79 /**
80 This is the unload handle for Debug Agent Dxe driver.
81
82 It will invoke Debug Agent Library to disable source debugging feature.
83
84 @param[in] ImageHandle The drivers' driver image.
85
86 @retval EFI_SUCCESS The image is unloaded.
87 @retval Others Failed to unload the image.
88
89 **/
90 EFI_STATUS
91 EFIAPI
92 DebugAgentDxeUnload (
93 IN EFI_HANDLE ImageHandle
94 )
95 {
96 EFI_STATUS Status;
97
98 InitializeDebugAgent (DEBUG_AGENT_INIT_DXE_UNLOAD, &Status, NULL);
99
100 return Status;
101 }