]>
Commit | Line | Data |
---|---|---|
83facfd1 LY |
1 | /** @file\r |
2 | Header file for CPU Cache info Library.\r | |
3 | \r | |
4 | Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>\r | |
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 | |
36 | UINT16 CacheWays;\r | |
37 | //\r | |
38 | // Size of single cache that this package's this type of logical processor corresponds to.\r | |
39 | // Value = (CPUID.04h:EBX[31:22] + 1) * (CPUID.04h:EBX[21:12] + 1) *\r | |
40 | // (CPUID.04h:EBX[11:00] + 1) * (CPUID.04h:ECX[31:00] + 1)\r | |
41 | //\r | |
42 | UINT32 CacheSizeinKB;\r | |
43 | //\r | |
44 | // Number of the cache that this package's this type of logical processor corresponds to.\r | |
45 | // Have subtracted the number of caches that are shared.\r | |
46 | //\r | |
47 | UINT16 CacheCount;\r | |
48 | } CPU_CACHE_INFO;\r | |
49 | \r | |
50 | /**\r | |
51 | Get CpuCacheInfo data array.\r | |
52 | \r | |
53 | @param[in, out] CpuCacheInfo Pointer to the CpuCacheInfo array.\r | |
54 | @param[in, out] CpuCacheInfoCount As input, point to the length of response CpuCacheInfo array.\r | |
55 | As output, point to the actual length of response CpuCacheInfo array.\r | |
56 | \r | |
57 | @retval EFI_SUCCESS Function completed successfully.\r | |
58 | @retval EFI_INVALID_PARAMETER CpuCacheInfoCount is NULL.\r | |
59 | @retval EFI_INVALID_PARAMETER CpuCacheInfo is NULL while CpuCacheInfoCount contains the value\r | |
60 | greater than zero.\r | |
61 | @retval EFI_UNSUPPORTED Processor does not support CPUID_CACHE_PARAMS Leaf.\r | |
83facfd1 LY |
62 | @retval EFI_OUT_OF_RESOURCES Required resources could not be allocated.\r |
63 | @retval EFI_BUFFER_TOO_SMALL CpuCacheInfoCount is too small to hold the response CpuCacheInfo\r | |
64 | array. CpuCacheInfoCount has been updated with the length needed\r | |
65 | to complete the request.\r | |
66 | **/\r | |
67 | EFI_STATUS\r | |
68 | EFIAPI\r | |
69 | GetCpuCacheInfo (\r | |
70 | IN OUT CPU_CACHE_INFO *CpuCacheInfo,\r | |
71 | IN OUT UINTN *CpuCacheInfoCount\r | |
72 | );\r | |
73 | \r | |
74 | #endif\r |