2 Provides cache info for each package, core type, cache level and cache type.
4 Copyright (c) 2020 Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #include <Library/BaseLib.h>
11 #include <Library/DebugLib.h>
12 #include <Library/PeiServicesLib.h>
13 #include <Library/PeiServicesTablePointerLib.h>
14 #include <Library/CpuCacheInfoLib.h>
15 #include <InternalCpuCacheInfoLib.h>
18 Get EDKII_PEI_MP_SERVICES2_PPI pointer.
20 @param[out] MpServices A pointer to the buffer where EDKII_PEI_MP_SERVICES2_PPI is stored
22 @retval EFI_SUCCESS EDKII_PEI_MP_SERVICES2_PPI interface is returned
23 @retval EFI_NOT_FOUND EDKII_PEI_MP_SERVICES2_PPI interface is not found
26 CpuCacheInfoGetMpServices (
27 OUT MP_SERVICES
*MpServices
32 Status
= PeiServicesLocatePpi (&gEdkiiPeiMpServices2PpiGuid
, 0, NULL
, (VOID
**)&MpServices
->Ppi
);
33 ASSERT_EFI_ERROR (Status
);
39 Activate all of the logical processors.
41 @param[in] MpServices MP_SERVICES structure.
42 @param[in] Procedure A pointer to the function to be run on enabled logical processors.
43 @param[in] ProcedureArgument The parameter passed into Procedure for all enabled logical processors.
46 CpuCacheInfoStartupAllCPUs (
47 IN MP_SERVICES MpServices
,
48 IN EFI_AP_PROCEDURE Procedure
,
49 IN VOID
*ProcedureArgument
54 Status
= MpServices
.Ppi
->StartupAllCPUs (MpServices
.Ppi
, Procedure
, 0, ProcedureArgument
);
55 ASSERT_EFI_ERROR (Status
);
59 Get detailed information of the requested logical processor.
61 @param[in] MpServices MP_SERVICES structure.
62 @param[in] ProcessorNum The requested logical processor number.
63 @param[out] ProcessorInfo A pointer to the buffer where the processor information is stored
66 CpuCacheInfoGetProcessorInfo (
67 IN MP_SERVICES MpServices
,
68 IN UINTN ProcessorNum
,
69 OUT EFI_PROCESSOR_INFORMATION
*ProcessorInfo
74 Status
= MpServices
.Ppi
->GetProcessorInfo (MpServices
.Ppi
, ProcessorNum
, ProcessorInfo
);
75 ASSERT_EFI_ERROR (Status
);
79 Get the logical processor number.
81 @param[in] MpServices MP_SERVICES structure.
83 @retval Return the logical processor number.
87 IN MP_SERVICES MpServices
93 Status
= MpServices
.Ppi
->WhoAmI (MpServices
.Ppi
, &ProcessorNum
);
94 ASSERT_EFI_ERROR (Status
);
96 return (UINT32
)ProcessorNum
;
100 Get the total number of logical processors in the platform.
102 @param[in] MpServices MP_SERVICES structure.
104 @retval Return the total number of logical processors.
107 CpuCacheInfoGetNumberOfProcessors (
108 IN MP_SERVICES MpServices
112 UINTN NumberOfProcessor
;
113 UINTN NumberOfEnabledProcessor
;
115 Status
= MpServices
.Ppi
->GetNumberOfProcessors (MpServices
.Ppi
, &NumberOfProcessor
, &NumberOfEnabledProcessor
);
116 ASSERT_EFI_ERROR (Status
);
118 return (UINT32
)NumberOfProcessor
;