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/UefiBootServicesTableLib.h>
13 #include <Library/CpuCacheInfoLib.h>
14 #include <InternalCpuCacheInfoLib.h>
17 Get EFI_MP_SERVICES_PROTOCOL pointer.
19 @param[out] MpServices A pointer to the buffer where EFI_MP_SERVICES_PROTOCOL is stored
21 @retval EFI_SUCCESS EFI_MP_SERVICES_PROTOCOL interface is returned
22 @retval EFI_NOT_FOUND EFI_MP_SERVICES_PROTOCOL interface is not found
25 CpuCacheInfoGetMpServices (
26 OUT MP_SERVICES
*MpServices
31 Status
= gBS
->LocateProtocol (&gEfiMpServiceProtocolGuid
, NULL
, (VOID
**)&MpServices
->Protocol
);
32 ASSERT_EFI_ERROR (Status
);
38 Activate all of the logical processors.
40 @param[in] MpServices MP_SERVICES structure.
41 @param[in] Procedure A pointer to the function to be run on enabled logical processors.
42 @param[in] ProcedureArgument The parameter passed into Procedure for all enabled logical processors.
45 CpuCacheInfoStartupAllCPUs (
46 IN MP_SERVICES MpServices
,
47 IN EFI_AP_PROCEDURE Procedure
,
48 IN VOID
*ProcedureArgument
53 Status
= MpServices
.Protocol
->StartupAllAPs (MpServices
.Protocol
, Procedure
, FALSE
, NULL
, 0, ProcedureArgument
, NULL
);
54 if (Status
== EFI_NOT_STARTED
) {
56 // EFI_NOT_STARTED is returned when there is no enabled AP.
57 // Treat this case as EFI_SUCCESS.
62 ASSERT_EFI_ERROR (Status
);
64 Procedure (ProcedureArgument
);
68 Get detailed information of the requested logical processor.
70 @param[in] MpServices MP_SERVICES structure.
71 @param[in] ProcessorNum The requested logical processor number.
72 @param[out] ProcessorInfo A pointer to the buffer where the processor information is stored
75 CpuCacheInfoGetProcessorInfo (
76 IN MP_SERVICES MpServices
,
77 IN UINTN ProcessorNum
,
78 OUT EFI_PROCESSOR_INFORMATION
*ProcessorInfo
83 Status
= MpServices
.Protocol
->GetProcessorInfo (MpServices
.Protocol
, ProcessorNum
, ProcessorInfo
);
84 ASSERT_EFI_ERROR (Status
);
88 Get the logical processor number.
90 @param[in] MpServices MP_SERVICES structure.
92 @retval Return the logical processor number.
96 IN MP_SERVICES MpServices
102 Status
= MpServices
.Protocol
->WhoAmI (MpServices
.Protocol
, &ProcessorNum
);
103 ASSERT_EFI_ERROR (Status
);
105 return (UINT32
)ProcessorNum
;
109 Get the total number of logical processors in the platform.
111 @param[in] MpServices MP_SERVICES structure.
113 @retval Return the total number of logical processors.
116 CpuCacheInfoGetNumberOfProcessors (
117 IN MP_SERVICES MpServices
121 UINTN NumberOfProcessor
;
122 UINTN NumberOfEnabledProcessor
;
124 Status
= MpServices
.Protocol
->GetNumberOfProcessors (MpServices
.Protocol
, &NumberOfProcessor
, &NumberOfEnabledProcessor
);
125 ASSERT_EFI_ERROR (Status
);
127 return (UINT32
)NumberOfProcessor
;