Commit Graph

298 Commits

Author SHA1 Message Date
Jose Marinho
8ea4c2dedb Add support for DWordPCC and QWordPCC
This commit follows from the DWordPCC enablement done in commit 1209ecf682

Change-Id: I3e552601c17fda1f4167036463ccb2fb3fb1a66b
2024-05-22 10:29:53 +01:00
Saket Dumbre
3eb07d2fe0
Merge pull request #941 from jmarinho/iASL_DWordPcc_support
Implement the DWordPCC Resource Descriptor Macro
2024-03-25 22:28:38 -07:00
josmar02
1209ecf682 Implement the DWordPCC Resource Descriptor Macro
The DWordPcc (alongside WordPcc and QWordPcc) were accepted to ACPI
inclusion via a code-first process.

This patch implements support in iASL for DWordPcc.

ASWG ticket: https://mantis.uefi.org/mantis/view.php?id=2429
Bugzilla ticket: https://bugzilla.tianocore.org/show_bug.cgi?id=4594

Change-Id: I06d61644b428bed2802a76abff59ceb1c79930da
Signed-off-by: Jose Marinho <jose.marinho@arm.com>
2024-03-25 19:20:55 +00:00
Saket Dumbre
c18edfb1ab Update the copyright year in the license header from 2023 to 2024 2024-03-21 20:23:36 -07:00
Niyas Sait
661feab5ee add support for ClockInput resource (v6.5) 2023-02-08 11:20:04 +00:00
Robert Moore
25bddd1824 Update all copyrights/signons to 2023
Copyright updates to 2023.
2023-02-07 09:33:27 -08:00
Robert Moore
738d7b0726 Update copyright notices to the year 2022
Affects all source modules and utility signons.
2022-02-17 13:15:32 -08:00
Robert Moore
7eb0b770cb iASL: Finish support for the IVRS ACPI table.
1) Add compiler support for IVRS.
2) Update disassembler support for IVRS.
3) Add a new utility, UtIsIdInteger to determine if a HID/CID is
an integer or a string.
2021-05-11 12:51:07 -07:00
Robert Moore
21a316fdaa ACPI 6.4: add Csi2Bus resource template 2021-03-10 13:24:35 -08:00
Robert Moore
c570953c91 Updated all copyrights to 2021. This affects all ACPICA source code
modules.
2021-01-05 09:02:10 -08:00
Erik Kaneda
ebb134b81f iASL: implement custom iASL macro for expected errors
Each type of iASL error is associate with a 4-digit error ID. This is
done in order to ignore or expect entire classes of remarks/warnings/errors.

However, there is a desire to expect these compiler messages on a
line-based granularity. This allows finer-grained testing of iASL
compiler messages.

The following example illustrates the use of this feature:

	DefinitionBlock ("", "DSDT", 2, "", "", 0x1)
	{
	    Device (ABCD)
	    {
	    }
	}

Compiling the above code will result in a warning like this:

	dsdt.asl      3:     Device (ABCD)
	Warning  3141 -                ^ Missing dependency (Device object requires a _HID or _ADR in same scope)

The following tells iASL to expect error code 3141 on line 3:

	DefinitionBlock ("", "DSDT", 2, "", "", 0x1)
	{
	    Device (ABCD) __EXPECT__(3141)
	    {
	    }
	}

Compiling this will expect the warning to be raised and result in a
successful compilation:

	ASL Input:     dsdt.asl -      97 bytes      1 keywords      9 source lines
	AML Output:    dsdt.aml -      43 bytes      0 opcodes       1 named objects

	Compilation successful. 0 Errors, 0 Warnings, 0 Remarks, 0 Optimizations

However, if the warning does not appear, compilation will result in
an error. This code snippet does not exhibit warning 3141 but still
expects this error code on line 3:

	DefinitionBlock ("", "DSDT", 2, "", "", 0x1)
	{
	    Device (ABCD) __EXPECT__(3141)
	    {
	        Name (_ADR, 0x12345678)
	    }
	}

