Commit Graph

352 Commits

Author SHA1 Message Date
Robert Moore a7a4a51ca6 Automated cleanup.
Remove tabs, indentation fixes, etc.
2023-03-31 08:42:00 -07:00
Najumon 463d30f0a8 add os specific support for Zephyr RTOS
The acpica will be integrated as module into Zephyr project for
enable acpi bus driver. This patch is for enable os specific
support layer for Zephyr.

Signed-off-by: Najumon <najumon.ba@intel.com>
2023-03-30 10:42:12 +05:30
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 c570953c91 Updated all copyrights to 2021. This affects all ACPICA source code
modules.
2021-01-05 09:02:10 -08:00
Colin Ian King 6648a6ac84 Tree-wide: fix various typos and spelling mistakes
Fix spelling issues found using the codespell checker

Signed-off-by: Colin Ian King <colin.king@canonical.com>
2020-07-30 14:59:34 +01:00
Robert Moore 4d938d0487 acpidump: Removed dead code from oslinuxtbl.c
ACPICA BZ 1119.
2020-05-06 13:10:15 -07:00
Erik Kaneda 540fbb3b2b converting all tabs to spaces
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
2020-03-24 09:40:19 -07:00
Robert Moore df52c57457 Fix a couple of typos
From ehaouas@noos.fr
2020-02-03 13:55:47 -08:00
Robert Moore 7bf96d5003
Merge pull request #539 from SchmErik/win-acpidump
acpidump: windows: use GetSystemFirmwareTable API for all tables exce…
2020-01-17 08:52:09 -08:00
Erik Kaneda d6a07fed29 acpidump: windows: use GetSystemFirmwareTable API for all tables except SSDT
By using this API, acpidump is able to get all tables in the XSDT

Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
2020-01-09 14:53:09 -08:00
Robert Moore 8b9c69d098 All acpica: Update copyrights to 2020
Including tool signons.
2020-01-09 14:30:27 -08:00
Robert Moore 7bc16c6503 Win OSL: Replace GetTickCount with GetTickCount64
Avoid possible overflow from GetTickCount. Also, cast math
using ACPI_100NSEC_PER_MSEC to uint64.
2019-08-22 12:12:35 -07:00
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
Robert Moore 92ec0935f2 Rename nameseg compare macro for clarity
ACPI_COMPARE_NAME changed to ACPI_COMPARE_NAMESEG
This clarifies (1) this is a compare on 4-byte namesegs, not
a generic compare. Improves understanding of the code.
2019-02-22 07:33:55 -08:00
Robert Moore 19c18d3157 Rename nameseg copy macro for clarity
ACPI_MOVE_NAME changed to ACPI_COPY_NAMESEG
This clarifies (1) this is a copy operation, and
(2) it operates on ACPI NameSegs.
Improves understanding of the code.
2019-02-22 07:17:52 -08: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
Robert Moore 0d5f6f6845 All acpica: Update copyrights to 2018
including tool signons.
2018-01-04 10:06:38 -08:00
Robert Moore 64ad9c69a1 Create and deploy safe version of strncpy. No functional change
AcpiUtSafeStrncpy - copy and terminate string. Strncpy is not
guaranteed to terminate the copied string if the input is longer
than the length of the target.
2017-12-08 07:35:29 -08:00
Matthias Lange 63a89b3d96 Fix function name in documentation
The function name in the documentation of AcpiEfiCompareGuid was referring to the wrong function.
2017-07-28 10:16:41 +02:00
Lv Zheng a7c6d65a5d EFI/EDK2: Enable /WX for MSVC builds
/WX turns warning into fatal erros for MSVC builds. We need /WX- during
EDK2 porting to allow agile development.

Now it is time to enable /WX. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2017-07-13 14:32:15 +08:00
Shao, Ming f9450316d8 EFI/EDK2: Add support to compile acpidump.efi with StdLib
This patch ports acpidump EDKII build to the environment where EDKII
internal C-library StdLib is used. Shao Ming.

Signed-off-by: "Shao, Ming" <smbest163@163.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2017-07-13 14:21:48 +08:00
Lv Zheng ae846edff2 EFI: Add AcpiOsStall()/AcpiOsSleep() support
This patch adds AcpiOsStall() and AcpiOsSleep() support.
Currently we do not support asynchronous polling of key stroke and timer,
so AcpiOsSleep() is simply an invocation of AcpiOsStall(). Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2017-07-13 14:21:46 +08:00
Lv Zheng f610e149bc EFI: Add AcpiOsGetTimer() support
This patch adds AcpiOsGetTimer() support for EFI environment.
Note that currently we don't support timezone. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2017-07-13 14:15:06 +08:00
Lv Zheng 06eafca73d EFI: Add stubs for multi-threading OSLs to make EFI ported applications running
This patch only adds stub supports for multi-threading OSLs to make
EFI ported application running.

