summaryrefslogtreecommitdiff
path: root/DynamicTablesPkg/Library/Common/AmlLib
AgeCommit message (Collapse)AuthorFilesLines
4 daysDynamicTablesPkg: AmlLib: Fix CodeQL IssueOliver Smith-Denny1-1/+1
Without the addition of this cast, the compiler promotes 1 to a UINT32, which leads CodeQL to complain that different size types are being compared. Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
6 daysDynamicTablesPkg: Correct _PSD package formatJeff Brasen1-13/+43
The _PSD structure should have nested packages. The current implementation generates Name (_PSD, Package() { NumEntries // Integer Revision // Integer (BYTE) Domain // Integer (DWORD) CoordType // Integer (DWORD) NumProcessors // Integer (DWORD) }) when this should be Name (_PSD, Package() { Package() { NumEntries // Integer Revision // Integer (BYTE) Domain // Integer (DWORD) CoordType // Integer (DWORD) NumProcessors // Integer (DWORD) } }) REF: https://uefi.org/specs/ACPI/6.5/08_Processor_Configuration_and_Control.html#psd-p-state-dependency Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
2024-09-02DynamicTablesPkg: Adds generic ACPI Creator IDAbdul Lateef Attar1-1/+1
Adds generic creator id as DYNT. Updates the common ACPI tables with generic CreatorId. Cc: Sami Mujawar <Sami.Mujawar@arm.com> Cc: Pierre Gondois <pierre.gondois@arm.com> Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
2024-08-30DynamicTablesPkg: AML code generation for IO resouce descriptor.Abdul Lateef Attar1-0/+83
Add helper functions to generate AML resource data for I/O resource descriptor. Cc: Pierre Gondois <pierre.gondois@arm.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
2024-08-01DynamicTablesPkg: Fix some spelling mistakes found by cspellRebecca Cran2-2/+2
When cspell is installed (via `npm install cspell`), CI checks for spelling mistakes. There are currently a very large number of them: some are genuine mistakes while others are words or acryonyms that cspell doesn't know. Fix a few of the misspellings in DynamicTablesPkg. Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
2024-07-01DynamicTablesPkg: AmlLib CONST cleanupJeshua Smith3-8/+8
Several input strings to AmlLib APIs are treated as CONST but were missing the CONST keyword, requiring their callers to create unnecessary r/w copies of r/o input strings. This change properly marks these input strings as CONST. Signed-off-by: Jeshua Smith <jeshuas@nvidia.com> Reviewed-by: Jeff Brasen <jbrasen@nvidia.com>
2024-05-10DynamicTablesPkg: Adds integer to the AML package nodeAbdul Lateef Attar1-0/+67
Adds an AmlAddIntegerToNamedPackage() API to generate AML code, which adds an integer value to the package node. Cc: Pierre Gondois <pierre.gondois@arm.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com> Reviewed-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2024-01-29DynamicTablesPkg: Exempt some _CPC field from checksPierre Gondois2-4/+27
When generating _CPC objects, some fields are mandatory by spec [1]. Some fields cannot be supported by a the Juno platform, which is used to test the _CPC generation. Therefore, rely on the PcdDevelopmentPlatformRelaxations Pcd to either: - warn about the missing fields and and let the OS handle the missing information - consider the missing fields as an error _CPC fields that are exempted from checks when the Pcd is set: - PerformanceLimitedRegister - ReferencePerformanceCounterRegister - DeliveredPerformanceCounterRegister [1] Cf. non-optional fields in: ACPI 6.5, s8.4.6.1 '_CPC (Continuous Performance Control)' Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2024-01-29DynamicTablesPkg: Add AmlCreatePsdNode() to generate _PSDPierre Gondois1-1/+187
Add AmlCreatePsdNode() to the AmlLib to generate _PSD objects. _PSD objects allow to describe 'performance control, P-state or CPPC, logical processor dependency', Cf. ACPI 6.5, s8.4.5.5 _PSD (P-State Dependency). Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2024-01-29DynamicTablesPkg: Rename AmlCpcInfo.h to AcpiObjects.hPierre Gondois1-1/+1
The DynamicTables framework uses the AmlLib to generate some Aml objects. It is done by using structured known by both frameworks, e.g. the AML_CPC_INFO/CM_ARM_CPC_INFO structures. To prepare adding similar structures (e.g. representing _PSD information), rename AmlCpcInfo.h to AcpiObjects.h. This new file will contain all the structures used by the AmlLib and the DynamicTables framework. Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2024-01-29DynamicTablesPkg: Use new CPC revision macroPierre Gondois1-1/+1
Make use of the newly added CPC revision macro. Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2024-01-03DynamicTablesPkg: Fix X64 compilation errorsAbdul Lateef Attar2-2/+4
Add the support for X64 compilation to the CI. Fix the compilation errors. Cc: Pierre Gondois <pierre.gondois@arm.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2023-12-22DynamicTablesPkg: AML Code generation to invoke a methodAbdul Lateef Attar1-0/+241
Adds API to generate AML code to invoke/call another method. Also provides ability to pass arguments of type integer, string, ArgObj or LocalObj. Cc: Pierre Gondois <pierre.gondois@arm.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com> Reviewed-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2023-12-22DynamicTablesPkg: Corrects function pointer typedef of AML_PARSE_FUNCTIONAbdul Lateef Attar1-2/+1
Corrects the function pointer typedef AML_PARSE_FUNCTION, otherwise some compiler like VS2019 gives error. Cc: Pierre Gondois <pierre.gondois@arm.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com> Reviewed-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2023-12-22DynamicTablesPkg: Corrects AmlCodeGenRdWordBusNumber parametersAbdul Lateef Attar1-5/+5
Corrects the parameters of AmlCodeGenRdWordBusNumber() to UINT16 to generate word bus number. Cc: Pierre Gondois <pierre.gondois@arm.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com> Reviewed-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2023-12-22DynamicTablesPkg: AML Code generation for word I/O rangesAbdul Lateef Attar1-0/+88
Add helper functions to generate AML resource data for word I/O. Cc: Pierre Gondois <pierre.gondois@arm.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com> Reviewed-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2023-10-23DynamicTablesPkg/AmlLib: Enumerate memory attributesJeshua Smith1-4/+4
AmlCodeGenRdQWordMemory's and AmlCodeGenRdDWordMemory's Cacheable and MemoryRangeType parameters treat specific values as having specific meanings as defined by the spec. This change adds enums to map those meanings to their corresponding values. Signed-off-by: Jeshua Smith <jeshuas@nvidia.com> Acked-by: Leif Lindholm <quic_llindhol@quicinc.com> Reviewed-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2023-09-22DynamicTablesPkg: AML Code generation for I/O rangesVidya Sagar1-0/+90
Add helper functions to generate AML Resource Data describing I/O ranges of four words long. API AmlCodeGenRdQWordIo () is exposed. Signed-off-by: Jeff Brasen <jbrasen@nvidia.com> Reviewed-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2023-09-22DynamicTablesPkg: Add Aml NameUnicodeString APIJeff Brasen1-0/+86
Add API to generate a Name that contains a Unicode string buffer. Signed-off-by: Jeff Brasen <jbrasen@nvidia.com> Reviewed-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2023-09-22DynamicTablesPkg: Add support to add Strings to packageJeff Brasen1-0/+84
Add API to add a String to a package created with NamedPackage API. Signed-off-by: Jeff Brasen <jbrasen@nvidia.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2023-09-22DynamicTablesPkg: Add support for simple method invocation.Jeff Brasen1-0/+238
Add support to add Return objects via AML that pass a single integer argument to the named method. Signed-off-by: Jeff Brasen <jbrasen@nvidia.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2023-09-22DynamicTablesPkg: Add ThermalZone CodeGen functionJeff Brasen1-0/+116
Add API to generate a ThermalZone object to AmlLib. Signed-off-by: Jeff Brasen <jbrasen@nvidia.com> Reviewed-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2022-12-13DynamicTablesPkg: Remove duplicated wordsPierre Gondois4-4/+4
In an effort to clean the documentation of the above package, remove duplicated words. Cc: Sami Mujawar <Sami.Mujawar@arm.com> Cc: Alexei Fedorov <Alexei.Fedorov@arm.com> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2022-10-31DynamicTablesPkg/AmlLib: Allow larger AccessSize for Pcc address spacePierre Gondois1-1/+6
For Pcc address space, the AccessSize field of a Register is used to delcare the Pcc Subspace Id. This Id can be up to 256. Cf. ACPI 6.4, s14.7 Referencing the PCC address space Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2022-10-31DynamicTablesPkg: Remove deprecated APIsPierre Gondois2-161/+0
commit 691c5f776274 ("DynamicTablesPkg: Deprecate Crs specific methods in AmlLib") deprecates some APIs. Finally remove them. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2022-09-23DynamicTablesPkg: AML Code generation to add _CPC entriesJeff Brasen1-0/+475
_CPC entries can describe CPU performance information. The object is described in ACPI 6.4 s8.4.7.1. "_CPC (Continuous Performance Control)". Add AmlCreateCpcNode() helper function to add _CPC entries to an existing CPU object. Signed-off-by: Jeff Brasen <jbrasen@nvidia.com> Reviewed-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2022-09-01DynamicTablesPkg: Fix typo in AmlCodeGenRdMemory32Fixed doxygen commentRebecca Cran1-1/+1
Fix typo of "Address". Signed-off-by: Rebecca Cran <rebecca@quicinc.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2022-09-01DynamicTablesPkg: Add support to build _DSDJeff Brasen1-0/+250
Add APIs needed to build _DSD with different UUIDs. This is per ACPI specification 6.4 s6.2.5. Adds support for building data packages with format Package {"Name", Integer} Signed-off-by: Jeff Brasen <jbrasen@nvidia.com> Reviewed-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2022-02-02DynamicTablesPkg: Add AmlCodeGenMethodRetInteger functionRebecca Cran1-0/+159
Add AmlCodeGenMethodRetInteger function to generate AML code for a Method returning an Integer. Signed-off-by: Rebecca Cran <quic_rcran@quicinc.com> Reviewed-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2022-02-02DynamicTablesPkg: Remove redundant cast in AmlCodeGenReturnRebecca Cran1-1/+1
In AmlCodeGenReturn, the cast to AML_NODE_HEADER* in the call to AmlSetFixedArgument is redundant because ReturnNode is already a AML_NODE_HEADER* . Signed-off-by: Rebecca Cran <quic_rcran@quicinc.com> Reviewed-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2022-02-02DynamicTablesPkg: Add Memory32Fixed functionRebecca Cran1-0/+58
Add a Memory32Fixed function to generate code for the corresponding Memory32Fixed macro in AML. Signed-off-by: Rebecca Cran <quic_rcran@quicinc.com> Reviewed-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2022-02-01DynamicTablesPkg: AmlLib: AmlAddPrtEntry() to handle GSIPierre Gondois1-34/+55
In ACPI 6.4, s6.2.13, _PRT objects describing PCI legacy interrupts can be defined following 2 models. In the first model, _PRT entries reference link devices. Link devices then describe interrupts. This allows to dynamically modify interrupts through _SRS and _PRS objects and to choose exactly the interrupt type (level/edge triggered, active high/low). In the second model, interrupt numbers are described in the _PRT entry. The interrupt type is then assumed by the OS. AmlAddPrtEntry() currently only handles the first model. Make changes to also handle the second model. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2021-12-13DynamicTablesPkg: Add AmlAttachNode()Pierre Gondois1-0/+36
This function allows to add a node as the last node of a parent node in an AML tree. For instance, ASL code corresponding to NewNode: Name (_UID, 0) ASL code corresponding to ParentNode: Device (PCI0) { Name(_HID, EISAID("PNP0A08")) } "AmlAttachNode (ParentNode, NewNode)" will result in: ASL code: Device (PCI0) { Name(_HID, EISAID("PNP0A08")) Name (_UID, 0) } To: Sami Mujawar <sami.mujawar@arm.com> To: Alexei Fedorov <Alexei.Fedorov@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-12-13DynamicTablesPkg: AML Code generation to add _PRT entriesPierre Gondois1-0/+214
_PRT entries can describe interrupt mapping for Pci devices. The object is described in ACPI 6.4 s6.2.13 "_PRT (PCI Routing Table)". Add AmlCodeGenPrtEntry() helper function to add _PRT entries to an existing _PRT object. To: Sami Mujawar <sami.mujawar@arm.com> To: Alexei Fedorov <Alexei.Fedorov@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-12-13DynamicTablesPkg: AML Code generation to create a named ResourceTemplate()Pierre Gondois1-0/+56
Add AmlCodeGenNameResourceTemplate() to generate code for a ResourceTemplate(). AmlCodeGenNameResourceTemplate ("REST", ParentNode, NewObjectNode) is equivalent of the following ASL code: Name(REST, ResourceTemplate () {}) To: Sami Mujawar <sami.mujawar@arm.com> To: Alexei Fedorov <Alexei.Fedorov@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-12-13DynamicTablesPkg: AML Code generation to create a named Package()Pierre Gondois1-0/+56
Add AmlCodeGenNamePackage() to generate code for a Package(). AmlCodeGenNamePackage ("PACK", ParentNode, NewObjectNode) is equivalent of the following ASL code: Name(PACK, Package () {}) To: Sami Mujawar <sami.mujawar@arm.com> To: Alexei Fedorov <Alexei.Fedorov@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-12-13DynamicTablesPkg: AML Code generation for memory rangesPierre Gondois1-0/+951
Add helper functions to generate AML Resource Data describing memory ranges. Memory ranges can be one, double or four words long. They can be of 'normal', IO or bus number memory type. The following APIs are exposed: - AmlCodeGenRdDWordIo () - AmlCodeGenRdDWordMemory () - AmlCodeGenRdWordBusNumber () - AmlCodeGenRdQWordMemory () To: Sami Mujawar <sami.mujawar@arm.com> To: Alexei Fedorov <Alexei.Fedorov@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-12-07DynamicTablesPkg: Apply uncrustify changesMichael Kubacki44-2483/+2885
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the DynamicTablesPkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-12-07DynamicTablesPkg: Change OPTIONAL keyword usage styleMichael D Kinney7-40/+40
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3760 Update all use of ', OPTIONAL' to ' OPTIONAL,' for function params. Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-10-20DynamicTablesPkg: Fix unitialized variable useMoritz Fischer1-1/+1
In the success case we should return EFI_SUCCESS rather than returning a potentially unitialized value of Status. Cc: Sami Mujawar <Sami.Mujawar@arm.com> Cc: Alexei Fedorov <Alexei.Fedorov@arm.com> Signed-off-by: Moritz Fischer <moritzf@google.com>
2021-10-08DynamicTablesPkg: AML code generation to add an _LPI statePierre Gondois1-0/+459
Add AmlAddLpiState() to generates AML code to add an _LPI state to an _LPI object created using AmlCreateLpiNode(). AmlAddLpiState increments the count of LPI states in the LPI node by one, and adds the following package: Package() { MinResidency, WorstCaseWakeLatency, Flags, ArchFlags, ResCntFreq, EnableParentState, (GenericRegisterDescriptor != NULL) ? // Entry method. If a ResourceTemplate(GenericRegisterDescriptor) : // Register is given, Integer, // use it. Use the // Integer otherwise ResourceTemplate() { // NULL Residency Register (SystemMemory, 0, 0, 0, 0) // Counter }, ResourceTemplate() { // NULL Usage Counter Register (SystemMemory, 0, 0, 0, 0) }, "" // NULL State Name }, Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-08DynamicTablesPkg: AML code generation for a _LPI objectPierre Gondois1-0/+133
_LPI object provides a method to describe Low Power Idle states that define the local power states for each node in a hierarchical processor topology. Therefore, add AmlCreateLpiNode() to generate code for a _LPI object. AmlCreateLpiNode ("_LPI", 0, 1, ParentNode, &LpiNode) is equivalent of the following ASL code: Name (_LPI, Package ( 0, // Revision 1, // LevelId 0 // Count )) Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-08DynamicTablesPkg: AML code generation for a Method returning a NSPierre Gondois1-0/+106
Add AmlCodeGenMethodRetNameString() to generate AML code to create a Method returning a NameString (NS). AmlCodeGenMethodRetNameString ( "MET0", "_CRS", 1, TRUE, 3, ParentNode, NewObjectNode ); is equivalent of the following ASL code: Method(MET0, 1, Serialized, 3) { Return (_CRS) } Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-08DynamicTablesPkg: AML code generation to Return a NameStringPierre Gondois1-0/+181
Add AmlCodeGenReturnNameString() to generate AML code for a Return object node, returning the object as a NameString. AmlCodeGenReturn ("NAM1", ParentNode, NewObjectNode) is equivalent of the following ASL code: Return(NAM1) Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-08DynamicTablesPkg: AML code generation for a MethodPierre Gondois1-0/+184
Add AmlCodeGenMethod() to generate code for a control method. AmlCodeGenMethod ("MET0", 1, TRUE, 3, ParentNode, NewObjectNode) is equivalent of the following ASL code: Method(MET0, 1, Serialized, 3) {} Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-08DynamicTablesPkg: AML code generation for a ResourceTemplatePierre Gondois1-0/+190
ASL provides a ResourceTemplate macro that creates a Buffer in which resource descriptor macros can be listed. The ResourceTemplate macro automatically generates an End descriptor and calculates the checksum for the resource template. Therefore, add AmlCodeGenResourceTemplate() to generate AML code for the ResourceTemplate() macro. This function generates a Buffer node with an EndTag resource data descriptor, which is similar to the ASL ResourceTemplate() macro. Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-08DynamicTablesPkg: Helper function to compute package lengthPierre Gondois2-2/+132
Some AML object have a PkgLen which indicates the size of the AML object. The package length can be encoded in 1 to 4 bytes. The bytes used to encode the PkgLen is itself counted in the PkgLen value. So, if an AML object's size increments/decrements, the number of bytes used to encode the PkgLen value can itself increment/decrement. Therefore, a helper function AmlComputePkgLength() is introduced to simply computation of the PkgLen. Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-08DynamicTablesPkg: AML code generation for a PackagePierre Gondois1-1/+80
Add AmlCodeGenPackage() to generate AML code for declaring a Package() object. This function generates an empty package node. New elements can then be added to the package's variable argument list. Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-08DynamicTablesPkg: AML Code generation for Resource data EndTagPierre Gondois2-0/+156
Add a helper function AmlCodeGenEndTag() to generate AML Resource Data EndTag. The EndTag resource data is automatically generated by the ASL compiler at the end of a list of resource data elements. Therefore, an equivalent function is not present in ASL. However, AmlCodeGenEndTag() is useful when generating AML code for the ResourceTemplate() macro. Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-08DynamicTablesPkg: AML Code generation for Register()Pierre Gondois2-0/+136
Add AmlCodeGenRegister() to generate AML code for the Generic Register Resource Descriptor. This function is equivalent to the ASL macro Register(). Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>