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