--- /dev/null
+/** @file\r
+ Header file for CPU Cache info Library.\r
+\r
+ Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#ifndef _CPU_CACHE_INFO_LIB_H_\r
+#define _CPU_CACHE_INFO_LIB_H_\r
+\r
+typedef struct {\r
+ //\r
+ // Package number.\r
+ //\r
+ UINT32 Package;\r
+ //\r
+ // Core type of logical processor.\r
+ // Value = CPUID.1Ah:EAX[31:24]\r
+ //\r
+ UINT8 CoreType;\r
+ //\r
+ // Level of the cache that this package's this type of logical processor corresponds to.\r
+ // Value = CPUID.04h:EAX[07:05]\r
+ //\r
+ UINT8 CacheLevel : 3;\r
+ //\r
+ // Type of the cache that this package's this type of logical processor corresponds to.\r
+ // Value = CPUID.04h:EAX[04:00]\r
+ //\r
+ UINT8 CacheType : 5;\r
+ //\r
+ // Ways of associativity.\r
+ // Value = CPUID.04h:EBX[31:22]\r
+ //\r
+ UINT16 CacheWays;\r
+ //\r
+ // Size of single cache that this package's this type of logical processor corresponds to.\r
+ // Value = (CPUID.04h:EBX[31:22] + 1) * (CPUID.04h:EBX[21:12] + 1) *\r
+ // (CPUID.04h:EBX[11:00] + 1) * (CPUID.04h:ECX[31:00] + 1)\r
+ //\r
+ UINT32 CacheSizeinKB;\r
+ //\r
+ // Number of the cache that this package's this type of logical processor corresponds to.\r
+ // Have subtracted the number of caches that are shared.\r
+ //\r
+ UINT16 CacheCount;\r
+} CPU_CACHE_INFO;\r
+\r
+/**\r
+ Get CpuCacheInfo data array.\r
+\r
+ @param[in, out] CpuCacheInfo Pointer to the CpuCacheInfo array.\r
+ @param[in, out] CpuCacheInfoCount As input, point to the length of response CpuCacheInfo array.\r
+ As output, point to the actual length of response CpuCacheInfo array.\r
+\r
+ @retval EFI_SUCCESS Function completed successfully.\r
+ @retval EFI_INVALID_PARAMETER CpuCacheInfoCount is NULL.\r
+ @retval EFI_INVALID_PARAMETER CpuCacheInfo is NULL while CpuCacheInfoCount contains the value\r
+ greater than zero.\r
+ @retval EFI_UNSUPPORTED Processor does not support CPUID_CACHE_PARAMS Leaf.\r
+ @retval EFI_NOT_FOUND EDKII_PEI_MP_SERVICES2_PPI or EFI_MP_SERVICES_PROTOCOL interface\r
+ is not found.\r
+ @retval EFI_OUT_OF_RESOURCES Required resources could not be allocated.\r
+ @retval EFI_BUFFER_TOO_SMALL CpuCacheInfoCount is too small to hold the response CpuCacheInfo\r
+ array. CpuCacheInfoCount has been updated with the length needed\r
+ to complete the request.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+GetCpuCacheInfo (\r
+ IN OUT CPU_CACHE_INFO *CpuCacheInfo,\r
+ IN OUT UINTN *CpuCacheInfoCount\r
+ );\r
+\r
+#endif\r