This code will result in the following compiler error because error
code 3141 was not generated during compilation.

	dsdt.asl      3:     Device (ABCD) __EXPECT__(3141)
	Error    6149 -                                  ^ Expected remark, warning, or error did not occur. Message ID: (3141)

	ASL Input:     dsdt.asl -     129 bytes      2 keywords     10 source lines

	Compilation failed. 1 Errors, 0 Warnings, 0 Remarks

Telling iASL about expected errors inline as a part of ASL code
allows us to contain all expected error information as a part of the
ASL codebase rather than requiring -vx flags to be placed inside of
makefiles.

Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
2020-03-18 18:24:12 -07:00
Erik Kaneda
8d60218076 iASL: add line number and file name for compiler error checks
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
2020-03-18 18:24:12 -07:00
Erik Kaneda
6f77db8c5d iASL: trivial code clean-up and function renaming, no functional change
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
2020-03-18 18:24:12 -07:00
Erik Kaneda
c644963c63 iASL: change MtProcessTypeOp and MtProcessParameterTypeList to be non-static
This change also fixes the function comment for MtProcessParameterTypeList

Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
2020-02-10 12:51:18 -08:00
Erik Kaneda
2662df195a iASL: rename and move XfGetParentMethod to UtGetParentMethodOp
XfGetParentMethod is used in namespace cross reference and method
analysis so this function should be a part of a aslutils.c rather
than aslxref.c. This function is similar to UtGetParentMethodNode but
returns an ACPI_PARSE_OBJECT so rename it to UtGetParentMethodOp for
clarity.

Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
2020-01-30 12:26:35 -08:00
Erik Kaneda
9f0c54845a iASL: rename UtGetParentMethod to UtGetParentMethodNode
This function returns a namespace node so renaming it as
UtGetParentMethodNode adds more clarity to the usage of this
function.

Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
2020-01-30 12:26:35 -08:00
Erik Kaneda
aacbd4b2ef iASL: use correct macro name for error message and other trivial fixes
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
2020-01-30 10:37:03 -08:00
Robert Moore
8b9c69d098 All acpica: Update copyrights to 2020
Including tool signons.
2020-01-09 14:30:27 -08:00
Robert Moore
4367485046
Merge pull request #492 from SchmErik/dt-line-cont
iASL: add line continuation support for DT compiler flex/bison
2019-08-15 13:12:20 -07:00
Robert Moore
d06def132a Fully deploy ACPI_PRINTF_LIKE macro
Macro was not being used across all "printf-like" functions.
Also, cleanup all calls to such functions now that they are
analyzed by the compiler (gcc). Both in 32-bit mode and 64-bit
mode.
2019-08-14 13:43:02 -07:00
Erik Schmauss
fc345ab529 iASL: trivial: fix codeing style, no functional change
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2019-08-12 14:04:13 -07:00
Erik Schmauss
313a092645 iASL: add line continuation support for DT compiler flex/bison
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2019-08-09 14:27:15 -07:00
Erik Schmauss
36037bdaf0 iASL: add data table prototype flag
This flag enables the the new flex/bison prototype front-end of the
data table compiler.

Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2019-07-31 15:45:23 -07:00
Erik Schmauss
8f512bd509 iASL: add null terminator to name strings that only consist of multiple prefixes (^)
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2019-07-17 14:22:59 -07:00
Erik Schmauss
1ed9f0276c iASL: return -1 if AML files were not generated due to compiler errors
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2019-07-11 10:58:13 -07:00
Erik Schmauss
30d64aaef1 Revert "iASL: use .src file handle only for include file error messages"
This reverts commit 1eb3ee94b6.
2019-04-18 12:46:00 -07:00
Erik Schmauss
1eb3ee94b6 iASL: use .src file handle only for include file error messages
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2019-04-04 19:23:08 -07:00
Erik Schmauss
15daa52f2f iASL: trivial clean up, no functional change
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2019-04-04 17:14:48 -07:00
Erik Schmauss
997f6ca123 iASL: perform analysis and code generation after parsing all tables
Performing parse tree analysis on all definition blocks
simultaneously results in more effective namespace cross-reference.
This enables iASL static analysis to determine unresolved external
declarations and namespace collisions during compilation.

