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