13486 Commits

Author SHA1 Message Date
Robert Moore
a83f7212df Remove extraneous status check
Removed an unnecessary status check after call to
NsBuildNormalizedPath.

Reported by Colin King (colin.king@canonical.com).
ACPICA BZ 1378.
2017-04-13 10:05:37 -07:00
Robert Moore
ff09dcf9eb Export the public mutex interfaces
These interfaces are intended to be used by device drivers.

Reported by: Guenter Roeck <linux@roeck-us.net>
2017-04-13 07:28:10 -07:00
Robert Moore
ed0389cb11 Disassembler: Abort on an invalid/unknown AML opcode
An invalid opcode indicates something seriously wrong with the
input AML file. The AML parser is immediately confused and lost,
causing the resulting parse tree to be ill-formed. The actual
disassembly can then cause numerous unrelated errors and faults.

This change aborts the disassembly upon discovery of such an
opcode during the AML parse phase.
2017-04-06 13:18:33 -07:00
Robert Moore
b067fe13c4 iASL: Add error check during external operator move
Check for error after an attempt to internalize the external
namepath. ACPICA BZ 1356.
2017-04-04 13:12:53 -07:00
Robert Moore
e323d40c46 iASL: Cleanup calls to memory allocation functions
Both UtLocalCalloc and UtStringCacheCalloc will abort the
compiler on an allocation failure. Therefore, there is no
need to check for a non-allocation after these calls. This
change makes this consistent across the compiler.
2017-04-04 10:15:20 -07:00
Robert Moore
eaa455accf Dispatcher: Remove unnecessary call to debugger
This call was simply wrong, and resulted in a -1 index into
the operand stack. Linux kernel bugzilla #120351
2017-04-04 09:20:50 -07:00
Robert Moore
9bf3d95950 Merge pull request #250 from SchmErik/cvEdit002
iasl: Fix potential null dereference in converter and edit comment.
2017-04-04 09:01:55 -07:00
Erik Schmauss
1ffcf9947d iasl: fix ASL/ASL+ converter comment.
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2017-04-03 14:55:01 -07:00
Erik Schmauss
3c1da41a35 iasl: Fix potential null dereference in ASL/ASL+ converter.
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2017-04-03 14:51:54 -07:00
Robert Moore
0ab2f782bb Merge pull request #249 from SchmErik/trivialFix003
Add explanation for UINT32 casts
2017-04-03 14:17:11 -07:00
Erik Schmauss
b00213bb96 Add explanation for UINT32 casts
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2017-04-03 13:20:10 -07:00
Robert Moore
5855890dba iASL: fix type warning for an isprint invocation
Required a cast on earlier versions of gcc (4.x)
2017-04-03 11:41:04 -07:00
Robert Moore
0d792c25d3 Debugger/acpiexec: Cleanup error messages
Clarify some of the error messages when a method failure happens.
2017-03-30 14:14:26 -07:00
Robert Moore
25f982289d Merge pull request #244 from zetalog/acpica-reduced
Acpica reduced
2017-03-30 13:58:34 -07:00
Robert Moore
832d793f44 Merge pull request #246 from SchmErik/trivialFix002
Explicitly cast 1 to UINT32.
2017-03-30 13:03:26 -07:00
Erik Schmauss
4091360d65 Explicitly cast 1 to UINT32.
The runtime errors caused when acpica tools are compiled with
-fsanitize=shift imply that these 1s are stored in integers.
This cast insures that 1 is stored in unsigned integers.

Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2017-03-29 15:24:23 -07:00
Robert Moore
7a6b9c0b31 Update error message for field beyond buffer case
Improve/clarify the problem of a field definition beyond the limit
of the target buffer.
2017-03-28 13:41:23 -07:00
Lv Zheng
99bc3beca9 Events: Add runtime stub support for event APIs
It is reported that on Linux, RTC driver complains wrong errors on
hardware reduced platform:
  [    4.085420] ACPI Warning: Could not enable fixed event - RealTimeClock (4) (20160422/evxface-654)

This patch fixes this by correctly adding runtime reduced hardware check.
Reported by Chandan Tagore, fixed by Lv Zheng.

Tested-by: Chandan Tagore <tagore.chandan@gmail.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2017-03-28 14:05:50 +08:00
Lv Zheng
e2df7455a9 OSL: Add support to exclude stdarg.h
Some hosts may choose not to include stdarg.h, implementing a
configurability in acgcc.h, allowing OSen like Solaris to exclude stdarg.h.
This patch also fixes acintel.h accordingly without providing builtin
support as Intel compiler is similar as GCC. Reported by Dana Myers, fixed
by Lv Zheng.

Reported-by: Dana Myers <dana.myers@oracle.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2017-03-24 11:12:59 +08:00
Robert Moore
9beaf4d508 iASL: Change an unnecessary ACPI_SIZE to UINT32
Not only not needed, ACPI_SIZE causes issues with printfs.
2017-03-23 13:49:05 -07:00
Mika Westerberg
51a92f414d Core: Always set GPIO VendorOffset
Acpiexec gives this warning when resources containing GPIOs are extracted
using Resource command:

  **** Data mismatch in descriptor [00] type 8C, Offset 00000000 ****
  Mismatch at byte offset 13: is 00, should be 25
  **** Data mismatch in descriptor [01] type 8C, Offset 00000025 ****
  Mismatch at byte offset 13: is 00, should be 25

