| Age | Commit message (Collapse) | Author | Files | Lines |
|
Add AmlCodeGenEqual() to create an AML LEqual expression from two
supplied operands.
Use the existing AML_METHOD_PARAM representation for integer, method
argument, and local variable operands. The generated equality expression
can be used as a predicate by control-flow objects.
Signed-off-by: Varshit Pandya <varshit.pandya@arm.com>
|
|
Add AmlCodeGenIf() to create an AML If object from a supplied
predicate node.
The API takes ownership of the predicate and returns an If node to
which executable statements can subsequently be appended.
Signed-off-by: Varshit Pandya <varshit.pandya@arm.com>
|
|
Add AmlCodeGenStoreToName() to create an AML Store operation with a
typed source operand and a named target.
Support integer, method argument and local variable sources using the
AML_METHOD_PARAM representation. Append the generated Store node to an
optional parent object.
Signed-off-by: Varshit Pandya <varshit.pandya@arm.com>
|
|
Add AmlCodeGenFieldElemNamed() to create a named element within an AML
Field list.
The API validates the supplied NameSeg and field length, encodes the
length using the AML FieldPkgLen format, and appends the resulting
NamedField node to its parent Field object.
Signed-off-by: Varshit Pandya <varshit.pandya@arm.com>
|
|
Add AmlCodeGenFieldElemReserved() to create an AML ReservedField
element and append it to a Field list.
The API accepts the reserved range length in bits and validates that
the parent supports a Field list. ReservedField elements describe
unnamed gaps in Field declarations and can be used when translating
ASL Offset() declarations.
Signed-off-by: Varshit Pandya <varshit.pandya@arm.com>
|
|
Add AmlCodeGenField() to create an empty AML Field object associated
with an OperationRegion.
Expose access type, lock rule, and update rule through typed public
enumerations and encode them in the Field flags byte. The generated
Field node can be attached directly to a parent or returned so that
field elements can subsequently be appended.
For example, the API can generate:
Field (REG0, DWordAcc, NoLock, Preserve)
{
}
Signed-off-by: Varshit Pandya <varshit.pandya@arm.com>
|
|
Add AmlCodeGenOperationRegion() to create an AML OperationRegion
object from a region name, address space, integer offset, and integer
length.
The API creates the OperationRegion object and populates its four fixed
AML operands:
- RegionName
- RegionSpace
- RegionOffset
- RegionLength
RegionOffset and RegionLength are encoded using the smallest suitable
AML integer representation. The generated node can either be attached
directly to a supplied parent or returned to the caller for later use.
For example, the API can generate an object equivalent to:
OperationRegion (
REG0,
SystemMemory,
RegionOffset,
RegionLength
)
This provides generators with a reusable way to describe register
regions without relying on a precompiled ASL template.
Signed-off-by: Varshit Pandya <varshit.pandya@arm.com>
|
|
Make AmlCodeGenNotify() public and declare it in AmlLib.h. Add the new
API to the CodeGen documentation group.
Callers currently cannot append an individual Notify operation while
incrementally constructing a method body.
For example, this enables generators to construct _EVT methods
containing conditional register writes and device notifications.
Signed-off-by: Varshit Pandya <varshit.pandya@arm.com>
|
|
Add AmlCodeGenMethod() and other missing public functions to the
CodeGen API documentation group.
Signed-off-by: Varshit Pandya <varshit.pandya@arm.com>
|
|
Add support for generating AML methods that return a buffer through the
new AmlCodeGenMethodRetBuffer() API.
Signed-off-by: Tuan Phan <tuan.phan@oss.qualcomm.com>
|
|
There is currently no API available for generating AML methods without
a return value. This change exports the AmlCodeGenMethod API so it can
be used to create non-returning methods when required.
Signed-off-by: Tuan Phan <tuan.phan@oss.qualcomm.com>
|
|
Add the following functions to the AmlResourceDataApi:
- AmlUpdateRdDWord()
- AmlUpdateRdWord()
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
|
|
Extend AML_METHOD_PARAM_TYPE enum with AmlMethodParamTypeBuffer (= 4)
to allow callers to pass a raw byte Buffer as an AML method argument.
Add a Buffer case to the switch in AmlCodeGenInvokeMethod() that
delegates to the existing AmlCodeGenBuffer() helper, with NULL-pointer
and zero-length guards matching the pattern of the other cases.
AmlCodeGenReturnInvokeMethod() already delegates to AmlCodeGenInvokeMethod()
so it picks up the new case automatically.
Update AML_METHOD_PARAM documentation: clarify that DataSize carries the
byte count when Type is AmlMethodParamTypeBuffer, and update the
union/struct field comments accordingly.
Cc: Pierre Gondois <pierre.gondois@arm.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
|
|
Introduce AmlCodeGenReturnInvokeMethod(), a new AML code generation API
that creates AML code for methods whose body returns the result of a
method invocation, i.e. Return(MethodName(args...)).
Supported parameter types for method arguments include:
- AmlMethodParamTypeInteger: Integer constants.
- AmlMethodParamTypeString: String literals.
- AmlMethodParamTypeArg: ArgObj references (Arg0-Arg6).
- AmlMethodParamTypeLocal: LocalObj references (Local0-Local7).
The resulting MethodInvocation node is wrapped in a Return statement
via AmlCodeGenReturn() and linked to the specified parent node.
Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
|
|
Refactor AmlCodeGenInvokeMethod() to construct a proper
AML_METHOD_INVOC_OP wrapper node instead of attaching the method
name and argument nodes directly as siblings to the parent. This
aligns the implementation with AmlCodeGenReturnInvokeMethod().
The method invocation is now built as a structured node with:
- FixedArg[0]: method name string (NameString data node)
- FixedArg[1]: argument count (UINT8 data node)
- VarList: parameter nodes (integer, string, ArgObj, LocalObj)
Also add an optional OUT NewObjectNode parameter so callers can
retrieve the created MethodInvocation node, and make ParentNode
optional, matching the convention used by other AmlLib CodeGen APIs.
Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
|
|
Replace traditional `#ifndef`/`#define`/`#endif` include guards with
`#pragma` once.
`#pragma once` is a widely supported preprocessor directive that
prevents header files from being included multiple times. It is
supported by all toolchains used to build edk2: GCC, Clang/LLVM, and
MSVC.
Compared to macro-based include guards, `#pragma once`:
- Eliminates the risk of macro name collisions or copy/paste errors
where two headers inadvertently use the same guard macro.
- Eliminate inconsistency in the way include guard macros are named
(e.g., some files use `__FILE_H__`, others use `FILE_H_`, etc.).
- Reduces boilerplate (three lines replaced by one).
- Avoids polluting the macro namespace with guard symbols.
- Can improve build times as the preprocessor can skip re-opening the
file entirely, rather than re-reading it to find the matching
`#endif` ("multiple-include optimization").
- Note that some compilers may already optimize traditional include
guards, by recognzining the idiomatic pattern.
This change is made acknowledging that overall portability of the
code will technically be reduced, as `#pragma once` is not part of the
C/C++ standards.
However, this is considered acceptable given:
1. edk2 already defines a subset of supported compilers in
BaseTools/Conf/tools_def.template, all of which have supported
`#pragma once` for over two decades.
2. There have been concerns raised to the project about inconsistent
include guard naming and potential macro collisions.
Approximate compiler support dates:
- MSVC: Supported since Visual C++ 4.2 (1996)
- GCC: Supported since 3.4 (2004)
(http://gnu.ist.utl.pt/software/gcc/gcc-3.4/changes.html)
- Clang (LLVM based): Since initial release in 2007
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
|
|
Adds APIs to create AML methods with Notify support in the AmlLib library.
New API takes additional parameters for Notify type and Notify value.
Notify type can be one of NameString, Local or Arg.
Notification value is an integer representing the Notify value.
Ref: ACPI spec 6.5 section 19.6.94 Notify (Notify Object of Event)
Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
|
|
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>
|
|
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>
|
|
This commit introduces a set of functions designed to facilitate the creation
and management of C-State (_CST, _CSD) and P-State (_PCT, _PSS) ACPI objects.
Detailed Summary:
1) AmlCreateCstNode(): This function is responsible for creating a _CST
(C-State) node, which is essential for defining processor idle states.
2) AmlAddCstState(): This function adds a C-State package to an existing
CST node, allowing for the specification of individual C-State entries.
3) AmlCreateCsdNode(): This function creates a _CSD (C-State Dependency) node,
which is used to describe dependencies between different C-States.
4) AmlCreatePctNode(): This function generates a _PCT (Performance Control) node,
complete with PCT packages, to manage performance state transitions.
5) AmlCreatePssNode(): This function creates a _PSS (Performance Supported States) node,
which lists the supported performance states for a processor.
Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
_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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
_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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
_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>
|
|
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>
|
|
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>
|