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 ASSERT_EFI_ERROR (Status
);
56 Procedure (ProcedureArgument
);
60 Get detailed information of the requested logical processor.
62 @param[in] MpServices MP_SERVICES structure.
63 @param[in] ProcessorNum The requested logical processor number.
64 @param[out] ProcessorInfo A pointer to the buffer where the processor information is stored
67 CpuCacheInfoGetProcessorInfo (
68 IN MP_SERVICES MpServices
,
69 IN UINTN ProcessorNum
,
70 OUT EFI_PROCESSOR_INFORMATION
*ProcessorInfo
75 Status
= MpServices
.Protocol
->GetProcessorInfo (MpServices
.Protocol
, ProcessorNum
, ProcessorInfo
);
76 ASSERT_EFI_ERROR (Status
);
80 Get the logical processor number.
82 @param[in] MpServices MP_SERVICES structure.
84 @retval Return the logical processor number.
88 IN MP_SERVICES MpServices
94 Status
= MpServices
.Protocol
->WhoAmI (MpServices
.Protocol
, &ProcessorNum
);
95 ASSERT_EFI_ERROR (Status
);
97 return (UINT32
)ProcessorNum
;
101 Get the total number of logical processors in the platform.
103 @param[in] MpServices MP_SERVICES structure.
105 @retval Return the total number of logical processors.
108 CpuCacheInfoGetNumberOfProcessors (
109 IN MP_SERVICES MpServices
113 UINTN NumberOfProcessor
;
114 UINTN NumberOfEnabledProcessor
;
116 Status
= MpServices
.Protocol
->GetNumberOfProcessors (MpServices
.Protocol
, &NumberOfProcessor
, &NumberOfEnabledProcessor
);
117 ASSERT_EFI_ERROR (Status
);
119 return (UINT32
)NumberOfProcessor
;