1 | /* $Id: VBoxDebugAgentLib.c 69429 2017-10-27 13:27:03Z 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-2016 Oracle Corporation
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | *
|
---|
18 | * The contents of this file may alternatively be used under the terms
|
---|
19 | * of the Common Development and Distribution License Version 1.0
|
---|
20 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
21 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
22 | * CDDL are applicable instead of those of the GPL.
|
---|
23 | *
|
---|
24 | * You may elect to license modified versions of this file under the
|
---|
25 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
26 | */
|
---|
27 |
|
---|
28 |
|
---|
29 | /*********************************************************************************************************************************
|
---|
30 | * Header Files *
|
---|
31 | *********************************************************************************************************************************/
|
---|
32 | #include <Base.h>
|
---|
33 | #include <Library/DebugAgentLib.h>
|
---|
34 | #include <Library/DebugLib.h>
|
---|
35 | #include "VBoxPkg.h"
|
---|
36 | #include "../../../../DevEFI.h"
|
---|
37 |
|
---|
38 |
|
---|
39 | VOID
|
---|
40 | EFIAPI
|
---|
41 | InitializeDebugAgent(
|
---|
42 | IN UINT32 InitFlag,
|
---|
43 | IN VOID *Context OPTIONAL,
|
---|
44 | IN DEBUG_AGENT_CONTINUE Function OPTIONAL
|
---|
45 | )
|
---|
46 | {
|
---|
47 | /*
|
---|
48 | * Do the reporting.
|
---|
49 | */
|
---|
50 | EFIDBGPOINT enmDbgPoint;
|
---|
51 | switch (InitFlag)
|
---|
52 | {
|
---|
53 | case DEBUG_AGENT_INIT_PREMEM_SEC: enmDbgPoint = EFIDBGPOINT_SEC_PREMEM; break;
|
---|
54 | case DEBUG_AGENT_INIT_POSTMEM_SEC: enmDbgPoint = EFIDBGPOINT_SEC_POSTMEM; break;
|
---|
55 | case DEBUG_AGENT_INIT_DXE_CORE: enmDbgPoint = EFIDBGPOINT_DXE_CORE; break;
|
---|
56 | case DEBUG_AGENT_INIT_SMM: enmDbgPoint = EFIDBGPOINT_SMM; break;
|
---|
57 | case DEBUG_AGENT_INIT_ENTER_SMI: enmDbgPoint = EFIDBGPOINT_SMI_ENTER; break;
|
---|
58 | case DEBUG_AGENT_INIT_EXIT_SMI: enmDbgPoint = EFIDBGPOINT_SMI_EXIT; break;
|
---|
59 | case DEBUG_AGENT_INIT_S3: enmDbgPoint = EFIDBGPOINT_GRAPHICS; break;
|
---|
60 | case DEBUG_AGENT_INIT_DXE_AP: enmDbgPoint = EFIDBGPOINT_DXE_AP; break;
|
---|
61 | default:
|
---|
62 | ASSERT(false);
|
---|
63 | enmDbgPoint = EFIDBGPOINT_INVALID;
|
---|
64 | break;
|
---|
65 | }
|
---|
66 | if (enmDbgPoint != EFIDBGPOINT_INVALID)
|
---|
67 | ASMOutU32(EFI_PORT_DEBUG_POINT, enmDbgPoint);
|
---|
68 |
|
---|
69 |
|
---|
70 | /*
|
---|
71 | * Call resume function if supplied.
|
---|
72 | */
|
---|
73 | if (Function)
|
---|
74 | Function(Context);
|
---|
75 | }
|
---|
76 |
|
---|
77 |
|
---|
78 | BOOLEAN
|
---|
79 | EFIAPI
|
---|
80 | SaveAndSetDebugTimerInterrupt(
|
---|
81 | IN BOOLEAN EnableStatus
|
---|
82 | )
|
---|
83 | {
|
---|
84 | NOREF(EnableStatus);
|
---|
85 | return FALSE;
|
---|
86 | }
|
---|
87 |
|
---|