In order to take advantage of this, compile definition blocks
with the following command:

iasl dsdt.asl ssdt1.asl ssdt2.asl ...

*** Changes related to multiple files:

Keep track of all files in a global list that is persistent
throughout compilation of both files. This is done in order to
compile multiple ASL files in the same namespace and parse tree.

This also resulted in moving the file handle assignment for the -vi
option during file initialization rather than commandline processing.

As each definition block is parsed, it is connected as a sibling node
to the previous definiton block.

*** Changes related to iASL error reporting:

Also, more error messages were added by replacing the fprintf to
stderr with AslError. By doing so, an error can be logged properly
and AML output files will be cleaned if there is a compiler error.

Adds the ability to print the correct source line by logging the .src
filename in each error node. This is necessary for errors that point
to an include file.

New iASL error: emitting an error when compiling duplicate files.

Ignore max error count when compiling with -f because
compilation needs to continue.

Fix parser error path to correctly abort compilation rather
than trying to proceed with more compilation.

*** Changes related to codegen behavior:

Seek to the end of the AML output file after codegen in case multiple
definition blocks need to be encoded in the same AML file. This makes
other parts of the codebase a little more convinent since it doesn't
have to seek to the correct place in the AML.

*** Misc changes:

Remove a call to ACPI_FREE. We should never be calling ACPI_FREE in
memory allocated in caches.

Display compilation summaries for multiple input files. Files that
have parser errors are reported as having parser errors. The summary
is based on the global file list.

Encapsulate global variables in global file nodes used for summary
reporting.

Final cleanup functions for iASL has been consolidated to the main()
function for simplicity.

Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2019-04-02 17:09:37 -07:00
Erik Schmauss
ff5a9c5437 Trivial: fix spelling mistakes
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2019-02-14 15:14:57 -08:00
Robert Moore
62f4f98e94 All acpica: Update copyrights to 2019
including tool signons.
2019-01-08 10:32:54 -08:00
Erik Schmauss
b74f8e484d iASL: add the ability to report specific warnings or remarks as errors
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2018-12-11 14:24:04 -08:00
Robert Moore
e855bcebcd iASL: Add support to detect illegal forward references
Forward references have never been allowed within control methods,
and now there are illegal from module-level code (This makes
ACPICA compatible with "other" acpi implementations).

Both types of fwd refs now generate an error message (this is
also a new addition to iASL).
2018-04-20 09:43:09 -07:00
Robert Moore
0d5f6f6845 All acpica: Update copyrights to 2018
including tool signons.
2018-01-04 10:06:38 -08:00
Erik Schmauss
9a8f4b7d30 iASL: adding mechanism for error messages that refer to multiple parse nodes
If a name alredy exists in scope error occurs, an error message pointing to
the duplicate declaration is helpful because it informs users on the error
locations of conflicting declarations. This change adds support for
AslDualParseOpError, a function that can allow the error message like below.

