TianoCore EDK2 master
Loading...
Searching...
No Matches
InternalTraceHubApi.c
Go to the documentation of this file.
1
10#include <Base.h>
13#include <Library/HobLib.h>
14#include "InternalTraceHubApi.h"
15
21UINT32
22EFIAPI
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
51VOID
52EFIAPI
55 IN UINT32 Count
56 )
57{
58 UINT8 *DbgContext;
59 UINT32 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}
VOID *EFIAPI GetFirstGuidHob(IN CONST EFI_GUID *Guid)
Definition: HobLib.c:215
VOID *EFIAPI GetNextGuidHob(IN CONST EFI_GUID *Guid, IN CONST VOID *HobStart)
Definition: HobLib.c:176
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
UINT32 EFIAPI CountThDebugInstance(VOID)
VOID EFIAPI PackThDebugInstance(IN OUT TRACEHUB_DEBUG_INFO_HOB *ThPtr, IN UINT32 Count)
#define NULL
Definition: Base.h:319
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define FixedPcdGet64(TokenName)
Definition: PcdLib.h:106
#define FixedPcdGetBool(TokenName)
Definition: PcdLib.h:120
#define FixedPcdGet8(TokenName)
Definition: PcdLib.h:64