]> git.proxmox.com Git - mirror_edk2.git/blame - DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c
DynamicTablesPkg: Apply uncrustify changes
[mirror_edk2.git] / DynamicTablesPkg / Library / Common / TableHelperLib / ConfigurationManagerObjectParser.c
CommitLineData
96e006b3
SM
1/** @file\r
2 Configuration Manager Object parser.\r
3\r
4 Copyright (c) 2021, ARM Limited. All rights reserved.<BR>\r
5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
6\r
7**/\r
8\r
9#include <Library/BaseLib.h>\r
10#include <Library/DebugLib.h>\r
11#include <ConfigurationManagerObject.h>\r
12#include "ConfigurationManagerObjectParser.h"\r
13\r
14STATIC\r
15VOID\r
16EFIAPI\r
17PrintOemId (\r
731c67e1
MK
18 CONST CHAR8 *Format,\r
19 UINT8 *Ptr\r
96e006b3
SM
20 );\r
21\r
22/** A parser for EArmObjBootArchInfo.\r
23*/\r
731c67e1
MK
24STATIC CONST CM_OBJ_PARSER CmArmBootArchInfoParser[] = {\r
25 { "BootArchFlags", 2, "0x%x", NULL }\r
96e006b3
SM
26};\r
27\r
28/** A parser for EArmObjPowerManagementProfileInfo.\r
29*/\r
731c67e1
MK
30STATIC CONST CM_OBJ_PARSER CmArmPowerManagementProfileInfoParser[] = {\r
31 { "PowerManagementProfile", 1, "0x%x", NULL }\r
96e006b3
SM
32};\r
33\r
34/** A parser for EArmObjGicCInfo.\r
35*/\r
731c67e1
MK
36STATIC CONST CM_OBJ_PARSER CmArmGicCInfoParser[] = {\r
37 { "CPUInterfaceNumber", 4, "0x%x", NULL },\r
38 { "AcpiProcessorUid", 4, "0x%x", NULL },\r
39 { "Flags", 4, "0x%x", NULL },\r
40 { "ParkingProtocolVersion", 4, "0x%x", NULL },\r
41 { "PerformanceInterruptGsiv", 4, "0x%x", NULL },\r
42 { "ParkedAddress", 8, "0x%llx", NULL },\r
43 { "PhysicalBaseAddress", 8, "0x%llx", NULL },\r
44 { "GICV", 8, "0x%llx", NULL },\r
45 { "GICH", 8, "0x%llx", NULL },\r
46 { "VGICMaintenanceInterrupt", 4, "0x%x", NULL },\r
47 { "GICRBaseAddress", 8, "0x%llx", NULL },\r
48 { "MPIDR", 8, "0x%llx", NULL },\r
49 { "ProcessorPowerEfficiencyClass", 1, "0x%x", NULL },\r
50 { "SpeOverflowInterrupt", 2, "0x%x", NULL },\r
51 { "ProximityDomain", 4, "0x%x", NULL },\r
52 { "ClockDomain", 4, "0x%x", NULL },\r
53 { "AffinityFlags", 4, "0x%x", NULL }\r
96e006b3
SM
54};\r
55\r
56/** A parser for EArmObjGicDInfo.\r
57*/\r
731c67e1
MK
58STATIC CONST CM_OBJ_PARSER CmArmGicDInfoParser[] = {\r
59 { "PhysicalBaseAddress", 8, "0x%llx", NULL },\r
60 { "SystemVectorBase", 4, "0x%x", NULL },\r
61 { "GicVersion", 1, "0x%x", NULL },\r
96e006b3
SM
62};\r
63\r
64/** A parser for EArmObjGicMsiFrameInfo.\r
65*/\r
731c67e1
MK
66STATIC CONST CM_OBJ_PARSER CmArmGicMsiFrameInfoParser[] = {\r
67 { "GicMsiFrameId", 4, "0x%x", NULL },\r
68 { "PhysicalBaseAddress", 8, "0x%llx", NULL },\r
69 { "Flags", 4, "0x%x", NULL },\r
70 { "SPICount", 2, "0x%x", NULL },\r
71 { "SPIBase", 2, "0x%x", NULL }\r
96e006b3
SM
72};\r
73\r
74/** A parser for EArmObjGicRedistributorInfo.\r
75*/\r
731c67e1
MK
76STATIC CONST CM_OBJ_PARSER CmArmGicRedistInfoParser[] = {\r
77 { "DiscoveryRangeBaseAddress", 8, "0x%llx", NULL },\r
78 { "DiscoveryRangeLength", 4, "0x%x", NULL }\r
96e006b3
SM
79};\r
80\r
81/** A parser for EArmObjGicItsInfo.\r
82*/\r
731c67e1
MK
83STATIC CONST CM_OBJ_PARSER CmArmGicItsInfoParser[] = {\r
84 { "GicItsId", 4, "0x%x", NULL },\r
85 { "PhysicalBaseAddress", 8, "0x%llx", NULL },\r
86 { "ProximityDomain", 4, "0x%x", NULL }\r
96e006b3
SM
87};\r
88\r
89/** A parser for EArmObjSerialConsolePortInfo,\r
90 EArmObjSerialDebugPortInfo and EArmObjSerialPortInfo.\r
91*/\r
731c67e1
MK
92STATIC CONST CM_OBJ_PARSER CmArmSerialPortInfoParser[] = {\r
93 { "BaseAddress", 8, "0x%llx", NULL },\r
94 { "Interrupt", 4, "0x%x", NULL },\r
95 { "BaudRate", 8, "0x%llx", NULL },\r
96 { "Clock", 4, "0x%x", NULL },\r
97 { "PortSubtype", 2, "0x%x", NULL },\r
98 { "BaseAddressLength", 8, "0x%llx", NULL },\r
99 { "AccessSize", 1, "0x%d", NULL }\r
96e006b3
SM
100};\r
101\r
102/** A parser for EArmObjGenericTimerInfo.\r
103*/\r
731c67e1
MK
104STATIC CONST CM_OBJ_PARSER CmArmGenericTimerInfoParser[] = {\r
105 { "CounterControlBaseAddress", 8, "0x%llx", NULL },\r
106 { "CounterReadBaseAddress", 8, "0x%llx", NULL },\r
107 { "SecurePL1TimerGSIV", 4, "0x%x", NULL },\r
108 { "SecurePL1TimerFlags", 4, "0x%x", NULL },\r
109 { "NonSecurePL1TimerGSIV", 4, "0x%x", NULL },\r
110 { "NonSecurePL1TimerFlags", 4, "0x%x", NULL },\r
111 { "VirtualTimerGSIV", 4, "0x%x", NULL },\r
112 { "VirtualTimerFlags", 4, "0x%x", NULL },\r
113 { "NonSecurePL2TimerGSIV", 4, "0x%x", NULL },\r
114 { "NonSecurePL2TimerFlags", 4, "0x%x", NULL },\r
115 { "VirtualPL2TimerGSIV", 4, "0x%x", NULL },\r
116 { "VirtualPL2TimerFlags", 4, "0x%x", NULL }\r
96e006b3
SM
117};\r
118\r
119/** A parser for EArmObjPlatformGTBlockInfo.\r
120*/\r
731c67e1
MK
121STATIC CONST CM_OBJ_PARSER CmArmGTBlockTimerFrameInfoParser[] = {\r
122 { "FrameNumber", 1, "0x%x", NULL },\r
123 { "PhysicalAddressCntBase", 8, "0x%llx", NULL },\r
124 { "PhysicalAddressCntEL0Base", 8, "0x%llx", NULL },\r
125 { "PhysicalTimerGSIV", 4, "0x%x", NULL },\r
126 { "PhysicalTimerFlags", 4, "0x%x", NULL },\r
127 { "VirtualTimerGSIV", 4, "0x%x", NULL },\r
128 { "VirtualTimerFlags", 4, "0x%x", NULL },\r
129 { "CommonFlags", 4, "0x%x", NULL }\r
96e006b3
SM
130};\r
131\r
132/** A parser for EArmObjGTBlockTimerFrameInfo.\r
133*/\r
731c67e1
MK
134STATIC CONST CM_OBJ_PARSER CmArmGTBlockInfoParser[] = {\r
135 { "GTBlockPhysicalAddress", 8, "0x%llx", NULL },\r
136 { "GTBlockTimerFrameCount", 4, "0x%x", NULL },\r
137 { "GTBlockTimerFrameToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL }\r
96e006b3
SM
138};\r
139\r
140/** A parser for EArmObjPlatformGenericWatchdogInfo.\r
141*/\r
731c67e1
MK
142STATIC CONST CM_OBJ_PARSER CmArmGenericWatchdogInfoParser[] = {\r
143 { "ControlFrameAddress", 8, "0x%llx", NULL },\r
144 { "RefreshFrameAddress", 8, "0x%llx", NULL },\r
145 { "TimerGSIV", 4, "0x%x", NULL },\r
146 { "Flags", 4, "0x%x", NULL }\r
96e006b3
SM
147};\r
148\r
149/** A parser for EArmObjPciConfigSpaceInfo.\r
150*/\r
731c67e1
MK
151STATIC CONST CM_OBJ_PARSER CmArmPciConfigSpaceInfoParser[] = {\r
152 { "BaseAddress", 8, "0x%llx", NULL },\r
153 { "PciSegmentGroupNumber", 2, "0x%x", NULL },\r
154 { "StartBusNumber", 1, "0x%x", NULL },\r
155 { "EndBusNumber", 1, "0x%x", NULL }\r
96e006b3
SM
156};\r
157\r
158/** A parser for EArmObjHypervisorVendorIdentity.\r
159*/\r
731c67e1
MK
160STATIC CONST CM_OBJ_PARSER CmArmHypervisorVendorIdParser[] = {\r
161 { "HypervisorVendorId", 8, "0x%llx", NULL }\r
96e006b3
SM
162};\r
163\r
164/** A parser for EArmObjFixedFeatureFlags.\r
165*/\r
731c67e1
MK
166STATIC CONST CM_OBJ_PARSER CmArmFixedFeatureFlagsParser[] = {\r
167 { "Flags", 4, "0x%x", NULL }\r
96e006b3
SM
168};\r
169\r
170/** A parser for EArmObjItsGroup.\r
171*/\r
731c67e1
MK
172STATIC CONST CM_OBJ_PARSER CmArmItsGroupNodeParser[] = {\r
173 { "Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
174 { "ItsIdCount", 4, "0x%x", NULL },\r
175 { "ItsIdToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL }\r
96e006b3
SM
176};\r
177\r
178/** A parser for EArmObjNamedComponent.\r
179*/\r
731c67e1
MK
180STATIC CONST CM_OBJ_PARSER CmArmNamedComponentNodeParser[] = {\r
181 { "Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
182 { "IdMappingCount", 4, "0x%x", NULL },\r
183 { "IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
184 { "Flags", 4, "0x%x", NULL },\r
185 { "CacheCoherent", 4, "0x%x", NULL },\r
186 { "AllocationHints", 1, "0x%x", NULL },\r
187 { "MemoryAccessFlags", 1, "0x%x", NULL },\r
188 { "AddressSizeLimit", 1, "0x%x", NULL },\r
189 { "ObjectName", sizeof (CHAR8 *), "%a", NULL }\r
96e006b3
SM
190};\r
191\r
192/** A parser for EArmObjRootComplex.\r
193*/\r
731c67e1
MK
194STATIC CONST CM_OBJ_PARSER CmArmRootComplexNodeParser[] = {\r
195 { "Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
196 { "IdMappingCount", 4, "0x%x", NULL },\r
197 { "IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
198 { "CacheCoherent", 4, "0x%x", NULL },\r
199 { "AllocationHints", 1, "0x%x", NULL },\r
200 { "MemoryAccessFlags", 1, "0x%x", NULL },\r
201 { "AtsAttribute", 4, "0x%x", NULL },\r
202 { "PciSegmentNumber", 4, "0x%x", NULL },\r
203 { "MemoryAddressSize", 1, "0x%x", NULL }\r
96e006b3
SM
204};\r
205\r
206/** A parser for EArmObjSmmuV1SmmuV2.\r
207*/\r
731c67e1
MK
208STATIC CONST CM_OBJ_PARSER CmArmSmmuV1SmmuV2NodeParser[] = {\r
209 { "Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
210 { "IdMappingCount", 4, "0x%x", NULL },\r
211 { "IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
212 { "BaseAddress", 8, "0x%llx", NULL },\r
213 { "Span", 8, "0x%llx", NULL },\r
214 { "Model", 4, "0x%x", NULL },\r
215 { "Flags", 4, "0x%x", NULL },\r
216 { "ContextInterruptCount", 4, "0x%x", NULL },\r
217 { "ContextInterruptToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
218 { "PmuInterruptCount", 4, "0x%x", NULL },\r
219 { "PmuInterruptToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
220 { "SMMU_NSgIrpt", 4, "0x%x", NULL },\r
221 { "SMMU_NSgIrptFlags", 4, "0x%x", NULL },\r
222 { "SMMU_NSgCfgIrpt", 4, "0x%x", NULL },\r
223 { "SMMU_NSgCfgIrptFlags", 4, "0x%x", NULL }\r
96e006b3
SM
224};\r
225\r
226/** A parser for EArmObjSmmuV3.\r
227*/\r
731c67e1
MK
228STATIC CONST CM_OBJ_PARSER CmArmSmmuV3NodeParser[] = {\r
229 { "Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
230 { "IdMappingCount", 4, "0x%x", NULL },\r
231 { "IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
232 { "BaseAddress", 8, "0x%llx", NULL },\r
233 { "Flags", 4, "0x%x", NULL },\r
234 { "VatosAddress", 8, "0x%llx", NULL },\r
235 { "Model", 4, "0x%x", NULL },\r
236 { "EventInterrupt", 4, "0x%x", NULL },\r
237 { "PriInterrupt", 4, "0x%x", NULL },\r
238 { "GerrInterrupt", 4, "0x%x", NULL },\r
239 { "SyncInterrupt", 4, "0x%x", NULL },\r
240 { "ProximityDomain", 4, "0x%x", NULL },\r
241 { "DeviceIdMappingIndex", 4, "0x%x", NULL }\r
96e006b3
SM
242};\r
243\r
244/** A parser for EArmObjPmcg.\r
245*/\r
731c67e1
MK
246STATIC CONST CM_OBJ_PARSER CmArmPmcgNodeParser[] = {\r
247 { "Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
248 { "IdMappingCount", 4, "0x%x", NULL },\r
249 { "IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
250 { "BaseAddress", 8, "0x%llx", NULL },\r
251 { "OverflowInterrupt", 4, "0x%x", NULL },\r
252 { "Page1BaseAddress", 8, "0x%llx", NULL },\r
253 { "ReferenceToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL }\r
96e006b3
SM
254};\r
255\r
256/** A parser for EArmObjGicItsIdentifierArray.\r
257*/\r
731c67e1
MK
258STATIC CONST CM_OBJ_PARSER CmArmGicItsIdentifierParser[] = {\r
259 { "ItsId", 4, "0x%x", NULL }\r
96e006b3
SM
260};\r
261\r
262/** A parser for EArmObjIdMappingArray.\r
263*/\r
731c67e1
MK
264STATIC CONST CM_OBJ_PARSER CmArmIdMappingParser[] = {\r
265 { "InputBase", 4, "0x%x", NULL },\r
266 { "NumIds", 4, "0x%x", NULL },\r
267 { "OutputBase", 4, "0x%x", NULL },\r
268 { "OutputReferenceToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
269 { "Flags", 4, "0x%x", NULL }\r
96e006b3
SM
270};\r
271\r
272/** A parser for EArmObjSmmuInterruptArray.\r
273*/\r
731c67e1
MK
274STATIC CONST CM_OBJ_PARSER CmArmGenericInterruptParser[] = {\r
275 { "Interrupt", 4, "0x%x", NULL },\r
276 { "Flags", 4, "0x%x", NULL }\r
96e006b3
SM
277};\r
278\r
279/** A parser for EArmObjProcHierarchyInfo.\r
280*/\r
731c67e1
MK
281STATIC CONST CM_OBJ_PARSER CmArmProcHierarchyInfoParser[] = {\r
282 { "Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
283 { "Flags", 4, "0x%x", NULL },\r
284 { "ParentToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
285 { "GicCToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
286 { "NoOfPrivateResources", 4, "0x%x", NULL },\r
287 { "PrivateResourcesArrayToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL }\r
96e006b3
SM
288};\r
289\r
290/** A parser for EArmObjCacheInfo.\r
291*/\r
731c67e1
MK
292STATIC CONST CM_OBJ_PARSER CmArmCacheInfoParser[] = {\r
293 { "Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
294 { "NextLevelOfCacheToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
295 { "Size", 4, "0x%x", NULL },\r
296 { "NumberOfSets", 4, "0x%x", NULL },\r
297 { "Associativity", 4, "0x%x", NULL },\r
298 { "Attributes", 1, "0x%x", NULL },\r
299 { "LineSize", 2, "0x%x", NULL }\r
96e006b3
SM
300};\r
301\r
302/** A parser for EArmObjProcNodeIdInfo.\r
303*/\r
731c67e1
MK
304STATIC CONST CM_OBJ_PARSER CmArmProcNodeIdInfoParser[] = {\r
305 { "Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
306 { "VendorId", 4, "0x%p", NULL },\r
307 { "Level1Id", 8, "0x%x", NULL },\r
308 { "Level2Id", 8, "0x%x", NULL },\r
309 { "MajorRev", 2, "0x%x", NULL },\r
310 { "MinorRev", 2, "0x%x", NULL },\r
311 { "SpinRev", 2, "0x%x", NULL }\r
96e006b3
SM
312};\r
313\r
314/** A parser for EArmObjCmRef.\r
315*/\r
731c67e1
MK
316STATIC CONST CM_OBJ_PARSER CmArmObjRefParser[] = {\r
317 { "ReferenceToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL }\r
96e006b3
SM
318};\r
319\r
320/** A parser for EArmObjMemoryAffinityInfo.\r
321*/\r
731c67e1
MK
322STATIC CONST CM_OBJ_PARSER CmArmMemoryAffinityInfoParser[] = {\r
323 { "ProximityDomain", 4, "0x%x", NULL },\r
324 { "BaseAddress", 8, "0x%llx", NULL },\r
325 { "Length", 8, "0x%llx", NULL },\r
326 { "Flags", 4, "0x%x", NULL }\r
96e006b3
SM
327};\r
328\r
329/** A parser for EArmObjDeviceHandleAcpi.\r
330*/\r
731c67e1
MK
331STATIC CONST CM_OBJ_PARSER CmArmDeviceHandleAcpiParser[] = {\r
332 { "Hid", 8, "0x%llx", NULL },\r
333 { "Uid", 4, "0x%x", NULL }\r
96e006b3
SM
334};\r
335\r
336/** A parser for EArmObjDeviceHandlePci.\r
337*/\r
731c67e1
MK
338STATIC CONST CM_OBJ_PARSER CmArmDeviceHandlePciParser[] = {\r
339 { "SegmentNumber", 2, "0x%x", NULL },\r
340 { "BusNumber", 1, "0x%x", NULL },\r
341 { "DeviceNumber", 1, "0x%x", NULL },\r
342 { "FunctionNumber", 1, "0x%x", NULL }\r
96e006b3
SM
343};\r
344\r
345/** A parser for EArmObjGenericInitiatorAffinityInfo.\r
346*/\r
731c67e1
MK
347STATIC CONST CM_OBJ_PARSER CmArmGenericInitiatorAffinityInfoParser[] = {\r
348 { "ProximityDomain", 4, "0x%x", NULL },\r
349 { "Flags", 4, "0x%x", NULL },\r
350 { "DeviceHandleType", 1, "0x%x", NULL },\r
351 { "DeviceHandleToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL }\r
96e006b3
SM
352};\r
353\r
354/** A parser for EArmObjCmn600Info.\r
355*/\r
731c67e1
MK
356STATIC CONST CM_OBJ_PARSER CmArmCmn600InfoParser[] = {\r
357 { "PeriphBaseAddress", 8, "0x%llx", NULL },\r
358 { "PeriphBaseAddressLength", 8, "0x%llx", NULL },\r
359 { "RootNodeBaseAddress", 8, "0x%llx", NULL },\r
360 { "DtcCount", 1, "0x%x", NULL },\r
361 { "DtcInterrupt[0]", 4, "0x%x", NULL },\r
362 { "DtcFlags[0]", 4, "0x%x", NULL },\r
363 { "DtcInterrupt[1]", 4, "0x%x", NULL },\r
364 { "DtcFlags[1]", 4, "0x%x", NULL },\r
365 { "DtcInterrupt[2]", 4, "0x%x", NULL },\r
366 { "DtcFlags[2]", 4, "0x%x", NULL },\r
367 { "DtcInterrupt[3]", 4, "0x%x", NULL },\r
368 { "DtcFlags[3]", 4, "0x%x", NULL }\r
96e006b3
SM
369};\r
370\r
f17ef10e
PG
371/** A parser for the EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE structure.\r
372*/\r
731c67e1
MK
373STATIC CONST CM_OBJ_PARSER AcpiGenericAddressParser[] = {\r
374 { "AddressSpaceId", 1, "%d", NULL },\r
375 { "RegisterBitWidth", 1, "%d", NULL },\r
376 { "RegisterBitOffset", 1, "%d", NULL },\r
377 { "AccessSize", 1, "%d", NULL },\r
378 { "Address", 8, "0x%llx", NULL },\r
f17ef10e
PG
379};\r
380\r
381/** A parser for EArmObjLpiInfo.\r
382*/\r
731c67e1
MK
383STATIC CONST CM_OBJ_PARSER CmArmLpiInfoParser[] = {\r
384 { "MinResidency", 4, "0x%llx", NULL },\r
385 { "WorstCaseWakeLatency", 4, "0x%llx", NULL },\r
386 { "Flags", 4, "0x%llx", NULL },\r
387 { "ArchFlags", 4, "0x%llx", NULL },\r
388 { "ResCntFreq", 4, "0x%llx", NULL },\r
389 { "EnableParentState", 4, "0x%llx", NULL },\r
390 { "IsInteger", 1, "%d", NULL },\r
391 { "IntegerEntryMethod", 8, "0x%llx", NULL },\r
392 { "RegisterEntryMethod", sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE),\r
f17ef10e 393 NULL, NULL, AcpiGenericAddressParser,\r
731c67e1
MK
394 ARRAY_SIZE (AcpiGenericAddressParser) },\r
395 { "ResidencyCounterRegister", sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE),\r
f17ef10e 396 NULL, NULL, AcpiGenericAddressParser,\r
731c67e1
MK
397 ARRAY_SIZE (AcpiGenericAddressParser) },\r
398 { "UsageCounterRegister", sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE),\r
f17ef10e 399 NULL, NULL, AcpiGenericAddressParser,\r
731c67e1
MK
400 ARRAY_SIZE (AcpiGenericAddressParser) },\r
401 { "StateName", 16, "0x%a", NULL },\r
f17ef10e
PG
402};\r
403\r
96e006b3
SM
404/** A parser for Arm namespace objects.\r
405*/\r
731c67e1
MK
406STATIC CONST CM_OBJ_PARSER_ARRAY ArmNamespaceObjectParser[] = {\r
407 { "EArmObjReserved", NULL, 0 },\r
408 { "EArmObjBootArchInfo", CmArmBootArchInfoParser,\r
409 ARRAY_SIZE (CmArmBootArchInfoParser) },\r
410 { "EArmObjCpuInfo", NULL, 0 },\r
411 { "EArmObjPowerManagementProfileInfo", CmArmPowerManagementProfileInfoParser,\r
412 ARRAY_SIZE (CmArmPowerManagementProfileInfoParser) },\r
413 { "EArmObjGicCInfo", CmArmGicCInfoParser, ARRAY_SIZE (CmArmGicCInfoParser) },\r
414 { "EArmObjGicDInfo", CmArmGicDInfoParser, ARRAY_SIZE (CmArmGicDInfoParser) },\r
415 { "EArmObjGicMsiFrameInfo", CmArmGicMsiFrameInfoParser,\r
416 ARRAY_SIZE (CmArmGicMsiFrameInfoParser) },\r
417 { "EArmObjGicRedistributorInfo", CmArmGicRedistInfoParser,\r
418 ARRAY_SIZE (CmArmGicRedistInfoParser) },\r
419 { "EArmObjGicItsInfo", CmArmGicItsInfoParser,\r
420 ARRAY_SIZE (CmArmGicItsInfoParser) },\r
421 { "EArmObjSerialConsolePortInfo", CmArmSerialPortInfoParser,\r
422 ARRAY_SIZE (CmArmSerialPortInfoParser) },\r
423 { "EArmObjSerialDebugPortInfo", CmArmSerialPortInfoParser,\r
424 ARRAY_SIZE (CmArmSerialPortInfoParser) },\r
425 { "EArmObjGenericTimerInfo", CmArmGenericTimerInfoParser,\r
426 ARRAY_SIZE (CmArmGenericTimerInfoParser) },\r
427 { "EArmObjPlatformGTBlockInfo", CmArmGTBlockTimerFrameInfoParser,\r
428 ARRAY_SIZE (CmArmGTBlockTimerFrameInfoParser) },\r
429 { "EArmObjGTBlockTimerFrameInfo", CmArmGTBlockInfoParser,\r
430 ARRAY_SIZE (CmArmGTBlockInfoParser) },\r
431 { "EArmObjPlatformGenericWatchdogInfo", CmArmGenericWatchdogInfoParser,\r
432 ARRAY_SIZE (CmArmGenericWatchdogInfoParser) },\r
433 { "EArmObjPciConfigSpaceInfo", CmArmPciConfigSpaceInfoParser,\r
434 ARRAY_SIZE (CmArmPciConfigSpaceInfoParser) },\r
435 { "EArmObjHypervisorVendorIdentity", CmArmHypervisorVendorIdParser,\r
436 ARRAY_SIZE (CmArmHypervisorVendorIdParser) },\r
437 { "EArmObjFixedFeatureFlags", CmArmFixedFeatureFlagsParser,\r
438 ARRAY_SIZE (CmArmFixedFeatureFlagsParser) },\r
439 { "EArmObjItsGroup", CmArmItsGroupNodeParser,\r
440 ARRAY_SIZE (CmArmItsGroupNodeParser) },\r
441 { "EArmObjNamedComponent", CmArmNamedComponentNodeParser,\r
442 ARRAY_SIZE (CmArmNamedComponentNodeParser) },\r
443 { "EArmObjRootComplex", CmArmRootComplexNodeParser,\r
444 ARRAY_SIZE (CmArmRootComplexNodeParser) },\r
445 { "EArmObjSmmuV1SmmuV2", CmArmSmmuV1SmmuV2NodeParser,\r
446 ARRAY_SIZE (CmArmSmmuV1SmmuV2NodeParser) },\r
447 { "EArmObjSmmuV3", CmArmSmmuV3NodeParser,\r
448 ARRAY_SIZE (CmArmSmmuV3NodeParser) },\r
449 { "EArmObjPmcg", CmArmPmcgNodeParser, ARRAY_SIZE (CmArmPmcgNodeParser) },\r
450 { "EArmObjGicItsIdentifierArray", CmArmGicItsIdentifierParser,\r
451 ARRAY_SIZE (CmArmGicItsIdentifierParser) },\r
452 { "EArmObjIdMappingArray", CmArmIdMappingParser,\r
453 ARRAY_SIZE (CmArmIdMappingParser) },\r
454 { "EArmObjSmmuInterruptArray", CmArmGenericInterruptParser,\r
455 ARRAY_SIZE (CmArmGenericInterruptParser) },\r
456 { "EArmObjProcHierarchyInfo", CmArmProcHierarchyInfoParser,\r
457 ARRAY_SIZE (CmArmProcHierarchyInfoParser) },\r
458 { "EArmObjCacheInfo", CmArmCacheInfoParser,\r
459 ARRAY_SIZE (CmArmCacheInfoParser) },\r
460 { "EArmObjProcNodeIdInfo", CmArmProcNodeIdInfoParser,\r
461 ARRAY_SIZE (CmArmProcNodeIdInfoParser) },\r
462 { "EArmObjCmRef", CmArmObjRefParser, ARRAY_SIZE (CmArmObjRefParser) },\r
463 { "EArmObjMemoryAffinityInfo", CmArmMemoryAffinityInfoParser,\r
464 ARRAY_SIZE (CmArmMemoryAffinityInfoParser) },\r
465 { "EArmObjDeviceHandleAcpi", CmArmDeviceHandleAcpiParser,\r
466 ARRAY_SIZE (CmArmDeviceHandleAcpiParser) },\r
467 { "EArmObjDeviceHandlePci", CmArmDeviceHandlePciParser,\r
468 ARRAY_SIZE (CmArmDeviceHandlePciParser) },\r
469 { "EArmObjGenericInitiatorAffinityInfo",\r
96e006b3 470 CmArmGenericInitiatorAffinityInfoParser,\r
731c67e1
MK
471 ARRAY_SIZE (CmArmGenericInitiatorAffinityInfoParser) },\r
472 { "EArmObjSerialPortInfo", CmArmSerialPortInfoParser,\r
473 ARRAY_SIZE (CmArmSerialPortInfoParser) },\r
474 { "EArmObjCmn600Info", CmArmCmn600InfoParser,\r
475 ARRAY_SIZE (CmArmCmn600InfoParser) },\r
476 { "EArmObjLpiInfo", CmArmLpiInfoParser,\r
477 ARRAY_SIZE (CmArmLpiInfoParser) },\r
478 { "EArmObjMax", NULL, 0 },\r
96e006b3
SM
479};\r
480\r
481/** A parser for EStdObjCfgMgrInfo.\r
482*/\r
731c67e1
MK
483STATIC CONST CM_OBJ_PARSER StdObjCfgMgrInfoParser[] = {\r
484 { "Revision", 4, "0x%x", NULL },\r
485 { "OemId[6]", 6, "%C%C%C%C%C%C", PrintOemId }\r
96e006b3
SM
486};\r
487\r
488/** A parser for EStdObjAcpiTableList.\r
489*/\r
731c67e1
MK
490STATIC CONST CM_OBJ_PARSER StdObjAcpiTableInfoParser[] = {\r
491 { "AcpiTableSignature", 4, "0x%x", NULL },\r
492 { "AcpiTableRevision", 1, "%d", NULL },\r
493 { "TableGeneratorId", sizeof (ACPI_TABLE_GENERATOR_ID), "0x%x", NULL },\r
494 { "AcpiTableData", sizeof (EFI_ACPI_DESCRIPTION_HEADER *), "0x%p", NULL },\r
495 { "OemTableId", 8, "0x%LLX", NULL },\r
496 { "OemRevision", 4, "0x%x", NULL }\r
96e006b3
SM
497};\r
498\r
499/** A parser for EStdObjSmbiosTableList.\r
500*/\r
731c67e1
MK
501STATIC CONST CM_OBJ_PARSER StdObjSmbiosTableInfoParser[] = {\r
502 { "TableGeneratorId", sizeof (SMBIOS_TABLE_GENERATOR_ID), "0x%x", NULL },\r
503 { "SmbiosTableData", sizeof (SMBIOS_STRUCTURE *), "0x%p", NULL }\r
96e006b3
SM
504};\r
505\r
506/** A parser for Standard namespace objects.\r
507*/\r
731c67e1
MK
508STATIC CONST CM_OBJ_PARSER_ARRAY StdNamespaceObjectParser[] = {\r
509 { "EStdObjCfgMgrInfo", StdObjCfgMgrInfoParser,\r
510 ARRAY_SIZE (StdObjCfgMgrInfoParser) },\r
511 { "EStdObjAcpiTableList", StdObjAcpiTableInfoParser,\r
512 ARRAY_SIZE (StdObjAcpiTableInfoParser) },\r
513 { "EStdObjSmbiosTableList", StdObjSmbiosTableInfoParser,\r
514 ARRAY_SIZE (StdObjSmbiosTableInfoParser) },\r
96e006b3
SM
515};\r
516\r
517/** Print OEM Id.\r
518\r
519 @param [in] Format Format to print the Ptr.\r
520 @param [in] Ptr Pointer to the OEM Id.\r
521**/\r
522STATIC\r
523VOID\r
524EFIAPI\r
525PrintOemId (\r
731c67e1
MK
526 IN CONST CHAR8 *Format,\r
527 IN UINT8 *Ptr\r
96e006b3
SM
528 )\r
529{\r
530 DEBUG ((\r
531 DEBUG_ERROR,\r
532 (Format != NULL) ? Format : "%C%C%C%C%C%C",\r
533 Ptr[0],\r
534 Ptr[1],\r
535 Ptr[2],\r
536 Ptr[3],\r
537 Ptr[4],\r
538 Ptr[5]\r
539 ));\r
540}\r
541\r
542/** Print fields of the objects.\r
543\r
544 @param [in] Data Pointer to the object to print.\r
545 @param [in] Parser Parser containing the object fields.\r
546 @param [in] ItemCount Number of entries/fields in the Parser.\r
547 @param [in] RemainingSize Parse at most *RemainingSize bytes.\r
548 This function decrements the value\r
549 from the number bytes consumed.\r
550 @param [in] IndentLevel Indentation to use when printing.\r
551**/\r
552STATIC\r
553VOID\r
554PrintCmObjDesc (\r
731c67e1
MK
555 IN VOID *Data,\r
556 IN CONST CM_OBJ_PARSER *Parser,\r
557 IN UINTN ItemCount,\r
558 IN INTN *RemainingSize,\r
559 IN UINT32 IndentLevel\r
96e006b3
SM
560 )\r
561{\r
562 UINT32 Index;\r
563 UINT32 IndentIndex;\r
564 INTN SubStructSize;\r
565\r
566 if ((Data == NULL) ||\r
567 (Parser == NULL) ||\r
568 (ItemCount == 0) ||\r
731c67e1
MK
569 (RemainingSize == NULL))\r
570 {\r
96e006b3
SM
571 ASSERT (0);\r
572 return;\r
573 }\r
574\r
575 // Print each field.\r
576 for (Index = 0; Index < ItemCount; Index++) {\r
577 // Check there is enough space in left.\r
578 *RemainingSize -= Parser[Index].Length;\r
579 if (*RemainingSize < 0) {\r
580 DEBUG ((\r
581 DEBUG_ERROR,\r
582 "\nERROR: %a: Buffer overrun\n",\r
583 Parser[Index].NameStr\r
584 ));\r
585 ASSERT (0);\r
586 return;\r
587 }\r
588\r
589 // Indentation\r
590 for (IndentIndex = 0; IndentIndex < IndentLevel; IndentIndex++) {\r
591 DEBUG ((DEBUG_ERROR, " "));\r
592 }\r
593\r
594 DEBUG ((\r
595 DEBUG_ERROR,\r
596 "%-*a :",\r
597 OUTPUT_FIELD_COLUMN_WIDTH - 2 * IndentLevel,\r
598 Parser[Index].NameStr\r
599 ));\r
600 if (Parser[Index].PrintFormatter != NULL) {\r
601 Parser[Index].PrintFormatter (Parser[Index].Format, Data);\r
602 } else if (Parser[Index].Format != NULL) {\r
603 switch (Parser[Index].Length) {\r
604 case 1:\r
731c67e1 605 DEBUG ((DEBUG_ERROR, Parser[Index].Format, *(UINT8 *)Data));\r
96e006b3
SM
606 break;\r
607 case 2:\r
731c67e1 608 DEBUG ((DEBUG_ERROR, Parser[Index].Format, *(UINT16 *)Data));\r
96e006b3
SM
609 break;\r
610 case 4:\r
731c67e1 611 DEBUG ((DEBUG_ERROR, Parser[Index].Format, *(UINT32 *)Data));\r
96e006b3
SM
612 break;\r
613 case 8:\r
731c67e1 614 DEBUG ((DEBUG_ERROR, Parser[Index].Format, ReadUnaligned64 (Data)));\r
96e006b3
SM
615 break;\r
616 default:\r
617 DEBUG ((\r
618 DEBUG_ERROR,\r
619 "\nERROR: %a: CANNOT PARSE THIS FIELD, Field Length = %d\n",\r
620 Parser[Index].NameStr,\r
621 Parser[Index].Length\r
622 ));\r
623 } // switch\r
624 } else if (Parser[Index].SubObjParser != NULL) {\r
625 SubStructSize = Parser[Index].Length;\r
626\r
627 DEBUG ((DEBUG_ERROR, "\n"));\r
628 PrintCmObjDesc (\r
629 Data,\r
630 Parser[Index].SubObjParser,\r
631 Parser[Index].SubObjItemCount,\r
632 &SubStructSize,\r
633 IndentLevel + 1\r
634 );\r
635 } else {\r
636 ASSERT (0);\r
637 DEBUG ((\r
638 DEBUG_ERROR,\r
639 "\nERROR: %a: CANNOT PARSE THIS FIELD, Field Length = %d\n",\r
640 Parser[Index].NameStr,\r
641 Parser[Index].Length\r
642 ));\r
643 }\r
731c67e1 644\r
96e006b3 645 DEBUG ((DEBUG_ERROR, "\n"));\r
731c67e1 646 Data = (UINT8 *)Data + Parser[Index].Length;\r
96e006b3
SM
647 } // for\r
648}\r
649\r
650/** Parse and print a CmObjDesc.\r
651\r
652 @param [in] CmObjDesc The CmObjDesc to parse and print.\r
653**/\r
654VOID\r
655EFIAPI\r
656ParseCmObjDesc (\r
731c67e1 657 IN CONST CM_OBJ_DESCRIPTOR *CmObjDesc\r
96e006b3
SM
658 )\r
659{\r
731c67e1
MK
660 UINTN ObjId;\r
661 UINTN NameSpaceId;\r
662 UINT32 ObjIndex;\r
663 UINT32 ObjectCount;\r
664 INTN RemainingSize;\r
665 CONST CM_OBJ_PARSER_ARRAY *ParserArray;\r
96e006b3
SM
666\r
667 if ((CmObjDesc == NULL) || (CmObjDesc->Data == NULL)) {\r
668 return;\r
669 }\r
670\r
671 NameSpaceId = GET_CM_NAMESPACE_ID (CmObjDesc->ObjectId);\r
731c67e1 672 ObjId = GET_CM_OBJECT_ID (CmObjDesc->ObjectId);\r
96e006b3
SM
673\r
674 switch (NameSpaceId) {\r
675 case EObjNameSpaceStandard:\r
676 if (ObjId >= EStdObjMax) {\r
677 ASSERT (0);\r
678 return;\r
679 }\r
731c67e1 680\r
96e006b3
SM
681 ParserArray = &StdNamespaceObjectParser[ObjId];\r
682 break;\r
683 case EObjNameSpaceArm:\r
684 if (ObjId >= EArmObjMax) {\r
685 ASSERT (0);\r
686 return;\r
687 }\r
731c67e1 688\r
96e006b3
SM
689 ParserArray = &ArmNamespaceObjectParser[ObjId];\r
690 break;\r
691 default:\r
692 // Not supported\r
693 ASSERT (0);\r
694 return;\r
695 } // switch\r
696\r
731c67e1 697 ObjectCount = CmObjDesc->Count;\r
96e006b3
SM
698 RemainingSize = CmObjDesc->Size;\r
699\r
700 for (ObjIndex = 0; ObjIndex < ObjectCount; ObjIndex++) {\r
701 DEBUG ((\r
702 DEBUG_ERROR,\r
703 "\n%-*a [%d/%d]:\n",\r
704 OUTPUT_FIELD_COLUMN_WIDTH,\r
705 ParserArray->ObjectName,\r
706 ObjIndex + 1,\r
707 ObjectCount\r
708 ));\r
709 PrintCmObjDesc (\r
710 CmObjDesc->Data,\r
711 ParserArray->Parser,\r
712 ParserArray->ItemCount,\r
713 &RemainingSize,\r
714 1\r
715 );\r
716 } // for\r
717}\r