1 | /** @file
|
---|
2 | SMM MP perf-logging implementation
|
---|
3 |
|
---|
4 | Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>
|
---|
5 |
|
---|
6 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
7 |
|
---|
8 | **/
|
---|
9 |
|
---|
10 | #ifndef MP_PERF_H_
|
---|
11 | #define MP_PERF_H_
|
---|
12 |
|
---|
13 | //
|
---|
14 | // The list of all MP procedures that need to be perf-logged.
|
---|
15 | //
|
---|
16 | #define SMM_MP_PERF_PROCEDURE_LIST(_) \
|
---|
17 | _(InitializeSmm), \
|
---|
18 | _(SmmRendezvousEntry), \
|
---|
19 | _(PlatformValidSmi), \
|
---|
20 | _(SmmRendezvousExit), \
|
---|
21 | _(SmmMpProcedureMax) // Add new entries above this line
|
---|
22 |
|
---|
23 | //
|
---|
24 | // To perf-log MP procedures, call MpPerfBegin()/MpPerfEnd() with CpuIndex
|
---|
25 | // and SMM_MP_PERF_PROCEDURE_ID with entry name defined in the SMM_MP_PERF_PROCEDURE_LIST.
|
---|
26 | //
|
---|
27 | #define SMM_MP_PERF_PROCEDURE_ID(procedure) SmmMpProcedureId ## procedure
|
---|
28 | enum {
|
---|
29 | SMM_MP_PERF_PROCEDURE_LIST (SMM_MP_PERF_PROCEDURE_ID)
|
---|
30 | };
|
---|
31 |
|
---|
32 | typedef struct {
|
---|
33 | UINT64 Begin[SMM_MP_PERF_PROCEDURE_ID (SmmMpProcedureMax)];
|
---|
34 | UINT64 End[SMM_MP_PERF_PROCEDURE_ID (SmmMpProcedureMax)];
|
---|
35 | } SMM_PERF_AP_PROCEDURE_PERFORMANCE;
|
---|
36 |
|
---|
37 | /**
|
---|
38 | Initialize the perf-logging feature for APs.
|
---|
39 |
|
---|
40 | @param NumberofCpus Number of processors in the platform.
|
---|
41 | **/
|
---|
42 | VOID
|
---|
43 | InitializeMpPerf (
|
---|
44 | UINTN NumberofCpus
|
---|
45 | );
|
---|
46 |
|
---|
47 | /**
|
---|
48 | Migrate MP performance data to standardized performance database.
|
---|
49 |
|
---|
50 | @param NumberofCpus Number of processors in the platform.
|
---|
51 | @param BspIndex The index of the BSP.
|
---|
52 | **/
|
---|
53 | VOID
|
---|
54 | MigrateMpPerf (
|
---|
55 | UINTN NumberofCpus,
|
---|
56 | UINTN BspIndex
|
---|
57 | );
|
---|
58 |
|
---|
59 | /**
|
---|
60 | Save the performance counter value before running the MP procedure.
|
---|
61 |
|
---|
62 | @param CpuIndex The index of the CPU.
|
---|
63 | @param MpProcedureId The ID of the MP procedure.
|
---|
64 | **/
|
---|
65 | VOID
|
---|
66 | MpPerfBegin (
|
---|
67 | IN UINTN CpuIndex,
|
---|
68 | IN UINTN MpProcedureId
|
---|
69 | );
|
---|
70 |
|
---|
71 | /**
|
---|
72 | Save the performance counter value after running the MP procedure.
|
---|
73 |
|
---|
74 | @param CpuIndex The index of the CPU.
|
---|
75 | @param MpProcedureId The ID of the MP procedure.
|
---|
76 | **/
|
---|
77 | VOID
|
---|
78 | MpPerfEnd (
|
---|
79 | IN UINTN CpuIndex,
|
---|
80 | IN UINTN MpProcedureId
|
---|
81 | );
|
---|
82 |
|
---|
83 | #endif
|
---|