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