This happens because we do not set VendorOffset when doing resource to AML
conversion. Fix this by always setting VendorOffset.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2017-03-23 13:02:09 -07:00
Robert Moore
97739215dd iASL: Improve error messages for auto-disassembly
cleanup error messages when attempting to determine if an
input file is ASCII or binary (compile or disassemble).
2017-03-23 12:55:10 -07:00
Robert Moore
54b4d991c5 Merge pull request #239 from SchmErik/asltsFix005
ASLTS: do not run binary comparisons if -f flag is set for compilation.
2017-03-22 10:46:12 -07:00
Robert Moore
680bde3e4d Merge pull request #231 from zetalog/acpica-pin
Acpica pin
2017-03-21 20:04:29 -07:00
Erik Schmauss
16fa2b6868 ASLTS: do not run binary comparisons if -f flag is set for compilation.
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2017-03-21 15:27:03 -07:00
Robert Moore
7cb6e66982 Fix a type value overlap in the AML support file
An AML opcode type field was overlapped with values used
for the top-level dispatch. Did not cause an actual problem,
but fixed anyway.
2017-03-21 09:43:35 -07:00
Robert Moore
5541cf097e Merge pull request #236 from debox1/new_table_support
Add support for new PCCT subtables
2017-03-21 08:45:53 -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
Mika Westerberg
0567dd36db iASL: Add StartIndex to RsGetInterruptDataLength()
We are going to use this function also when parsing PinFunction() resource
where pin list starts at different location. To support that pass
StartIndex as parameter instead of hard-coding it to be 10.

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
David E. Box
e7b817e3c4 Add support for new PCCT subtables
Extended PCC Subspaces (types 3 and 4)

Signed-off-by: David E. Box <david.e.box@linux.intel.com>
2017-03-17 14:59:04 -07:00
Robert Moore
7d14e40d82 Merge pull request #232 from SchmErik/asltsExternalOp
Aslts external op
2017-03-17 10:46:31 -07:00
Robert Moore
93c4bce0a7 Merge pull request #235 from zetalog/acpica-typedef
Acpica typedef
2017-03-17 09:13:57 -07:00
Lv Zheng
39411f710d acpisrc: Allow simple typedef union/struct
acpisrc can only convert the followings:
  typedef union/struct foo {
      int bar;
  } FOO;
Into:
  union struct foo {
      int bar;
  };

It cannot detect the followings:
  typedef union/struct foo FOO;
And convert it into:
  typedef union/struct foo foo;

This patch facilitates acpisrc to detect such forms, thus allows some
typedefs to be converted using the latter style with "SIMPLE" conversion
(see ACPI_EFI_FILE in astable.c as a demo). Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2017-03-16 16:02:31 +08:00
Robert Moore
c13298c518 Merge pull request #234 from SchmErik/asltsFix004
ASLTS: removing unnecessary .c files and including their information …
2017-03-15 12:51:42 -07:00
Erik Schmauss
8999ef41b2 ASLTS: removing unnecessary .c files and including their information in .asl files.
The .c files contain snippets of ASL code. This has been extracted and placed as a
comment within DECL.asl. Note the style of this comment does not adhere to our
normal style so that it is easy to copy/paste, if needed.

Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2017-03-15 11:43:10 -07:00
Robert Moore
335d5198f4 Makefiles: Add "make status" rule
Also some cleanup of output
2017-03-15 08:39:01 -07:00
Robert Moore
cb8d27270e Disassembler: Use // comments when processing buffer objects
The disassembler emits hex bytes, then the ascii equivalent
within a comment. Change the comment type from /* */ to //
This is perfectly legal ASL, and prevents problems when a
buffer contains a /* or */.
2017-03-14 14:15:03 -07:00
Robert Moore
66248c455c Merge pull request #233 from SchmErik/asltsFix003
ASLTS: Fixing small syntax issue resulting in ASLTS build issues
2017-03-14 12:16:24 -07:00
Erik Schmauss
d35dfcb31e ASLTS: Fixing small syntax issue resulting in ASLTS build issues on debian.
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2017-03-14 11:20:23 -07:00
Robert Moore
871c131649 Merge pull request #225 from Jnosh/pcat-compat-flag-values-fix
Tables: Fix defined values for MADT PCAT_COMPAT flag
2017-03-14 07:11:34 -07:00
Erik Schmauss
5c6cd994f0 ASLTS: refactor removal of artifact files to retain clean test directory when test run is successful.
This applies to the binary comparison portion of the ASLTS script.

Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2017-03-10 15:53:13 -08:00
Erik Schmauss
6134f5331a ASLTS: add flags to compile externals in binary comparison test
When performing the binary comparison test sequence, the compilation
will use the -oE flag to compile the externals in place (rather than
emitting external aml bytecode at the top of the definition block.
The disassembly will use the -oe flag to disassemble externals in place.
The final re-compilation will use the same flags as the normal test case
compilation.

The -oe and -oE flags ensures that the externals within ASL will remain
in the same location throughout the compilation and disassembly. This is
needed for binary comparisons to match for several test cases such as bdemo
and table.

Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2017-03-10 15:05:13 -08:00
Robert Moore
b922ecaf90 Add header support for TPM2 table changes
Update to new version of the TCG/ACPI spec.
Does not include table compiler or disassembler support.
2017-03-10 13:49:42 -08:00
Robert Moore
9d512b45fb Disassembler: Update Switch support
Fix a compiler error and automated cleanup.
2017-03-10 13:48:07 -08:00
Robert Moore
446d77b99e Merge pull request #230 from debox1/improve_switch_disasm
disassembler: improve Switch support
2017-03-10 10:32:44 -08:00
David E. Box
3c36625def disassembler: improve Switch support
Changes the resource descriptor parse tree walk to a general
preprocessing walk and calls the Switch conversion code from here.
Move Switch code to new dmswitch.c file. Also improves algorithm to
handle multiple levels of Switch statements and perform legacy
disassembly for older or otherwise non-spec compliant Switch
implementations.

Signed-off-by: David E. Box <david.e.box@linux.intel.com>
2017-03-09 14:07:52 -08:00