In order to fully support acpiexec in a non multi-threading environment,
ACPICA core itself need to be upgraded to contain full asynchrnous support.
Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2017-07-13 14:14:51 +08:00
Lv Zheng 45bb76a55a EFI: Add OSL supports for those can be empty
This patch adds OSLs that can be empty under EFI environment. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2017-07-13 14:14:43 +08:00
Lv Zheng 343fc31840 acpidump: Add DSDT/FACS instance support for Linux and EFI
ACPI spec allows to configure different 32-bit/64-bit table addresses for
DSDT and FACS. And for FACS, it's meaningful to dump both of them as they
are used to support different suspend protocols.

While:
1. on Linux, only 1 instance is supported for DSDT/FACS; and
2. on EFI, the code in OslGetTable() is buggy with special table instances,
   causing endless file dump for such tables (reported by Shao Ming in link
   #2).

This patch adds DSDT/FACS instance support for Linux/EFI but doesn't cover
BSD as BSD acpidump needs a full refresh. Fixed by Lv Zheng.

Link: https://bugs.acpica.org/show_bug.cgi?id=1407 [#1]
Link: https://github.com/acpica/acpica/issues/285  [#2]
Reported-by: Shao Ming <smbest163@163.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2017-07-13 14:14:24 +08:00
Robert Moore dfbb87c3a9 Unix application OSL: Correctly handle control-c (EINTR)
Handle EINTR from a sem_wait operation. Ignore a control-c.
2017-05-22 12:57:40 -07: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 16577e5265 Source tree: Update copyright notices to 2017
Affects all files.
2017-01-06 14:19:19 -08:00
Lv Zheng 4f733cf58b Divergences: Reduce trivial OS specific divergences
It's time to synchronize with Linux around trivial OS specific updates.
This patch collects all such changes. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-12-27 15:46:27 +08:00
Lv Zheng 30495a682e Clib/EFI: Add fgets() to improve portability
This patch adds fgets(). Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-12-14 16:33:22 +08:00
Lv Zheng cc6947172d Clib/EFI: Add file position seeking/telling support
This patch adds file position seeking/telling support. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-12-14 16:33:22 +08:00
Lv Zheng 24abc25e62 Clib/EFI: Add standard input descriptor support
This patch implements stdin for EFI environment using
SIMPLE_INPUT_INTERFACE. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-12-14 16:33:22 +08:00
Lv Zheng 4dbfe66bf1 Clib/EFI: Add fgetc()/fputc() to improve portability
This patch added two new Clibrary functions: fgetc()/fputc() for EFI
environment, they are implemented using fread()/fwrite().

Note in this patch, stdin is simply defined as NULL for EFI
environment. Its EFI support should be implemented by further patches.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-12-14 16:33:22 +08:00
Lv Zheng 09fdea4f11 Debugger: Improve code quality
Use safer strncpy() instead of strcpy() in AcpiDbRunRemoteDebugger().
Detected by Coverity tools.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-12-05 16:24:16 +08:00
Robert Moore e033071cf5 Merge pull request #190 from zetalog/acpica-sleep
Acpica sleep
2016-12-02 08:14:56 -08:00
Lv Zheng ba665dc8e2 Hardware: Add sleep register hooks
In Linux, para-virtualization implmentation hooks critical register writes
to prevent real hardware operations. This increases divergences when the
sleep registers are cracked in Linux resident ACPICA. This patch tries to
introduce a single OSL to reduce the divergences. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-11-11 01:14:39 +08:00
Lv Zheng e76eb8b36a Debugger: Convert some mechanisms to OSPM specific
The following mechanisms are OSPM specific:
1. Redirect output destination to console: no file redirection will be
   needed by an in-kernel debugger, there is even no file can be accessed
   when the debugger is running in the kernel mode.
2. Output command prompts: programs other than acpiexec can have different
   prompt characters and the prompt characters may be implemented as a
   special character sequence to form a char device IO protocol.
3. Command ready/complete handshake: OSPM debugger may wait more conditions
   to implement OSPM specific semantics (for example, FIFO full/empty
   conditions for O_NONBLOCK or IO open/close conditions).
Leaving such OSPM specific stuffs in the ACPICA debugger core blocks
Linux debugger IO driver implementation.

Several new OSL APIs are provided by this patch:
1. AcpiOsInitializeDebugger: initialize debugger.
2. AcpiOsTerminateDebugger: reversal of AcpiOsInitializeDebugger.
3. AcpiOsWaitCommandReady: putting debugger task into wait state when a
   command is not ready. OSPMs can terminate command loop by returning
   AE_CTRL_TERMINATE from this API. Normally, wait_event() or
   WaitForMultipleObject() may be used to implement this API.
4. AcpiOsNotifyCommandComplete: putting user task into running state when a
   command has been completed. OSPMs can terminate command loop by
   returning AE_CTRL_TERMINATE from this API. Normally, wake_up() or
   SetEvent() may be used to implement this API.
This patch also converts current command signaling implementation into a
generic debugger layer (osgendbg.c) to be used by the existing OSPMs or
acpiexec, in return, Linux can have chance to implement its own command
handshake mechanism. This patch also implements acpiexec batch mode in a
multi-threading mode comaptible style as a demo (this can be confirmed by
configuring acpiexec into DEBUGGER_MULTI_THREADED mode where the batch mode
is still working). Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-11-03 01:17:13 +08:00
Lv Zheng de5b9c0ef1 MacOSX: Fix anonymous semaphore implementation
Using of temporal file name functions can easily result in bus errors on
MacOSX. This patch implements anonymous semaphore using an automatic
increasing number. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-09-30 11:04:49 +08:00
Lv Zheng bbcb58f787 MacOSX: Fix wrong sem_destroy definition
The following build errors can be seen for MacOSX builds:
.../osunixxf.c:882:9: error: 'sem_close' is deprecated [-Werror,-Wdeprecated-declarations]
.../acmacosx.h:122:29: note: expanded from macro 'sem_destroy'
#define sem_destroy         sem_close

sem_destroy() issue is caused by the wrong order of the following lines:
  #define #sem_destroy        sem_close
  #include <semaphore.h>
This patch fixes it by removing the buggy re-definitiion. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-09-20 13:19:55 +08:00
metacollin 01eb9a58f4 MacOSX: Remove deprecated tmpnam call for OS X
The following build errors can be seen for MacOSX builds:
.../osunixxf.c:829:42: error: 'tmpnam' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of tmpnam(3), it is highly recommended that you use mkstemp(3) instead. [-Werror,-Wdeprecated-declarations]

tmpnam should NOT be used and provides an easy and obvious privilege
escalation attack point.  There is no advantage or compatibility reason to
use this function on OS X, and it correctly throws an error if its use is
attempted.  Simply replacing it with mktemp, which behaves identically to
tmpnam, only with responsible protection against interprocess attacks.  It
will behave identically if given NULL, and will fail in exactly the same
way, so there is no danger in switching to this function.

It's also safely tucked away in a specific #ifdef __APPLE__ block anyway,
so the scope of this change is perfectly controlled.

Signed-off-by: metacollin <metacollin@gmail.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-09-20 13:19:55 +08:00
Robert Moore de7dca0ad0 EFI support: coding style cleanup
Fixes a few issues to standardize the code.
2016-08-26 08:04:01 -07:00
Robert Moore 07798d0b2f Merge pull request #164 from jmarcelof/efi-pci-os-services
Efi PCI Configuration Space access
2016-08-26 07:46:36 -07:00
Robert Moore 650028342f Merge pull request #159 from jmarcelof/fix-efi-build
Fix efi build with gcc 6.0+
2016-08-16 12:38:33 -07:00
Marcelo Ferreira f62f3a8118 OSL: Add AcpiOs{Read,Write}PciConfiguration to osefixf.c
Implement functions to read from or write to the PCI configuration space on the
efi environment.
The implementation expects that the number of bits (Width) to be 8, 16, 32 or 64.
Add also an auxiliar function that looks for the PCI device handler correspondent
to an ACPI_PCI_ID.

Signed-off-by: Marcelo Ferreira <joaomarcelo@lesc.ufc.br>
2016-08-10 15:31:32 -03:00
Robert Moore 6e782517d6 EFI support: Untabify file
Fix a single tab.
2016-07-29 14:18:06 -07:00
Marcelo Ferreira 4948fba3d4 Fix acpidump.efi build
Fix 'logical-op' warning generated by gcc 6.0 or above regarding conditionals
as "if (File == stdout || File == stderr)" since in that environment both
stdout and stderr were expanded to ST->ConOut.
This patch replace the stdout and stderr defines by global variables to avoid
that issue.

Signed-off-by: Marcelo Ferreira <joaomarcelo@lesc.ufc.br>
2016-07-28 10:01:10 -03:00
Robert Moore fd167da830 Merge pull request #154 from zetalog/acpica-efi2
Acpica efi2
2016-07-26 10:32:17 -07:00