summaryrefslogtreecommitdiff
path: root/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c
AgeCommit message (Collapse)AuthorFilesLines
2026-07-31DynamicTablesPkg/AmiLib: Fix stack corruption in AmlCodeGenRdInterruptTuan Phan1-13/+22
In AmlCodeGenRdInterrupt(), the IRQ list was copied directly into an EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR structure allocated on the stack. Since the structure only contains storage for the first interrupt entry, copying multiple IRQs would write beyond the allocated buffer and corrupt the stack. Fix this issue by allocating the descriptor dynamically with sufficient space to accommodate the entire IRQ list. This ensures all interrupt entries are copied safely without overwriting adjacent stack memory. Signed-off-by: Tuan Phan <tuan.phan@oss.qualcomm.com>
2026-07-11DynamicTablesPkg: Move CheckAddressSpaceFields() to AmlUtility.cPierre Gondois1-72/+1
Move the CheckAddressSpaceFields() function to AmlUtility.c to allow other files to re-use it. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2025-12-11DynamicTablesPkg/AmlLib: Remove invalid ASSERT for IRQ macro generationAbdul Lateef Attar1-0/+3
The ACPI specification does not require legacy IRQs (x86) to be ActiveLow when EdgeTriggered or vice-versa. Hence the ASSERT checking for ActiveLow when EdgeTriggered is removed for IRQ macro generation non-ARM architecture. The IRQNoFlags macro defaults to EdgeTrigger and ActiveHigh configuration, demonstrating that this combination is valid. Reference: ACPI Specification 6.5 - Section 19.6.66: IRQ (Interrupt Resource Descriptor Macro) - Section 19.6.67: IRQNoFlags (Interrupt Resource Descriptor Macro) Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
2025-07-21DynamicTablesPkg: Adds AML code generation for serial UART RDAbdul Lateef Attar1-0/+350
Adds AML code generation for Serial UART resource descriptor. This commit introduces helper functions to generate AML resource data for serial UART resource descriptor. Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
2025-07-21DynamicTablesPkg: Adds AML code generation for IRQAbdul Lateef Attar1-1/+109
Adds AML code generation for IRQ resource descriptor. This commit introduces helper functions to generate AML resource data for IRQ resource descriptors. Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
2024-10-24DynamicTablesPkg: Drop the unnecessary comparision of UINT8 max valueSudeep Holla1-3/+1
Clang build breaks with the following error: | DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c:1441:20: | error: result of comparison of constant 256 with expression of type 'UINT8' | (aka 'unsigned char') is always false [-Werror,-Wtautological-constant-out-of-range-compare] | 1441 | (AccessSize > 256)) || | | ~~~~~~~~~~ ^ ~~~ | 1 error generated. AccessSize is UINT8 and the maximum value for UINT8 is 255, so the comparision is unnecessary. Drop the check to fix the build. Signed-off-by: Sudeep Holla <sudeep.holla@arm.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>
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>
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 Gondois1-76/+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-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-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>
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 Kubacki1-43/+48
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 Kinney1-4/+4
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 for Resource data EndTagPierre Gondois1-0/+113
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 Gondois1-0/+87
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>
2021-10-08DynamicTablesPkg: Clear pointer in node creation fctsPierre Gondois1-2/+8
The following functions: - AmlCreateRootNode() - AmlCreateObjectNode() - AmlCreateDataNode() create a node and return it by populating a pointer. This pointer should only be considered/used if the function returns successfully. Otherwise, the value stored in this pointer should be ignored. For their error handling, some other functions assume that this pointer is reset to NULL if an error occurs during a node creation. To make this assumption correct, explicitly clear this input pointer. Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-01DynamicTablesPkg: Rework AmlResourceDataCodegen.c/hPierre Gondois1-151/+84
Rework all the functions to to have a generic prototype: - First take take the resource data specific arguments. E.g.: for a Register(): the AddressSpace, BitWidth, ... - The penultimate parameter is a NameOpNode. The resource data created is appended to the ResourceTemplate() contained in the NameOpNode. - The last parameter is a pointer holding the created resource data. A least one of the two last parameter must be provided. One of them can be omitted. This generic interface allows to either: - Add the resource data to a NameOpNode. This is a common case for the Ssdt tables generator. - Get the created resource data and let the caller place it in an AML tree. Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-01DynamicTablesPkg: Deprecate Crs specific methods in AmlLibPierre Gondois1-15/+90
Some functions in the AmlLib have 'Crs' in their name and can only be applied to '_CRS' AML objects. To re-use them on AML objects that have different names: - Rename them and remove the '_CRS' name check. - Create aliases having of the 'Crs' function prototypes. These aliases are available when DISABLE_NEW_DEPRECATED_INTERFACES is not defined. They will be deprecated in a near future. The deprecated functions are: - AmlNameOpCrsGetFirstRdNode() - AmlNameOpCrsGetNextRdNode() - AmlCodeGenCrsAddRdInterrupt() Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2020-10-21DynamicTablesPkg: AmlLib fix ECC errorsSami Mujawar1-1/+1
Fix the following ECC reported errors in AmlLib. - [1008] File has invalid Non-ACSII char. - [9002] The function headers should follow Doxygen special documentation blocks in section 2.3.5 Comment does NOT have tail **/ Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
2020-08-13DynamicTablesPkg: AML Resource Data CodegenPierre Gondois1-0/+256
AML Codegen is a Dynamic AML technique that facilitates generation of small segments of AML code. The AML code generated using AML Codegen is represented as nodes in the AML Tree. AML Resource Data Codegen implements interfaces required for generating Resource Data elements that can be attached to an AML tree. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>