]> git.proxmox.com Git - mirror_edk2.git/blame - DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c
DynamicTablesPkg: Add Pci related objects
[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 151STATIC CONST CM_OBJ_PARSER CmArmPciConfigSpaceInfoParser[] = {\r
ce306e48
PG
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
156 { "AddressMapToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
157 { "InterruptMapToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
96e006b3
SM
158};\r
159\r
160/** A parser for EArmObjHypervisorVendorIdentity.\r
161*/\r
731c67e1
MK
162STATIC CONST CM_OBJ_PARSER CmArmHypervisorVendorIdParser[] = {\r
163 { "HypervisorVendorId", 8, "0x%llx", NULL }\r
96e006b3
SM
164};\r
165\r
166/** A parser for EArmObjFixedFeatureFlags.\r
167*/\r
731c67e1
MK
168STATIC CONST CM_OBJ_PARSER CmArmFixedFeatureFlagsParser[] = {\r
169 { "Flags", 4, "0x%x", NULL }\r
96e006b3
SM
170};\r
171\r
172/** A parser for EArmObjItsGroup.\r
173*/\r
731c67e1
MK
174STATIC CONST CM_OBJ_PARSER CmArmItsGroupNodeParser[] = {\r
175 { "Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
176 { "ItsIdCount", 4, "0x%x", NULL },\r
177 { "ItsIdToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL }\r
96e006b3
SM
178};\r
179\r
180/** A parser for EArmObjNamedComponent.\r
181*/\r
731c67e1
MK
182STATIC CONST CM_OBJ_PARSER CmArmNamedComponentNodeParser[] = {\r
183 { "Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
184 { "IdMappingCount", 4, "0x%x", NULL },\r
185 { "IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
186 { "Flags", 4, "0x%x", NULL },\r
187 { "CacheCoherent", 4, "0x%x", NULL },\r
188 { "AllocationHints", 1, "0x%x", NULL },\r
189 { "MemoryAccessFlags", 1, "0x%x", NULL },\r
190 { "AddressSizeLimit", 1, "0x%x", NULL },\r
191 { "ObjectName", sizeof (CHAR8 *), "%a", NULL }\r
96e006b3
SM
192};\r
193\r
194/** A parser for EArmObjRootComplex.\r
195*/\r
731c67e1
MK
196STATIC CONST CM_OBJ_PARSER CmArmRootComplexNodeParser[] = {\r
197 { "Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
198 { "IdMappingCount", 4, "0x%x", NULL },\r
199 { "IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
200 { "CacheCoherent", 4, "0x%x", NULL },\r
201 { "AllocationHints", 1, "0x%x", NULL },\r
202 { "MemoryAccessFlags", 1, "0x%x", NULL },\r
203 { "AtsAttribute", 4, "0x%x", NULL },\r
204 { "PciSegmentNumber", 4, "0x%x", NULL },\r
205 { "MemoryAddressSize", 1, "0x%x", NULL }\r
96e006b3
SM
206};\r
207\r
208/** A parser for EArmObjSmmuV1SmmuV2.\r
209*/\r
731c67e1
MK
210STATIC CONST CM_OBJ_PARSER CmArmSmmuV1SmmuV2NodeParser[] = {\r
211 { "Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
212 { "IdMappingCount", 4, "0x%x", NULL },\r
213 { "IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
214 { "BaseAddress", 8, "0x%llx", NULL },\r
215 { "Span", 8, "0x%llx", NULL },\r
216 { "Model", 4, "0x%x", NULL },\r
217 { "Flags", 4, "0x%x", NULL },\r
218 { "ContextInterruptCount", 4, "0x%x", NULL },\r
219 { "ContextInterruptToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
220 { "PmuInterruptCount", 4, "0x%x", NULL },\r
221 { "PmuInterruptToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
222 { "SMMU_NSgIrpt", 4, "0x%x", NULL },\r
223 { "SMMU_NSgIrptFlags", 4, "0x%x", NULL },\r
224 { "SMMU_NSgCfgIrpt", 4, "0x%x", NULL },\r
225 { "SMMU_NSgCfgIrptFlags", 4, "0x%x", NULL }\r
96e006b3
SM
226};\r
227\r
228/** A parser for EArmObjSmmuV3.\r
229*/\r
731c67e1
MK
230STATIC CONST CM_OBJ_PARSER CmArmSmmuV3NodeParser[] = {\r
231 { "Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
232 { "IdMappingCount", 4, "0x%x", NULL },\r
233 { "IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
234 { "BaseAddress", 8, "0x%llx", NULL },\r
235 { "Flags", 4, "0x%x", NULL },\r
236 { "VatosAddress", 8, "0x%llx", NULL },\r
237 { "Model", 4, "0x%x", NULL },\r
238 { "EventInterrupt", 4, "0x%x", NULL },\r
239 { "PriInterrupt", 4, "0x%x", NULL },\r
240 { "GerrInterrupt", 4, "0x%x", NULL },\r
241 { "SyncInterrupt", 4, "0x%x", NULL },\r
242 { "ProximityDomain", 4, "0x%x", NULL },\r
243 { "DeviceIdMappingIndex", 4, "0x%x", NULL }\r
96e006b3
SM
244};\r
245\r
246/** A parser for EArmObjPmcg.\r
247*/\r
731c67e1
MK
248STATIC CONST CM_OBJ_PARSER CmArmPmcgNodeParser[] = {\r
249 { "Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
250 { "IdMappingCount", 4, "0x%x", NULL },\r
251 { "IdMappingToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
252 { "BaseAddress", 8, "0x%llx", NULL },\r
253 { "OverflowInterrupt", 4, "0x%x", NULL },\r
254 { "Page1BaseAddress", 8, "0x%llx", NULL },\r
255 { "ReferenceToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL }\r
96e006b3
SM
256};\r
257\r
258/** A parser for EArmObjGicItsIdentifierArray.\r
259*/\r
731c67e1
MK
260STATIC CONST CM_OBJ_PARSER CmArmGicItsIdentifierParser[] = {\r
261 { "ItsId", 4, "0x%x", NULL }\r
96e006b3
SM
262};\r
263\r
264/** A parser for EArmObjIdMappingArray.\r
265*/\r
731c67e1
MK
266STATIC CONST CM_OBJ_PARSER CmArmIdMappingParser[] = {\r
267 { "InputBase", 4, "0x%x", NULL },\r
268 { "NumIds", 4, "0x%x", NULL },\r
269 { "OutputBase", 4, "0x%x", NULL },\r
270 { "OutputReferenceToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
271 { "Flags", 4, "0x%x", NULL }\r
96e006b3
SM
272};\r
273\r
274/** A parser for EArmObjSmmuInterruptArray.\r
275*/\r
731c67e1
MK
276STATIC CONST CM_OBJ_PARSER CmArmGenericInterruptParser[] = {\r
277 { "Interrupt", 4, "0x%x", NULL },\r
278 { "Flags", 4, "0x%x", NULL }\r
96e006b3
SM
279};\r
280\r
281/** A parser for EArmObjProcHierarchyInfo.\r
282*/\r
731c67e1
MK
283STATIC CONST CM_OBJ_PARSER CmArmProcHierarchyInfoParser[] = {\r
284 { "Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
285 { "Flags", 4, "0x%x", NULL },\r
286 { "ParentToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
287 { "GicCToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
288 { "NoOfPrivateResources", 4, "0x%x", NULL },\r
289 { "PrivateResourcesArrayToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL }\r
96e006b3
SM
290};\r
291\r
292/** A parser for EArmObjCacheInfo.\r
293*/\r
731c67e1
MK
294STATIC CONST CM_OBJ_PARSER CmArmCacheInfoParser[] = {\r
295 { "Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
296 { "NextLevelOfCacheToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
297 { "Size", 4, "0x%x", NULL },\r
298 { "NumberOfSets", 4, "0x%x", NULL },\r
299 { "Associativity", 4, "0x%x", NULL },\r
300 { "Attributes", 1, "0x%x", NULL },\r
301 { "LineSize", 2, "0x%x", NULL }\r
96e006b3
SM
302};\r
303\r
304/** A parser for EArmObjProcNodeIdInfo.\r
305*/\r
731c67e1
MK
306STATIC CONST CM_OBJ_PARSER CmArmProcNodeIdInfoParser[] = {\r
307 { "Token", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },\r
308 { "VendorId", 4, "0x%p", NULL },\r
309 { "Level1Id", 8, "0x%x", NULL },\r
310 { "Level2Id", 8, "0x%x", NULL },\r
311 { "MajorRev", 2, "0x%x", NULL },\r
312 { "MinorRev", 2, "0x%x", NULL },\r
313 { "SpinRev", 2, "0x%x", NULL }\r
96e006b3
SM
314};\r
315\r
316/** A parser for EArmObjCmRef.\r
317*/\r
731c67e1
MK
318STATIC CONST CM_OBJ_PARSER CmArmObjRefParser[] = {\r
319 { "ReferenceToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL }\r
96e006b3
SM
320};\r
321\r
322/** A parser for EArmObjMemoryAffinityInfo.\r
323*/\r
731c67e1
MK
324STATIC CONST CM_OBJ_PARSER CmArmMemoryAffinityInfoParser[] = {\r
325 { "ProximityDomain", 4, "0x%x", NULL },\r
326 { "BaseAddress", 8, "0x%llx", NULL },\r
327 { "Length", 8, "0x%llx", NULL },\r
328 { "Flags", 4, "0x%x", NULL }\r
96e006b3
SM
329};\r
330\r
331/** A parser for EArmObjDeviceHandleAcpi.\r
332*/\r
731c67e1
MK
333STATIC CONST CM_OBJ_PARSER CmArmDeviceHandleAcpiParser[] = {\r
334 { "Hid", 8, "0x%llx", NULL },\r
335 { "Uid", 4, "0x%x", NULL }\r
96e006b3
SM
336};\r
337\r
338/** A parser for EArmObjDeviceHandlePci.\r
339*/\r
731c67e1
MK
340STATIC CONST CM_OBJ_PARSER CmArmDeviceHandlePciParser[] = {\r
341 { "SegmentNumber", 2, "0x%x", NULL },\r
342 { "BusNumber", 1, "0x%x", NULL },\r
343 { "DeviceNumber", 1, "0x%x", NULL },\r
344 { "FunctionNumber", 1, "0x%x", NULL }\r
96e006b3
SM
345};\r
346\r
347/** A parser for EArmObjGenericInitiatorAffinityInfo.\r
348*/\r
731c67e1
MK
349STATIC CONST CM_OBJ_PARSER CmArmGenericInitiatorAffinityInfoParser[] = {\r
350 { "ProximityDomain", 4, "0x%x", NULL },\r
351 { "Flags", 4, "0x%x", NULL },\r
352 { "DeviceHandleType", 1, "0x%x", NULL },\r
353 { "DeviceHandleToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL }\r
96e006b3
SM
354};\r
355\r
356/** A parser for EArmObjCmn600Info.\r
357*/\r
731c67e1
MK
358STATIC CONST CM_OBJ_PARSER CmArmCmn600InfoParser[] = {\r
359 { "PeriphBaseAddress", 8, "0x%llx", NULL },\r
360 { "PeriphBaseAddressLength", 8, "0x%llx", NULL },\r
361 { "RootNodeBaseAddress", 8, "0x%llx", NULL },\r
362 { "DtcCount", 1, "0x%x", NULL },\r
363 { "DtcInterrupt[0]", 4, "0x%x", NULL },\r
364 { "DtcFlags[0]", 4, "0x%x", NULL },\r
365 { "DtcInterrupt[1]", 4, "0x%x", NULL },\r
366 { "DtcFlags[1]", 4, "0x%x", NULL },\r
367 { "DtcInterrupt[2]", 4, "0x%x", NULL },\r
368 { "DtcFlags[2]", 4, "0x%x", NULL },\r
369 { "DtcInterrupt[3]", 4, "0x%x", NULL },\r
370 { "DtcFlags[3]", 4, "0x%x", NULL }\r
96e006b3
SM
371};\r
372\r
f17ef10e
PG
373/** A parser for the EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE structure.\r
374*/\r
731c67e1
MK
375STATIC CONST CM_OBJ_PARSER AcpiGenericAddressParser[] = {\r
376 { "AddressSpaceId", 1, "%d", NULL },\r
377 { "RegisterBitWidth", 1, "%d", NULL },\r
378 { "RegisterBitOffset", 1, "%d", NULL },\r
379 { "AccessSize", 1, "%d", NULL },\r
380 { "Address", 8, "0x%llx", NULL },\r
f17ef10e
PG
381};\r
382\r
383/** A parser for EArmObjLpiInfo.\r
384*/\r
731c67e1
MK
385STATIC CONST CM_OBJ_PARSER CmArmLpiInfoParser[] = {\r
386 { "MinResidency", 4, "0x%llx", NULL },\r
387 { "WorstCaseWakeLatency", 4, "0x%llx", NULL },\r
388 { "Flags", 4, "0x%llx", NULL },\r
389 { "ArchFlags", 4, "0x%llx", NULL },\r
390 { "ResCntFreq", 4, "0x%llx", NULL },\r
391 { "EnableParentState", 4, "0x%llx", NULL },\r
392 { "IsInteger", 1, "%d", NULL },\r
393 { "IntegerEntryMethod", 8, "0x%llx", NULL },\r
394 { "RegisterEntryMethod", sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE),\r
f17ef10e 395 NULL, NULL, AcpiGenericAddressParser,\r
731c67e1
MK
396 ARRAY_SIZE (AcpiGenericAddressParser) },\r
397 { "ResidencyCounterRegister", sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE),\r
f17ef10e 398 NULL, NULL, AcpiGenericAddressParser,\r
731c67e1
MK
399 ARRAY_SIZE (AcpiGenericAddressParser) },\r
400 { "UsageCounterRegister", sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE),\r
f17ef10e 401 NULL, NULL, AcpiGenericAddressParser,\r
731c67e1
MK
402 ARRAY_SIZE (AcpiGenericAddressParser) },\r
403 { "StateName", 16, "0x%a", NULL },\r
f17ef10e
PG
404};\r
405\r
ce306e48
PG
406/** A parser for EArmObjPciAddressMapInfo.\r
407*/\r
408STATIC CONST CM_OBJ_PARSER CmArmPciAddressMapInfoParser[] = {\r
409 { "SpaceCode", 1, "%d", NULL },\r
410 { "PciAddress", 8, "0x%llx", NULL },\r
411 { "CpuAddress", 8, "0x%llx", NULL },\r
412 { "AddressSize", 8, "0x%llx", NULL },\r
413};\r
414\r
415/** A parser for EArmObjPciInterruptMapInfo.\r
416*/\r
417STATIC CONST CM_OBJ_PARSER CmPciInterruptMapInfoParser[] = {\r
418 { "PciBus", 1, "0x%x", NULL },\r
419 { "PciDevice", 1, "0x%x", NULL },\r
420 { "PciInterrupt", 1, "0x%x", NULL },\r
421 { "IntcInterrupt", sizeof (CM_ARM_GENERIC_INTERRUPT),\r
422 NULL, NULL, CmArmGenericInterruptParser,\r
423 ARRAY_SIZE (CmArmGenericInterruptParser) },\r
424};\r
425\r
96e006b3
SM
426/** A parser for Arm namespace objects.\r
427*/\r
731c67e1
MK
428STATIC CONST CM_OBJ_PARSER_ARRAY ArmNamespaceObjectParser[] = {\r
429 { "EArmObjReserved", NULL, 0 },\r
430 { "EArmObjBootArchInfo", CmArmBootArchInfoParser,\r
431 ARRAY_SIZE (CmArmBootArchInfoParser) },\r
432 { "EArmObjCpuInfo", NULL, 0 },\r
433 { "EArmObjPowerManagementProfileInfo", CmArmPowerManagementProfileInfoParser,\r
434 ARRAY_SIZE (CmArmPowerManagementProfileInfoParser) },\r
435 { "EArmObjGicCInfo", CmArmGicCInfoParser, ARRAY_SIZE (CmArmGicCInfoParser) },\r
436 { "EArmObjGicDInfo", CmArmGicDInfoParser, ARRAY_SIZE (CmArmGicDInfoParser) },\r
437 { "EArmObjGicMsiFrameInfo", CmArmGicMsiFrameInfoParser,\r
438 ARRAY_SIZE (CmArmGicMsiFrameInfoParser) },\r
439 { "EArmObjGicRedistributorInfo", CmArmGicRedistInfoParser,\r
440 ARRAY_SIZE (CmArmGicRedistInfoParser) },\r
441 { "EArmObjGicItsInfo", CmArmGicItsInfoParser,\r
442 ARRAY_SIZE (CmArmGicItsInfoParser) },\r
443 { "EArmObjSerialConsolePortInfo", CmArmSerialPortInfoParser,\r
444 ARRAY_SIZE (CmArmSerialPortInfoParser) },\r
445 { "EArmObjSerialDebugPortInfo", CmArmSerialPortInfoParser,\r
446 ARRAY_SIZE (CmArmSerialPortInfoParser) },\r
447 { "EArmObjGenericTimerInfo", CmArmGenericTimerInfoParser,\r
448 ARRAY_SIZE (CmArmGenericTimerInfoParser) },\r
449 { "EArmObjPlatformGTBlockInfo", CmArmGTBlockTimerFrameInfoParser,\r
450 ARRAY_SIZE (CmArmGTBlockTimerFrameInfoParser) },\r
451 { "EArmObjGTBlockTimerFrameInfo", CmArmGTBlockInfoParser,\r
452 ARRAY_SIZE (CmArmGTBlockInfoParser) },\r
453 { "EArmObjPlatformGenericWatchdogInfo", CmArmGenericWatchdogInfoParser,\r
454 ARRAY_SIZE (CmArmGenericWatchdogInfoParser) },\r
455 { "EArmObjPciConfigSpaceInfo", CmArmPciConfigSpaceInfoParser,\r
456 ARRAY_SIZE (CmArmPciConfigSpaceInfoParser) },\r
457 { "EArmObjHypervisorVendorIdentity", CmArmHypervisorVendorIdParser,\r
458 ARRAY_SIZE (CmArmHypervisorVendorIdParser) },\r
459 { "EArmObjFixedFeatureFlags", CmArmFixedFeatureFlagsParser,\r
460 ARRAY_SIZE (CmArmFixedFeatureFlagsParser) },\r
461 { "EArmObjItsGroup", CmArmItsGroupNodeParser,\r
462 ARRAY_SIZE (CmArmItsGroupNodeParser) },\r
463 { "EArmObjNamedComponent", CmArmNamedComponentNodeParser,\r
464 ARRAY_SIZE (CmArmNamedComponentNodeParser) },\r
465 { "EArmObjRootComplex", CmArmRootComplexNodeParser,\r
466 ARRAY_SIZE (CmArmRootComplexNodeParser) },\r
467 { "EArmObjSmmuV1SmmuV2", CmArmSmmuV1SmmuV2NodeParser,\r
468 ARRAY_SIZE (CmArmSmmuV1SmmuV2NodeParser) },\r
469 { "EArmObjSmmuV3", CmArmSmmuV3NodeParser,\r
470 ARRAY_SIZE (CmArmSmmuV3NodeParser) },\r
471 { "EArmObjPmcg", CmArmPmcgNodeParser, ARRAY_SIZE (CmArmPmcgNodeParser) },\r
472 { "EArmObjGicItsIdentifierArray", CmArmGicItsIdentifierParser,\r
473 ARRAY_SIZE (CmArmGicItsIdentifierParser) },\r
474 { "EArmObjIdMappingArray", CmArmIdMappingParser,\r
475 ARRAY_SIZE (CmArmIdMappingParser) },\r
476 { "EArmObjSmmuInterruptArray", CmArmGenericInterruptParser,\r
477 ARRAY_SIZE (CmArmGenericInterruptParser) },\r
478 { "EArmObjProcHierarchyInfo", CmArmProcHierarchyInfoParser,\r
479 ARRAY_SIZE (CmArmProcHierarchyInfoParser) },\r
480 { "EArmObjCacheInfo", CmArmCacheInfoParser,\r
481 ARRAY_SIZE (CmArmCacheInfoParser) },\r
482 { "EArmObjProcNodeIdInfo", CmArmProcNodeIdInfoParser,\r
483 ARRAY_SIZE (CmArmProcNodeIdInfoParser) },\r
484 { "EArmObjCmRef", CmArmObjRefParser, ARRAY_SIZE (CmArmObjRefParser) },\r
485 { "EArmObjMemoryAffinityInfo", CmArmMemoryAffinityInfoParser,\r
486 ARRAY_SIZE (CmArmMemoryAffinityInfoParser) },\r
487 { "EArmObjDeviceHandleAcpi", CmArmDeviceHandleAcpiParser,\r
488 ARRAY_SIZE (CmArmDeviceHandleAcpiParser) },\r
489 { "EArmObjDeviceHandlePci", CmArmDeviceHandlePciParser,\r
490 ARRAY_SIZE (CmArmDeviceHandlePciParser) },\r
491 { "EArmObjGenericInitiatorAffinityInfo",\r
96e006b3 492 CmArmGenericInitiatorAffinityInfoParser,\r
731c67e1
MK
493 ARRAY_SIZE (CmArmGenericInitiatorAffinityInfoParser) },\r
494 { "EArmObjSerialPortInfo", CmArmSerialPortInfoParser,\r
495 ARRAY_SIZE (CmArmSerialPortInfoParser) },\r
496 { "EArmObjCmn600Info", CmArmCmn600InfoParser,\r
497 ARRAY_SIZE (CmArmCmn600InfoParser) },\r
498 { "EArmObjLpiInfo", CmArmLpiInfoParser,\r
499 ARRAY_SIZE (CmArmLpiInfoParser) },\r
ce306e48
PG
500 { "EArmObjPciAddressMapInfo", CmArmPciAddressMapInfoParser,\r
501 ARRAY_SIZE (CmArmPciAddressMapInfoParser) },\r
502 { "EArmObjPciInterruptMapInfo", CmPciInterruptMapInfoParser,\r
503 ARRAY_SIZE (CmPciInterruptMapInfoParser) },\r
731c67e1 504 { "EArmObjMax", NULL, 0 },\r
96e006b3
SM
505};\r
506\r
507/** A parser for EStdObjCfgMgrInfo.\r
508*/\r
731c67e1
MK
509STATIC CONST CM_OBJ_PARSER StdObjCfgMgrInfoParser[] = {\r
510 { "Revision", 4, "0x%x", NULL },\r
511 { "OemId[6]", 6, "%C%C%C%C%C%C", PrintOemId }\r
96e006b3
SM
512};\r
513\r
514/** A parser for EStdObjAcpiTableList.\r
515*/\r
731c67e1
MK
516STATIC CONST CM_OBJ_PARSER StdObjAcpiTableInfoParser[] = {\r
517 { "AcpiTableSignature", 4, "0x%x", NULL },\r
518 { "AcpiTableRevision", 1, "%d", NULL },\r
519 { "TableGeneratorId", sizeof (ACPI_TABLE_GENERATOR_ID), "0x%x", NULL },\r
520 { "AcpiTableData", sizeof (EFI_ACPI_DESCRIPTION_HEADER *), "0x%p", NULL },\r
521 { "OemTableId", 8, "0x%LLX", NULL },\r
522 { "OemRevision", 4, "0x%x", NULL }\r
96e006b3
SM
523};\r
524\r
525/** A parser for EStdObjSmbiosTableList.\r
526*/\r
731c67e1
MK
527STATIC CONST CM_OBJ_PARSER StdObjSmbiosTableInfoParser[] = {\r
528 { "TableGeneratorId", sizeof (SMBIOS_TABLE_GENERATOR_ID), "0x%x", NULL },\r
529 { "SmbiosTableData", sizeof (SMBIOS_STRUCTURE *), "0x%p", NULL }\r
96e006b3
SM
530};\r
531\r
532/** A parser for Standard namespace objects.\r
533*/\r
731c67e1
MK
534STATIC CONST CM_OBJ_PARSER_ARRAY StdNamespaceObjectParser[] = {\r
535 { "EStdObjCfgMgrInfo", StdObjCfgMgrInfoParser,\r
536 ARRAY_SIZE (StdObjCfgMgrInfoParser) },\r
537 { "EStdObjAcpiTableList", StdObjAcpiTableInfoParser,\r
538 ARRAY_SIZE (StdObjAcpiTableInfoParser) },\r
539 { "EStdObjSmbiosTableList", StdObjSmbiosTableInfoParser,\r
540 ARRAY_SIZE (StdObjSmbiosTableInfoParser) },\r
96e006b3
SM
541};\r
542\r
543/** Print OEM Id.\r
544\r
545 @param [in] Format Format to print the Ptr.\r
546 @param [in] Ptr Pointer to the OEM Id.\r
547**/\r
548STATIC\r
549VOID\r
550EFIAPI\r
551PrintOemId (\r
731c67e1
MK
552 IN CONST CHAR8 *Format,\r
553 IN UINT8 *Ptr\r
96e006b3
SM
554 )\r
555{\r
556 DEBUG ((\r
557 DEBUG_ERROR,\r
558 (Format != NULL) ? Format : "%C%C%C%C%C%C",\r
559 Ptr[0],\r
560 Ptr[1],\r
561 Ptr[2],\r
562 Ptr[3],\r
563 Ptr[4],\r
564 Ptr[5]\r
565 ));\r
566}\r
567\r
568/** Print fields of the objects.\r
569\r
570 @param [in] Data Pointer to the object to print.\r
571 @param [in] Parser Parser containing the object fields.\r
572 @param [in] ItemCount Number of entries/fields in the Parser.\r
573 @param [in] RemainingSize Parse at most *RemainingSize bytes.\r
574 This function decrements the value\r
575 from the number bytes consumed.\r
576 @param [in] IndentLevel Indentation to use when printing.\r
577**/\r
578STATIC\r
579VOID\r
580PrintCmObjDesc (\r
731c67e1
MK
581 IN VOID *Data,\r
582 IN CONST CM_OBJ_PARSER *Parser,\r
583 IN UINTN ItemCount,\r
584 IN INTN *RemainingSize,\r
585 IN UINT32 IndentLevel\r
96e006b3
SM
586 )\r
587{\r
588 UINT32 Index;\r
589 UINT32 IndentIndex;\r
590 INTN SubStructSize;\r
591\r
592 if ((Data == NULL) ||\r
593 (Parser == NULL) ||\r
594 (ItemCount == 0) ||\r
731c67e1
MK
595 (RemainingSize == NULL))\r
596 {\r
96e006b3
SM
597 ASSERT (0);\r
598 return;\r
599 }\r
600\r
601 // Print each field.\r
602 for (Index = 0; Index < ItemCount; Index++) {\r
603 // Check there is enough space in left.\r
604 *RemainingSize -= Parser[Index].Length;\r
605 if (*RemainingSize < 0) {\r
606 DEBUG ((\r
607 DEBUG_ERROR,\r
608 "\nERROR: %a: Buffer overrun\n",\r
609 Parser[Index].NameStr\r
610 ));\r
611 ASSERT (0);\r
612 return;\r
613 }\r
614\r
615 // Indentation\r
616 for (IndentIndex = 0; IndentIndex < IndentLevel; IndentIndex++) {\r
617 DEBUG ((DEBUG_ERROR, " "));\r
618 }\r
619\r
620 DEBUG ((\r
621 DEBUG_ERROR,\r
622 "%-*a :",\r
623 OUTPUT_FIELD_COLUMN_WIDTH - 2 * IndentLevel,\r
624 Parser[Index].NameStr\r
625 ));\r
626 if (Parser[Index].PrintFormatter != NULL) {\r
627 Parser[Index].PrintFormatter (Parser[Index].Format, Data);\r
628 } else if (Parser[Index].Format != NULL) {\r
629 switch (Parser[Index].Length) {\r
630 case 1:\r
731c67e1 631 DEBUG ((DEBUG_ERROR, Parser[Index].Format, *(UINT8 *)Data));\r
96e006b3
SM
632 break;\r
633 case 2:\r
731c67e1 634 DEBUG ((DEBUG_ERROR, Parser[Index].Format, *(UINT16 *)Data));\r
96e006b3
SM
635 break;\r
636 case 4:\r
731c67e1 637 DEBUG ((DEBUG_ERROR, Parser[Index].Format, *(UINT32 *)Data));\r
96e006b3
SM
638 break;\r
639 case 8:\r
731c67e1 640 DEBUG ((DEBUG_ERROR, Parser[Index].Format, ReadUnaligned64 (Data)));\r
96e006b3
SM
641 break;\r
642 default:\r
643 DEBUG ((\r
644 DEBUG_ERROR,\r
645 "\nERROR: %a: CANNOT PARSE THIS FIELD, Field Length = %d\n",\r
646 Parser[Index].NameStr,\r
647 Parser[Index].Length\r
648 ));\r
649 } // switch\r
650 } else if (Parser[Index].SubObjParser != NULL) {\r
651 SubStructSize = Parser[Index].Length;\r
652\r
653 DEBUG ((DEBUG_ERROR, "\n"));\r
654 PrintCmObjDesc (\r
655 Data,\r
656 Parser[Index].SubObjParser,\r
657 Parser[Index].SubObjItemCount,\r
658 &SubStructSize,\r
659 IndentLevel + 1\r
660 );\r
661 } else {\r
662 ASSERT (0);\r
663 DEBUG ((\r
664 DEBUG_ERROR,\r
665 "\nERROR: %a: CANNOT PARSE THIS FIELD, Field Length = %d\n",\r
666 Parser[Index].NameStr,\r
667 Parser[Index].Length\r
668 ));\r
669 }\r
731c67e1 670\r
96e006b3 671 DEBUG ((DEBUG_ERROR, "\n"));\r
731c67e1 672 Data = (UINT8 *)Data + Parser[Index].Length;\r
96e006b3
SM
673 } // for\r
674}\r
675\r
676/** Parse and print a CmObjDesc.\r
677\r
678 @param [in] CmObjDesc The CmObjDesc to parse and print.\r
679**/\r
680VOID\r
681EFIAPI\r
682ParseCmObjDesc (\r
731c67e1 683 IN CONST CM_OBJ_DESCRIPTOR *CmObjDesc\r
96e006b3
SM
684 )\r
685{\r
731c67e1
MK
686 UINTN ObjId;\r
687 UINTN NameSpaceId;\r
688 UINT32 ObjIndex;\r
689 UINT32 ObjectCount;\r
690 INTN RemainingSize;\r
691 CONST CM_OBJ_PARSER_ARRAY *ParserArray;\r
96e006b3
SM
692\r
693 if ((CmObjDesc == NULL) || (CmObjDesc->Data == NULL)) {\r
694 return;\r
695 }\r
696\r
697 NameSpaceId = GET_CM_NAMESPACE_ID (CmObjDesc->ObjectId);\r
731c67e1 698 ObjId = GET_CM_OBJECT_ID (CmObjDesc->ObjectId);\r
96e006b3
SM
699\r
700 switch (NameSpaceId) {\r
701 case EObjNameSpaceStandard:\r
702 if (ObjId >= EStdObjMax) {\r
703 ASSERT (0);\r
704 return;\r
705 }\r
731c67e1 706\r
96e006b3
SM
707 ParserArray = &StdNamespaceObjectParser[ObjId];\r
708 break;\r
709 case EObjNameSpaceArm:\r
710 if (ObjId >= EArmObjMax) {\r
711 ASSERT (0);\r
712 return;\r
713 }\r
731c67e1 714\r
96e006b3
SM
715 ParserArray = &ArmNamespaceObjectParser[ObjId];\r
716 break;\r
717 default:\r
718 // Not supported\r
719 ASSERT (0);\r
720 return;\r
721 } // switch\r
722\r
731c67e1 723 ObjectCount = CmObjDesc->Count;\r
96e006b3
SM
724 RemainingSize = CmObjDesc->Size;\r
725\r
726 for (ObjIndex = 0; ObjIndex < ObjectCount; ObjIndex++) {\r
727 DEBUG ((\r
728 DEBUG_ERROR,\r
729 "\n%-*a [%d/%d]:\n",\r
730 OUTPUT_FIELD_COLUMN_WIDTH,\r
731 ParserArray->ObjectName,\r
732 ObjIndex + 1,\r
733 ObjectCount\r
734 ));\r
735 PrintCmObjDesc (\r
736 CmObjDesc->Data,\r
737 ParserArray->Parser,\r
738 ParserArray->ItemCount,\r
739 &RemainingSize,\r
740 1\r
741 );\r
742 } // for\r
743}\r