DSDT.iiii   1692:       Device(PEG2) {
Error    6074 -                  ^ Name already exists in scope (PEG2)
                 Original name creation/declaration below:
DSDT.iiii     93:   External(\_SB.PCI0.PEG2, DeviceObj)

Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2017-09-05 14:53:13 -07:00
Robert Moore
0d3a7f1d96 iASL: Move all allocation functions to new modules
Memory allocation functions are in aslallocate.c
Cache functions are in aslcache.c
2017-09-01 10:38:59 -07:00
Robert Moore
610046d444 Restructure/cleanup all string-to-integer conversion functions
Improve adherence to ACPI spec for implicit and explicit conversions
Adds octal support for constants in ASL code
Adds integer overflow errors for constants during ASL compilation
Eliminates most of the existing complex flags parameters
Simplify support for implicit/explicit runtime conversions
Adds one new file, utilities/utstrsuppt.c
2017-08-18 12:40:31 -07:00
Erik Schmauss
2d27a12fde iASL: add option to expect specific compilation remarks/warnings/errors
The -vx [messageId] option, where the x stands for EXpect, allows the
compiler to expect that the compilation will result in an ASL exception
with a particular messageId. If this error is not raised. The
compilation will result in an error. This will help create a whole new
class of compilation tests in ASLTS.

Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2017-07-18 16:04:40 -07:00
Robert Moore
5b16148558 iASL: Resolve some naming inconsistencies
Fix some confusion between "parse op" and "parse node".
Adds a new file, aslparseop.c
Consistently use "parse op" to describe the elements of the
parse tree data structure.
An "Op" is the primary data structure element, even though
it sounds odd.
2017-06-02 10:26:16 -07:00
Mika Westerberg
08b83591c0 ACPI 6.2: Add support for PinGroupConfig() resource
PinGroupConfig() is analogous to PinGroupFunction() but instead of mode
(muxing), it is used to apply specific fine-grained configuration to a
set of referenced pins.

The format of this new resource is:

  PinGroupConfig (Shared/Exclusive, PinConfigType, PinConfigValue,
                  ResourceSource, ResourceSourceIndex, ResourceSourceLabel,
                  ResourceUsage, DescriptorName, VendorData)

The PinConfigType/PinConfigValue are the same used by PinConfig()
resource.

Here also the combination of ResourceSource and ResourceSourceLabel is
used to specify the PinGroup() this resource refers to.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2017-03-21 13:54:51 +08:00
Mika Westerberg
bd9a745749 ACPI 6.2: Add support for PinGroupFunction() resource
PinGroupFunction() is a new resource introduced with ACPI 6.2. It is
used with PinGroup() to configure specific mode for a set of pins
exposed by a GPIO controller.

The format of the resource is:

  PinGroupFunction (Shared/Exclusive, FunctionNumber, ResourceSource,
                    ResourceSourceIndex, ResourceSourceLabel,
                    ResourceUsage, DescriptorName, VendorData)

The ResourceSource and ResourceSourceLabel fields are used to specify
the PinGroup() resource referenced by PinGroupFunction().

  Device (GPIO)
  {
      Name (_CRS, ResourceTemplate () {
          PinGroup ("group1") {2, 3}
          PinGroup ("group2") {4, 5}
          ...
      })
  }

  Device (I2C)
  {
      Name (_CRS, ResourceTemplate () {
          PinGroupFunction (Exclusive, 6, "^GPIO", 0, "mygroup2")
      })
  }

In the above example the PinGroupFunction() references the second
PinGroup() resource (using label "mygroup2" and configures pins 4 and 5
into mode 6.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2017-03-21 13:54:51 +08:00
Mika Westerberg
7d928e3174 ACPI 6.2: Add support for PinGroup() resource
ACPI 6.2 introduced a new resource that is used to declare set of pins
belonging to a GPIO controller. This resource is referenced by new
PinGroupFunction() and PinGroupConfig() resources using ResourceSource
and ResourceLabel fields.

The PinGroup() resource looks like this:

  PinGroup (ResourceLabel, ResourceUsage, DescriptorName,
            VendorData) {Pin List}

This resource should be listed in _CRS under the GPIO/pincontroller
device providing these pins.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2017-03-21 13:54:51 +08:00
Mika Westerberg
a06fdba686 ACPI 6.2: Add support for PinConfig() resource
ACPI 6.2 introduced a new resource that is used to specify fine-grained
configuration of a pin or set of pins used by a device. The ASL syntax of
this new resource looks like:

  PinConfig (Shared/Exclusive, PinConfigType, PinConfigValue,
             ResourceSource, ResourceSourceIndex, ResourceUsage,
             DescriptorName, VendorData) {Pin List}

PinConfigType is an integer with following accepted values:

  0x00 (Default) - No configuration is applied to the pin
  0x01 (Bias Pull-up) - Pin is pulled up using certain size resistor
  0x02 (Bias Pull-down) - Pin is pulled down using certain size resistor
  0x03 (Bias Default) - Set to default biasing
  0x04 (Bias Disable) - All bias settings will be disabled
  0x05 (Bias High Impedance) - Configure the pin as HiZ
  0x06 (Bias Bus Hold) - Configure the pin in a weak latch state where
                         it drives the last value on a tristate bus
  0x07 (Drive Open Drain) - Configure the pin into open drain state
  0x08 (Drive Open Source) - Configure the pin into open source state
  0x09 (Drive Push Pull) - Configure the pin into push-pull state
  0x0a (Drive Strength) - How much the pin can supply current
  0x0b (Slew Rate) - Configure slew rate of the pin
  0x0c (Input Debounce) - Enable input debouncer for the pin
  0x0d (Input Schmitt Trigger) - Enable schmitt trigger for the pin
  0x0e - 0x7f - Reserved
  0x80 - 0xff - Vendor defined types

The PinConfigValue depends on the type and is expressed as units
suitable for that type (for example bias uses Ohms).

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2017-03-21 13:54:51 +08:00
Mika Westerberg
6bbc6357f7 ACPI 6.2: Add support for PinFunction() resource
ACPI 6.2 introduced a new resource that is used to describe how certain
pins are muxed for a device. The ASL syntax of this new resource looks
like below:

  PinFunction(Shared, PinConfig, FunctionNumber, ResourceSource,
              ResourceSourceIndex, ResourceUsage, DescriptorName,
              VendorData) {Pin List}

Which is pretty similar to GpioIo()/GpioInt() resources.

Teach ACPICA about this new resource.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2017-03-21 13:54:51 +08:00
Robert Moore
72452261ae Update legal header in all source modules
Adds the dual GNU/BSD dual license to the existing Intel license.
Provides all licensing information in each source module.
Affects all ACPICA source modules.
2017-03-02 13:21:13 -08:00
Robert Moore
c04d310039 iASL: add ASL conversion tool
The key feature of this utility is that the original comments within
the input ASL files are preserved during the conversion process, and
included within the converted ASL+ file -- thus creating a transparent
conversion of existing ASL files to ASL+ (ASL 2.0)
2017-02-24 14:47:30 -08:00
Robert Moore
16577e5265 Source tree: Update copyright notices to 2017
Affects all files.
2017-01-06 14:19:19 -08:00
Robert Moore
90caa1a543 iASL: Add help message for using acpidump/acpiextract/iasl
Describe tool chain to obtain and disassemble ACPI tables.
2016-08-09 10:35:01 -07:00
Robert Moore
265637ff2a iASL: Split help screens to a new file
Adds aslhelp.c
2016-07-29 14:12:31 -07:00
Lv Zheng
32701b33cd Clib: Cleanup va_arg related code
We in fact is always using the compiler specific stdarg.h for GCC even
when ACPI_USE_STANDARD_HEADERS is not defined. So that the va_arg usages
can always be correct for different compiler options.

Likewise, the va_arg implemented in acenv.h is actually MSVC specific,
this patch also moves it to acmsvc.h and tunes acwin.h to correctly use
it.

After cleaning up, this patch removes all <stdarg.h> inclusions from
other files, but doesn't touch the BSD headers. It seems on BSD clones, for
the _KERNEL builds, <machine/stdarg.h> and <stdarg.h> should be the same
file, and both of them can be removed. However this patch leaves this to
the BSD developers to confirm. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-07-22 23:48:16 +08:00