VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.c@ 101291

Last change on this file since 101291 was 101291, checked in by vboxsync, 14 months ago

EFI/FirmwareNew: Make edk2-stable202308 build on all supported platforms (using gcc at least, msvc not tested yet), bugref:4643

  • Property svn:eol-style set to native
File size: 1.9 KB
Line 
1/** @file
2Functions implementation in this file are not common for all type of TraceHubDebugSysTLib.
3
4Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>
5
6SPDX-License-Identifier: BSD-2-Clause-Patent
7
8**/
9
10#include <Base.h>
11#include <Guid/TraceHubDebugInfoHob.h>
12#include <Library/BaseMemoryLib.h>
13#include <Library/HobLib.h>
14#include "InternalTraceHubApi.h"
15
16/**
17 Count the total number of Trace Hub debug instance in the system.
18
19 @retval UINT32 The total number of Trace Hub debug instance in the system.
20**/
21UINT32
22EFIAPI
23CountThDebugInstance (
24 VOID
25 )
26{
27 UINT8 *DbgContext;
28 UINT32 DbgInstCount;
29
30 DbgInstCount = 0;
31
32 DbgContext = (UINT8 *)GetFirstGuidHob (&gTraceHubDebugInfoHobGuid);
33 if (DbgContext != NULL) {
34 while (DbgContext != NULL) {
35 DbgInstCount++;
36 DbgContext = (UINT8 *)GetNextGuidHob (&gTraceHubDebugInfoHobGuid, GET_NEXT_HOB (DbgContext));
37 }
38 } else {
39 DbgInstCount++;
40 }
41
42 return DbgInstCount;
43}
44
45/**
46 Pack Trace Hub debug instances in the system.
47
48 @param[in, out] ThPtr A pointer to TRACEHUB_DEBUG_INFO_HOB structure.
49 @param[in] Count Number of Trace Hub HOBs.
50**/
51VOID
52EFIAPI
53PackThDebugInstance (
54 IN OUT TRACEHUB_DEBUG_INFO_HOB *ThPtr,
55 IN UINT32 Count
56 )
57{
58 UINT8 *DbgContext;
59 UINT16 Index;
60
61 DbgContext = GetFirstGuidHob (&gTraceHubDebugInfoHobGuid);
62 if (DbgContext != NULL) {
63 for (Index = 0; Index < Count; Index++) {
64 CopyMem (&ThPtr[Index], GET_GUID_HOB_DATA (DbgContext), sizeof (TRACEHUB_DEBUG_INFO_HOB));
65 DbgContext = GetNextGuidHob (&gTraceHubDebugInfoHobGuid, GET_NEXT_HOB (DbgContext));
66 }
67 } else {
68 for (Index = 0; Index < Count; Index++) {
69 ThPtr[Index].TraceHubMmioAddress = FixedPcdGet64 (PcdTraceHubDebugMmioAddress);
70 ThPtr[Index].Flag = FixedPcdGetBool (PcdEnableTraceHubDebugMsg);
71 ThPtr[Index].DebugLevel = FixedPcdGet8 (PcdTraceHubDebugLevel);
72 }
73 }
74}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette