164 Commits

Author SHA1 Message Date
Robert Moore
24870bd9e7 Rename nameseg length macro/define for clarity
ACPI_NAME_SIZE changed to ACPI_NAMESEG_SIZE
This clarifies that this is the length of an individual
nameseg, not the length of a generic namestring/namepath.
Improves understanding of the code.
2019-02-22 07:46:57 -08:00
Erik Schmauss
a4849944e8 ACPI 6.3: add PCC operation region support for AML interpreter
This change adds PCC operation region support in the AML interpreter
and a default handler for acpiexec. According to the specification,
the PCC operation region performs a transaction when the COMD field
is written. This allows ASL to write data to other fields before
sending the data.

In order to accommodate this protocol, a temorary buffer is added
to the regionfield object to accumulate writes. If any offset that
spans COMD is written, the temporary buffer is sent to the PCC
operation region handler to be processed.

This change also renames the PCC keyword to PlatformCommChannel.

Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2019-02-13 13:22:14 -08:00
Erik Schmauss
f4fafd6245 iASL: add explanation for nameseg lexing, no functional change
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2019-01-11 13:38:58 -08:00
Robert Moore
62f4f98e94 All acpica: Update copyrights to 2019
including tool signons.
2019-01-08 10:32:54 -08:00
Robert Moore
0e4638cfea iASL: Standardize names for all global variables
For consistency, all iASL global names forced to AslGbl*
2018-09-20 07:30:38 -07:00
Robert Moore
bb7188b008 iASL: Rename some of the Field Attribute defines
Makes the names match the ACPI spec, for clarity.
2018-08-24 09:24:35 -07:00
Robert Moore
0d5f6f6845 All acpica: Update copyrights to 2018
including tool signons.
2018-01-04 10:06:38 -08: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
Robert Moore
167e48f20c iASL: Add __METHOD__ predefined macro
Returns the name of the parent control method.
2017-06-29 13:27:57 -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
b138a24ae1 iASL: Grammar change updates
1) Make parentheses the highest precedence operators. This affects
definition of most grammar elements to reflect tokenization of
parens.

2) Grammar changes for ObjectType, RefOf, CondRefOf, DerefOf --
mostly to disallow method invocations.
2016-11-04 08:52:10 -07:00
Robert Moore
5a0555ece4 ACPI 6.0, iASL/Tools: Add support for new resource descriptors
Adds full support for:
I2cSerialBusV2
SpiSerialBusV2
UartSerialBusV2

Compiler, Disassembler, Resource Manager, AcpiHelp.
2016-04-15 08:55:57 -07:00
Robert Moore
b9a8a4f1d3 iASL: Initial implemenation of For() macro
Converts For into While.
Initial implementation, may change as it goes into the
ACPI spec.
2016-04-12 08:15:19 -07:00
Robert Moore
61bfce8a56 Revert "iASL: Add support for conditional ternary operator"
This reverts commit 16fa94dfd56cabd325c40ed5aa42f42e15dbcd93.

Several serious issues remain related to the ACPI specification,
code generation, and disassembly.

This feature is on hold until such time as these issues can
be resolved (if they can be resolved).
2016-04-01 13:35:50 -07:00
Robert Moore
16fa94dfd5 iASL: Add support for conditional ternary operator
(A ? B : C) if/else operator, c-style.
2016-03-25 13:40:30 -07:00
Robert Moore
7264968d69 Source tree: Update copyright notices to 2016
Affects all files.
2016-01-06 08:57:09 -08:00
Robert Moore
5cdee2df86 iASL: Add support for multiple ACPI tables in a single ASL file.
Initial support to simply compile the file to a single AML file.
Probably mostly useful for testing/debugging purposes.
2015-10-23 10:38:30 -07:00
Robert Moore
f849f5ebe7 Update source file permissions (2)
Reset user execute bit, set other permissions read-only.
2015-09-23 13:22:14 -07:00
Robert Moore
e33d51f822 Update source file permissions (1)
Set user execute bit to force git to commit the files.
2015-09-23 13:14:16 -07:00
Robert Moore
fbe67c4683 iASL: Add symbolic operator support for Index() operator.
Index (XXXX, 2) is now supported by XXXX [2]
2015-08-20 09:06:26 -07:00
Robert Moore
03b6194506 iASL: Add additional cast for the new C library name convention.
Additional portability issue fixed.
2015-06-18 07:35:09 -07:00
Robert Moore
3b1026e0bd De-macroize calls to standard C library functions.
Across all of ACPICA. Replace C library macros such as ACPI_STRLEN
with the standard names such as strlen. The original purpose for
these macros is long since obsolete.
2015-06-09 12:11:26 -07:00
Robert Moore
1abceb6210 iASL: Differentiate between #include and Include().
Emit an error message if files included via the ASL Include() contain
that Include() is processed, the preprocessor has already been fully
executed. Rather than attempt to create yet another temp file (there
are already two), we just emit an error message that suggests that
2015-05-08 13:00:17 -07:00
David E. Box
8990e73ab2 Update Copyright headers to 2015. 2015-01-27 11:55:38 -08:00
David E. Box
6a13235548 Revert "source and test: update copyright notices to 2015"
This reverts commit 28a95326289ca5ee7cd95f8e8e809dc5564d9509.

