]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Include/Library/OemMiscLib.h
d1ac81f73d9f75260c6d333a0ceab96804aacd67
[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
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 {
20 CpuCacheL1 = 1,
21 CpuCacheL2,
22 CpuCacheL3,
23 CpuCacheL4,
24 CpuCacheL5,
25 CpuCacheL6,
26 CpuCacheL7,
27 CpuCacheLevelMax
28 } OEM_MISC_CPU_CACHE_LEVEL;
29
30 typedef struct
31 {
32 UINT8 Voltage; ///< Processor voltage
33 UINT16 CurrentSpeed; ///< Current clock speed in MHz
34 UINT16 MaxSpeed; ///< Maximum clock speed in MHz
35 UINT16 ExternalClock; ///< External clock speed in MHz
36 UINT16 CoreCount; ///< Number of cores available
37 UINT16 CoresEnabled; ///< Number of cores enabled
38 UINT16 ThreadCount; ///< Number of threads per processor
39 } OEM_MISC_PROCESSOR_DATA;
40
41 typedef enum
42 {
43 ProductNameType01,
44 SerialNumType01,
45 UuidType01,
46 SystemManufacturerType01,
47 SkuNumberType01,
48 FamilyType01,
49 AssertTagType02,
50 SerialNumberType02,
51 BoardManufacturerType02,
52 SkuNumberType02,
53 ChassisLocationType02,
54 AssetTagType03,
55 SerialNumberType03,
56 VersionType03,
57 ChassisTypeType03,
58 ManufacturerType03,
59 SkuNumberType03,
60 SmbiosHiiStringFieldMax
61 } OEM_MISC_SMBIOS_HII_STRING_FIELD;
62
63 /*
64 * The following are functions that the each platform needs to
65 * implement in its OemMiscLib library.
66 */
67
68 /** Gets the CPU frequency of the specified processor.
69
70 @param ProcessorIndex Index of the processor to get the frequency for.
71
72 @return CPU frequency in Hz
73 **/
74 UINTN
75 EFIAPI
76 OemGetCpuFreq (
77 IN UINT8 ProcessorIndex
78 );
79
80 /** Gets information about the specified processor and stores it in
81 the structures provided.
82
83 @param ProcessorIndex Index of the processor to get the information for.
84 @param ProcessorStatus Processor status.
85 @param ProcessorCharacteristics Processor characteritics.
86 @param MiscProcessorData Miscellaneous processor information.
87
88 @return TRUE on success, FALSE on failure.
89 **/
90 BOOLEAN
91 EFIAPI
92 OemGetProcessorInformation (
93 IN UINTN ProcessorIndex,
94 IN OUT PROCESSOR_STATUS_DATA *ProcessorStatus,
95 IN OUT PROCESSOR_CHARACTERISTIC_FLAGS *ProcessorCharacteristics,
96 IN OUT OEM_MISC_PROCESSOR_DATA *MiscProcessorData
97 );
98
99 /** Gets information about the cache at the specified cache level.
100
101 @param ProcessorIndex The processor to get information for.
102 @param CacheLevel The cache level to get information for.
103 @param DataCache Whether the cache is a data cache.
104 @param UnifiedCache Whether the cache is a unified cache.
105 @param SmbiosCacheTable The SMBIOS Type7 cache information structure.
106
107 @return TRUE on success, FALSE on failure.
108 **/
109 BOOLEAN
110 EFIAPI
111 OemGetCacheInformation (
112 IN UINT8 ProcessorIndex,
113 IN UINT8 CacheLevel,
114 IN BOOLEAN DataCache,
115 IN BOOLEAN UnifiedCache,
116 IN OUT SMBIOS_TABLE_TYPE7 *SmbiosCacheTable
117 );
118
119 /** Gets the maximum number of processors supported by the platform.
120
121 @return The maximum number of processors.
122 **/
123 UINT8
124 EFIAPI
125 OemGetMaxProcessors (
126 VOID
127 );
128
129 /** Gets the type of chassis for the system.
130
131 @param ChassisType The type of the chassis.
132
133 @retval EFI_SUCCESS The chassis type was fetched successfully.
134 **/
135 EFI_STATUS
136 EFIAPI
137 OemGetChassisType (
138 OUT UINT8 *ChassisType
139 );
140
141 /** Returns whether the specified processor is present or not.
142
143 @param ProcessIndex The processor index to check.
144
145 @return TRUE is the processor is present, FALSE otherwise.
146 **/
147 BOOLEAN
148 EFIAPI
149 OemIsProcessorPresent (
150 IN UINTN ProcessorIndex
151 );
152
153 /** Updates the HII string for the specified field.
154
155 @param HiiHandle The HII handle.
156 @param TokenToUpdate The string to update.
157 @param Field The field to get information about.
158 **/
159 VOID
160 EFIAPI
161 OemUpdateSmbiosInfo (
162 IN EFI_HII_HANDLE HiiHandle,
163 IN EFI_STRING_ID TokenToUpdate,
164 IN OEM_MISC_SMBIOS_HII_STRING_FIELD Field
165 );
166
167 #endif // OEM_MISC_LIB_H_