OemMiscLib.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. /** @file
  2. *
  3. * Copyright (c) 2022, Ampere Computing LLC. All rights reserved.
  4. * Copyright (c) 2021, NUVIA Inc. All rights reserved.
  5. * Copyright (c) 2015, Hisilicon Limited. All rights reserved.
  6. * Copyright (c) 2015, Linaro Limited. All rights reserved.
  7. *
  8. * SPDX-License-Identifier: BSD-2-Clause-Patent
  9. *
  10. **/
  11. #ifndef OEM_MISC_LIB_H_
  12. #define OEM_MISC_LIB_H_
  13. #include <Uefi.h>
  14. #include <IndustryStandard/SmBios.h>
  15. typedef enum {
  16. CpuCacheL1 = 1,
  17. CpuCacheL2,
  18. CpuCacheL3,
  19. CpuCacheL4,
  20. CpuCacheL5,
  21. CpuCacheL6,
  22. CpuCacheL7,
  23. CpuCacheLevelMax
  24. } OEM_MISC_CPU_CACHE_LEVEL;
  25. typedef struct {
  26. UINT8 Voltage; ///< Processor voltage
  27. UINT16 CurrentSpeed; ///< Current clock speed in MHz
  28. UINT16 MaxSpeed; ///< Maximum clock speed in MHz
  29. UINT16 ExternalClock; ///< External clock speed in MHz
  30. UINT16 CoreCount; ///< Number of cores available
  31. UINT16 CoresEnabled; ///< Number of cores enabled
  32. UINT16 ThreadCount; ///< Number of threads per processor
  33. } OEM_MISC_PROCESSOR_DATA;
  34. typedef enum {
  35. BiosVersionType00,
  36. ProductNameType01,
  37. SerialNumType01,
  38. UuidType01,
  39. SystemManufacturerType01,
  40. VersionType01,
  41. SkuNumberType01,
  42. FamilyType01,
  43. AssetTagType02,
  44. SerialNumberType02,
  45. BoardManufacturerType02,
  46. ProductNameType02,
  47. VersionType02,
  48. SkuNumberType02,
  49. ChassisLocationType02,
  50. AssetTagType03,
  51. SerialNumberType03,
  52. VersionType03,
  53. ChassisTypeType03,
  54. ManufacturerType03,
  55. SkuNumberType03,
  56. ProcessorPartNumType04,
  57. ProcessorSerialNumType04,
  58. ProcessorVersionType04,
  59. SmbiosHiiStringFieldMax
  60. } OEM_MISC_SMBIOS_HII_STRING_FIELD;
  61. /*
  62. * The following are functions that the each platform needs to
  63. * implement in its OemMiscLib library.
  64. */
  65. /** Gets the CPU frequency of the specified processor.
  66. @param ProcessorIndex Index of the processor to get the frequency for.
  67. @return CPU frequency in Hz
  68. **/
  69. UINTN
  70. EFIAPI
  71. OemGetCpuFreq (
  72. IN UINT8 ProcessorIndex
  73. );
  74. /** Gets information about the specified processor and stores it in
  75. the structures provided.
  76. @param ProcessorIndex Index of the processor to get the information for.
  77. @param ProcessorStatus Processor status.
  78. @param ProcessorCharacteristics Processor characteritics.
  79. @param MiscProcessorData Miscellaneous processor information.
  80. @return TRUE on success, FALSE on failure.
  81. **/
  82. BOOLEAN
  83. EFIAPI
  84. OemGetProcessorInformation (
  85. IN UINTN ProcessorIndex,
  86. IN OUT PROCESSOR_STATUS_DATA *ProcessorStatus,
  87. IN OUT PROCESSOR_CHARACTERISTIC_FLAGS *ProcessorCharacteristics,
  88. IN OUT OEM_MISC_PROCESSOR_DATA *MiscProcessorData
  89. );
  90. /** Gets information about the cache at the specified cache level.
  91. @param ProcessorIndex The processor to get information for.
  92. @param CacheLevel The cache level to get information for.
  93. @param DataCache Whether the cache is a data cache.
  94. @param UnifiedCache Whether the cache is a unified cache.
  95. @param SmbiosCacheTable The SMBIOS Type7 cache information structure.
  96. @return TRUE on success, FALSE on failure.
  97. **/
  98. BOOLEAN
  99. EFIAPI
  100. OemGetCacheInformation (
  101. IN UINT8 ProcessorIndex,
  102. IN UINT8 CacheLevel,
  103. IN BOOLEAN DataCache,
  104. IN BOOLEAN UnifiedCache,
  105. IN OUT SMBIOS_TABLE_TYPE7 *SmbiosCacheTable
  106. );
  107. /** Gets the maximum number of processors supported by the platform.
  108. @return The maximum number of processors.
  109. **/
  110. UINT8
  111. EFIAPI
  112. OemGetMaxProcessors (
  113. VOID
  114. );
  115. /** Gets the type of chassis for the system.
  116. @retval The type of the chassis.
  117. **/
  118. MISC_CHASSIS_TYPE
  119. EFIAPI
  120. OemGetChassisType (
  121. VOID
  122. );
  123. /** Returns whether the specified processor is present or not.
  124. @param ProcessIndex The processor index to check.
  125. @return TRUE is the processor is present, FALSE otherwise.
  126. **/
  127. BOOLEAN
  128. EFIAPI
  129. OemIsProcessorPresent (
  130. IN UINTN ProcessorIndex
  131. );
  132. /** Updates the HII string for the specified field.
  133. @param HiiHandle The HII handle.
  134. @param TokenToUpdate The string to update.
  135. @param Field The field to get information about.
  136. **/
  137. VOID
  138. EFIAPI
  139. OemUpdateSmbiosInfo (
  140. IN EFI_HII_HANDLE HiiHandle,
  141. IN EFI_STRING_ID TokenToUpdate,
  142. IN OEM_MISC_SMBIOS_HII_STRING_FIELD Field
  143. );
  144. /** Fetches the Type 32 boot information status.
  145. @return Boot status.
  146. **/
  147. MISC_BOOT_INFORMATION_STATUS_DATA_TYPE
  148. EFIAPI
  149. OemGetBootStatus (
  150. VOID
  151. );
  152. /** Fetches the chassis status when it was last booted.
  153. @return Chassis status.
  154. **/
  155. MISC_CHASSIS_STATE
  156. EFIAPI
  157. OemGetChassisBootupState (
  158. VOID
  159. );
  160. /** Fetches the chassis power supply/supplies status when last booted.
  161. @return Chassis power supply/supplies status.
  162. **/
  163. MISC_CHASSIS_STATE
  164. EFIAPI
  165. OemGetChassisPowerSupplyState (
  166. VOID
  167. );
  168. /** Fetches the chassis thermal status when last booted.
  169. @return Chassis thermal status.
  170. **/
  171. MISC_CHASSIS_STATE
  172. EFIAPI
  173. OemGetChassisThermalState (
  174. VOID
  175. );
  176. /** Fetches the chassis security status when last booted.
  177. @return Chassis security status.
  178. **/
  179. MISC_CHASSIS_SECURITY_STATE
  180. EFIAPI
  181. OemGetChassisSecurityStatus (
  182. VOID
  183. );
  184. /** Fetches the chassis height in RMUs (Rack Mount Units).
  185. @return The height of the chassis.
  186. **/
  187. UINT8
  188. EFIAPI
  189. OemGetChassisHeight (
  190. VOID
  191. );
  192. /** Fetches the number of power cords.
  193. @return The number of power cords.
  194. **/
  195. UINT8
  196. EFIAPI
  197. OemGetChassisNumPowerCords (
  198. VOID
  199. );
  200. /**
  201. Fetches the system UUID.
  202. @param[out] SystemUuid The pointer to the buffer to store the System UUID.
  203. **/
  204. VOID
  205. EFIAPI
  206. OemGetSystemUuid (
  207. OUT GUID *SystemUuid
  208. );
  209. /** Fetches the BIOS release.
  210. @return The BIOS release.
  211. **/
  212. UINT16
  213. EFIAPI
  214. OemGetBiosRelease (
  215. VOID
  216. );
  217. /** Fetches the embedded controller firmware release.
  218. @return The embedded controller firmware release.
  219. **/
  220. UINT16
  221. EFIAPI
  222. OemGetEmbeddedControllerFirmwareRelease (
  223. VOID
  224. );
  225. #endif // OEM_MISC_LIB_H_