]> git.proxmox.com Git - mirror_edk2.git/blob - UefiCpuPkg/Include/Library/CpuCacheInfoLib.h
a23b8b12b5eedc4e538b1d06a300dec59344dd0f
[mirror_edk2.git] / UefiCpuPkg / Include / Library / CpuCacheInfoLib.h
1 /** @file
2 Header file for CPU Cache info Library.
3
4 Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #ifndef _CPU_CACHE_INFO_LIB_H_
10 #define _CPU_CACHE_INFO_LIB_H_
11
12 typedef struct {
13 //
14 // Package number.
15 //
16 UINT32 Package;
17 //
18 // Core type of logical processor.
19 // Value = CPUID.1Ah:EAX[31:24]
20 //
21 UINT8 CoreType;
22 //
23 // Level of the cache that this package's this type of logical processor corresponds to.
24 // Value = CPUID.04h:EAX[07:05]
25 //
26 UINT8 CacheLevel : 3;
27 //
28 // Type of the cache that this package's this type of logical processor corresponds to.
29 // Value = CPUID.04h:EAX[04:00]
30 //
31 UINT8 CacheType : 5;
32 //
33 // Ways of associativity.
34 // Value = CPUID.04h:EBX[31:22]
35 //
36 UINT16 CacheWays;
37 //
38 // Size of single cache that this package's this type of logical processor corresponds to.
39 // Value = (CPUID.04h:EBX[31:22] + 1) * (CPUID.04h:EBX[21:12] + 1) *
40 // (CPUID.04h:EBX[11:00] + 1) * (CPUID.04h:ECX[31:00] + 1)
41 //
42 UINT32 CacheSizeinKB;
43 //
44 // Number of the cache that this package's this type of logical processor corresponds to.
45 // Have subtracted the number of caches that are shared.
46 //
47 UINT16 CacheCount;
48 } CPU_CACHE_INFO;
49
50 /**
51 Get CpuCacheInfo data array.
52
53 @param[in, out] CpuCacheInfo Pointer to the CpuCacheInfo array.
54 @param[in, out] CpuCacheInfoCount As input, point to the length of response CpuCacheInfo array.
55 As output, point to the actual length of response CpuCacheInfo array.
56
57 @retval EFI_SUCCESS Function completed successfully.
58 @retval EFI_INVALID_PARAMETER CpuCacheInfoCount is NULL.
59 @retval EFI_INVALID_PARAMETER CpuCacheInfo is NULL while CpuCacheInfoCount contains the value
60 greater than zero.
61 @retval EFI_UNSUPPORTED Processor does not support CPUID_CACHE_PARAMS Leaf.
62 @retval EFI_NOT_FOUND EDKII_PEI_MP_SERVICES2_PPI or EFI_MP_SERVICES_PROTOCOL interface
63 is not found.
64 @retval EFI_OUT_OF_RESOURCES Required resources could not be allocated.
65 @retval EFI_BUFFER_TOO_SMALL CpuCacheInfoCount is too small to hold the response CpuCacheInfo
66 array. CpuCacheInfoCount has been updated with the length needed
67 to complete the request.
68 **/
69 EFI_STATUS
70 EFIAPI
71 GetCpuCacheInfo (
72 IN OUT CPU_CACHE_INFO *CpuCacheInfo,
73 IN OUT UINTN *CpuCacheInfoCount
74 );
75
76 #endif