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