1 | /* $Id: VBoxDebugAgentLib.c 96407 2022-08-22 17:43:14Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox implementation of DebugAgentLib that reports EFI state transitions
|
---|
4 | * to DevEFI for debugging purposes.
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2013-2022 Oracle and/or its affiliates.
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox base platform packages, as
|
---|
11 | * available from https://www.virtualbox.org.
|
---|
12 | *
|
---|
13 | * This program is free software; you can redistribute it and/or
|
---|
14 | * modify it under the terms of the GNU General Public License
|
---|
15 | * as published by the Free Software Foundation, in version 3 of the
|
---|
16 | * License.
|
---|
17 | *
|
---|
18 | * This program is distributed in the hope that it will be useful, but
|
---|
19 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
21 | * General Public License for more details.
|
---|
22 | *
|
---|
23 | * You should have received a copy of the GNU General Public License
|
---|
24 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
25 | *
|
---|
26 | * The contents of this file may alternatively be used under the terms
|
---|
27 | * of the Common Development and Distribution License Version 1.0
|
---|
28 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
29 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
30 | * CDDL are applicable instead of those of the GPL.
|
---|
31 | *
|
---|
32 | * You may elect to license modified versions of this file under the
|
---|
33 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
34 | *
|
---|
35 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
36 | */
|
---|
37 |
|
---|
38 |
|
---|
39 | /*********************************************************************************************************************************
|
---|
40 | * Header Files *
|
---|
41 | *********************************************************************************************************************************/
|
---|
42 | #include <Base.h>
|
---|
43 | #include <Library/DebugAgentLib.h>
|
---|
44 | #include <Library/DebugLib.h>
|
---|
45 | #include "VBoxPkg.h"
|
---|
46 | #include "../../../../DevEFI.h"
|
---|
47 |
|
---|
48 |
|
---|
49 | VOID
|
---|
50 | EFIAPI
|
---|
51 | InitializeDebugAgent(
|
---|
52 | IN UINT32 InitFlag,
|
---|
53 | IN VOID *Context OPTIONAL,
|
---|
54 | IN DEBUG_AGENT_CONTINUE Function OPTIONAL
|
---|
55 | )
|
---|
56 | {
|
---|
57 | /*
|
---|
58 | * Do the reporting.
|
---|
59 | */
|
---|
60 | EFIDBGPOINT enmDbgPoint;
|
---|
61 | switch (InitFlag)
|
---|
62 | {
|
---|
63 | case DEBUG_AGENT_INIT_PREMEM_SEC: enmDbgPoint = EFIDBGPOINT_SEC_PREMEM; break;
|
---|
64 | case DEBUG_AGENT_INIT_POSTMEM_SEC: enmDbgPoint = EFIDBGPOINT_SEC_POSTMEM; break;
|
---|
65 | case DEBUG_AGENT_INIT_DXE_CORE: enmDbgPoint = EFIDBGPOINT_DXE_CORE; break;
|
---|
66 | case DEBUG_AGENT_INIT_SMM: enmDbgPoint = EFIDBGPOINT_SMM; break;
|
---|
67 | case DEBUG_AGENT_INIT_ENTER_SMI: enmDbgPoint = EFIDBGPOINT_SMI_ENTER; break;
|
---|
68 | case DEBUG_AGENT_INIT_EXIT_SMI: enmDbgPoint = EFIDBGPOINT_SMI_EXIT; break;
|
---|
69 | case DEBUG_AGENT_INIT_S3: enmDbgPoint = EFIDBGPOINT_GRAPHICS; break;
|
---|
70 | case DEBUG_AGENT_INIT_DXE_AP: enmDbgPoint = EFIDBGPOINT_DXE_AP; break;
|
---|
71 | default:
|
---|
72 | ASSERT(false);
|
---|
73 | enmDbgPoint = EFIDBGPOINT_INVALID;
|
---|
74 | break;
|
---|
75 | }
|
---|
76 | if (enmDbgPoint != EFIDBGPOINT_INVALID)
|
---|
77 | ASMOutU32(EFI_PORT_DEBUG_POINT, enmDbgPoint);
|
---|
78 |
|
---|
79 |
|
---|
80 | /*
|
---|
81 | * Call resume function if supplied.
|
---|
82 | */
|
---|
83 | if (Function)
|
---|
84 | Function(Context);
|
---|
85 | }
|
---|
86 |
|
---|
87 |
|
---|
88 | BOOLEAN
|
---|
89 | EFIAPI
|
---|
90 | SaveAndSetDebugTimerInterrupt(
|
---|
91 | IN BOOLEAN EnableStatus
|
---|
92 | )
|
---|
93 | {
|
---|
94 | NOREF(EnableStatus);
|
---|
95 | return FALSE;
|
---|
96 | }
|
---|
97 |
|
---|