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