Commit mistakenly changes file format to CRLF from default LF.
2015-01-27 11:39:30 -08:00
David E. Box
28a9532628 source and test: update copyright notices to 2015 2015-01-23 14:44:06 -08:00
Robert Moore
17fcee2f55 iASL: Couple parser fixes for C-style operators.
Xor and parentheses.
2014-10-31 12:44:02 -07:00
Robert Moore
ff4feb1e91 iASL: Add support for Printf and Fprintf macros.
Printf stores to the debug object.
Fprintf stores to any named object.
%o is the main format specifier since only very limited typechecking
can be performed at compile time.
2014-10-24 14:05:58 -07:00
Robert Moore
f8d55d5dea iASL: Prefix _PLD names with "PLD" to avoid collisions.
Prevent collisions with the 4-character user namespace.
May be temporary.
2014-10-08 10:06:40 -07:00
Robert Moore
f6a5a11cae iASL: Add support for C-style operators and expressions.
This change creates an extension to the ASL language that introduces
the use of a C-like syntax and C symbols for both the math and
logical operations.

Note: Does not create new AML opcodes that would need to be implemented
by an AML interpreter. It simply adds new operators and related syntax
to the ASL parser.

Note: This language extension can exist concurrently with the existing ASL syntax.

Compiler support only, dissasembler support is under development.

Examples of the new syntax, each followed by the corresponding legacy ASL syntax:

(New syntax) --> (Legacy syntax)

// Math operators

Z = X + Y --> Add (X, Y, Z)
Z = X - Y --> Subtract (X, Y, Z)
Z = X * Y --> Multiply (X, Y, Z)
Z = X / Y --> Divide (X, Y, , Z)
Z = X % Y --> Mod (X, Y, Z)

Z = X << Y --> ShiftLeft (X, Y, Z)
Z = X >> Y --> ShiftRight (X, Y, Z)

Z = X & Y --> And (X, Y, Z)
Z = X | Y --> Or (X, Y, Z)
Z = X ^ Y --> Xor (X, Y, Z)

X++ --> Increment (X)
X-- --> Decrement (X)

Z = ~X --> Not (X, Z)

// Store/Assignment operations

X = Y --> Store (Y, X)
X += Y --> Add (X, Y, X)
X -= Y --> Subtract (X, Y, X)
X *= Y --> Multiply (X, Y, X)
X /= Y --> Divide (X, Y, , X)
X %= Y --> Mod (X, Y, X)
X <<= Y --> ShiftLeft (X, Y, X)
X >>= Y --> ShiftRight (X, Y, X)
X &= Y --> And (X, Y, X)
X |= Y --> Or (X, Y, X)
X ^= Y --> Xor (X, Y, X)

// Logical operators

(X == Y) --> LEqual (X, Y)
(X != Y) --> LNotEqual (X, Y)
(X < Y) --> LLess (X, Y)
(X > Y) --> LGreater (X, Y)
(X <= Y) --> LLessEqual (X, Y)
(X >= Y) --> LGreaterEqual (X, Y)
(X && Y) --> LAnd (X, Y)
(X || Y) --> LOr (X, Y)
(!X) --> LNot (X)
2014-10-02 08:07:50 -07:00
Robert Moore
165b36e841 iASL: Add support for ToPLD macro.
This macro is intended to simplify the constuction of _PLD buffers.
NOTE: Prototype only, subject to change before this macro is
added to the ACPI specification. David E. Box.
2014-10-01 10:24:56 -07:00
Robert Moore
f159658034 iASL: Improve cacheing, reduce memory leaks.
Ensure that the parse tree is deleted for each compile.
Fix other miscellaneous memory leaks per-compile.
Consistently deploy the use of the string cache.
Add tracking for multiple buffers within caches.
Ensure the cache buffers are always deleted.
2014-08-13 13:03:09 -07:00
Robert Moore
1281766a5a iASL: Minor update for the main lex file. No functional change.
Add additional braces around C conditional statements to appease
the acpisrc utility which will complain if braces are not used for
if/else statements.
2014-07-21 14:26:39 -07:00
Robert Moore
4ca0698cbb Update ACPICA copyrights to 2014.
Update ACPICA copyrights to 2014. Includes all source headers and
signons for the various tools.
2014-01-06 09:10:08 -08:00
Robert Moore
789175a1a8 iASL/Disassembler: Add option to ignore NOOP opcodes/operators.
Implemented for both the compiler and the disassembler.
Often, the NOOP opcode is used as padding for packages that are
changed dynamically by the BIOS. When disassembled, these NOOPs will
cause syntax errors. This option causes the disassembler to ignore
the NOOP opcode, and it also causes the compiler to ignore NOOP statements
as well.
2013-01-11 13:18:52 -08:00
Robert Moore
5b6ee00b56 Update ACPICA copyrights to 2013.
Includes all source headers and signons for the various tools.
2013-01-08 09:23:11 -08:00
Robert Moore
2406636978 Small fix for standard Intel legal header.
Remove an extraneous space after a comma, for consistency.
2012-09-27 09:36:49 -07:00
Robert Moore
a28a14bc42 Remove extra spaces after periods in the Intel license.
For consistency with the rest of the source code.
2012-09-26 13:17:19 -07:00
Robert Moore
70e176edb5 ACPI 5.0/iASL: Add support for PCC keyword.
Adds support for the PCC keyword for the Register() resource descriptor
macro.
2012-05-03 10:31:24 -07:00
Robert Moore
0adca1bedd iASL: Split out C support functions from main lex file.
Split out C functions from aslcompiler.l to aslsupport.l for
improved readability and maintainablity.
2012-04-02 14:49:38 -07:00
Robert Moore
ebd7f0820d iASL: Cleanup/standardize main lex file.
Standardize function names, general cleanup.
2012-03-29 13:47:04 -07:00
Robert Moore
e97fd500e5 iASL: Cleanup #line handling code.
Miscellaneous cleanup; Remove debug output code.
2012-03-29 13:11:15 -07:00