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