]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPkg/Include/Library/OemMiscLib.h
ArmPkg: Add Library/OemMiscLib.h
[mirror_edk2.git] / ArmPkg / Include / Library / OemMiscLib.h
diff --git a/ArmPkg/Include/Library/OemMiscLib.h b/ArmPkg/Include/Library/OemMiscLib.h
new file mode 100644 (file)
index 0000000..e70019d
--- /dev/null
@@ -0,0 +1,167 @@
+/** @file\r
+*\r
+*  Copyright (c) 2021, NUVIA Inc. All rights reserved.\r
+*  Copyright (c) 2015, Hisilicon Limited. All rights reserved.\r
+*  Copyright (c) 2015, Linaro Limited. All rights reserved.\r
+*\r
+*  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+*\r
+**/\r
+\r
+\r
+#ifndef OEM_MISC_LIB_H_\r
+#define OEM_MISC_LIB_H_\r
+\r
+#include <Uefi.h>\r
+#include <IndustryStandard/SmBios.h>\r
+\r
+typedef enum\r
+{\r
+  CpuCacheL1 = 1,\r
+  CpuCacheL2,\r
+  CpuCacheL3,\r
+  CpuCacheL4,\r
+  CpuCacheL5,\r
+  CpuCacheL6,\r
+  CpuCacheL7,\r
+  CpuCacheLevelMax\r
+} OEM_MISC_CPU_CACHE_LEVEL;\r
+\r
+typedef struct\r
+{\r
+  UINT8 Voltage;        ///< Processor voltage\r
+  UINT16 CurrentSpeed;  ///< Current clock speed in MHz\r
+  UINT16 MaxSpeed;      ///< Maximum clock speed in MHz\r
+  UINT16 ExternalClock; ///< External clock speed in MHz\r
+  UINT16 CoreCount;     ///< Number of cores available\r
+  UINT16 CoresEnabled;  ///< Number of cores enabled\r
+  UINT16 ThreadCount;   ///< Number of threads per processor\r
+} OEM_MISC_PROCESSOR_DATA;\r
+\r
+typedef enum\r
+{\r
+    ProductNameType01,\r
+    SerialNumType01,\r
+    UuidType01,\r
+    SystemManufacturerType01,\r
+    SkuNumberType01,\r
+    FamilyType01,\r
+    AssertTagType02,\r
+    SerialNumberType02,\r
+    BoardManufacturerType02,\r
+    SkuNumberType02,\r
+    ChassisLocationType02,\r
+    AssetTagType03,\r
+    SerialNumberType03,\r
+    VersionType03,\r
+    ChassisTypeType03,\r
+    ManufacturerType03,\r
+    SkuNumberType03,\r
+    SmbiosHiiStringFieldMax\r
+} OEM_MISC_SMBIOS_HII_STRING_FIELD;\r
+\r
+/*\r
+ * The following are functions that the each platform needs to\r
+ * implement in its OemMiscLib library.\r
+ */\r
+\r
+/** Gets the CPU frequency of the specified processor.\r
+\r
+  @param ProcessorIndex Index of the processor to get the frequency for.\r
+\r
+  @return               CPU frequency in Hz\r
+**/\r
+EFIAPI\r
+UINTN\r
+OemGetCpuFreq (\r
+  IN UINT8 ProcessorIndex\r
+  );\r
+\r
+/** Gets information about the specified processor and stores it in\r
+    the structures provided.\r
+\r
+  @param ProcessorIndex  Index of the processor to get the information for.\r
+  @param ProcessorStatus Processor status.\r
+  @param ProcessorCharacteristics Processor characteritics.\r
+  @param MiscProcessorData        Miscellaneous processor information.\r
+\r
+  @return  TRUE on success, FALSE on failure.\r
+**/\r
+EFIAPI\r
+BOOLEAN\r
+OemGetProcessorInformation (\r
+  IN UINTN ProcessorIndex,\r
+  IN OUT PROCESSOR_STATUS_DATA *ProcessorStatus,\r
+  IN OUT PROCESSOR_CHARACTERISTIC_FLAGS *ProcessorCharacteristics,\r
+  IN OUT OEM_MISC_PROCESSOR_DATA *MiscProcessorData\r
+  );\r
+\r
+/** Gets information about the cache at the specified cache level.\r
+\r
+  @param ProcessorIndex The processor to get information for.\r
+  @param CacheLevel     The cache level to get information for.\r
+  @param DataCache  Whether the cache is a data cache.\r
+  @param UnifiedCache Whether the cache is a unified cache.\r
+  @param SmbiosCacheTable The SMBIOS Type7 cache information structure.\r
+\r
+  @return TRUE on success, FALSE on failure.\r
+**/\r
+EFIAPI\r
+BOOLEAN\r
+OemGetCacheInformation (\r
+  IN UINT8   ProcessorIndex,\r
+  IN UINT8   CacheLevel,\r
+  IN BOOLEAN DataCache,\r
+  IN BOOLEAN UnifiedCache,\r
+  IN OUT SMBIOS_TABLE_TYPE7 *SmbiosCacheTable\r
+  );\r
+\r
+/** Gets the maximum number of sockets supported by the platform.\r
+\r
+  @return The maximum number of sockets.\r
+**/\r
+EFIAPI\r
+UINT8\r
+OemGetProcessorMaxSockets (\r
+  VOID\r
+  );\r
+\r
+/** Gets the type of chassis for the system.\r
+\r
+  @param ChassisType The type of the chassis.\r
+\r
+  @retval EFI_SUCCESS The chassis type was fetched successfully.\r
+**/\r
+EFIAPI\r
+EFI_STATUS\r
+OemGetChassisType (\r
+  OUT UINT8 *ChassisType\r
+  );\r
+\r
+/** Returns whether the specified processor is present or not.\r
+\r
+  @param ProcessIndex The processor index to check.\r
+\r
+  @return TRUE is the processor is present, FALSE otherwise.\r
+**/\r
+EFIAPI\r
+BOOLEAN\r
+OemIsSocketPresent (\r
+  IN UINTN ProcessorIndex\r
+  );\r
+\r
+/** Updates the HII string for the specified field.\r
+\r
+  @param mHiiHandle    The HII handle.\r
+  @param TokenToUpdate The string to update.\r
+  @param Offset        The field to get information about.\r
+**/\r
+EFIAPI\r
+VOID\r
+OemUpdateSmbiosInfo (\r
+  IN EFI_HII_HANDLE    HiiHandle,\r
+  IN EFI_STRING_ID     TokenToUpdate,\r
+  IN OEM_MISC_SMBIOS_HII_STRING_FIELD Offset\r
+  );\r
+\r
+#endif // OEM_MISC_LIB_H_\r