From ad5bbfb8e1be05ad72aab31d4149034d4078fe0d Mon Sep 17 00:00:00 2001 From: Fredrik Holmqvist Date: Sat, 23 Aug 2014 16:21:05 +0200 Subject: [PATCH] Update ACPICA to 20140724. Previous update was 20121018. So it was about time don't you think? I think so :) * ACPI 5.1 is fully supported in ACPICA as of this release. Changes are so many that I can just point to the Changelog: https://acpica.org/sites/acpica/files/changes_13.txt Here is the work in progress: http://instagram.com/p/sCxrHnh2sU/ --- .gitignore | 2 + src/add-ons/kernel/bus_managers/acpi/Jamfile | 9 + .../acpi/acpica/common/acgetline.c | 512 +++++++++ .../bus_managers/acpi/acpica/common/adfile.c | 27 +- .../bus_managers/acpi/acpica/common/adisasm.c | 192 +--- .../bus_managers/acpi/acpica/common/adwalk.c | 95 +- .../bus_managers/acpi/acpica/common/ahids.c | 290 +++++ .../acpi/acpica/common/ahpredef.c | 39 +- .../bus_managers/acpi/acpica/common/ahuuids.c | 201 ++++ .../bus_managers/acpi/acpica/common/cmfsize.c | 185 +++ .../acpi/acpica/common/dmextern.c | 742 +++++++----- .../acpi/acpica/common/dmrestag.c | 2 +- .../bus_managers/acpi/acpica/common/dmtable.c | 150 ++- .../acpi/acpica/common/dmtbdump.c | 391 +++++-- .../acpi/acpica/common/dmtbinfo.c | 266 ++++- .../bus_managers/acpi/acpica/common/getopt.c | 16 +- .../acpica/components/dispatcher/dsargs.c | 2 +- .../acpica/components/dispatcher/dscontrol.c | 2 +- .../acpica/components/dispatcher/dsfield.c | 4 +- .../acpica/components/dispatcher/dsinit.c | 61 +- .../acpica/components/dispatcher/dsmethod.c | 158 ++- .../acpica/components/dispatcher/dsmthdat.c | 2 +- .../acpica/components/dispatcher/dsobject.c | 2 +- .../acpica/components/dispatcher/dsopcode.c | 2 +- .../acpica/components/dispatcher/dsutils.c | 20 +- .../acpica/components/dispatcher/dswexec.c | 5 +- .../acpica/components/dispatcher/dswload.c | 21 +- .../acpica/components/dispatcher/dswload2.c | 2 +- .../acpica/components/dispatcher/dswscope.c | 2 +- .../acpica/components/dispatcher/dswstate.c | 2 +- .../acpi/acpica/components/events/evevent.c | 2 +- .../acpi/acpica/components/events/evglock.c | 2 +- .../acpi/acpica/components/events/evgpe.c | 49 +- .../acpi/acpica/components/events/evgpeblk.c | 37 +- .../acpi/acpica/components/events/evgpeinit.c | 10 +- .../acpi/acpica/components/events/evgpeutil.c | 23 +- .../acpi/acpica/components/events/evhandler.c | 2 +- .../acpi/acpica/components/events/evmisc.c | 4 +- .../acpi/acpica/components/events/evregion.c | 14 +- .../acpi/acpica/components/events/evrgnini.c | 2 +- .../acpi/acpica/components/events/evsci.c | 4 +- .../acpi/acpica/components/events/evxface.c | 65 +- .../acpi/acpica/components/events/evxfevnt.c | 3 +- .../acpi/acpica/components/events/evxfgpe.c | 99 +- .../acpi/acpica/components/events/evxfregn.c | 3 +- .../acpica/components/executer/exconfig.c | 85 +- .../acpica/components/executer/exconvrt.c | 2 +- .../acpica/components/executer/excreate.c | 2 +- .../acpi/acpica/components/executer/exdebug.c | 13 +- .../acpi/acpica/components/executer/exdump.c | 227 +++- .../acpi/acpica/components/executer/exfield.c | 103 +- .../acpi/acpica/components/executer/exfldio.c | 2 +- .../acpi/acpica/components/executer/exmisc.c | 2 +- .../acpi/acpica/components/executer/exmutex.c | 2 +- .../acpi/acpica/components/executer/exnames.c | 2 +- .../acpica/components/executer/exoparg1.c | 2 +- .../acpica/components/executer/exoparg2.c | 2 +- .../acpica/components/executer/exoparg3.c | 2 +- .../acpica/components/executer/exoparg6.c | 2 +- .../acpi/acpica/components/executer/exprep.c | 2 +- .../acpica/components/executer/exregion.c | 2 +- .../acpica/components/executer/exresnte.c | 6 +- .../acpica/components/executer/exresolv.c | 2 +- .../acpi/acpica/components/executer/exresop.c | 2 +- .../acpi/acpica/components/executer/exstore.c | 170 ++- .../acpica/components/executer/exstoren.c | 2 +- .../acpica/components/executer/exstorob.c | 2 +- .../acpica/components/executer/exsystem.c | 14 +- .../acpi/acpica/components/executer/exutils.c | 92 +- .../acpi/acpica/components/hardware/hwacpi.c | 2 +- .../acpica/components/hardware/hwesleep.c | 2 +- .../acpi/acpica/components/hardware/hwgpe.c | 2 +- .../acpi/acpica/components/hardware/hwpci.c | 15 +- .../acpi/acpica/components/hardware/hwregs.c | 10 +- .../acpi/acpica/components/hardware/hwsleep.c | 2 +- .../acpi/acpica/components/hardware/hwtimer.c | 4 +- .../acpi/acpica/components/hardware/hwvalid.c | 2 +- .../acpi/acpica/components/hardware/hwxface.c | 12 +- .../acpica/components/hardware/hwxfsleep.c | 4 +- .../acpica/components/namespace/nsaccess.c | 2 +- .../acpica/components/namespace/nsalloc.c | 21 +- .../acpica/components/namespace/nsarguments.c | 2 +- .../acpica/components/namespace/nsconvert.c | 2 +- .../acpi/acpica/components/namespace/nsdump.c | 9 +- .../acpica/components/namespace/nsdumpdv.c | 2 +- .../acpi/acpica/components/namespace/nseval.c | 2 +- .../acpi/acpica/components/namespace/nsinit.c | 7 +- .../acpi/acpica/components/namespace/nsload.c | 6 +- .../acpica/components/namespace/nsnames.c | 2 +- .../acpica/components/namespace/nsobject.c | 21 +- .../acpica/components/namespace/nsparse.c | 2 +- .../acpica/components/namespace/nspredef.c | 2 +- .../acpica/components/namespace/nsprepkg.c | 42 +- .../acpica/components/namespace/nsrepair.c | 27 +- .../acpica/components/namespace/nsrepair2.c | 40 +- .../acpica/components/namespace/nssearch.c | 2 +- .../acpica/components/namespace/nsutils.c | 20 +- .../acpi/acpica/components/namespace/nswalk.c | 2 +- .../acpica/components/namespace/nsxfeval.c | 21 +- .../acpica/components/namespace/nsxfname.c | 3 +- .../acpica/components/namespace/nsxfobj.c | 3 +- .../acpi/acpica/components/parser/psargs.c | 2 +- .../acpi/acpica/components/parser/psloop.c | 7 +- .../acpi/acpica/components/parser/psobject.c | 9 +- .../acpi/acpica/components/parser/psopcode.c | 2 +- .../acpi/acpica/components/parser/psopinfo.c | 54 +- .../acpi/acpica/components/parser/psparse.c | 2 +- .../acpi/acpica/components/parser/psscope.c | 2 +- .../acpi/acpica/components/parser/pstree.c | 2 +- .../acpi/acpica/components/parser/psutils.c | 2 +- .../acpi/acpica/components/parser/pswalk.c | 2 +- .../acpi/acpica/components/parser/psxface.c | 2 +- .../acpi/acpica/components/resources/rsaddr.c | 2 +- .../acpi/acpica/components/resources/rscalc.c | 10 +- .../acpica/components/resources/rscreate.c | 59 +- .../acpi/acpica/components/resources/rsdump.c | 4 +- .../acpica/components/resources/rsdumpinfo.c | 4 +- .../acpi/acpica/components/resources/rsinfo.c | 4 +- .../acpi/acpica/components/resources/rsio.c | 2 +- .../acpi/acpica/components/resources/rsirq.c | 2 +- .../acpi/acpica/components/resources/rslist.c | 2 +- .../acpica/components/resources/rsmemory.c | 2 +- .../acpi/acpica/components/resources/rsmisc.c | 2 +- .../acpica/components/resources/rsserial.c | 2 +- .../acpica/components/resources/rsutils.c | 4 +- .../acpica/components/resources/rsxface.c | 3 +- .../acpi/acpica/components/tables/tbdata.c | 927 +++++++++++++++ .../acpi/acpica/components/tables/tbfadt.c | 365 +++--- .../acpi/acpica/components/tables/tbfind.c | 4 +- .../acpi/acpica/components/tables/tbinstal.c | 1008 +++++++---------- .../acpi/acpica/components/tables/tbprint.c | 21 +- .../acpi/acpica/components/tables/tbutils.c | 232 +--- .../acpi/acpica/components/tables/tbxface.c | 13 +- .../acpi/acpica/components/tables/tbxfload.c | 97 +- .../acpi/acpica/components/tables/tbxfroot.c | 2 +- .../acpica/components/utilities/utaddress.c | 16 +- .../acpica/components/utilities/utalloc.c | 143 +-- .../acpica/components/utilities/utbuffer.c | 137 ++- .../acpica/components/utilities/utcache.c | 14 +- .../acpi/acpica/components/utilities/utclib.c | 6 +- .../acpi/acpica/components/utilities/utcopy.c | 15 +- .../acpica/components/utilities/utdebug.c | 67 +- .../acpica/components/utilities/utdecode.c | 112 +- .../acpica/components/utilities/utdelete.c | 18 +- .../acpica/components/utilities/uterror.c | 2 +- .../acpi/acpica/components/utilities/uteval.c | 2 +- .../acpica/components/utilities/utexcep.c | 3 +- .../acpica/components/utilities/utfileio.c | 434 +++++++ .../acpica/components/utilities/utglobal.c | 192 +--- .../acpi/acpica/components/utilities/uthex.c | 185 +++ .../acpi/acpica/components/utilities/utids.c | 2 +- .../acpi/acpica/components/utilities/utinit.c | 158 ++- .../acpi/acpica/components/utilities/utlock.c | 2 +- .../acpi/acpica/components/utilities/utmath.c | 2 +- .../acpi/acpica/components/utilities/utmisc.c | 2 +- .../acpica/components/utilities/utmutex.c | 2 +- .../acpica/components/utilities/utobject.c | 4 +- .../acpi/acpica/components/utilities/utosi.c | 31 +- .../acpica/components/utilities/utownerid.c | 2 +- .../acpica/components/utilities/utpredef.c | 2 +- .../acpica/components/utilities/utprint.c | 883 +++++++++++++++ .../acpica/components/utilities/utresrc.c | 4 +- .../acpica/components/utilities/utstate.c | 2 +- .../acpica/components/utilities/utstring.c | 79 +- .../acpica/components/utilities/uttrack.c | 34 +- .../acpi/acpica/components/utilities/utuuid.c | 175 +++ .../acpica/components/utilities/utxface.c | 5 +- .../acpica/components/utilities/utxferror.c | 7 +- .../acpica/components/utilities/utxfinit.c | 21 +- .../acpica/components/utilities/utxfmutex.c | 2 +- .../bus_managers/acpi/acpica/include/acapps.h | 25 +- .../acpi/acpica/include/acbuffer.h | 2 +- .../acpi/acpica/include/accommon.h | 2 +- .../acpi/acpica/include/acconfig.h | 25 +- .../acpi/acpica/include/acdebug.h | 16 +- .../acpi/acpica/include/acdisasm.h | 65 +- .../acpi/acpica/include/acdispat.h | 16 +- .../acpi/acpica/include/acevents.h | 12 +- .../acpi/acpica/include/acexcep.h | 2 +- .../acpi/acpica/include/acglobal.h | 426 +++---- .../acpi/acpica/include/achware.h | 2 +- .../acpi/acpica/include/acinterp.h | 14 +- .../acpi/acpica/include/aclocal.h | 48 +- .../acpi/acpica/include/acmacros.h | 42 +- .../acpi/acpica/include/acnames.h | 34 +- .../acpi/acpica/include/acnamesp.h | 2 +- .../acpi/acpica/include/acobject.h | 5 +- .../acpi/acpica/include/acopcode.h | 2 +- .../acpi/acpica/include/acoutput.h | 2 +- .../acpi/acpica/include/acparser.h | 2 +- .../bus_managers/acpi/acpica/include/acpi.h | 3 +- .../acpi/acpica/include/acpiosxf.h | 172 ++- .../bus_managers/acpi/acpica/include/acpixf.h | 590 ++++++++-- .../acpi/acpica/include/acpredef.h | 29 +- .../acpi/acpica/include/acresrc.h | 7 +- .../acpi/acpica/include/acrestyp.h | 2 +- .../acpi/acpica/include/acstruct.h | 5 +- .../acpi/acpica/include/actables.h | 93 +- .../bus_managers/acpi/acpica/include/actbl.h | 28 +- .../bus_managers/acpi/acpica/include/actbl1.h | 92 +- .../bus_managers/acpi/acpica/include/actbl2.h | 119 +- .../bus_managers/acpi/acpica/include/actbl3.h | 150 ++- .../acpi/acpica/include/actypes.h | 108 +- .../acpi/acpica/include/acutils.h | 140 ++- .../acpi/acpica/include/amlcode.h | 2 +- .../acpi/acpica/include/amlresrc.h | 2 +- .../acpi/acpica/include/platform/acenv.h | 73 +- .../acpi/acpica/include/platform/acenvex.h | 135 +++ .../acpi/acpica/include/platform/acgcc.h | 15 +- .../acpi/acpica/include/platform/achaiku.h | 5 +- .../acpi/acpica/include/platform/acintel.h | 2 +- .../kernel/device_manager/device_manager.cpp | 2 +- 212 files changed, 9667 insertions(+), 3233 deletions(-) create mode 100644 src/add-ons/kernel/bus_managers/acpi/acpica/common/acgetline.c create mode 100644 src/add-ons/kernel/bus_managers/acpi/acpica/common/ahids.c create mode 100644 src/add-ons/kernel/bus_managers/acpi/acpica/common/ahuuids.c create mode 100644 src/add-ons/kernel/bus_managers/acpi/acpica/common/cmfsize.c create mode 100644 src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbdata.c create mode 100644 src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utfileio.c create mode 100644 src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/uthex.c create mode 100644 src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utprint.c create mode 100644 src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utuuid.c create mode 100644 src/add-ons/kernel/bus_managers/acpi/acpica/include/platform/acenvex.h diff --git a/.gitignore b/.gitignore index e20de9c420..02456c5841 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ build/user_config_headers *~ # Vim swp files .*.swp + +conf.sh diff --git a/src/add-ons/kernel/bus_managers/acpi/Jamfile b/src/add-ons/kernel/bus_managers/acpi/Jamfile index 85cdb1a685..f630621569 100644 --- a/src/add-ons/kernel/bus_managers/acpi/Jamfile +++ b/src/add-ons/kernel/bus_managers/acpi/Jamfile @@ -8,6 +8,10 @@ SubDirCcFlags -D_KERNEL_MODE ; local common_src = + acgetline.c + ahids.c + ahuuids.c + cmfsize.c dmtbdump.c dmtbinfo.c ; @@ -143,6 +147,7 @@ local resources_src = ; local tables_src = + tbdata.c tbfadt.c tbfind.c tbinstal.c @@ -166,7 +171,9 @@ local utilities_src = uterror.c uteval.c utexcep.c + utfileio.c utglobal.c + uthex.c utids.c utinit.c utlock.c @@ -177,10 +184,12 @@ local utilities_src = utosi.c utownerid.c utpredef.c + utprint.c utresrc.c utstate.c utstring.c uttrack.c + utuuid.c utxface.c utxferror.c utxfinit.c diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/common/acgetline.c b/src/add-ons/kernel/bus_managers/acpi/acpica/common/acgetline.c new file mode 100644 index 0000000000..77ca341651 --- /dev/null +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/common/acgetline.c @@ -0,0 +1,512 @@ +/****************************************************************************** + * + * Module Name: acgetline - local line editing + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#include "acpi.h" +#include "accommon.h" +#include "amlcode.h" +#include "acparser.h" +#include "acdebug.h" + +#include + +/* + * This is an os-independent implementation of line-editing services needed + * by the AcpiExec utility. It uses getchar() and putchar() and the existing + * history support provided by the AML debugger. It assumes that the terminal + * is in the correct line-editing mode such as raw and noecho. The OSL + * interface AcpiOsInitialize should do this. AcpiOsTerminate should put the + * terminal back into the original mode. + */ +#define _COMPONENT ACPI_OS_SERVICES + ACPI_MODULE_NAME ("acgetline") + + +/* Local prototypes */ + +static void +AcpiAcClearLine ( + UINT32 EndOfLine, + UINT32 CursorPosition); + +/* Various ASCII constants */ + +#define _ASCII_NUL 0 +#define _ASCII_BACKSPACE 0x08 +#define _ASCII_TAB 0x09 +#define _ASCII_ESCAPE 0x1B +#define _ASCII_SPACE 0x20 +#define _ASCII_LEFT_BRACKET 0x5B +#define _ASCII_DEL 0x7F +#define _ASCII_UP_ARROW 'A' +#define _ASCII_DOWN_ARROW 'B' +#define _ASCII_RIGHT_ARROW 'C' +#define _ASCII_LEFT_ARROW 'D' +#define _ASCII_NEWLINE '\n' + +extern UINT32 AcpiGbl_NextCmdNum; + +/* Erase a single character on the input command line */ + +#define ACPI_CLEAR_CHAR() \ + putchar (_ASCII_BACKSPACE); \ + putchar (_ASCII_SPACE); \ + putchar (_ASCII_BACKSPACE); + +/* Backup cursor by Count positions */ + +#define ACPI_BACKUP_CURSOR(i, Count) \ + for (i = 0; i < (Count); i++) \ + {putchar (_ASCII_BACKSPACE);} + + +/****************************************************************************** + * + * FUNCTION: AcpiAcClearLine + * + * PARAMETERS: EndOfLine - Current end-of-line index + * CursorPosition - Current cursor position within line + * + * RETURN: None + * + * DESCRIPTION: Clear the entire command line the hard way, but probably the + * most portable. + * + *****************************************************************************/ + +static void +AcpiAcClearLine ( + UINT32 EndOfLine, + UINT32 CursorPosition) +{ + UINT32 i; + + + if (CursorPosition < EndOfLine) + { + /* Clear line from current position to end of line */ + + for (i = 0; i < (EndOfLine - CursorPosition); i++) + { + putchar (' '); + } + } + + /* Clear the entire line */ + + for (; EndOfLine > 0; EndOfLine--) + { + ACPI_CLEAR_CHAR (); + } +} + + +/****************************************************************************** + * + * FUNCTION: AcpiOsGetLine + * + * PARAMETERS: Buffer - Where to return the command line + * BufferLength - Maximum length of Buffer + * BytesRead - Where the actual byte count is returned + * + * RETURN: Status and actual bytes read + * + * DESCRIPTION: Get the next input line from the terminal. NOTE: terminal + * is expected to be in a mode that supports line-editing (raw, + * noecho). This function is intended to be very portable. Also, + * it uses the history support implemented in the AML debugger. + * + *****************************************************************************/ + +ACPI_STATUS +AcpiOsGetLine ( + char *Buffer, + UINT32 BufferLength, + UINT32 *BytesRead) +{ + char *NextCommand; + UINT32 MaxCommandIndex = AcpiGbl_NextCmdNum - 1; + UINT32 CurrentCommandIndex = MaxCommandIndex; + UINT32 PreviousCommandIndex = MaxCommandIndex; + int InputChar; + UINT32 CursorPosition = 0; + UINT32 EndOfLine = 0; + UINT32 i; + + + /* Always clear the line buffer before we read a new line */ + + memset (Buffer, 0, BufferLength); + + /* + * This loop gets one character at a time (except for esc sequences) + * until a newline or error is detected. + * + * Note: Don't attempt to write terminal control ESC sequences, even + * though it makes certain things more difficult. + */ + while (1) + { + if (EndOfLine >= (BufferLength - 1)) + { + return (AE_BUFFER_OVERFLOW); + } + + InputChar = getchar (); + switch (InputChar) + { + default: /* This is the normal character case */ + + /* Echo the character (at EOL) and copy it to the line buffer */ + + if (EndOfLine == CursorPosition) + { + putchar (InputChar); + Buffer[EndOfLine] = (char) InputChar; + + EndOfLine++; + CursorPosition++; + Buffer[EndOfLine] = 0; + continue; + } + + /* Insert character into the middle of the buffer */ + + memmove (&Buffer[CursorPosition + 1], &Buffer[CursorPosition], + (EndOfLine - CursorPosition + 1)); + + Buffer [CursorPosition] = (char) InputChar; + Buffer [EndOfLine + 1] = 0; + + /* Display the new part of line starting at the new character */ + + fprintf (stdout, "%s", &Buffer[CursorPosition]); + + /* Restore cursor */ + + ACPI_BACKUP_CURSOR (i, EndOfLine - CursorPosition); + CursorPosition++; + EndOfLine++; + continue; + + case _ASCII_DEL: /* Backspace key */ + + if (!EndOfLine) /* Any characters on the command line? */ + { + continue; + } + + if (EndOfLine == CursorPosition) /* Erase the final character */ + { + ACPI_CLEAR_CHAR (); + EndOfLine--; + CursorPosition--; + continue; + } + + if (!CursorPosition) /* Do not backup beyond start of line */ + { + continue; + } + + /* Remove the character from the line */ + + memmove (&Buffer[CursorPosition - 1], &Buffer[CursorPosition], + (EndOfLine - CursorPosition + 1)); + + /* Display the new part of line starting at the new character */ + + putchar (_ASCII_BACKSPACE); + fprintf (stdout, "%s ", &Buffer[CursorPosition - 1]); + + /* Restore cursor */ + + ACPI_BACKUP_CURSOR (i, EndOfLine - CursorPosition + 1); + EndOfLine--; + if (CursorPosition > 0) + { + CursorPosition--; + } + continue; + + case _ASCII_NEWLINE: /* Normal exit case at end of command line */ + case _ASCII_NUL: + + /* Return the number of bytes in the command line string */ + + if (BytesRead) + { + *BytesRead = EndOfLine; + } + + /* Echo, terminate string buffer, and exit */ + + putchar (InputChar); + Buffer[EndOfLine] = 0; + return (AE_OK); + + case _ASCII_TAB: + + /* Ignore */ + + continue; + + case EOF: + + return (AE_ERROR); + + case _ASCII_ESCAPE: + + /* Check for escape sequences of the form "ESC[x" */ + + InputChar = getchar (); + if (InputChar != _ASCII_LEFT_BRACKET) + { + continue; /* Ignore this ESC, does not have the '[' */ + } + + /* Get the code following the ESC [ */ + + InputChar = getchar (); /* Backup one character */ + switch (InputChar) + { + case _ASCII_LEFT_ARROW: + + if (CursorPosition > 0) + { + putchar (_ASCII_BACKSPACE); + CursorPosition--; + } + continue; + + case _ASCII_RIGHT_ARROW: + /* + * Move one character forward. Do this without sending + * ESC sequence to the terminal for max portability. + */ + if (CursorPosition < EndOfLine) + { + /* Backup to start of line and print the entire line */ + + ACPI_BACKUP_CURSOR (i, CursorPosition); + fprintf (stdout, "%s", Buffer); + + /* Backup to where the cursor should be */ + + CursorPosition++; + ACPI_BACKUP_CURSOR (i, EndOfLine - CursorPosition); + } + continue; + + case _ASCII_UP_ARROW: + + /* If no commands available or at start of history list, ignore */ + + if (!CurrentCommandIndex) + { + continue; + } + + /* Manage our up/down progress */ + + if (CurrentCommandIndex > PreviousCommandIndex) + { + CurrentCommandIndex = PreviousCommandIndex; + } + + /* Get the historical command from the debugger */ + + NextCommand = AcpiDbGetHistoryByIndex (CurrentCommandIndex); + if (!NextCommand) + { + return (AE_ERROR); + } + + /* Make this the active command and echo it */ + + AcpiAcClearLine (EndOfLine, CursorPosition); + strcpy (Buffer, NextCommand); + fprintf (stdout, "%s", Buffer); + EndOfLine = CursorPosition = strlen (Buffer); + + PreviousCommandIndex = CurrentCommandIndex; + CurrentCommandIndex--; + continue; + + case _ASCII_DOWN_ARROW: + + if (!MaxCommandIndex) /* Any commands available? */ + { + continue; + } + + /* Manage our up/down progress */ + + if (CurrentCommandIndex < PreviousCommandIndex) + { + CurrentCommandIndex = PreviousCommandIndex; + } + + /* If we are the end of the history list, output a clear new line */ + + if ((CurrentCommandIndex + 1) > MaxCommandIndex) + { + AcpiAcClearLine (EndOfLine, CursorPosition); + EndOfLine = CursorPosition = 0; + PreviousCommandIndex = CurrentCommandIndex; + continue; + } + + PreviousCommandIndex = CurrentCommandIndex; + CurrentCommandIndex++; + + /* Get the historical command from the debugger */ + + NextCommand = AcpiDbGetHistoryByIndex (CurrentCommandIndex); + if (!NextCommand) + { + return (AE_ERROR); + } + + /* Make this the active command and echo it */ + + AcpiAcClearLine (EndOfLine, CursorPosition); + strcpy (Buffer, NextCommand); + fprintf (stdout, "%s", Buffer); + EndOfLine = CursorPosition = strlen (Buffer); + continue; + + case 0x31: + case 0x32: + case 0x33: + case 0x34: + case 0x35: + case 0x36: + /* + * Ignore the various keys like insert/delete/home/end, etc. + * But we must eat the final character of the ESC sequence. + */ + InputChar = getchar (); + continue; + + default: + + /* Ignore random escape sequences that we don't care about */ + + continue; + } + continue; + } + } +} diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/common/adfile.c b/src/add-ons/kernel/bus_managers/acpi/acpica/common/adfile.c index 1af4cc2c3a..3426107220 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/common/adfile.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/common/adfile.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -271,20 +271,28 @@ FlGenerateFilename ( { char *Position; char *NewFilename; + char *DirectoryPosition; /* - * Copy the original filename to a new buffer. Leave room for the worst case - * where we append the suffix, an added dot and the null terminator. + * Copy the original filename to a new buffer. Leave room for the worst + * case where we append the suffix, an added dot and the null terminator. */ NewFilename = ACPI_ALLOCATE_ZEROED ((ACPI_SIZE) strlen (InputFilename) + strlen (Suffix) + 2); + if (!NewFilename) + { + return (NULL); + } + strcpy (NewFilename, InputFilename); /* Try to find the last dot in the filename */ + DirectoryPosition = strrchr (NewFilename, '/'); Position = strrchr (NewFilename, '.'); - if (Position) + + if (Position && (Position > DirectoryPosition)) { /* Tack on the new suffix */ @@ -360,7 +368,6 @@ FlSplitInputPathname ( *OutDirectoryPath = NULL; - *OutFilename = NULL; if (!InputPath) { @@ -402,10 +409,18 @@ FlSplitInputPathname ( if (!Filename) { + ACPI_FREE (DirectoryPath); return (AE_NO_MEMORY); } *OutDirectoryPath = DirectoryPath; - *OutFilename = Filename; + + if (OutFilename) + { + *OutFilename = Filename; + return (AE_OK); + } + + ACPI_FREE (Filename); return (AE_OK); } diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/common/adisasm.c b/src/add-ons/kernel/bus_managers/acpi/acpica/common/adisasm.c index f14ae176ca..df7000158e 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/common/adisasm.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/common/adisasm.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -151,10 +151,6 @@ NsSetupNamespaceListing ( /* Local prototypes */ -static UINT32 -AdGetFileSize ( - FILE *File); - static void AdCreateTableHeader ( char *Filename, @@ -227,38 +223,6 @@ static ACPI_TABLE_DESC LocalTables[1]; static ACPI_PARSE_OBJECT *AcpiGbl_ParseOpRoot; -/******************************************************************************* - * - * FUNCTION: AdGetFileSize - * - * PARAMETERS: File - Open file handle - * - * RETURN: File Size - * - * DESCRIPTION: Get current file size. Uses seek-to-EOF. File must be open. - * - ******************************************************************************/ - -static UINT32 -AdGetFileSize ( - FILE *File) -{ - UINT32 FileSize; - long Offset; - - - Offset = ftell (File); - - fseek (File, 0, SEEK_END); - FileSize = (UINT32) ftell (File); - - /* Restore file pointer */ - - fseek (File, Offset, SEEK_SET); - return (FileSize); -} - - /******************************************************************************* * * FUNCTION: AdInitialize @@ -278,7 +242,7 @@ AdInitialize ( ACPI_STATUS Status; - /* ACPI CA subsystem initialization */ + /* ACPICA subsystem initialization */ Status = AcpiOsInitialize (); if (ACPI_FAILURE (Status)) @@ -322,7 +286,6 @@ AdInitialize ( * OutToFile - TRUE if output should go to a file * Prefix - Path prefix for output * OutFilename - where the filename is returned - * GetAllTables - TRUE if all tables are desired * * RETURN: Status * @@ -335,8 +298,7 @@ AdAmlDisassemble ( BOOLEAN OutToFile, char *Filename, char *Prefix, - char **OutFilename, - BOOLEAN GetAllTables) + char **OutFilename) { ACPI_STATUS Status; char *DisasmFilename = NULL; @@ -420,7 +382,7 @@ AdAmlDisassemble ( } else { - Status = AdGetLocalTables (Filename, GetAllTables); + Status = AdGetLocalTables (); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Could not get ACPI tables, %s\n", @@ -455,7 +417,7 @@ AdAmlDisassemble ( /* Create/Open a disassembly output file */ DisasmFilename = FlGenerateFilename (Prefix, FILE_SUFFIX_DISASSEMBLY); - if (!OutFilename) + if (!DisasmFilename) { fprintf (stderr, "Could not generate output filename\n"); Status = AE_ERROR; @@ -467,6 +429,7 @@ AdAmlDisassemble ( { fprintf (stderr, "Could not open output file %s\n", DisasmFilename); Status = AE_ERROR; + ACPI_FREE (DisasmFilename); goto Cleanup; } @@ -487,7 +450,7 @@ AdAmlDisassemble ( fprintf (stderr, "Acpi Data Table [%4.4s] decoded\n", Table->Signature); fprintf (stderr, "Formatted output: %s - %u bytes\n", - DisasmFilename, AdGetFileSize (File)); + DisasmFilename, CmGetFileSize (File)); } else { @@ -543,9 +506,10 @@ AdAmlDisassemble ( "reparsing with new information\n", AcpiDmGetExternalMethodCount ()); - /* Reparse, rebuild namespace. no need to xref namespace */ + /* Reparse, rebuild namespace */ AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot); + AcpiGbl_ParseOpRoot = NULL; AcpiNsDeleteNamespaceSubtree (AcpiGbl_RootNode); AcpiGbl_RootNode = NULL; @@ -559,6 +523,9 @@ AdAmlDisassemble ( AcpiGbl_RootNodeStruct.Flags = 0; Status = AcpiNsRootInitialize (); + + /* New namespace, add the external definitions first */ + AcpiDmAddExternalsToNamespace (); /* Parse the table again. No need to reload it, however */ @@ -571,6 +538,14 @@ AdAmlDisassemble ( goto Cleanup; } + /* Cross reference the namespace again */ + + AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot, + AcpiGbl_RootNode, OwnerId); + + AcpiDmCrossReferenceNamespace (AcpiGbl_ParseOpRoot, + AcpiGbl_RootNode, OwnerId); + if (AslCompilerdebug) { AcpiOsPrintf ("/**** After second load and resource conversion\n"); @@ -605,7 +580,7 @@ AdAmlDisassemble ( fprintf (stderr, "Disassembly completed\n"); fprintf (stderr, "ASL Output: %s - %u bytes\n", - DisasmFilename, AdGetFileSize (File)); + DisasmFilename, CmGetFileSize (File)); } } @@ -642,7 +617,7 @@ Cleanup: * * RETURN: None * - * DESCRIPTION: Create the disassembler header, including ACPI CA signon with + * DESCRIPTION: Create the disassembler header, including ACPICA signon with * current time and date. * *****************************************************************************/ @@ -674,7 +649,7 @@ AdDisassemblerHeader ( * * RETURN: None * - * DESCRIPTION: Create the ASL table header, including ACPI CA signon with + * DESCRIPTION: Create the ASL table header, including ACPICA signon with * current time and date. * *****************************************************************************/ @@ -752,8 +727,17 @@ AdCreateTableHeader ( else { NewFilename = ACPI_ALLOCATE_ZEROED (9); - strncat (NewFilename, Table->Signature, 4); - strcat (NewFilename, ".aml"); + if (NewFilename) + { + strncat (NewFilename, Table->Signature, 4); + strcat (NewFilename, ".aml"); + } + } + + if (!NewFilename) + { + AcpiOsPrintf (" **** Could not generate AML output filename\n"); + return; } /* Open the ASL definition block */ @@ -818,8 +802,7 @@ AdDisplayTables ( * * FUNCTION: AdGetLocalTables * - * PARAMETERS: Filename - Not used - * GetAllTables - TRUE if all tables are desired + * PARAMETERS: None * * RETURN: Status * @@ -829,105 +812,36 @@ AdDisplayTables ( ACPI_STATUS AdGetLocalTables ( - char *Filename, - BOOLEAN GetAllTables) + void) { ACPI_STATUS Status; ACPI_TABLE_HEADER TableHeader; ACPI_TABLE_HEADER *NewTable; - UINT32 NumTables; - UINT32 PointerSize; UINT32 TableIndex; - if (GetAllTables) - { - ACPI_MOVE_32_TO_32 (TableHeader.Signature, ACPI_SIG_RSDT); - AcpiOsTableOverride (&TableHeader, &NewTable); - if (!NewTable) - { - fprintf (stderr, "Could not obtain RSDT\n"); - return (AE_NO_ACPI_TABLES); - } - else - { - AdWriteTable (NewTable, NewTable->Length, - ACPI_SIG_RSDT, NewTable->OemTableId); - } - - if (ACPI_COMPARE_NAME (NewTable->Signature, ACPI_SIG_RSDT)) - { - PointerSize = sizeof (UINT32); - } - else - { - PointerSize = sizeof (UINT64); - } - - /* - * Determine the number of tables pointed to by the RSDT/XSDT. - * This is defined by the ACPI Specification to be the number of - * pointers contained within the RSDT/XSDT. The size of the pointers - * is architecture-dependent. - */ - NumTables = (NewTable->Length - sizeof (ACPI_TABLE_HEADER)) / PointerSize; - AcpiOsPrintf ("There are %u tables defined in the %4.4s\n\n", - NumTables, NewTable->Signature); - - /* Get the FADT */ - - ACPI_MOVE_32_TO_32 (TableHeader.Signature, ACPI_SIG_FADT); - AcpiOsTableOverride (&TableHeader, &NewTable); - if (NewTable) - { - AdWriteTable (NewTable, NewTable->Length, - ACPI_SIG_FADT, NewTable->OemTableId); - } - AcpiOsPrintf ("\n"); - - /* Don't bother with FACS, it is usually all zeros */ - } - - /* Always get the DSDT */ + /* Get the DSDT via table override */ ACPI_MOVE_32_TO_32 (TableHeader.Signature, ACPI_SIG_DSDT); AcpiOsTableOverride (&TableHeader, &NewTable); - if (NewTable) - { - AdWriteTable (NewTable, NewTable->Length, - ACPI_SIG_DSDT, NewTable->OemTableId); - - /* Store DSDT in the Table Manager */ - - Status = AcpiTbStoreTable (0, NewTable, NewTable->Length, - 0, &TableIndex); - if (ACPI_FAILURE (Status)) - { - fprintf (stderr, "Could not store DSDT\n"); - return (AE_NO_ACPI_TABLES); - } - } - else + if (!NewTable) { fprintf (stderr, "Could not obtain DSDT\n"); return (AE_NO_ACPI_TABLES); } -#if 0 - /* TBD: Future implementation */ + AdWriteTable (NewTable, NewTable->Length, + ACPI_SIG_DSDT, NewTable->OemTableId); - AcpiOsPrintf ("\n"); + /* Store DSDT in the Table Manager */ - /* Get all SSDTs */ - - ACPI_MOVE_32_TO_32 (TableHeader.Signature, ACPI_SIG_SSDT); - do + Status = AcpiTbStoreTable (0, NewTable, NewTable->Length, + 0, &TableIndex); + if (ACPI_FAILURE (Status)) { - NewTable = NULL; - Status = AcpiOsTableOverride (&TableHeader, &NewTable); - - } while (NewTable); -#endif + fprintf (stderr, "Could not store DSDT\n"); + return (AE_NO_ACPI_TABLES); + } return (AE_OK); } @@ -1016,7 +930,8 @@ AdParseTable ( if (LoadTable) { Status = AcpiTbStoreTable ((ACPI_PHYSICAL_ADDRESS) Table, Table, - Table->Length, ACPI_TABLE_ORIGIN_ALLOCATED, &TableIndex); + Table->Length, ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL, + &TableIndex); if (ACPI_FAILURE (Status)) { return (Status); @@ -1051,9 +966,12 @@ AdParseTable ( return (AE_OK); } - /* Pass 3: Parse control methods and link their parse trees into the main parse tree */ - - fprintf (stderr, "Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)\n"); + /* + * Pass 3: Parse control methods and link their parse trees + * into the main parse tree + */ + fprintf (stderr, + "Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)\n"); Status = AcpiDmParseDeferredOps (AcpiGbl_ParseOpRoot); fprintf (stderr, "\n"); diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/common/adwalk.c b/src/add-ons/kernel/bus_managers/acpi/acpica/common/adwalk.c index 76ef5dfdb0..808e4e2258 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/common/adwalk.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/common/adwalk.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -541,8 +541,9 @@ AcpiDmFindOrphanDescending ( !ChildOp->Common.Node) { AcpiNsExternalizeName (ACPI_UINT32_MAX, ChildOp->Common.Value.String, - NULL, &Path); - AcpiOsPrintf ("/* %-16s A-NAMEPATH: %s */\n", Op->Common.AmlOpName, Path); + NULL, &Path); + AcpiOsPrintf ("/* %-16s A-NAMEPATH: %s */\n", + Op->Common.AmlOpName, Path); ACPI_FREE (Path); NextOp = Op->Common.Next; @@ -550,22 +551,26 @@ AcpiDmFindOrphanDescending ( { /* This NamePath has no args, assume it is an integer */ - AcpiDmAddToExternalList (ChildOp, ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0); + AcpiDmAddOpToExternalList (ChildOp, + ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0, 0); return (AE_OK); } ArgCount = AcpiDmInspectPossibleArgs (3, 1, NextOp); - AcpiOsPrintf ("/* A-CHILDREN: %u Actual %u */\n", ArgCount, AcpiDmCountChildren (Op)); + AcpiOsPrintf ("/* A-CHILDREN: %u Actual %u */\n", + ArgCount, AcpiDmCountChildren (Op)); if (ArgCount < 1) { /* One Arg means this is just a Store(Name,Target) */ - AcpiDmAddToExternalList (ChildOp, ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0); + AcpiDmAddOpToExternalList (ChildOp, + ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0, 0); return (AE_OK); } - AcpiDmAddToExternalList (ChildOp, ChildOp->Common.Value.String, ACPI_TYPE_METHOD, ArgCount); + AcpiDmAddOpToExternalList (ChildOp, + ChildOp->Common.Value.String, ACPI_TYPE_METHOD, ArgCount, 0); } break; #endif @@ -581,7 +586,8 @@ AcpiDmFindOrphanDescending ( { /* This NamePath has no args, assume it is an integer */ - AcpiDmAddToExternalList (ChildOp, ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0); + AcpiDmAddOpToExternalList (ChildOp, + ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0, 0); return (AE_OK); } @@ -590,11 +596,13 @@ AcpiDmFindOrphanDescending ( { /* One Arg means this is just a Store(Name,Target) */ - AcpiDmAddToExternalList (ChildOp, ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0); + AcpiDmAddOpToExternalList (ChildOp, + ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0, 0); return (AE_OK); } - AcpiDmAddToExternalList (ChildOp, ChildOp->Common.Value.String, ACPI_TYPE_METHOD, ArgCount); + AcpiDmAddOpToExternalList (ChildOp, + ChildOp->Common.Value.String, ACPI_TYPE_METHOD, ArgCount, 0); } break; @@ -626,7 +634,8 @@ AcpiDmFindOrphanDescending ( /* And namepath is the first argument */ (ParentOp->Common.Value.Arg == Op)) { - AcpiDmAddToExternalList (Op, Op->Common.Value.String, ACPI_TYPE_INTEGER, 0); + AcpiDmAddOpToExternalList (Op, + Op->Common.Value.String, ACPI_TYPE_INTEGER, 0, 0); break; } } @@ -636,8 +645,8 @@ AcpiDmFindOrphanDescending ( * operator) - it *must* be a method invocation, nothing else is * grammatically possible. */ - AcpiDmAddToExternalList (Op, Op->Common.Value.String, ACPI_TYPE_METHOD, ArgCount); - + AcpiDmAddOpToExternalList (Op, + Op->Common.Value.String, ACPI_TYPE_METHOD, ArgCount, 0); } break; @@ -813,6 +822,7 @@ AcpiDmXrefDescendingOp ( ACPI_NAMESPACE_NODE *Node; ACPI_OPERAND_OBJECT *Object; UINT32 ParamCount = 0; + char *Pathname; WalkState = Info->WalkState; @@ -822,11 +832,13 @@ AcpiDmXrefDescendingOp ( if ((!(OpInfo->Flags & AML_NAMED)) && (!(OpInfo->Flags & AML_CREATE)) && - (Op->Common.AmlOpcode != AML_INT_NAMEPATH_OP)) + (Op->Common.AmlOpcode != AML_INT_NAMEPATH_OP) && + (Op->Common.AmlOpcode != AML_NOTIFY_OP)) { goto Exit; } + /* Get the NamePath from the appropriate place */ if (OpInfo->Flags & AML_NAMED) @@ -863,6 +875,10 @@ AcpiDmXrefDescendingOp ( Path = NextOp->Common.Value.String; } } + else if (Op->Common.AmlOpcode == AML_NOTIFY_OP) + { + Path = Op->Common.Value.Arg->Asl.Value.String; + } else { Path = Op->Common.Value.String; @@ -880,11 +896,14 @@ AcpiDmXrefDescendingOp ( * The namespace is also used as a lookup table for references to resource * descriptors and the fields within them. */ + Node = NULL; Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, WalkState, &Node); if (ACPI_SUCCESS (Status) && (Node->Flags & ANOBJ_IS_EXTERNAL)) { + /* Node was created by an External() statement */ + Status = AE_NOT_FOUND; } @@ -892,25 +911,38 @@ AcpiDmXrefDescendingOp ( { if (Status == AE_NOT_FOUND) { - AcpiDmAddToExternalList (Op, Path, (UINT8) ObjectType, 0); - /* - * We could install this into the namespace, but we catch duplicate - * externals when they are added to the list. + * Add this symbol as an external declaration, except if the + * parent is a CondRefOf operator. For this operator, we do not + * need an external, nor do we want one, since this can cause + * disassembly problems if the symbol is actually a control + * method. */ -#if 0 - Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY, - ACPI_IMODE_LOAD_PASS1, ACPI_NS_DONT_OPEN_SCOPE, - WalkState, &Node); -#endif + if (!(Op->Asl.Parent && + (Op->Asl.Parent->Asl.AmlOpcode == AML_COND_REF_OF_OP))) + { + if (Node) + { + AcpiDmAddNodeToExternalList (Node, + (UINT8) ObjectType, 0, 0); + } + else + { + AcpiDmAddOpToExternalList (Op, Path, + (UINT8) ObjectType, 0, 0); + } + } } } /* - * Found the node in external table, add it to external list - * Node->OwnerId == 0 indicates built-in ACPI Names, _OS_ etc + * Found the node, but check if it came from an external table. + * Add it to external list. Note: Node->OwnerId == 0 indicates + * one of the built-in ACPI Names (_OS_ etc.) which can safely + * be ignored. */ - else if (Node->OwnerId && WalkState->OwnerId != Node->OwnerId) + else if (Node->OwnerId && + (WalkState->OwnerId != Node->OwnerId)) { ObjectType2 = ObjectType; @@ -924,7 +956,16 @@ AcpiDmXrefDescendingOp ( } } - AcpiDmAddToExternalList (Op, Path, (UINT8) ObjectType2, ParamCount | 0x80); + Pathname = AcpiNsGetExternalPathname (Node); + if (!Pathname) + { + return (AE_NO_MEMORY); + } + + AcpiDmAddNodeToExternalList (Node, (UINT8) ObjectType2, + ParamCount, ACPI_EXT_RESOLVED_REFERENCE); + + ACPI_FREE (Pathname); Op->Common.Node = Node; } else diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/common/ahids.c b/src/add-ons/kernel/bus_managers/acpi/acpica/common/ahids.c new file mode 100644 index 0000000000..af6771b152 --- /dev/null +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/common/ahids.c @@ -0,0 +1,290 @@ +/****************************************************************************** + * + * Module Name: ahids - Table of ACPI/PNP _HID/_CID values + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#include "acpi.h" +#include "accommon.h" + +#define _COMPONENT ACPI_UTILITIES + ACPI_MODULE_NAME ("ahids") + + +/* + * ACPI/PNP Device IDs with description strings + */ +const AH_DEVICE_ID AslDeviceIds[] = +{ + {"10EC5640", "Realtek I2S Audio Codec"}, + {"80860F0A", "Intel Atom UART Controller"}, + {"80860F14", "Intel Baytrail SDIO/MMC Host Controller"}, + {"80860F28", "Intel SST Audio DSP"}, + {"80860F41", "Intel Baytrail I2C Host Controller"}, + {"ACPI0001", "SMBus 1.0 Host Controller"}, + {"ACPI0002", "Smart Battery Subsystem"}, + {"ACPI0003", "Power Source Device"}, + {"ACPI0004", "Module Device"}, + {"ACPI0005", "SMBus 2.0 Host Controller"}, + {"ACPI0006", "GPE Block Device"}, + {"ACPI0007", "Processor Device"}, + {"ACPI0008", "Ambient Light Sensor Device"}, + {"ACPI0009", "I/O xAPIC Device"}, + {"ACPI000A", "I/O APIC Device"}, + {"ACPI000B", "I/O SAPIC Device"}, + {"ACPI000C", "Processor Aggregator Device"}, + {"ACPI000D", "Power Meter Device"}, + {"ACPI000E", "Time and Alarm Device"}, + {"ACPI000F", "User Presence Detection Device"}, + {"ATK4001", "Asus Radio Control Button"}, + {"ATML1000", "Atmel Touchscreen Controller"}, + {"BCM2E39", "Broadcom BT Serial Bus Driver over UART Bus Enumerator"}, + {"CPLM3218", "Capella Micro CM3218x Ambient Light Sensor"}, + {"DELLABCE", "Dell Airplane Mode Switch Driver"}, + {"DLAC3002", "Qualcomm Atheros Bluetooth UART Transport"}, + {"INT0002", "Virtual GPIO Controller"}, + {"INT0800", "Intel 82802 Firmware Hub Device"}, + {"INT3394", "ACPI System Fan"}, + {"INT3396", "Standard Power Management Controller"}, + {"INT33A0", "Intel Smart Connect Technology Device"}, + {"INT33A1", "Intel Power Engine"}, + {"INT33BB", "Intel Baytrail SD Host Controller"}, + {"INT33BD", "Intel Baytrail Mailbox Device"}, + {"INT33C0", "Intel Serial I/O SPI Host Controller"}, + {"INT33C1", "Intel Serial I/O SPI Host Controller"}, + {"INT33C2", "Intel Serial I/O I2C Host Controller"}, + {"INT33C3", "Intel Serial I/O I2C Host Controller"}, + {"INT33C4", "Intel Serial I/O UART Host Controller"}, + {"INT33C5", "Intel Serial I/O UART Host Controller"}, + {"INT33C6", "Intel SD Host Controller"}, + {"INT33C7", "Intel Serial I/O GPIO Host Controller"}, + {"INT33C8", "Intel Smart Sound Technology Host Controller"}, + {"INT33C9", "Wolfson Microelectronics Audio WM5102"}, + {"INT33CA", "Intel SPB Peripheral"}, + {"INT33CB", "Intel Smart Sound Technology Audio Codec"}, + {"INT33D1", "Intel GPIO Buttons"}, + {"INT33D2", "Intel GPIO Buttons"}, + {"INT33D3", "Intel GPIO Buttons"}, + {"INT33D4", "Intel GPIO Buttons"}, + {"INT33D6", "Intel Virtual Buttons Device"}, + {"INT33F0", "Camera Sensor MT9M114"}, + {"INT33FB", "MIPI-CSI Camera Sensor OV2722"}, + {"INT33FC", "Intel Baytrail GPIO Controller"}, + {"INT33FD", "Intel Baytrail Power Management IC"}, + {"INT3400", "Intel Dynamic Power Performance Management"}, + {"INT3401", "Intel Extended Thermal Model CPU"}, + {"INT3403", "DPTF Temperature Sensor"}, + {"INT3406", "Intel Dynamic Platform & Thermal Framework Display Participant"}, + {"INT3407", "DPTF Platform Power Meter"}, + {"INT340E", "Motherboard Resources"}, + {"INT3420", "Intel Bluetooth RF Kill"}, + {"INT3F0D", "ACPI Motherboard Resources"}, + {"INTCF1A", "Sony IMX175 Camera Sensor"}, + {"INTCFD9", "Intel Baytrail SOC GPIO Controller"}, + {"INTL9C60", "Intel Baytrail SOC DMA Controller"}, + {"INVN6500", "InvenSense MPU-6500 Six Axis Gyroscope and Accelerometer"}, + {"LNXCPU", "Linux Logical CPU"}, + {"LNXPOWER", "ACPI Power Resource (power gating)"}, + {"LNXPWRBN", "System Power Button"}, + {"LNXSYBUS", "System Bus"}, + {"LNXSYSTM", "ACPI Root Node"}, + {"LNXTHERM", "ACPI Thermal Zone"}, + {"LNXVIDEO", "ACPI Video Controller"}, + {"MSFT0101", "TPM 2.0 Security Device"}, + {"NXP5442", "NXP 5442 Near Field Communications Controller"}, + {"PNP0000", "8259-compatible Programmable Interrupt Controller"}, + {"PNP0001", "EISA Interrupt Controller"}, + {"PNP0002", "MCA Interrupt Controller"}, + {"PNP0003", "IO-APIC Interrupt Controller"}, + {"PNP0100", "PC-class System Timer"}, + {"PNP0103", "HPET System Timer"}, + {"PNP0200", "PC-class DMA Controller"}, + {"PNP0300", "IBM PC/XT Keyboard Controller (83 key)"}, + {"PNP0301", "IBM PC/XT Keyboard Controller (86 key)"}, + {"PNP0302", "IBM PC/XT Keyboard Controller (84 key)"}, + {"PNP0303", "IBM Enhanced Keyboard (101/102-key, PS/2 Mouse)"}, + {"PNP0400", "Standard LPT Parallel Port"}, + {"PNP0401", "ECP Parallel Port"}, + {"PNP0500", "Standard PC COM Serial Port"}, + {"PNP0501", "16550A-compatible COM Serial Port"}, + {"PNP0510", "Generic IRDA-compatible Device"}, + {"PNP0800", "Microsoft Sound System Compatible Device"}, + {"PNP0A03", "PCI Bus"}, + {"PNP0A05", "Generic Container Device"}, + {"PNP0A06", "Generic Container Device"}, + {"PNP0A08", "PCI Express Bus"}, + {"PNP0B00", "AT Real-Time Clock"}, + {"PNP0B01", "Intel PIIX4-compatible RTC/CMOS Device"}, + {"PNP0B02", "Dallas Semiconductor-compatible RTC/CMOS Device"}, + {"PNP0C01", "System Board"}, + {"PNP0C02", "PNP Motherboard Resources"}, + {"PNP0C04", "x87-compatible Floating Point Processing Unit"}, + {"PNP0C08", "ACPI Core Hardware"}, + {"PNP0C09", "Embedded Controller Device"}, + {"PNP0C0A", "Control Method Battery"}, + {"PNP0C0B", "Fan (Thermal Solution)"}, + {"PNP0C0C", "Power Button Device"}, + {"PNP0C0D", "Lid Device"}, + {"PNP0C0E", "Sleep Button Device"}, + {"PNP0C0F", "PCI Interrupt Link Device"}, + {"PNP0C10", "System Indicator Device"}, + {"PNP0C11", "Thermal Zone"}, + {"PNP0C12", "Device Bay Controller"}, + {"PNP0C14", "Windows Management Instrumentation Device"}, + {"PNP0C15", "Docking Station"}, + {"PNP0C40", "Standard Button Controller"}, + {"PNP0C50", "HID Protocol Device (I2C bus)"}, + {"PNP0C60", "Display Sensor Device"}, + {"PNP0C70", "Dock Sensor Device"}, + {"PNP0C80", "Memory Device"}, + {"PNP0D10", "XHCI USB Controller with debug"}, + {"PNP0D15", "XHCI USB Controller without debug"}, + {"PNP0D20", "EHCI USB Controller without debug"}, + {"PNP0D25", "EHCI USB Controller with debug"}, + {"PNP0D40", "SDA Standard Compliant SD Host Controller"}, + {"PNP0D80", "Windows-compatible System Power Management Controller"}, + {"PNP0F03", "Microsoft PS/2-style Mouse"}, + {"SMO91D0", "Sensor Hub"}, + + {NULL, NULL} +}; + + +/******************************************************************************* + * + * FUNCTION: AcpiAhMatchHardwareId + * + * PARAMETERS: HardwareId - String representation of an _HID or _CID + * + * RETURN: ID info struct. NULL if HardwareId is not found + * + * DESCRIPTION: Lookup an _HID/_CID in the device ID table + * + ******************************************************************************/ + +const AH_DEVICE_ID * +AcpiAhMatchHardwareId ( + char *HardwareId) +{ + const AH_DEVICE_ID *Info; + + + for (Info = AslDeviceIds; Info->Name; Info++) + { + if (!ACPI_STRCMP (HardwareId, Info->Name)) + { + return (Info); + } + } + + return (NULL); +} diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/common/ahpredef.c b/src/add-ons/kernel/bus_managers/acpi/acpica/common/ahpredef.c index 78e1960f0a..7123b7f4dd 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/common/ahpredef.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/common/ahpredef.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -116,6 +116,9 @@ #include "acpi.h" #include "accommon.h" +#define _COMPONENT ACPI_UTILITIES + ACPI_MODULE_NAME ("ahpredef") + /* * iASL only needs a partial table (short descriptions only). * AcpiHelp needs the full table. @@ -166,6 +169,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = AH_PREDEF ("_BTM", "Battery Time", "Returns the battery runtime"), AH_PREDEF ("_BTP", "Battery Trip Point", "Sets a Control Method Battery trip point"), AH_PREDEF ("_CBA", "Configuration Base Address", "Sets the base address for a PCI Express host bridge"), + AH_PREDEF ("_CCA", "Cache Coherency Attribute", "Returns a device's support level for cache coherency"), AH_PREDEF ("_CDM", "Clock Domain", "Returns a logical processor's clock domain identifier"), AH_PREDEF ("_CID", "Compatible ID", "Returns a device's Plug and Play Compatible ID list"), AH_PREDEF ("_CLS", "Class Code", "Returns PCI class code and subclass"), @@ -190,6 +194,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = AH_PREDEF ("_DOS", "Disable Output Switching", "Sets the display output switching mode"), AH_PREDEF ("_DPL", "Device Selection Polarity", "Polarity of Device Selection signal, Resource Descriptor field"), AH_PREDEF ("_DRS", "Drive Strength", "Drive Strength setting for GPIO connection, Resource Descriptor field"), + AH_PREDEF ("_DSD", "Device-Specific Data", "Returns a list of device property information"), AH_PREDEF ("_DSM", "Device-Specific Method", "Executes device-specific functions"), AH_PREDEF ("_DSS", "Device Set State", "Sets the display device state"), AH_PREDEF ("_DSW", "Device Sleep Wake", "Sets the sleep and wake transition states for a device"), @@ -241,6 +246,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = AH_PREDEF ("_LID", "Lid Status", "Returns the open/closed status of the lid on a mobile system"), AH_PREDEF ("_LIN", "Lines In Use", "Handshake lines, Resource Descriptor field"), AH_PREDEF ("_LL_", "Low Level", "Interrupt polarity, Resource Descriptor field"), + AH_PREDEF ("_LPD", "Low Power Dependencies", "Returns a list of dependencies for low power idle entry"), AH_PREDEF ("_MAF", "Maximum Address Fixed", "Resource Descriptor field"), AH_PREDEF ("_MAT", "Multiple APIC Table Entry", "Returns a list of MADT APIC structure entries"), AH_PREDEF ("_MAX", "Maximum Base Address", "Resource Descriptor field"), @@ -393,3 +399,34 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = AH_PREDEF ("_Wxx", "Wake Event", "Method executed as a result of a wake event"), AH_PREDEF (NULL, NULL, NULL) }; + + +/******************************************************************************* + * + * FUNCTION: AcpiAhMatchPredefinedName + * + * PARAMETERS: Nameseg - Predefined name string + * + * RETURN: ID info struct. NULL if Nameseg not found + * + * DESCRIPTION: Lookup a predefined name. + * + ******************************************************************************/ + +const AH_PREDEFINED_NAME * +AcpiAhMatchPredefinedName ( + char *Nameseg) +{ + const AH_PREDEFINED_NAME *Info; + + + for (Info = AslPredefinedInfo; Info->Name; Info++) + { + if (ACPI_COMPARE_NAME (Nameseg, Info->Name)) + { + return (Info); + } + } + + return (NULL); +} diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/common/ahuuids.c b/src/add-ons/kernel/bus_managers/acpi/acpica/common/ahuuids.c new file mode 100644 index 0000000000..1bf362c22a --- /dev/null +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/common/ahuuids.c @@ -0,0 +1,201 @@ +/****************************************************************************** + * + * Module Name: ahuuids - Table of known ACPI-related UUIDs + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#include "acpi.h" +#include "accommon.h" + +#define _COMPONENT ACPI_UTILITIES + ACPI_MODULE_NAME ("ahuuids") + +/* + * Table of "known" (ACPI-related) UUIDs + */ +const AH_UUID AcpiUuids[] = +{ + {"PCI Host Bridge Device", + "33db4d5b-1ff7-401c-9657-7441c03dd766"}, + + {"Platform-wide Capabilities", + "0811b06e-4a27-44f9-8d60-3cbbc22e7b48"}, + + {"Dynamic Enumeration", + "d8c1a3a6-be9b-4c9b-91bf-c3cb81fc5daf"}, + + {"GPIO Controller", + "4f248f40-d5e2-499f-834c-27758ea1cd3f"}, + + {"Battery Thermal Limit", + "4c2067e3-887d-475c-9720-4af1d3ed602e"}, + + {"Thermal Extensions", + "14d399cd-7a27-4b18-8fb4-7cb7b9f4e500"}, + + {"USB Controller", + "ce2ee385-00e6-48cb-9f05-2edb927c4899"}, + + {"HID I2C Device", + "3cdff6f7-4267-4555-ad05-b30a3d8938de"}, + + {"Power Button Device", + "dfbcf3c5-e7a5-44e6-9c1f-29c76f6e059c"}, + + {"Device Labeling Interface", + "e5c937d0-3553-4d7a-9117-ea4d19c3434d"}, + + {"SATA Controller", + "e4db149b-fcfe-425b-a6d8-92357d78fc7f"}, + + {"Physical Presence Interface", + "3dddfaa6-361b-4eb4-a424-8d10089d1653"}, + + {NULL, NULL} +}; + + +/******************************************************************************* + * + * FUNCTION: AcpiAhMatchUuid + * + * PARAMETERS: Data - Data buffer containing a UUID + * + * RETURN: ASCII description string for the UUID if it is found. + * + * DESCRIPTION: Returns a description string for "known" UUIDs, which are + * are UUIDs that are related to ACPI in some way. + * + ******************************************************************************/ + +const char * +AcpiAhMatchUuid ( + UINT8 *Data) +{ + const AH_UUID *Info; + UINT8 UuidBuffer[UUID_BUFFER_LENGTH]; + + + /* Walk the table of known ACPI-related UUIDs */ + + for (Info = AcpiUuids; Info->Description; Info++) + { + AcpiUtConvertStringToUuid (Info->String, UuidBuffer); + + if (!ACPI_MEMCMP (Data, UuidBuffer, UUID_BUFFER_LENGTH)) + { + return (Info->Description); + } + } + + return (NULL); +} diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/common/cmfsize.c b/src/add-ons/kernel/bus_managers/acpi/acpica/common/cmfsize.c new file mode 100644 index 0000000000..15116830c9 --- /dev/null +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/common/cmfsize.c @@ -0,0 +1,185 @@ +/****************************************************************************** + * + * Module Name: cfsize - Common get file size function + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#include "acpi.h" +#include "accommon.h" +#include "acapps.h" +#include + +#define _COMPONENT ACPI_TOOLS + ACPI_MODULE_NAME ("cmfsize") + + +/******************************************************************************* + * + * FUNCTION: CmGetFileSize + * + * PARAMETERS: File - Open file descriptor + * + * RETURN: File Size. On error, -1 (ACPI_UINT32_MAX) + * + * DESCRIPTION: Get the size of a file. Uses seek-to-EOF. File must be open. + * Does not disturb the current file pointer. + * + ******************************************************************************/ + +UINT32 +CmGetFileSize ( + ACPI_FILE File) +{ + long FileSize; + long CurrentOffset; + ACPI_STATUS Status; + + + /* Save the current file pointer, seek to EOF to obtain file size */ + + CurrentOffset = AcpiOsGetFileOffset (File); + if (CurrentOffset < 0) + { + goto OffsetError; + } + + Status = AcpiOsSetFileOffset (File, 0, ACPI_FILE_END); + if (ACPI_FAILURE (Status)) + { + goto SeekError; + } + + FileSize = AcpiOsGetFileOffset (File); + if (FileSize < 0) + { + goto OffsetError; + } + + /* Restore original file pointer */ + + Status = AcpiOsSetFileOffset (File, CurrentOffset, ACPI_FILE_BEGIN); + if (ACPI_FAILURE (Status)) + { + goto SeekError; + } + + return ((UINT32) FileSize); + + +OffsetError: + AcpiLogError ("Could not get file offset"); + return (ACPI_UINT32_MAX); + +SeekError: + AcpiLogError ("Could not set file offset"); + return (ACPI_UINT32_MAX); +} diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/common/dmextern.c b/src/add-ons/kernel/bus_managers/acpi/acpica/common/dmextern.c index 9ad80930e1..30196dff04 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/common/dmextern.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/common/dmextern.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -139,7 +139,7 @@ */ static const char *AcpiGbl_DmTypeNames[] = { - /* 00 */ "", /* Type ANY */ + /* 00 */ ", UnknownObj", /* Type ANY */ /* 01 */ ", IntObj", /* 02 */ ", StrObj", /* 03 */ ", BuffObj", @@ -176,10 +176,19 @@ AcpiDmNormalizeParentPrefix ( char *Path); static void -AcpiDmAddToExternalListFromFile ( +AcpiDmAddPathToExternalList ( char *Path, UINT8 Type, - UINT32 Value); + UINT32 Value, + UINT16 Flags); + +static ACPI_STATUS +AcpiDmCreateNewExternal ( + char *ExternalPath, + char *InternalPath, + UINT8 Type, + UINT32 Value, + UINT16 Flags); /******************************************************************************* @@ -351,48 +360,41 @@ Cleanup: ACPI_STATUS AcpiDmAddToExternalFileList ( - char *PathList) + char *Pathname) { ACPI_EXTERNAL_FILE *ExternalFile; - char *Path; - char *TmpPath; + char *LocalPathname; - if (!PathList) + if (!Pathname) { return (AE_OK); } - Path = strtok (PathList, ","); - - while (Path) + LocalPathname = ACPI_ALLOCATE (strlen (Pathname) + 1); + if (!LocalPathname) { - TmpPath = ACPI_ALLOCATE_ZEROED (ACPI_STRLEN (Path) + 1); - if (!TmpPath) - { - return (AE_NO_MEMORY); - } - - ACPI_STRCPY (TmpPath, Path); - - ExternalFile = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EXTERNAL_FILE)); - if (!ExternalFile) - { - ACPI_FREE (TmpPath); - return (AE_NO_MEMORY); - } - - ExternalFile->Path = TmpPath; - - if (AcpiGbl_ExternalFileList) - { - ExternalFile->Next = AcpiGbl_ExternalFileList; - } - - AcpiGbl_ExternalFileList = ExternalFile; - Path = strtok (NULL, ","); + return (AE_NO_MEMORY); } + ExternalFile = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EXTERNAL_FILE)); + if (!ExternalFile) + { + ACPI_FREE (LocalPathname); + return (AE_NO_MEMORY); + } + + /* Take a copy of the file pathname */ + + strcpy (LocalPathname, Pathname); + ExternalFile->Path = LocalPathname; + + if (AcpiGbl_ExternalFileList) + { + ExternalFile->Next = AcpiGbl_ExternalFileList; + } + + AcpiGbl_ExternalFileList = ExternalFile; return (AE_OK); } @@ -426,196 +428,6 @@ AcpiDmClearExternalFileList ( } -/******************************************************************************* - * - * FUNCTION: AcpiDmAddToExternalList - * - * PARAMETERS: Op - Current parser Op - * Path - Internal (AML) path to the object - * Type - ACPI object type to be added - * Value - Arg count if adding a Method object - * - * RETURN: None - * - * DESCRIPTION: Insert a new name into the global list of Externals which - * will in turn be later emitted as an External() declaration - * in the disassembled output. - * - ******************************************************************************/ - -void -AcpiDmAddToExternalList ( - ACPI_PARSE_OBJECT *Op, - char *Path, - UINT8 Type, - UINT32 Value) -{ - char *ExternalPath; - char *Fullpath = NULL; - ACPI_EXTERNAL_LIST *NewExternal; - ACPI_EXTERNAL_LIST *NextExternal; - ACPI_EXTERNAL_LIST *PrevExternal = NULL; - ACPI_STATUS Status; - BOOLEAN Resolved = FALSE; - - - if (!Path) - { - return; - } - - if (Type == ACPI_TYPE_METHOD) - { - if (Value & 0x80) - { - Resolved = TRUE; - } - Value &= 0x07; - } - - /* - * We don't want External() statements to contain a leading '\'. - * This prevents duplicate external statements of the form: - * - * External (\ABCD) - * External (ABCD) - * - * This would cause a compile time error when the disassembled - * output file is recompiled. - */ - if ((*Path == AML_ROOT_PREFIX) && (Path[1])) - { - Path++; - } - - /* Externalize the ACPI pathname */ - - Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, Path, - NULL, &ExternalPath); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* - * Get the full pathname from the root if "Path" has one or more - * parent prefixes (^). Note: path will not contain a leading '\'. - */ - if (*Path == (UINT8) AML_PARENT_PREFIX) - { - Fullpath = AcpiDmNormalizeParentPrefix (Op, ExternalPath); - if (Fullpath) - { - /* Set new external path */ - - ACPI_FREE (ExternalPath); - ExternalPath = Fullpath; - } - } - - /* Check all existing externals to ensure no duplicates */ - - NextExternal = AcpiGbl_ExternalList; - while (NextExternal) - { - if (!ACPI_STRCMP (ExternalPath, NextExternal->Path)) - { - /* Duplicate method, check that the Value (ArgCount) is the same */ - - if ((NextExternal->Type == ACPI_TYPE_METHOD) && - (NextExternal->Value != Value)) - { - ACPI_ERROR ((AE_INFO, - "External method arg count mismatch %s: Current %u, attempted %u", - NextExternal->Path, NextExternal->Value, Value)); - } - - /* Allow upgrade of type from ANY */ - - else if (NextExternal->Type == ACPI_TYPE_ANY) - { - NextExternal->Type = Type; - NextExternal->Value = Value; - } - - ACPI_FREE (ExternalPath); - return; - } - - NextExternal = NextExternal->Next; - } - - /* Allocate and init a new External() descriptor */ - - NewExternal = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EXTERNAL_LIST)); - if (!NewExternal) - { - ACPI_FREE (ExternalPath); - return; - } - - NewExternal->Path = ExternalPath; - NewExternal->Type = Type; - NewExternal->Value = Value; - NewExternal->Resolved = Resolved; - NewExternal->Length = (UINT16) ACPI_STRLEN (ExternalPath); - - /* Was the external path with parent prefix normalized to a fullpath? */ - - if (Fullpath == ExternalPath) - { - /* Get new internal path */ - - Status = AcpiNsInternalizeName (ExternalPath, &Path); - if (ACPI_FAILURE (Status)) - { - ACPI_FREE (ExternalPath); - ACPI_FREE (NewExternal); - return; - } - - /* Set flag to indicate External->InternalPath need to be freed */ - - NewExternal->Flags |= ACPI_IPATH_ALLOCATED; - } - - NewExternal->InternalPath = Path; - - /* Link the new descriptor into the global list, alphabetically ordered */ - - NextExternal = AcpiGbl_ExternalList; - while (NextExternal) - { - if (AcpiUtStricmp (NewExternal->Path, NextExternal->Path) < 0) - { - if (PrevExternal) - { - PrevExternal->Next = NewExternal; - } - else - { - AcpiGbl_ExternalList = NewExternal; - } - - NewExternal->Next = NextExternal; - return; - } - - PrevExternal = NextExternal; - NextExternal = NextExternal->Next; - } - - if (PrevExternal) - { - PrevExternal->Next = NewExternal; - } - else - { - AcpiGbl_ExternalList = NewExternal; - } -} - - /******************************************************************************* * * FUNCTION: AcpiDmGetExternalsFromFile @@ -657,6 +469,7 @@ AcpiDmGetExternalsFromFile ( { fprintf (stderr, "Could not open external reference file \"%s\"\n", Gbl_ExternalRefFilename); + AslAbort (); return; } @@ -665,18 +478,37 @@ AcpiDmGetExternalsFromFile ( while (fgets (StringBuffer, ASL_MSG_BUFFER_SIZE, ExternalRefFile)) { Token = strtok (StringBuffer, METHOD_SEPARATORS); /* "External" */ - if (!Token) continue; - if (strcmp (Token, "External")) continue; + if (!Token) + { + continue; + } + if (strcmp (Token, "External")) + { + continue; + } MethodName = strtok (NULL, METHOD_SEPARATORS); /* Method namepath */ - if (!MethodName) continue; + if (!MethodName) + { + continue; + } Token = strtok (NULL, METHOD_SEPARATORS); /* "MethodObj" */ - if (!Token) continue; - if (strcmp (Token, "MethodObj")) continue; + if (!Token) + { + continue; + } + + if (strcmp (Token, "MethodObj")) + { + continue; + } Token = strtok (NULL, METHOD_SEPARATORS); /* Arg count */ - if (!Token) continue; + if (!Token) + { + continue; + } /* Convert arg count string to an integer */ @@ -698,7 +530,8 @@ AcpiDmGetExternalsFromFile ( AcpiOsPrintf ("%s: Importing method external (%u arguments) %s\n", Gbl_ExternalRefFilename, ArgCount, MethodName); - AcpiDmAddToExternalListFromFile (MethodName, ACPI_TYPE_METHOD, ArgCount | 0x80); + AcpiDmAddPathToExternalList (MethodName, ACPI_TYPE_METHOD, + ArgCount, (ACPI_EXT_RESOLVED_REFERENCE | ACPI_EXT_ORIGIN_FROM_FILE)); ImportCount++; } @@ -723,11 +556,13 @@ AcpiDmGetExternalsFromFile ( /******************************************************************************* * - * FUNCTION: AcpiDmAddToExternalListFromFile + * FUNCTION: AcpiDmAddOpToExternalList * - * PARAMETERS: Path - Internal (AML) path to the object + * PARAMETERS: Op - Current parser Op + * Path - Internal (AML) path to the object * Type - ACPI object type to be added * Value - Arg count if adding a Method object + * Flags - To be passed to the external object * * RETURN: None * @@ -735,73 +570,325 @@ AcpiDmGetExternalsFromFile ( * will in turn be later emitted as an External() declaration * in the disassembled output. * + * This function handles the most common case where the referenced + * name is simply not found in the constructed namespace. + * ******************************************************************************/ -static void -AcpiDmAddToExternalListFromFile ( +void +AcpiDmAddOpToExternalList ( + ACPI_PARSE_OBJECT *Op, char *Path, UINT8 Type, - UINT32 Value) + UINT32 Value, + UINT16 Flags) { - char *InternalPath; char *ExternalPath; - ACPI_EXTERNAL_LIST *NewExternal; - ACPI_EXTERNAL_LIST *NextExternal; - ACPI_EXTERNAL_LIST *PrevExternal = NULL; + char *InternalPath = Path; + char *Temp; ACPI_STATUS Status; - BOOLEAN Resolved = FALSE; + + + ACPI_FUNCTION_TRACE (DmAddOpToExternalList); if (!Path) { - return; + return_VOID; } - /* TBD: Add a flags parameter */ + /* Remove a root backslash if present */ - if (Type == ACPI_TYPE_METHOD) - { - if (Value & 0x80) - { - Resolved = TRUE; - } - Value &= 0x07; - } - - /* - * We don't want External() statements to contain a leading '\'. - * This prevents duplicate external statements of the form: - * - * External (\ABCD) - * External (ABCD) - * - * This would cause a compile time error when the disassembled - * output file is recompiled. - */ if ((*Path == AML_ROOT_PREFIX) && (Path[1])) { Path++; } + /* Externalize the pathname */ + + Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, Path, + NULL, &ExternalPath); + if (ACPI_FAILURE (Status)) + { + return_VOID; + } + + /* + * Get the full pathname from the root if "Path" has one or more + * parent prefixes (^). Note: path will not contain a leading '\'. + */ + if (*Path == (UINT8) AML_PARENT_PREFIX) + { + Temp = AcpiDmNormalizeParentPrefix (Op, ExternalPath); + + /* Set new external path */ + + ACPI_FREE (ExternalPath); + ExternalPath = Temp; + if (!Temp) + { + return_VOID; + } + + /* Create the new internal pathname */ + + Flags |= ACPI_EXT_INTERNAL_PATH_ALLOCATED; + Status = AcpiNsInternalizeName (ExternalPath, &InternalPath); + if (ACPI_FAILURE (Status)) + { + ACPI_FREE (ExternalPath); + return_VOID; + } + } + + /* Create the new External() declaration node */ + + Status = AcpiDmCreateNewExternal (ExternalPath, InternalPath, + Type, Value, Flags); + if (ACPI_FAILURE (Status)) + { + ACPI_FREE (ExternalPath); + if (Flags & ACPI_EXT_INTERNAL_PATH_ALLOCATED) + { + ACPI_FREE (InternalPath); + } + } + + return_VOID; +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmAddNodeToExternalList + * + * PARAMETERS: Node - Namespace node for object to be added + * Type - ACPI object type to be added + * Value - Arg count if adding a Method object + * Flags - To be passed to the external object + * + * RETURN: None + * + * DESCRIPTION: Insert a new name into the global list of Externals which + * will in turn be later emitted as an External() declaration + * in the disassembled output. + * + * This function handles the case where the referenced name has + * been found in the namespace, but the name originated in a + * table other than the one that is being disassembled (such + * as a table that is added via the iASL -e option). + * + ******************************************************************************/ + +void +AcpiDmAddNodeToExternalList ( + ACPI_NAMESPACE_NODE *Node, + UINT8 Type, + UINT32 Value, + UINT16 Flags) +{ + char *ExternalPath; + char *InternalPath; + char *Temp; + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (DmAddNodeToExternalList); + + + if (!Node) + { + return_VOID; + } + + /* Get the full external and internal pathnames to the node */ + + ExternalPath = AcpiNsGetExternalPathname (Node); + if (!ExternalPath) + { + return_VOID; + } + + Status = AcpiNsInternalizeName (ExternalPath, &InternalPath); + if (ACPI_FAILURE (Status)) + { + ACPI_FREE (ExternalPath); + return_VOID; + } + + /* Remove the root backslash */ + + if ((*ExternalPath == AML_ROOT_PREFIX) && (ExternalPath[1])) + { + Temp = ACPI_ALLOCATE_ZEROED (ACPI_STRLEN (ExternalPath) + 1); + if (!Temp) + { + return_VOID; + } + + ACPI_STRCPY (Temp, &ExternalPath[1]); + ACPI_FREE (ExternalPath); + ExternalPath = Temp; + } + + /* Create the new External() declaration node */ + + Status = AcpiDmCreateNewExternal (ExternalPath, InternalPath, Type, + Value, (Flags | ACPI_EXT_INTERNAL_PATH_ALLOCATED)); + if (ACPI_FAILURE (Status)) + { + ACPI_FREE (ExternalPath); + ACPI_FREE (InternalPath); + } + + return_VOID; +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmAddPathToExternalList + * + * PARAMETERS: Path - External name of the object to be added + * Type - ACPI object type to be added + * Value - Arg count if adding a Method object + * Flags - To be passed to the external object + * + * RETURN: None + * + * DESCRIPTION: Insert a new name into the global list of Externals which + * will in turn be later emitted as an External() declaration + * in the disassembled output. + * + * This function currently is used to add externals via a + * reference file (via the -fe iASL option). + * + ******************************************************************************/ + +static void +AcpiDmAddPathToExternalList ( + char *Path, + UINT8 Type, + UINT32 Value, + UINT16 Flags) +{ + char *InternalPath; + char *ExternalPath; + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (DmAddPathToExternalList); + + + if (!Path) + { + return_VOID; + } + + /* Remove a root backslash if present */ + + if ((*Path == AML_ROOT_PREFIX) && (Path[1])) + { + Path++; + } + + /* Create the internal and external pathnames */ + + Status = AcpiNsInternalizeName (Path, &InternalPath); + if (ACPI_FAILURE (Status)) + { + return_VOID; + } + + Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, InternalPath, + NULL, &ExternalPath); + if (ACPI_FAILURE (Status)) + { + ACPI_FREE (InternalPath); + return_VOID; + } + + /* Create the new External() declaration node */ + + Status = AcpiDmCreateNewExternal (ExternalPath, InternalPath, + Type, Value, (Flags | ACPI_EXT_INTERNAL_PATH_ALLOCATED)); + if (ACPI_FAILURE (Status)) + { + ACPI_FREE (ExternalPath); + ACPI_FREE (InternalPath); + } + + return_VOID; +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmCreateNewExternal + * + * PARAMETERS: ExternalPath - External path to the object + * InternalPath - Internal (AML) path to the object + * Type - ACPI object type to be added + * Value - Arg count if adding a Method object + * Flags - To be passed to the external object + * + * RETURN: Status + * + * DESCRIPTION: Common low-level function to insert a new name into the global + * list of Externals which will in turn be later emitted as + * External() declarations in the disassembled output. + * + * Note: The external name should not include a root prefix + * (backslash). We do not want External() statements to contain + * a leading '\', as this prevents duplicate external statements + * of the form: + * + * External (\ABCD) + * External (ABCD) + * + * This would cause a compile time error when the disassembled + * output file is recompiled. + * + * There are two cases that are handled here. For both, we emit + * an External() statement: + * 1) The name was simply not found in the namespace. + * 2) The name was found, but it originated in a table other than + * the table that is being disassembled. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDmCreateNewExternal ( + char *ExternalPath, + char *InternalPath, + UINT8 Type, + UINT32 Value, + UINT16 Flags) +{ + ACPI_EXTERNAL_LIST *NewExternal; + ACPI_EXTERNAL_LIST *NextExternal; + ACPI_EXTERNAL_LIST *PrevExternal = NULL; + + + ACPI_FUNCTION_TRACE (DmCreateNewExternal); + + /* Check all existing externals to ensure no duplicates */ NextExternal = AcpiGbl_ExternalList; while (NextExternal) { - if (!ACPI_STRCMP (Path, NextExternal->Path)) + if (!ACPI_STRCMP (ExternalPath, NextExternal->Path)) { /* Duplicate method, check that the Value (ArgCount) is the same */ if ((NextExternal->Type == ACPI_TYPE_METHOD) && - (NextExternal->Value != Value)) + (NextExternal->Value != Value) && + (Value > 0)) { ACPI_ERROR ((AE_INFO, - "(File) External method arg count mismatch %s: Current %u, override to %u", + "External method arg count mismatch %s: Current %u, attempted %u", NextExternal->Path, NextExternal->Value, Value)); - - /* Override, since new value came from external reference file */ - - NextExternal->Value = Value; } /* Allow upgrade of type from ANY */ @@ -812,44 +899,31 @@ AcpiDmAddToExternalListFromFile ( NextExternal->Value = Value; } - return; + return_ACPI_STATUS (AE_ALREADY_EXISTS); } NextExternal = NextExternal->Next; } - /* Get the internal pathname (AML format) */ - - Status = AcpiNsInternalizeName (Path, &InternalPath); - if (ACPI_FAILURE (Status)) - { - return; - } - /* Allocate and init a new External() descriptor */ NewExternal = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EXTERNAL_LIST)); if (!NewExternal) { - ACPI_FREE (InternalPath); - return; + return_ACPI_STATUS (AE_NO_MEMORY); } - /* Must copy and normalize the input path */ - - AcpiNsExternalizeName (ACPI_UINT32_MAX, InternalPath, NULL, &ExternalPath); + ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, + "Adding external reference node (%s) type [%s]\n", + ExternalPath, AcpiUtGetTypeName (Type))); + NewExternal->Flags = Flags; + NewExternal->Value = Value; NewExternal->Path = ExternalPath; NewExternal->Type = Type; - NewExternal->Value = Value; - NewExternal->Resolved = Resolved; - NewExternal->Length = (UINT16) ACPI_STRLEN (Path); + NewExternal->Length = (UINT16) ACPI_STRLEN (ExternalPath); NewExternal->InternalPath = InternalPath; - /* Set flag to indicate External->InternalPath needs to be freed */ - - NewExternal->Flags |= ACPI_IPATH_ALLOCATED | ACPI_FROM_REFERENCE_FILE; - /* Link the new descriptor into the global list, alphabetically ordered */ NextExternal = AcpiGbl_ExternalList; @@ -867,7 +941,7 @@ AcpiDmAddToExternalListFromFile ( } NewExternal->Next = NextExternal; - return; + return_ACPI_STATUS (AE_OK); } PrevExternal = NextExternal; @@ -882,6 +956,8 @@ AcpiDmAddToExternalListFromFile ( { AcpiGbl_ExternalList = NewExternal; } + + return_ACPI_STATUS (AE_OK); } @@ -1057,7 +1133,7 @@ AcpiDmEmitExternals ( if (NextExternal->Type == ACPI_TYPE_METHOD) { AcpiGbl_NumExternalMethods++; - if (NextExternal->Resolved) + if (NextExternal->Flags & ACPI_EXT_RESOLVED_REFERENCE) { AcpiGbl_ResolvedExternalMethods++; } @@ -1076,18 +1152,17 @@ AcpiDmEmitExternals ( while (NextExternal) { if ((NextExternal->Type == ACPI_TYPE_METHOD) && - (!NextExternal->Resolved)) + (!(NextExternal->Flags & ACPI_EXT_RESOLVED_REFERENCE))) { AcpiOsPrintf (" External (%s%s", NextExternal->Path, AcpiDmGetObjectTypeName (NextExternal->Type)); - AcpiOsPrintf ( - ") // Warning: Unresolved Method, " - "guessing %u arguments (may be incorrect, see warning above)\n", + AcpiOsPrintf (") // Warning: Unresolved method, " + "guessing %u arguments\n", NextExternal->Value); - NextExternal->Emitted = TRUE; + NextExternal->Flags |= ACPI_EXT_EXTERNAL_EMITTED; } NextExternal = NextExternal->Next; @@ -1108,7 +1183,8 @@ AcpiDmEmitExternals ( NextExternal = AcpiGbl_ExternalList; while (NextExternal) { - if (!NextExternal->Emitted && (NextExternal->Flags & ACPI_FROM_REFERENCE_FILE)) + if (!(NextExternal->Flags & ACPI_EXT_EXTERNAL_EMITTED) && + (NextExternal->Flags & ACPI_EXT_ORIGIN_FROM_FILE)) { AcpiOsPrintf (" External (%s%s", NextExternal->Path, @@ -1123,7 +1199,7 @@ AcpiDmEmitExternals ( { AcpiOsPrintf (")\n"); } - NextExternal->Emitted = TRUE; + NextExternal->Flags |= ACPI_EXT_EXTERNAL_EMITTED; } NextExternal = NextExternal->Next; @@ -1137,7 +1213,7 @@ AcpiDmEmitExternals ( */ while (AcpiGbl_ExternalList) { - if (!AcpiGbl_ExternalList->Emitted) + if (!(AcpiGbl_ExternalList->Flags & ACPI_EXT_EXTERNAL_EMITTED)) { AcpiOsPrintf (" External (%s%s", AcpiGbl_ExternalList->Path, @@ -1159,7 +1235,7 @@ AcpiDmEmitExternals ( /* Free this external info block and move on to next external */ NextExternal = AcpiGbl_ExternalList->Next; - if (AcpiGbl_ExternalList->Flags & ACPI_IPATH_ALLOCATED) + if (AcpiGbl_ExternalList->Flags & ACPI_EXT_INTERNAL_PATH_ALLOCATED) { ACPI_FREE (AcpiGbl_ExternalList->InternalPath); } @@ -1281,12 +1357,24 @@ AcpiDmUnresolvedWarning ( " * were not specified. This resulting disassembler output file may not\n" " * compile because the disassembler did not know how many arguments\n" " * to assign to these methods. To specify the tables needed to resolve\n" - " * external control method references, use the one of the following\n" - " * example iASL invocations:\n" - " * iasl -e -d \n" - " * iasl -e -d \n" + " * external control method references, the -e option can be used to\n" + " * specify the filenames. Example iASL invocations:\n" + " * iasl -e ssdt1.aml ssdt2.aml ssdt3.aml -d dsdt.aml\n" + " * iasl -e dsdt.aml ssdt2.aml -d ssdt1.aml\n" + " * iasl -e ssdt*.aml -d dsdt.aml\n" + " *\n" + " * In addition, the -fe option can be used to specify a file containing\n" + " * control method external declarations with the associated method\n" + " * argument counts. Each line of the file must be of the form:\n" + " * External (, MethodObj, )\n" + " * Invocation:\n" + " * iasl -fe refs.txt -d dsdt.aml\n" + " *\n" + " * The following methods were unresolved and many not compile properly\n" + " * because the disassembler had to guess at the number of arguments\n" + " * required for each:\n" " */\n", - AcpiGbl_NumExternalMethods); + AcpiGbl_NumExternalMethods); } else if (AcpiGbl_NumExternalMethods != AcpiGbl_ResolvedExternalMethods) { @@ -1295,10 +1383,21 @@ AcpiDmUnresolvedWarning ( AcpiOsPrintf (" /*\n" " * iASL Warning: There were %u external control methods found during\n" " * disassembly, but only %u %s resolved (%u unresolved). Additional\n" - " * ACPI tables are required to properly disassemble the code. This\n" + " * ACPI tables may be required to properly disassemble the code. This\n" " * resulting disassembler output file may not compile because the\n" " * disassembler did not know how many arguments to assign to the\n" " * unresolved methods.\n" + " *\n" + " * If necessary, the -fe option can be used to specify a file containing\n" + " * control method external declarations with the associated method\n" + " * argument counts. Each line of the file must be of the form:\n" + " * External (, MethodObj, )\n" + " * Invocation:\n" + " * iasl -fe refs.txt -d dsdt.aml\n" + " *\n" + " * The following methods were unresolved and many not compile properly\n" + " * because the disassembler had to guess at the number of arguments\n" + " * required for each:\n" " */\n", AcpiGbl_NumExternalMethods, AcpiGbl_ResolvedExternalMethods, (AcpiGbl_ResolvedExternalMethods > 1 ? "were" : "was"), @@ -1317,10 +1416,18 @@ AcpiDmUnresolvedWarning ( "were not specified. The resulting disassembler output file may not\n" "compile because the disassembler did not know how many arguments\n" "to assign to these methods. To specify the tables needed to resolve\n" - "external control method references, use the one of the following\n" - "example iASL invocations:\n" - " iasl -e -d \n" - " iasl -e -d \n", + "external control method references, the -e option can be used to\n" + "specify the filenames. Example iASL invocations:\n" + " iasl -e ssdt1.aml ssdt2.aml ssdt3.aml -d dsdt.aml\n" + " iasl -e dsdt.aml ssdt2.aml -d ssdt1.aml\n" + " iasl -e ssdt*.aml -d dsdt.aml\n" + "\n" + "In addition, the -fe option can be used to specify a file containing\n" + "control method external declarations with the associated method\n" + "argument counts. Each line of the file must be of the form:\n" + " External (, MethodObj, )\n" + "Invocation:\n" + " iasl -fe refs.txt -d dsdt.aml\n", AcpiGbl_NumExternalMethods); } else if (AcpiGbl_NumExternalMethods != AcpiGbl_ResolvedExternalMethods) @@ -1330,10 +1437,17 @@ AcpiDmUnresolvedWarning ( fprintf (stderr, "\n" "iASL Warning: There were %u external control methods found during\n" "disassembly, but only %u %s resolved (%u unresolved). Additional\n" - "ACPI tables are required to properly disassemble the code. The\n" + "ACPI tables may be required to properly disassemble the code. The\n" "resulting disassembler output file may not compile because the\n" "disassembler did not know how many arguments to assign to the\n" - "unresolved methods.\n", + "unresolved methods.\n" + "\n" + "If necessary, the -fe option can be used to specify a file containing\n" + "control method external declarations with the associated method\n" + "argument counts. Each line of the file must be of the form:\n" + " External (, MethodObj, )\n" + "Invocation:\n" + " iasl -fe refs.txt -d dsdt.aml\n", AcpiGbl_NumExternalMethods, AcpiGbl_ResolvedExternalMethods, (AcpiGbl_ResolvedExternalMethods > 1 ? "were" : "was"), (AcpiGbl_NumExternalMethods - AcpiGbl_ResolvedExternalMethods)); diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/common/dmrestag.c b/src/add-ons/kernel/bus_managers/acpi/acpica/common/dmrestag.c index 6f12f749c8..7eca155814 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/common/dmrestag.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/common/dmrestag.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/common/dmtable.c b/src/add-ons/kernel/bus_managers/acpi/acpica/common/dmtable.c index fa7b30085f..efb50b5603 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/common/dmtable.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/common/dmtable.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -159,9 +159,21 @@ static const char *AcpiDmDmarSubnames[] = "Reserved Memory Region", "Root Port ATS Capability", "Remapping Hardware Static Affinity", + "ACPI Namespace Device Declaration", "Unknown SubTable Type" /* Reserved */ }; +static const char *AcpiDmDmarScope[] = +{ + "Reserved value", + "PCI Endpoint Device", + "PCI Bridge Device", + "IOAPIC Device", + "Message-capable HPET Device", + "Namespace Device", + "Unknown Scope Type" /* Reserved */ +}; + static const char *AcpiDmEinjActions[] = { "Begin Operation", @@ -232,6 +244,13 @@ static const char *AcpiDmErstInstructions[] = "Unknown Instruction" }; +static const char *AcpiDmGtdtSubnames[] = +{ + "Generic Timer Block", + "Generic Watchdog Timer", + "Unknown SubTable Type" /* Reserved */ +}; + static const char *AcpiDmHestSubnames[] = { "IA-32 Machine Check Exception", @@ -261,20 +280,29 @@ static const char *AcpiDmHestNotifySubnames[] = static const char *AcpiDmMadtSubnames[] = { - "Processor Local APIC", /* ACPI_MADT_TYPE_LOCAL_APIC */ - "I/O APIC", /* ACPI_MADT_TYPE_IO_APIC */ - "Interrupt Source Override", /* ACPI_MADT_TYPE_INTERRUPT_OVERRIDE */ - "NMI Source", /* ACPI_MADT_TYPE_NMI_SOURCE */ - "Local APIC NMI", /* ACPI_MADT_TYPE_LOCAL_APIC_NMI */ - "Local APIC Address Override", /* ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE */ - "I/O SAPIC", /* ACPI_MADT_TYPE_IO_SAPIC */ - "Local SAPIC", /* ACPI_MADT_TYPE_LOCAL_SAPIC */ - "Platform Interrupt Sources", /* ACPI_MADT_TYPE_INTERRUPT_SOURCE */ - "Processor Local x2APIC", /* ACPI_MADT_TYPE_LOCAL_X2APIC */ - "Local x2APIC NMI", /* ACPI_MADT_TYPE_LOCAL_X2APIC_NMI */ - "Generic Interrupt Controller", /* ACPI_MADT_GENERIC_INTERRUPT */ - "Generic Interrupt Distributor",/* ACPI_MADT_GENERIC_DISTRIBUTOR */ - "Unknown SubTable Type" /* Reserved */ + "Processor Local APIC", /* ACPI_MADT_TYPE_LOCAL_APIC */ + "I/O APIC", /* ACPI_MADT_TYPE_IO_APIC */ + "Interrupt Source Override", /* ACPI_MADT_TYPE_INTERRUPT_OVERRIDE */ + "NMI Source", /* ACPI_MADT_TYPE_NMI_SOURCE */ + "Local APIC NMI", /* ACPI_MADT_TYPE_LOCAL_APIC_NMI */ + "Local APIC Address Override", /* ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE */ + "I/O SAPIC", /* ACPI_MADT_TYPE_IO_SAPIC */ + "Local SAPIC", /* ACPI_MADT_TYPE_LOCAL_SAPIC */ + "Platform Interrupt Sources", /* ACPI_MADT_TYPE_INTERRUPT_SOURCE */ + "Processor Local x2APIC", /* ACPI_MADT_TYPE_LOCAL_X2APIC */ + "Local x2APIC NMI", /* ACPI_MADT_TYPE_LOCAL_X2APIC_NMI */ + "Generic Interrupt Controller", /* ACPI_MADT_GENERIC_INTERRUPT */ + "Generic Interrupt Distributor", /* ACPI_MADT_GENERIC_DISTRIBUTOR */ + "Generic MSI Frame", /* ACPI_MADT_GENERIC_MSI_FRAME */ + "Generic Interrupt Redistributor", /* ACPI_MADT_GENERIC_REDISTRIBUTOR */ + "Unknown SubTable Type" /* Reserved */ +}; + +static const char *AcpiDmPcctSubnames[] = +{ + "Generic Communications Subspace", /* ACPI_PCCT_TYPE_GENERIC_SUBSPACE */ + "HW-Reduced Communications Subspace", + "Unknown SubTable Type" /* Reserved */ }; static const char *AcpiDmPmttSubnames[] = @@ -307,6 +335,12 @@ static const char *AcpiDmIvrsSubnames[] = "Unknown SubTable Type" /* Reserved */ }; +static const char *AcpiDmLpitSubnames[] = +{ + "Native C-state Idle Structure", + "Simple I/O Idle Structure", + "Unknown SubTable Type" /* Reserved */ +}; #define ACPI_FADT_PM_RESERVED 9 @@ -358,7 +392,7 @@ ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, TemplateBoot, "Simple Boot Flag Table"}, {ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, DtCompileCpep, TemplateCpep, "Corrected Platform Error Polling table"}, {ACPI_SIG_CSRT, NULL, AcpiDmDumpCsrt, DtCompileCsrt, TemplateCsrt, "Core System Resource Table"}, - {ACPI_SIG_DBG2, NULL, AcpiDmDumpDbg2, NULL, NULL, "Debug Port table type 2"}, + {ACPI_SIG_DBG2, AcpiDmTableInfoDbg2, AcpiDmDumpDbg2, DtCompileDbg2, TemplateDbg2, "Debug Port table type 2"}, {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, NULL, TemplateDbgp, "Debug Port table"}, {ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, DtCompileDmar, TemplateDmar, "DMA Remapping table"}, {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, NULL, TemplateEcdt, "Embedded Controller Boot Resources Table"}, @@ -366,17 +400,18 @@ ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_ERST, NULL, AcpiDmDumpErst, DtCompileErst, TemplateErst, "Error Record Serialization Table"}, {ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, DtCompileFadt, TemplateFadt, "Fixed ACPI Description Table (FADT)"}, {ACPI_SIG_FPDT, NULL, AcpiDmDumpFpdt, DtCompileFpdt, TemplateFpdt, "Firmware Performance Data Table"}, - {ACPI_SIG_GTDT, AcpiDmTableInfoGtdt, NULL, NULL, TemplateGtdt, "Generic Timer Description Table"}, + {ACPI_SIG_GTDT, NULL, AcpiDmDumpGtdt, DtCompileGtdt, TemplateGtdt, "Generic Timer Description Table"}, {ACPI_SIG_HEST, NULL, AcpiDmDumpHest, DtCompileHest, TemplateHest, "Hardware Error Source Table"}, {ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, NULL, TemplateHpet, "High Precision Event Timer table"}, {ACPI_SIG_IVRS, NULL, AcpiDmDumpIvrs, DtCompileIvrs, TemplateIvrs, "I/O Virtualization Reporting Structure"}, + {ACPI_SIG_LPIT, NULL, AcpiDmDumpLpit, DtCompileLpit, TemplateLpit, "Low Power Idle Table"}, {ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, DtCompileMadt, TemplateMadt, "Multiple APIC Description Table (MADT)"}, {ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, DtCompileMcfg, TemplateMcfg, "Memory Mapped Configuration table"}, {ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, NULL, TemplateMchi, "Management Controller Host Interface table"}, {ACPI_SIG_MPST, AcpiDmTableInfoMpst, AcpiDmDumpMpst, DtCompileMpst, TemplateMpst, "Memory Power State Table"}, {ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, DtCompileMsct, TemplateMsct, "Maximum System Characteristics Table"}, {ACPI_SIG_MTMR, NULL, AcpiDmDumpMtmr, DtCompileMtmr, TemplateMtmr, "MID Timer Table"}, - {ACPI_SIG_PCCT, NULL, AcpiDmDumpPcct, NULL, NULL, "Platform Communications Channel Table"}, + {ACPI_SIG_PCCT, AcpiDmTableInfoPcct, AcpiDmDumpPcct, DtCompilePcct, TemplatePcct, "Platform Communications Channel Table"}, {ACPI_SIG_PMTT, NULL, AcpiDmDumpPmtt, DtCompilePmtt, TemplatePmtt, "Platform Memory Topology Table"}, {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, TemplateRsdt, "Root System Description Table"}, {ACPI_SIG_S3PT, NULL, NULL, NULL, TemplateS3pt, "S3 Performance Table"}, @@ -722,6 +757,7 @@ AcpiDmDumpTable ( UINT32 ByteLength; UINT8 Temp8; UINT16 Temp16; + UINT64 Value; ACPI_DMTABLE_DATA *TableData; const char *Name; BOOLEAN LastOutputBlankLine = FALSE; @@ -763,7 +799,9 @@ AcpiDmDumpTable ( case ACPI_DMT_SPACEID: case ACPI_DMT_ACCWIDTH: case ACPI_DMT_IVRS: + case ACPI_DMT_GTDT: case ACPI_DMT_MADT: + case ACPI_DMT_PCCT: case ACPI_DMT_PMTT: case ACPI_DMT_SRAT: case ACPI_DMT_ASF: @@ -773,6 +811,7 @@ AcpiDmDumpTable ( case ACPI_DMT_EINJINST: case ACPI_DMT_ERSTACT: case ACPI_DMT_ERSTINST: + case ACPI_DMT_DMAR_SCOPE: ByteLength = 1; break; @@ -793,6 +832,7 @@ AcpiDmDumpTable ( case ACPI_DMT_NAME4: case ACPI_DMT_SIG: case ACPI_DMT_SLIC: + case ACPI_DMT_LPIT: ByteLength = 4; break; @@ -935,10 +975,19 @@ AcpiDmDumpTable ( * Dump bytes - high byte first, low byte last. * Note: All ACPI tables are little-endian. */ + Value = 0; for (Temp8 = (UINT8) ByteLength; Temp8 > 0; Temp8--) { AcpiOsPrintf ("%2.2X", Target[Temp8 - 1]); + Value |= Target[Temp8 - 1]; + Value <<= 8; } + + if (!Value && (Info->Flags & DT_DESCRIBES_OPTIONAL)) + { + AcpiOsPrintf (" [Optional field not present]"); + } + AcpiOsPrintf ("\n"); break; @@ -1094,6 +1143,19 @@ AcpiDmDumpTable ( AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), AcpiDmDmarSubnames[Temp16]); break; + case ACPI_DMT_DMAR_SCOPE: + + /* DMAR device scope types */ + + Temp8 = *Target; + if (Temp8 > ACPI_DMAR_SCOPE_TYPE_RESERVED) + { + Temp8 = ACPI_DMAR_SCOPE_TYPE_RESERVED; + } + + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmDmarScope[Temp8]); + break; + case ACPI_DMT_EINJACT: /* EINJ Action types */ @@ -1146,6 +1208,19 @@ AcpiDmDumpTable ( AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmErstInstructions[Temp8]); break; + case ACPI_DMT_GTDT: + + /* GTDT subtable types */ + + Temp8 = *Target; + if (Temp8 > ACPI_GTDT_TYPE_RESERVED) + { + Temp8 = ACPI_GTDT_TYPE_RESERVED; + } + + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmGtdtSubnames[Temp8]); + break; + case ACPI_DMT_HEST: /* HEST subtable types */ @@ -1194,6 +1269,19 @@ AcpiDmDumpTable ( AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmMadtSubnames[Temp8]); break; + case ACPI_DMT_PCCT: + + /* PCCT subtable types */ + + Temp8 = *Target; + if (Temp8 > ACPI_PCCT_TYPE_RESERVED) + { + Temp8 = ACPI_PCCT_TYPE_RESERVED; + } + + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmPcctSubnames[Temp8]); + break; + case ACPI_DMT_PMTT: /* PMTT subtable types */ @@ -1274,6 +1362,32 @@ AcpiDmDumpTable ( AcpiOsPrintf (UINT8_FORMAT, *Target, Name); break; + case ACPI_DMT_LPIT: + + /* LPIT subtable types */ + + Temp8 = *Target; + switch (Temp8) + { + case ACPI_LPIT_TYPE_NATIVE_CSTATE: + + Name = AcpiDmLpitSubnames[0]; + break; + + case ACPI_LPIT_TYPE_SIMPLE_IO: + + Name = AcpiDmLpitSubnames[1]; + break; + + default: + + Name = AcpiDmLpitSubnames[2]; + break; + } + + AcpiOsPrintf (UINT32_FORMAT, *Target, Name); + break; + case ACPI_DMT_EXIT: return (AE_OK); diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/common/dmtbdump.c b/src/add-ons/kernel/bus_managers/acpi/acpica/common/dmtbdump.c index 84c646a649..b0ae9058a4 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/common/dmtbdump.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/common/dmtbdump.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -491,12 +491,12 @@ AcpiDmDumpAsf ( UINT8 Type; - /* No main table, only sub-tables */ + /* No main table, only subtables */ SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, Table, Offset); while (Offset < Table->Length) { - /* Common sub-table header */ + /* Common subtable header */ Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, SubTable->Header.Length, AcpiDmTableInfoAsfHdr); @@ -551,7 +551,7 @@ AcpiDmDumpAsf ( default: - AcpiOsPrintf ("\n**** Unknown ASF sub-table type 0x%X\n", SubTable->Header.Type); + AcpiOsPrintf ("\n**** Unknown ASF subtable type 0x%X\n", SubTable->Header.Type); return; } @@ -613,7 +613,7 @@ AcpiDmDumpAsf ( AcpiOsPrintf ("\n"); - /* Point to next sub-table */ + /* Point to next subtable */ if (!SubTable->Header.Length) { @@ -658,7 +658,7 @@ AcpiDmDumpCpep ( return; } - /* Sub-tables */ + /* Subtables */ SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Table, Offset); while (Offset < Table->Length) @@ -671,7 +671,7 @@ AcpiDmDumpCpep ( return; } - /* Point to next sub-table */ + /* Point to next subtable */ Offset += SubTable->Header.Length; SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, SubTable, @@ -710,7 +710,7 @@ AcpiDmDumpCsrt ( /* The main table only contains the ACPI header, thus already handled */ - /* Sub-tables (Resource Groups) */ + /* Subtables (Resource Groups) */ SubTable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Table, Offset); while (Offset < Table->Length) @@ -774,7 +774,7 @@ AcpiDmDumpCsrt ( SubSubTable->Length); } - /* Point to next sub-table */ + /* Point to next subtable */ Offset += SubTable->Length; SubTable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, SubTable, @@ -818,7 +818,7 @@ AcpiDmDumpDbg2 ( return; } - /* Sub-tables */ + /* Subtables */ SubTable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Table, Offset); while (Offset < Table->Length) @@ -881,10 +881,13 @@ AcpiDmDumpDbg2 ( /* Dump the OemData (optional) */ - AcpiDmDumpBuffer (SubTable, SubTable->OemDataOffset, SubTable->OemDataLength, - Offset + SubTable->OemDataOffset, "OEM Data"); + if (SubTable->OemDataOffset) + { + AcpiDmDumpBuffer (SubTable, SubTable->OemDataOffset, SubTable->OemDataLength, + Offset + SubTable->OemDataOffset, "OEM Data"); + } - /* Point to next sub-table */ + /* Point to next subtable */ Offset += SubTable->Length; SubTable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, SubTable, @@ -930,12 +933,12 @@ AcpiDmDumpDmar ( return; } - /* Sub-tables */ + /* Subtables */ SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Table, Offset); while (Offset < Table->Length) { - /* Common sub-table header */ + /* Common subtable header */ AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Length, Offset, SubTable, @@ -960,21 +963,27 @@ AcpiDmDumpDmar ( ScopeOffset = sizeof (ACPI_DMAR_RESERVED_MEMORY); break; - case ACPI_DMAR_TYPE_ATSR: + case ACPI_DMAR_TYPE_ROOT_ATS: InfoTable = AcpiDmTableInfoDmar2; ScopeOffset = sizeof (ACPI_DMAR_ATSR); break; - case ACPI_DMAR_HARDWARE_AFFINITY: + case ACPI_DMAR_TYPE_HARDWARE_AFFINITY: InfoTable = AcpiDmTableInfoDmar3; ScopeOffset = sizeof (ACPI_DMAR_RHSA); break; + case ACPI_DMAR_TYPE_NAMESPACE: + + InfoTable = AcpiDmTableInfoDmar4; + ScopeOffset = sizeof (ACPI_DMAR_ANDD); + break; + default: - AcpiOsPrintf ("\n**** Unknown DMAR sub-table type 0x%X\n\n", SubTable->Type); + AcpiOsPrintf ("\n**** Unknown DMAR subtable type 0x%X\n\n", SubTable->Type); return; } @@ -985,7 +994,16 @@ AcpiDmDumpDmar ( return; } - /* Dump the device scope entries (if any) */ + /* + * Dump the optional device scope entries + */ + if ((SubTable->Type == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) || + (SubTable->Type == ACPI_DMAR_TYPE_NAMESPACE)) + { + /* These types do not support device scopes */ + + goto NextSubtable; + } ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, SubTable, ScopeOffset); while (ScopeOffset < SubTable->Length) @@ -1025,7 +1043,8 @@ AcpiDmDumpDmar ( ScopeTable, ScopeTable->Length); } - /* Point to next sub-table */ +NextSubtable: + /* Point to next subtable */ Offset += SubTable->Length; SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, SubTable, SubTable->Length); @@ -1064,7 +1083,7 @@ AcpiDmDumpEinj ( return; } - /* Sub-tables */ + /* Subtables */ SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset); while (Offset < Table->Length) @@ -1077,7 +1096,7 @@ AcpiDmDumpEinj ( return; } - /* Point to next sub-table (each subtable is of fixed length) */ + /* Point to next subtable (each subtable is of fixed length) */ Offset += sizeof (ACPI_WHEA_HEADER); SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable, @@ -1117,7 +1136,7 @@ AcpiDmDumpErst ( return; } - /* Sub-tables */ + /* Subtables */ SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset); while (Offset < Table->Length) @@ -1130,7 +1149,7 @@ AcpiDmDumpErst ( return; } - /* Point to next sub-table (each subtable is of fixed length) */ + /* Point to next subtable (each subtable is of fixed length) */ Offset += sizeof (ACPI_WHEA_HEADER); SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable, @@ -1165,12 +1184,12 @@ AcpiDmDumpFpdt ( /* There is no main table (other than the standard ACPI header) */ - /* Sub-tables */ + /* Subtables */ SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Table, Offset); while (Offset < Table->Length) { - /* Common sub-table header */ + /* Common subtable header */ AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Length, Offset, SubTable, @@ -1194,7 +1213,7 @@ AcpiDmDumpFpdt ( default: - AcpiOsPrintf ("\n**** Unknown FPDT sub-table type 0x%X\n\n", SubTable->Type); + AcpiOsPrintf ("\n**** Unknown FPDT subtable type 0x%X\n\n", SubTable->Type); /* Attempt to continue */ @@ -1214,7 +1233,7 @@ AcpiDmDumpFpdt ( } NextSubTable: - /* Point to next sub-table */ + /* Point to next subtable */ Offset += SubTable->Length; SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, SubTable, SubTable->Length); @@ -1222,6 +1241,123 @@ NextSubTable: } +/******************************************************************************* + * + * FUNCTION: AcpiDmDumpGtdt + * + * PARAMETERS: Table - A GTDT table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a GTDT. This table type consists + * of an open-ended number of subtables. + * + ******************************************************************************/ + +void +AcpiDmDumpGtdt ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + ACPI_GTDT_HEADER *SubTable; + UINT32 Length = Table->Length; + UINT32 Offset = sizeof (ACPI_TABLE_GTDT); + ACPI_DMTABLE_INFO *InfoTable; + UINT32 SubTableLength; + UINT32 GtCount; + ACPI_GTDT_TIMER_ENTRY *GtxTable; + + + /* Main table */ + + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoGtdt); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Subtables */ + + SubTable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, Table, Offset); + while (Offset < Table->Length) + { + /* Common subtable header */ + + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Length, AcpiDmTableInfoGtdtHdr); + if (ACPI_FAILURE (Status)) + { + return; + } + + GtCount = 0; + switch (SubTable->Type) + { + case ACPI_GTDT_TYPE_TIMER_BLOCK: + + SubTableLength = sizeof (ACPI_GTDT_TIMER_BLOCK); + GtCount = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK, + SubTable))->TimerCount; + + InfoTable = AcpiDmTableInfoGtdt0; + break; + + case ACPI_GTDT_TYPE_WATCHDOG: + + SubTableLength = sizeof (ACPI_GTDT_WATCHDOG); + + InfoTable = AcpiDmTableInfoGtdt1; + break; + + default: + + /* Cannot continue on unknown type - no length */ + + AcpiOsPrintf ("\n**** Unknown GTDT subtable type 0x%X\n", SubTable->Type); + return; + } + + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Length, InfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Point to end of current subtable (each subtable above is of fixed length) */ + + Offset += SubTableLength; + + /* If there are any Gt Timer Blocks from above, dump them now */ + + if (GtCount) + { + GtxTable = ACPI_ADD_PTR (ACPI_GTDT_TIMER_ENTRY, SubTable, SubTableLength); + SubTableLength += GtCount * sizeof (ACPI_GTDT_TIMER_ENTRY); + + while (GtCount) + { + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Length, Offset, GtxTable, + sizeof (ACPI_GTDT_TIMER_ENTRY), AcpiDmTableInfoGtdt0a); + if (ACPI_FAILURE (Status)) + { + return; + } + Offset += sizeof (ACPI_GTDT_TIMER_ENTRY); + GtxTable++; + GtCount--; + } + } + + /* Point to next subtable */ + + SubTable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, SubTable, SubTableLength); + } +} + + /******************************************************************************* * * FUNCTION: AcpiDmDumpHest @@ -1257,7 +1393,7 @@ AcpiDmDumpHest ( return; } - /* Sub-tables */ + /* Subtables */ SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset); while (Offset < Table->Length) @@ -1315,7 +1451,7 @@ AcpiDmDumpHest ( /* Cannot continue on unknown type - no length */ - AcpiOsPrintf ("\n**** Unknown HEST sub-table type 0x%X\n", SubTable->Type); + AcpiOsPrintf ("\n**** Unknown HEST subtable type 0x%X\n", SubTable->Type); return; } @@ -1353,7 +1489,7 @@ AcpiDmDumpHest ( } } - /* Point to next sub-table */ + /* Point to next subtable */ SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, SubTable, SubTableLength); } @@ -1396,12 +1532,12 @@ AcpiDmDumpIvrs ( return; } - /* Sub-tables */ + /* Subtables */ SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset); while (Offset < Table->Length) { - /* Common sub-table header */ + /* Common subtable header */ AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, @@ -1427,7 +1563,7 @@ AcpiDmDumpIvrs ( default: - AcpiOsPrintf ("\n**** Unknown IVRS sub-table type 0x%X\n", + AcpiOsPrintf ("\n**** Unknown IVRS subtable type 0x%X\n", SubTable->Type); /* Attempt to continue */ @@ -1530,7 +1666,7 @@ AcpiDmDumpIvrs ( } NextSubTable: - /* Point to next sub-table */ + /* Point to next subtable */ Offset += SubTable->Length; SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, SubTable, SubTable->Length); @@ -1538,6 +1674,85 @@ NextSubTable: } +/******************************************************************************* + * + * FUNCTION: AcpiDmDumpLpit + * + * PARAMETERS: Table - A LPIT table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a LPIT. This table type consists + * of an open-ended number of subtables. Note: There are no + * entries in the main table. An LPIT consists of the table + * header and then subtables only. + * + ******************************************************************************/ + +void +AcpiDmDumpLpit ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + ACPI_LPIT_HEADER *SubTable; + UINT32 Length = Table->Length; + UINT32 Offset = sizeof (ACPI_TABLE_LPIT); + ACPI_DMTABLE_INFO *InfoTable; + UINT32 SubTableLength; + + + /* Subtables */ + + SubTable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Table, Offset); + while (Offset < Table->Length) + { + /* Common subtable header */ + + Status = AcpiDmDumpTable (Length, Offset, SubTable, + sizeof (ACPI_LPIT_HEADER), AcpiDmTableInfoLpitHdr); + if (ACPI_FAILURE (Status)) + { + return; + } + + switch (SubTable->Type) + { + case ACPI_LPIT_TYPE_NATIVE_CSTATE: + + InfoTable = AcpiDmTableInfoLpit0; + SubTableLength = sizeof (ACPI_LPIT_NATIVE); + break; + + case ACPI_LPIT_TYPE_SIMPLE_IO: + + InfoTable = AcpiDmTableInfoLpit1; + SubTableLength = sizeof (ACPI_LPIT_IO); + break; + + default: + + /* Cannot continue on unknown type - no length */ + + AcpiOsPrintf ("\n**** Unknown LPIT subtable type 0x%X\n", SubTable->Type); + return; + } + + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTableLength, InfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } + AcpiOsPrintf ("\n"); + + /* Point to next subtable */ + + Offset += SubTableLength; + SubTable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, SubTable, SubTableLength); + } +} + + /******************************************************************************* * * FUNCTION: AcpiDmDumpMadt @@ -1570,12 +1785,12 @@ AcpiDmDumpMadt ( return; } - /* Sub-tables */ + /* Subtables */ SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset); while (Offset < Table->Length) { - /* Common sub-table header */ + /* Common subtable header */ AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Length, Offset, SubTable, @@ -1652,9 +1867,19 @@ AcpiDmDumpMadt ( InfoTable = AcpiDmTableInfoMadt12; break; + case ACPI_MADT_TYPE_GENERIC_MSI_FRAME: + + InfoTable = AcpiDmTableInfoMadt13; + break; + + case ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR: + + InfoTable = AcpiDmTableInfoMadt14; + break; + default: - AcpiOsPrintf ("\n**** Unknown MADT sub-table type 0x%X\n\n", SubTable->Type); + AcpiOsPrintf ("\n**** Unknown MADT subtable type 0x%X\n\n", SubTable->Type); /* Attempt to continue */ @@ -1674,7 +1899,7 @@ AcpiDmDumpMadt ( } NextSubTable: - /* Point to next sub-table */ + /* Point to next subtable */ Offset += SubTable->Length; SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, SubTable->Length); @@ -1711,7 +1936,7 @@ AcpiDmDumpMcfg ( return; } - /* Sub-tables */ + /* Subtables */ SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset); while (Offset < Table->Length) @@ -1731,7 +1956,7 @@ AcpiDmDumpMcfg ( return; } - /* Point to next sub-table (each subtable is of fixed length) */ + /* Point to next subtable (each subtable is of fixed length) */ Offset += sizeof (ACPI_MCFG_ALLOCATION); SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, SubTable, @@ -1913,12 +2138,12 @@ AcpiDmDumpMsct ( return; } - /* Sub-tables */ + /* Subtables */ SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset); while (Offset < Table->Length) { - /* Common sub-table header */ + /* Common subtable header */ AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, @@ -1928,7 +2153,7 @@ AcpiDmDumpMsct ( return; } - /* Point to next sub-table */ + /* Point to next subtable */ Offset += sizeof (ACPI_MSCT_PROXIMITY); SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, SubTable, sizeof (ACPI_MSCT_PROXIMITY)); @@ -1965,12 +2190,12 @@ AcpiDmDumpMtmr ( return; } - /* Sub-tables */ + /* Subtables */ SubTable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Table, Offset); while (Offset < Table->Length) { - /* Common sub-table header */ + /* Common subtable header */ AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, @@ -1980,7 +2205,7 @@ AcpiDmDumpMtmr ( return; } - /* Point to next sub-table */ + /* Point to next subtable */ Offset += sizeof (ACPI_MTMR_ENTRY); SubTable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, SubTable, sizeof (ACPI_MTMR_ENTRY)); @@ -2007,6 +2232,7 @@ AcpiDmDumpPcct ( { ACPI_STATUS Status; ACPI_PCCT_SUBSPACE *SubTable; + ACPI_DMTABLE_INFO *InfoTable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_PCCT); @@ -2019,20 +2245,50 @@ AcpiDmDumpPcct ( return; } - /* Sub-tables */ + /* Subtables */ SubTable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Table, Offset); while (Offset < Table->Length) { + /* Common subtable header */ + AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Header.Length, AcpiDmTableInfoPcct0); + SubTable->Header.Length, AcpiDmTableInfoPcctHdr); if (ACPI_FAILURE (Status)) { return; } - /* Point to next sub-table */ + switch (SubTable->Header.Type) + { + case ACPI_PCCT_TYPE_GENERIC_SUBSPACE: + + InfoTable = AcpiDmTableInfoPcct0; + break; + + case ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE: + + InfoTable = AcpiDmTableInfoPcct1; + break; + + default: + + AcpiOsPrintf ( + "\n**** Unexpected or unknown PCCT subtable type 0x%X\n\n", + SubTable->Header.Type); + return; + } + + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Header.Length, InfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Point to next subtable */ Offset += SubTable->Header.Length; SubTable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, SubTable, @@ -2180,8 +2436,7 @@ AcpiDmDumpPmtt ( if (DomainCount) { AcpiOsPrintf ( - "\n**** DomainCount exceeds subtable length\n\n", - MemSubTable->Type); + "\n**** DomainCount exceeds subtable length\n\n"); } /* Walk the physical component (DIMM) subtables */ @@ -2281,7 +2536,7 @@ AcpiDmDumpS3pt ( SubTable = ACPI_ADD_PTR (ACPI_S3PT_HEADER, S3ptTable, Offset); while (Offset < S3ptTable->Length) { - /* Common sub-table header */ + /* Common subtable header */ AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (S3ptTable->Length, Offset, SubTable, @@ -2305,7 +2560,7 @@ AcpiDmDumpS3pt ( default: - AcpiOsPrintf ("\n**** Unknown S3PT sub-table type 0x%X\n", SubTable->Type); + AcpiOsPrintf ("\n**** Unknown S3PT subtable type 0x%X\n", SubTable->Type); /* Attempt to continue */ @@ -2326,7 +2581,7 @@ AcpiDmDumpS3pt ( } NextSubTable: - /* Point to next sub-table */ + /* Point to next subtable */ Offset += SubTable->Length; SubTable = ACPI_ADD_PTR (ACPI_S3PT_HEADER, SubTable, SubTable->Length); @@ -2363,7 +2618,7 @@ AcpiDmDumpSlic ( SubTable = ACPI_ADD_PTR (ACPI_SLIC_HEADER, Table, Offset); while (Offset < Table->Length) { - /* Common sub-table header */ + /* Common subtable header */ AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, @@ -2387,7 +2642,7 @@ AcpiDmDumpSlic ( default: - AcpiOsPrintf ("\n**** Unknown SLIC sub-table type 0x%X\n", SubTable->Type); + AcpiOsPrintf ("\n**** Unknown SLIC subtable type 0x%X\n", SubTable->Type); /* Attempt to continue */ @@ -2408,7 +2663,7 @@ AcpiDmDumpSlic ( } NextSubTable: - /* Point to next sub-table */ + /* Point to next subtable */ Offset += SubTable->Length; SubTable = ACPI_ADD_PTR (ACPI_SLIC_HEADER, SubTable, SubTable->Length); @@ -2524,12 +2779,12 @@ AcpiDmDumpSrat ( return; } - /* Sub-tables */ + /* Subtables */ SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset); while (Offset < Table->Length) { - /* Common sub-table header */ + /* Common subtable header */ AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, @@ -2557,7 +2812,7 @@ AcpiDmDumpSrat ( break; default: - AcpiOsPrintf ("\n**** Unknown SRAT sub-table type 0x%X\n", SubTable->Type); + AcpiOsPrintf ("\n**** Unknown SRAT subtable type 0x%X\n", SubTable->Type); /* Attempt to continue */ @@ -2578,7 +2833,7 @@ AcpiDmDumpSrat ( } NextSubTable: - /* Point to next sub-table */ + /* Point to next subtable */ Offset += SubTable->Length; SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, SubTable->Length); @@ -2615,12 +2870,12 @@ AcpiDmDumpVrtc ( return; } - /* Sub-tables */ + /* Subtables */ SubTable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, Table, Offset); while (Offset < Table->Length) { - /* Common sub-table header */ + /* Common subtable header */ AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, @@ -2630,7 +2885,7 @@ AcpiDmDumpVrtc ( return; } - /* Point to next sub-table */ + /* Point to next subtable */ Offset += sizeof (ACPI_VRTC_ENTRY); SubTable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, SubTable, sizeof (ACPI_VRTC_ENTRY)); @@ -2667,12 +2922,12 @@ AcpiDmDumpWdat ( return; } - /* Sub-tables */ + /* Subtables */ SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Table, Offset); while (Offset < Table->Length) { - /* Common sub-table header */ + /* Common subtable header */ AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, @@ -2682,7 +2937,7 @@ AcpiDmDumpWdat ( return; } - /* Point to next sub-table */ + /* Point to next subtable */ Offset += sizeof (ACPI_WDAT_ENTRY); SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, SubTable, sizeof (ACPI_WDAT_ENTRY)); diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/common/dmtbinfo.c b/src/add-ons/kernel/bus_managers/acpi/acpica/common/dmtbinfo.c index def6de804e..2a3bed4c15 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/common/dmtbinfo.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/common/dmtbinfo.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -209,11 +209,16 @@ #define ACPI_DMAR1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DMAR_RESERVED_MEMORY,f) #define ACPI_DMAR2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DMAR_ATSR,f) #define ACPI_DMAR3_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DMAR_RHSA,f) +#define ACPI_DMAR4_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DMAR_ANDD,f) #define ACPI_EINJ0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_WHEA_HEADER,f) #define ACPI_ERST0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_WHEA_HEADER,f) #define ACPI_FPDTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_FPDT_HEADER,f) #define ACPI_FPDT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_FPDT_BOOT,f) #define ACPI_FPDT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_FPDT_S3PT_PTR,f) +#define ACPI_GTDT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_GTDT_TIMER_BLOCK,f) +#define ACPI_GTDT0a_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_GTDT_TIMER_ENTRY,f) +#define ACPI_GTDT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_GTDT_WATCHDOG,f) +#define ACPI_GTDTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_GTDT_HEADER,f) #define ACPI_HEST0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_IA_MACHINE_CHECK,f) #define ACPI_HEST1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_IA_CORRECTED,f) #define ACPI_HEST2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_IA_NMI,f) @@ -230,6 +235,9 @@ #define ACPI_IVRS8A_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IVRS_DEVICE8A,f) #define ACPI_IVRS8B_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IVRS_DEVICE8B,f) #define ACPI_IVRS8C_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IVRS_DEVICE8C,f) +#define ACPI_LPITH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_LPIT_HEADER,f) +#define ACPI_LPIT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_LPIT_NATIVE,f) +#define ACPI_LPIT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_LPIT_IO,f) #define ACPI_MADT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_LOCAL_APIC,f) #define ACPI_MADT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_IO_APIC,f) #define ACPI_MADT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_INTERRUPT_OVERRIDE,f) @@ -243,6 +251,8 @@ #define ACPI_MADT10_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_LOCAL_X2APIC_NMI,f) #define ACPI_MADT11_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_GENERIC_INTERRUPT,f) #define ACPI_MADT12_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_GENERIC_DISTRIBUTOR,f) +#define ACPI_MADT13_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_GENERIC_MSI_FRAME,f) +#define ACPI_MADT14_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_GENERIC_REDISTRIBUTOR,f) #define ACPI_MADTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SUBTABLE_HEADER,f) #define ACPI_MCFG0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MCFG_ALLOCATION,f) #define ACPI_MPST0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MPST_POWER_NODE,f) @@ -253,6 +263,7 @@ #define ACPI_MSCT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MSCT_PROXIMITY,f) #define ACPI_MTMR0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MTMR_ENTRY,f) #define ACPI_PCCT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PCCT_SUBSPACE,f) +#define ACPI_PCCT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PCCT_HW_REDUCED,f) #define ACPI_PMTT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PMTT_SOCKET,f) #define ACPI_PMTT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PMTT_CONTROLLER,f) #define ACPI_PMTT1A_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PMTT_DOMAIN,f) @@ -285,6 +296,9 @@ #define ACPI_SRAT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SRAT_MEM_AFFINITY,f,o) #define ACPI_SRAT2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SRAT_X2APIC_CPU_AFFINITY,f,o) #define ACPI_GTDT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_GTDT,f,o) +#define ACPI_GTDT0a_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_GTDT_TIMER_ENTRY,f,o) +#define ACPI_GTDT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_GTDT_WATCHDOG,f,o) +#define ACPI_LPITH_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_LPIT_HEADER,f,o) #define ACPI_MADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_MADT,f,o) #define ACPI_MADT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_APIC,f,o) #define ACPI_MADT2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_INTERRUPT_OVERRIDE,f,o) @@ -295,9 +309,11 @@ #define ACPI_MADT9_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_X2APIC,f,o) #define ACPI_MADT10_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_X2APIC_NMI,f,o) #define ACPI_MADT11_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_GENERIC_INTERRUPT,f,o) +#define ACPI_MADT13_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_GENERIC_MSI_FRAME,f,o) #define ACPI_MPST0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MPST_POWER_NODE,f,o) #define ACPI_MPST2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MPST_POWER_DATA,f,o) #define ACPI_PCCT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_PCCT,f,o) +#define ACPI_PCCT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PCCT_HW_REDUCED,f,o) #define ACPI_PMTTH_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PMTT_HEADER,f,o) #define ACPI_WDDT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_WDDT,f,o) #define ACPI_EINJ0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_WHEA_HEADER,f,o) @@ -508,17 +524,22 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoFadt2[] = { {ACPI_DMT_GAS, ACPI_FADT_OFFSET (ResetRegister), "Reset Register", 0}, {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (ResetValue), "Value to cause reset", 0}, - {ACPI_DMT_UINT24, ACPI_FADT_OFFSET (Reserved4[0]), "Reserved", 0}, + {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (ArmBootFlags), "Reserved", 0}, + {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (MinorRevision), "Reserved", 0}, ACPI_DMT_TERMINATOR }; -/* ACPI 2.0+ Extensions (FADT version 3 and 4) */ +/* ACPI 2.0+ Extensions (FADT version 3, 4, and 5) */ ACPI_DMTABLE_INFO AcpiDmTableInfoFadt3[] = { {ACPI_DMT_GAS, ACPI_FADT_OFFSET (ResetRegister), "Reset Register", 0}, {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (ResetValue), "Value to cause reset", 0}, - {ACPI_DMT_UINT24, ACPI_FADT_OFFSET (Reserved4[0]), "Reserved", 0}, + {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (ArmBootFlags), "ARM Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET(ArmBootFlags,0), "PSCI Compliant", 0}, + {ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET(ArmBootFlags,0), "Must use HVC for PSCI", 0}, + ACPI_DMT_NEW_LINE, + {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (MinorRevision), "FADT Minor Revision", 0}, {ACPI_DMT_UINT64, ACPI_FADT_OFFSET (XFacs), "FACS Address", 0}, {ACPI_DMT_UINT64, ACPI_FADT_OFFSET (XDsdt), "DSDT Address", 0}, {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm1aEventBlock), "PM1A Event Block", 0}, @@ -792,12 +813,12 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2[] = ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2Device[] = { {ACPI_DMT_UINT8, ACPI_DBG20_OFFSET (Revision), "Revision", 0}, - {ACPI_DMT_UINT16, ACPI_DBG20_OFFSET (Length), "Length", 0}, + {ACPI_DMT_UINT16, ACPI_DBG20_OFFSET (Length), "Length", DT_LENGTH}, {ACPI_DMT_UINT8, ACPI_DBG20_OFFSET (RegisterCount), "Register Count", 0}, {ACPI_DMT_UINT16, ACPI_DBG20_OFFSET (NamepathLength), "Namepath Length", 0}, {ACPI_DMT_UINT16, ACPI_DBG20_OFFSET (NamepathOffset), "Namepath Offset", 0}, - {ACPI_DMT_UINT16, ACPI_DBG20_OFFSET (OemDataLength), "OEM Data Length", 0}, - {ACPI_DMT_UINT16, ACPI_DBG20_OFFSET (OemDataOffset), "OEM Data Offset", 0}, + {ACPI_DMT_UINT16, ACPI_DBG20_OFFSET (OemDataLength), "OEM Data Length", DT_DESCRIBES_OPTIONAL}, + {ACPI_DMT_UINT16, ACPI_DBG20_OFFSET (OemDataOffset), "OEM Data Offset", DT_DESCRIBES_OPTIONAL}, {ACPI_DMT_UINT16, ACPI_DBG20_OFFSET (PortType), "Port Type", 0}, {ACPI_DMT_UINT16, ACPI_DBG20_OFFSET (PortSubtype), "Port Subtype", 0}, {ACPI_DMT_UINT16, ACPI_DBG20_OFFSET (Reserved), "Reserved", 0}, @@ -826,6 +847,12 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2Name[] = ACPI_DMT_TERMINATOR }; +ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2OemData[] = +{ + {ACPI_DMT_BUFFER, 0, "OEM Data", DT_OPTIONAL}, + ACPI_DMT_TERMINATOR +}; + /******************************************************************************* * @@ -869,7 +896,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoDmarHdr[] = ACPI_DMTABLE_INFO AcpiDmTableInfoDmarScope[] = { - {ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (EntryType), "Device Scope Entry Type", 0}, + {ACPI_DMT_DMAR_SCOPE, ACPI_DMARS_OFFSET (EntryType), "Device Scope Type", 0}, {ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (Length), "Entry Length", DT_LENGTH}, {ACPI_DMT_UINT16, ACPI_DMARS_OFFSET (Reserved), "Reserved", 0}, {ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (EnumerationId), "Enumeration ID", 0}, @@ -921,6 +948,16 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoDmar3[] = ACPI_DMT_TERMINATOR }; +/* 4: ACPI Namespace Device Declaration Structure */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoDmar4[] = +{ + {ACPI_DMT_UINT24, ACPI_DMAR4_OFFSET (Reserved[0]), "Reserved", 0}, + {ACPI_DMT_UINT8, ACPI_DMAR4_OFFSET (DeviceNumber), "Device Number", 0}, + {ACPI_DMT_STRING, ACPI_DMAR4_OFFSET (DeviceName[0]), "Device Name", 0}, + ACPI_DMT_TERMINATOR +}; + /******************************************************************************* * @@ -1060,29 +1097,89 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoFpdt1[] = ACPI_DMTABLE_INFO AcpiDmTableInfoGtdt[] = { - {ACPI_DMT_UINT64, ACPI_GTDT_OFFSET (Address), "Timer Address", 0}, - {ACPI_DMT_UINT32, ACPI_GTDT_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, - {ACPI_DMT_FLAG0, ACPI_GTDT_FLAG_OFFSET (Flags,0), "Memory Present", 0}, + {ACPI_DMT_UINT64, ACPI_GTDT_OFFSET (CounterBlockAddresss), "Counter Block Address", 0}, + {ACPI_DMT_UINT32, ACPI_GTDT_OFFSET (Reserved), "Reserved", 0}, ACPI_DMT_NEW_LINE, - {ACPI_DMT_UINT32, ACPI_GTDT_OFFSET (SecurePl1Interrupt), "Secure PL1 Interrupt", 0}, - {ACPI_DMT_UINT32, ACPI_GTDT_OFFSET (SecurePl1Flags), "SPL1 Flags (decoded below)", DT_FLAG}, - {ACPI_DMT_FLAG0, ACPI_GTDT_FLAG_OFFSET (SecurePl1Flags,0), "Trigger Mode", 0}, - {ACPI_DMT_FLAG1, ACPI_GTDT_FLAG_OFFSET (SecurePl1Flags,0), "Polarity", 0}, + {ACPI_DMT_UINT32, ACPI_GTDT_OFFSET (SecureEl1Interrupt), "Secure EL1 Interrupt", 0}, + {ACPI_DMT_UINT32, ACPI_GTDT_OFFSET (SecureEl1Flags), "EL1 Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_GTDT_FLAG_OFFSET (SecureEl1Flags,0), "Trigger Mode", 0}, + {ACPI_DMT_FLAG1, ACPI_GTDT_FLAG_OFFSET (SecureEl1Flags,0), "Polarity", 0}, + {ACPI_DMT_FLAG2, ACPI_GTDT_FLAG_OFFSET (SecureEl1Flags,0), "Always On", 0}, ACPI_DMT_NEW_LINE, - {ACPI_DMT_UINT32, ACPI_GTDT_OFFSET (NonSecurePl1Interrupt), "Non-Secure PL1 Interrupt", 0}, - {ACPI_DMT_UINT32, ACPI_GTDT_OFFSET (NonSecurePl1Flags), "NSPL1 Flags (decoded below)", DT_FLAG}, - {ACPI_DMT_FLAG0, ACPI_GTDT_FLAG_OFFSET (NonSecurePl1Flags,0),"Trigger Mode", 0}, - {ACPI_DMT_FLAG1, ACPI_GTDT_FLAG_OFFSET (NonSecurePl1Flags,0),"Polarity", 0}, + {ACPI_DMT_UINT32, ACPI_GTDT_OFFSET (NonSecureEl1Interrupt), "Non-Secure EL1 Interrupt", 0}, + {ACPI_DMT_UINT32, ACPI_GTDT_OFFSET (NonSecureEl1Flags), "NEL1 Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_GTDT_FLAG_OFFSET (NonSecureEl1Flags,0),"Trigger Mode", 0}, + {ACPI_DMT_FLAG1, ACPI_GTDT_FLAG_OFFSET (NonSecureEl1Flags,0),"Polarity", 0}, + {ACPI_DMT_FLAG2, ACPI_GTDT_FLAG_OFFSET (NonSecureEl1Flags,0),"Always On", 0}, ACPI_DMT_NEW_LINE, {ACPI_DMT_UINT32, ACPI_GTDT_OFFSET (VirtualTimerInterrupt), "Virtual Timer Interrupt", 0}, {ACPI_DMT_UINT32, ACPI_GTDT_OFFSET (VirtualTimerFlags), "VT Flags (decoded below)", DT_FLAG}, {ACPI_DMT_FLAG0, ACPI_GTDT_FLAG_OFFSET (VirtualTimerFlags,0),"Trigger Mode", 0}, {ACPI_DMT_FLAG1, ACPI_GTDT_FLAG_OFFSET (VirtualTimerFlags,0),"Polarity", 0}, + {ACPI_DMT_FLAG2, ACPI_GTDT_FLAG_OFFSET (VirtualTimerFlags,0),"Always On", 0}, ACPI_DMT_NEW_LINE, - {ACPI_DMT_UINT32, ACPI_GTDT_OFFSET (NonSecurePl2Interrupt), "Non-Secure PL2 Interrupt", 0}, - {ACPI_DMT_UINT32, ACPI_GTDT_OFFSET (NonSecurePl2Flags), "NSPL2 Flags (decoded below)", DT_FLAG}, - {ACPI_DMT_FLAG0, ACPI_GTDT_FLAG_OFFSET (NonSecurePl2Flags,0),"Trigger Mode", 0}, - {ACPI_DMT_FLAG1, ACPI_GTDT_FLAG_OFFSET (NonSecurePl2Flags,0),"Polarity", 0}, + {ACPI_DMT_UINT32, ACPI_GTDT_OFFSET (NonSecureEl2Interrupt), "Non-Secure EL2 Interrupt", 0}, + {ACPI_DMT_UINT32, ACPI_GTDT_OFFSET (NonSecureEl2Flags), "NEL2 Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_GTDT_FLAG_OFFSET (NonSecureEl2Flags,0),"Trigger Mode", 0}, + {ACPI_DMT_FLAG1, ACPI_GTDT_FLAG_OFFSET (NonSecureEl2Flags,0),"Polarity", 0}, + {ACPI_DMT_FLAG2, ACPI_GTDT_FLAG_OFFSET (NonSecureEl2Flags,0),"Always On", 0}, + {ACPI_DMT_UINT64, ACPI_GTDT_OFFSET (CounterReadBlockAddress), "Counter Read Block Address", 0}, + ACPI_DMT_NEW_LINE, + {ACPI_DMT_UINT32, ACPI_GTDT_OFFSET (PlatformTimerCount), "Platform Timer Count", 0}, + {ACPI_DMT_UINT32, ACPI_GTDT_OFFSET (PlatformTimerOffset), "Platform Timer Offset", 0}, + ACPI_DMT_TERMINATOR +}; + +/* GTDT Subtable header (one per Subtable) */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoGtdtHdr[] = +{ + {ACPI_DMT_GTDT, ACPI_GTDTH_OFFSET (Type), "Subtable Type", 0}, + {ACPI_DMT_UINT16, ACPI_GTDTH_OFFSET (Length), "Length", DT_LENGTH}, + ACPI_DMT_TERMINATOR +}; + +/* GTDT Subtables */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoGtdt0[] = +{ + {ACPI_DMT_UINT8, ACPI_GTDT0_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT64, ACPI_GTDT0_OFFSET (BlockAddress), "Block Address", 0}, + {ACPI_DMT_UINT32, ACPI_GTDT0_OFFSET (TimerCount), "Timer Count", 0}, + {ACPI_DMT_UINT32, ACPI_GTDT0_OFFSET (TimerOffset), "Timer Offset", 0}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoGtdt0a[] = +{ + {ACPI_DMT_UINT8 , ACPI_GTDT0a_OFFSET (FrameNumber), "Frame Number", 0}, + {ACPI_DMT_UINT24, ACPI_GTDT0a_OFFSET (Reserved[0]), "Reserved", 0}, + {ACPI_DMT_UINT64, ACPI_GTDT0a_OFFSET (BaseAddress), "Base Address", 0}, + {ACPI_DMT_UINT64, ACPI_GTDT0a_OFFSET (El0BaseAddress), "EL0 Base Address", 0}, + {ACPI_DMT_UINT32, ACPI_GTDT0a_OFFSET (TimerInterrupt), "Timer Interrupt", 0}, + {ACPI_DMT_UINT32, ACPI_GTDT0a_OFFSET (TimerFlags), "Timer Flags (decoded below)", 0}, + {ACPI_DMT_FLAG0, ACPI_GTDT0a_FLAG_OFFSET (TimerFlags,0), "Trigger Mode", 0}, + {ACPI_DMT_FLAG1, ACPI_GTDT0a_FLAG_OFFSET (TimerFlags,0), "Polarity", 0}, + {ACPI_DMT_UINT32, ACPI_GTDT0a_OFFSET (VirtualTimerInterrupt), "Virtual Timer Interrupt", 0}, + {ACPI_DMT_UINT32, ACPI_GTDT0a_OFFSET (VirtualTimerFlags), "Virtual Timer Flags (decoded below)", 0}, + {ACPI_DMT_FLAG0, ACPI_GTDT0a_FLAG_OFFSET (VirtualTimerFlags,0), "Trigger Mode", 0}, + {ACPI_DMT_FLAG1, ACPI_GTDT0a_FLAG_OFFSET (VirtualTimerFlags,0), "Polarity", 0}, + {ACPI_DMT_UINT32, ACPI_GTDT0a_OFFSET (CommonFlags), "Common Flags (decoded below)", 0}, + {ACPI_DMT_FLAG0, ACPI_GTDT0a_FLAG_OFFSET (CommonFlags,0), "Secure", 0}, + {ACPI_DMT_FLAG1, ACPI_GTDT0a_FLAG_OFFSET (CommonFlags,0), "Always On", 0}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoGtdt1[] = +{ + {ACPI_DMT_UINT8, ACPI_GTDT1_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT64, ACPI_GTDT1_OFFSET (RefreshFrameAddress), "Refresh Frame Address", 0}, + {ACPI_DMT_UINT64, ACPI_GTDT1_OFFSET (ControlFrameAddress), "Control Frame Address", 0}, + {ACPI_DMT_UINT32, ACPI_GTDT1_OFFSET (TimerInterrupt), "Timer Interrupt", 0}, + {ACPI_DMT_UINT32, ACPI_GTDT1_OFFSET (TimerFlags), "Timer Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_GTDT1_FLAG_OFFSET (TimerFlags,0), "Trigger Mode", 0}, + {ACPI_DMT_FLAG1, ACPI_GTDT1_FLAG_OFFSET (TimerFlags,0), "Polarity", 0}, + {ACPI_DMT_FLAG2, ACPI_GTDT1_FLAG_OFFSET (TimerFlags,0), "Security", 0}, ACPI_DMT_TERMINATOR }; @@ -1371,6 +1468,59 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs8c[] = }; +/******************************************************************************* + * + * LPIT - Low Power Idle Table + * + ******************************************************************************/ + +/* Main table consists only of the standard ACPI table header */ + +/* Common Subtable header (one per Subtable) */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoLpitHdr[] = +{ + {ACPI_DMT_LPIT, ACPI_LPITH_OFFSET (Type), "Subtable Type", 0}, + {ACPI_DMT_UINT32, ACPI_LPITH_OFFSET (Length), "Length", DT_LENGTH}, + {ACPI_DMT_UINT16, ACPI_LPITH_OFFSET (UniqueId), "Unique ID", 0}, + {ACPI_DMT_UINT16, ACPI_LPITH_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_LPITH_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_LPITH_FLAG_OFFSET (Flags, 0), "State Disabled", 0}, + {ACPI_DMT_FLAG1, ACPI_LPITH_FLAG_OFFSET (Flags, 0), "No Counter", 0}, + ACPI_DMT_TERMINATOR +}; + +/* LPIT Subtables */ + +/* 0: Native C-state */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoLpit0[] = +{ + {ACPI_DMT_GAS, ACPI_LPIT0_OFFSET (EntryTrigger), "Entry Trigger", 0}, + {ACPI_DMT_UINT32, ACPI_LPIT0_OFFSET (Residency), "Residency", 0}, + {ACPI_DMT_UINT32, ACPI_LPIT0_OFFSET (Latency), "Latency", 0}, + {ACPI_DMT_GAS, ACPI_LPIT0_OFFSET (ResidencyCounter), "Residency Counter", 0}, + {ACPI_DMT_UINT64, ACPI_LPIT0_OFFSET (CounterFrequency), "Counter Frequency", 0}, + ACPI_DMT_TERMINATOR +}; + +/* 1: Simple I/O */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoLpit1[] = +{ + {ACPI_DMT_GAS, ACPI_LPIT1_OFFSET (EntryTrigger), "Entry Trigger", 0}, + {ACPI_DMT_UINT32, ACPI_LPIT1_OFFSET (TriggerAction), "Trigger Action", 0}, + {ACPI_DMT_UINT64, ACPI_LPIT1_OFFSET (TriggerValue), "Trigger Value", 0}, + {ACPI_DMT_UINT64, ACPI_LPIT1_OFFSET (TriggerMask), "Trigger Mask", 0}, + {ACPI_DMT_GAS, ACPI_LPIT1_OFFSET (MinimumIdleState), "Minimum Idle State", 0}, + {ACPI_DMT_UINT32, ACPI_LPIT1_OFFSET (Residency), "Residency", 0}, + {ACPI_DMT_UINT32, ACPI_LPIT1_OFFSET (Latency), "Latency", 0}, + {ACPI_DMT_GAS, ACPI_LPIT1_OFFSET (ResidencyCounter), "Residency Counter", 0}, + {ACPI_DMT_UINT64, ACPI_LPIT1_OFFSET (CounterFrequency), "Counter Frequency", 0}, + ACPI_DMT_TERMINATOR +}; + + /******************************************************************************* * * MADT - Multiple APIC Description Table and subtables @@ -1536,14 +1686,21 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt10[] = ACPI_DMTABLE_INFO AcpiDmTableInfoMadt11[] = { {ACPI_DMT_UINT16, ACPI_MADT11_OFFSET (Reserved), "Reserved", 0}, - {ACPI_DMT_UINT32, ACPI_MADT11_OFFSET (GicId), "Local GIC Hardware ID", 0}, + {ACPI_DMT_UINT32, ACPI_MADT11_OFFSET (CpuInterfaceNumber), "CPU Interface Number", 0}, {ACPI_DMT_UINT32, ACPI_MADT11_OFFSET (Uid), "Processor UID", 0}, {ACPI_DMT_UINT32, ACPI_MADT11_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, {ACPI_DMT_FLAG0, ACPI_MADT11_FLAG_OFFSET (Flags,0), "Processor Enabled", 0}, + {ACPI_DMT_FLAG1, ACPI_MADT11_FLAG_OFFSET (Flags,0), "Performance Interrupt Trigger Mode", 0}, + {ACPI_DMT_FLAG2, ACPI_MADT11_FLAG_OFFSET (Flags,0), "Virtual GIC Interrupt Trigger Mode", 0}, {ACPI_DMT_UINT32, ACPI_MADT11_OFFSET (ParkingVersion), "Parking Protocol Version", 0}, {ACPI_DMT_UINT32, ACPI_MADT11_OFFSET (PerformanceInterrupt), "Performance Interrupt", 0}, {ACPI_DMT_UINT64, ACPI_MADT11_OFFSET (ParkedAddress), "Parked Address", 0}, {ACPI_DMT_UINT64, ACPI_MADT11_OFFSET (BaseAddress), "Base Address", 0}, + {ACPI_DMT_UINT64, ACPI_MADT11_OFFSET (GicvBaseAddress), "Virtual GIC Base Address", 0}, + {ACPI_DMT_UINT64, ACPI_MADT11_OFFSET (GichBaseAddress), "Hypervisor GIC Base Address", 0}, + {ACPI_DMT_UINT32, ACPI_MADT11_OFFSET (VgicInterrupt), "Virtual GIC Interrupt", 0}, + {ACPI_DMT_UINT64, ACPI_MADT11_OFFSET (GicrBaseAddress), "Redistributor Base Address", 0}, + {ACPI_DMT_UINT64, ACPI_MADT11_OFFSET (ArmMpidr), "ARM MPIDR", 0}, ACPI_DMT_TERMINATOR }; @@ -1559,6 +1716,30 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt12[] = ACPI_DMT_TERMINATOR }; +/* 13: Generic MSI Frame (ACPI 5.1) */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoMadt13[] = +{ + {ACPI_DMT_UINT16, ACPI_MADT13_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_MADT13_OFFSET (MsiFrameId), "MSI Frame ID", 0}, + {ACPI_DMT_UINT64, ACPI_MADT13_OFFSET (BaseAddress), "Base Address", 0}, + {ACPI_DMT_UINT32, ACPI_MADT13_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_MADT13_FLAG_OFFSET (Flags,0), "Select SPI", 0}, + {ACPI_DMT_UINT16, ACPI_MADT13_OFFSET (SpiCount), "SPI Count", 0}, + {ACPI_DMT_UINT16, ACPI_MADT13_OFFSET (SpiBase), "SPI Base", 0}, + ACPI_DMT_TERMINATOR +}; + +/* 14: Generic Redistributor (ACPI 5.1) */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoMadt14[] = +{ + {ACPI_DMT_UINT16, ACPI_MADT14_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT64, ACPI_MADT14_OFFSET (BaseAddress), "Base Address", 0}, + {ACPI_DMT_UINT32, ACPI_MADT14_OFFSET (Length), "Length", 0}, + ACPI_DMT_TERMINATOR +}; + /******************************************************************************* * @@ -1749,25 +1930,52 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoPcct[] = { {ACPI_DMT_UINT32, ACPI_PCCT_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, {ACPI_DMT_FLAG0, ACPI_PCCT_FLAG_OFFSET (Flags,0), "Doorbell", 0}, - {ACPI_DMT_UINT32, ACPI_PCCT_OFFSET (Latency), "Command Latency", 0}, - {ACPI_DMT_UINT32, ACPI_PCCT_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT64, ACPI_PCCT_OFFSET (Reserved), "Reserved", 0}, ACPI_DMT_TERMINATOR }; /* PCCT subtables */ +ACPI_DMTABLE_INFO AcpiDmTableInfoPcctHdr[] = +{ + {ACPI_DMT_PCCT, ACPI_PCCT0_OFFSET (Header.Type), "Subtable Type", 0}, + {ACPI_DMT_UINT8, ACPI_PCCT0_OFFSET (Header.Length), "Length", DT_LENGTH}, + ACPI_DMT_TERMINATOR +}; + /* 0: Generic Communications Subspace */ ACPI_DMTABLE_INFO AcpiDmTableInfoPcct0[] = { - {ACPI_DMT_UINT8, ACPI_PCCT0_OFFSET (Header.Type), "Subtable Type", 0}, - {ACPI_DMT_UINT8, ACPI_PCCT0_OFFSET (Header.Length), "Length", DT_LENGTH}, {ACPI_DMT_UINT48, ACPI_PCCT0_OFFSET (Reserved[0]), "Reserved", 0}, {ACPI_DMT_UINT64, ACPI_PCCT0_OFFSET (BaseAddress), "Base Address", 0}, {ACPI_DMT_UINT64, ACPI_PCCT0_OFFSET (Length), "Address Length", 0}, {ACPI_DMT_GAS, ACPI_PCCT0_OFFSET (DoorbellRegister), "Doorbell Register", 0}, {ACPI_DMT_UINT64, ACPI_PCCT0_OFFSET (PreserveMask), "Preserve Mask", 0}, {ACPI_DMT_UINT64, ACPI_PCCT0_OFFSET (WriteMask), "Write Mask", 0}, + {ACPI_DMT_UINT32, ACPI_PCCT0_OFFSET (Latency), "Command Latency", 0}, + {ACPI_DMT_UINT32, ACPI_PCCT0_OFFSET (MaxAccessRate), "Maximum Access Rate", 0}, + {ACPI_DMT_UINT16, ACPI_PCCT0_OFFSET (MinTurnaroundTime), "Minimum Turnaround Time", 0}, + ACPI_DMT_TERMINATOR +}; + +/* 1: HW-reduced Communications Subspace (ACPI 5.1) */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoPcct1[] = +{ + {ACPI_DMT_UINT32, ACPI_PCCT1_OFFSET (DoorbellInterrupt), "Doorbell Interrupt", 0}, + {ACPI_DMT_UINT8, ACPI_PCCT1_OFFSET (Flags), "Flags (Decoded Below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_PCCT1_FLAG_OFFSET (Flags,0), "Polarity", 0}, + {ACPI_DMT_FLAG1, ACPI_PCCT1_FLAG_OFFSET (Flags,0), "Mode", 0}, + {ACPI_DMT_UINT8, ACPI_PCCT1_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT64, ACPI_PCCT1_OFFSET (BaseAddress), "Base Address", 0}, + {ACPI_DMT_UINT64, ACPI_PCCT1_OFFSET (Length), "Address Length", 0}, + {ACPI_DMT_GAS, ACPI_PCCT1_OFFSET (DoorbellRegister), "Doorbell Register", 0}, + {ACPI_DMT_UINT64, ACPI_PCCT1_OFFSET (PreserveMask), "Preserve Mask", 0}, + {ACPI_DMT_UINT64, ACPI_PCCT1_OFFSET (WriteMask), "Write Mask", 0}, + {ACPI_DMT_UINT32, ACPI_PCCT1_OFFSET (Latency), "Command Latency", 0}, + {ACPI_DMT_UINT32, ACPI_PCCT1_OFFSET (MaxAccessRate), "Maximum Access Rate", 0}, + {ACPI_DMT_UINT16, ACPI_PCCT1_OFFSET (MinTurnaroundTime), "Minimum Turnaround Time", 0}, ACPI_DMT_TERMINATOR }; @@ -1999,7 +2207,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSpcr[] = ACPI_DMTABLE_INFO AcpiDmTableInfoSpmi[] = { {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (InterfaceType), "Interface Type", 0}, - {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (Reserved), "Reserved", DT_NON_ZERO}, /* Value must be 1 */ {ACPI_DMT_UINT16, ACPI_SPMI_OFFSET (SpecRevision), "IPMI Spec Version", 0}, {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (InterruptType), "Interrupt Type", 0}, {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (GpeNumber), "GPE Number", 0}, diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/common/getopt.c b/src/add-ons/kernel/bus_managers/acpi/acpica/common/getopt.c index f3d8fbaf2b..c60a711098 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/common/getopt.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/common/getopt.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -123,14 +123,12 @@ * "f|" - Option has required single-char sub-options */ -#include -#include #include "acpi.h" #include "accommon.h" #include "acapps.h" #define ACPI_OPTION_ERROR(msg, badchar) \ - if (AcpiGbl_Opterr) {fprintf (stderr, "%s%c\n", msg, badchar);} + if (AcpiGbl_Opterr) {AcpiLogError ("%s%c\n", msg, badchar);} int AcpiGbl_Opterr = 1; @@ -195,7 +193,7 @@ AcpiGetoptArgument ( * PARAMETERS: argc, argv - from main * opts - options info list * - * RETURN: Option character or EOF + * RETURN: Option character or ACPI_OPT_END * * DESCRIPTION: Get the next option * @@ -217,12 +215,12 @@ AcpiGetopt( argv[AcpiGbl_Optind][0] != '-' || argv[AcpiGbl_Optind][1] == '\0') { - return (EOF); + return (ACPI_OPT_END); } - else if (strcmp (argv[AcpiGbl_Optind], "--") == 0) + else if (ACPI_STRCMP (argv[AcpiGbl_Optind], "--") == 0) { AcpiGbl_Optind++; - return (EOF); + return (ACPI_OPT_END); } } @@ -233,7 +231,7 @@ AcpiGetopt( /* Make sure that the option is legal */ if (CurrentChar == ':' || - (OptsPtr = strchr (opts, CurrentChar)) == NULL) + (OptsPtr = ACPI_STRCHR (opts, CurrentChar)) == NULL) { ACPI_OPTION_ERROR ("Illegal option: -", CurrentChar); diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dsargs.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dsargs.c index 1ac21971df..78013413bc 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dsargs.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dsargs.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dscontrol.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dscontrol.c index 1751e283ac..6ed6010db3 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dscontrol.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dscontrol.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dsfield.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dsfield.c index 56a8d3e9fb..2219952b68 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dsfield.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dsfield.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -188,7 +188,7 @@ AcpiDsCreateExternalRegion ( * OperationRegion not found. Generate an External for it, and * insert the name into the namespace. */ - AcpiDmAddToExternalList (Op, Path, ACPI_TYPE_REGION, 0); + AcpiDmAddOpToExternalList (Op, Path, ACPI_TYPE_REGION, 0, 0); Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_REGION, ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, WalkState, Node); if (ACPI_FAILURE (Status)) diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dsinit.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dsinit.c index 119d734c6e..22ed601fea 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dsinit.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dsinit.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -124,6 +124,7 @@ #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME ("dsinit") + /* Local prototypes */ static ACPI_STATUS @@ -163,8 +164,8 @@ AcpiDsInitOneObject ( { ACPI_INIT_WALK_INFO *Info = (ACPI_INIT_WALK_INFO *) Context; ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; - ACPI_OBJECT_TYPE Type; ACPI_STATUS Status; + ACPI_OPERAND_OBJECT *ObjDesc; ACPI_FUNCTION_ENTRY (); @@ -183,9 +184,7 @@ AcpiDsInitOneObject ( /* And even then, we are only interested in a few object types */ - Type = AcpiNsGetType (ObjHandle); - - switch (Type) + switch (AcpiNsGetType (ObjHandle)) { case ACPI_TYPE_REGION: @@ -201,8 +200,45 @@ AcpiDsInitOneObject ( break; case ACPI_TYPE_METHOD: - + /* + * Auto-serialization support. We will examine each method that is + * NotSerialized to determine if it creates any Named objects. If + * it does, it will be marked serialized to prevent problems if + * the method is entered by two or more threads and an attempt is + * made to create the same named object twice -- which results in + * an AE_ALREADY_EXISTS exception and method abort. + */ Info->MethodCount++; + ObjDesc = AcpiNsGetAttachedObject (Node); + if (!ObjDesc) + { + break; + } + + /* Ignore if already serialized */ + + if (ObjDesc->Method.InfoFlags & ACPI_METHOD_SERIALIZED) + { + Info->SerialMethodCount++; + break; + } + + if (AcpiGbl_AutoSerializeMethods) + { + /* Parse/scan method and serialize it if necessary */ + + AcpiDsAutoSerializeMethod (Node, ObjDesc); + if (ObjDesc->Method.InfoFlags & ACPI_METHOD_SERIALIZED) + { + /* Method was just converted to Serialized */ + + Info->SerialMethodCount++; + Info->SerializedMethodCount++; + break; + } + } + + Info->NonSerialMethodCount++; break; case ACPI_TYPE_DEVICE: @@ -259,7 +295,6 @@ AcpiDsInitializeObjects ( ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "**** Starting initialization of namespace objects ****\n")); - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Parsing all Control Methods:")); /* Set all init info to zero */ @@ -295,12 +330,14 @@ AcpiDsInitializeObjects ( } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - "\nTable [%4.4s](id %4.4X) - %u Objects with %u Devices %u Methods %u Regions\n", - Table->Signature, OwnerId, Info.ObjectCount, - Info.DeviceCount, Info.MethodCount, Info.OpRegionCount)); + "Table [%4.4s] (id %4.4X) - %4u Objects with %3u Devices, " + "%3u Regions, %3u Methods (%u/%u/%u Serial/Non/Cvt)\n", + Table->Signature, OwnerId, Info.ObjectCount, Info.DeviceCount, + Info.OpRegionCount, Info.MethodCount, Info.SerialMethodCount, + Info.NonSerialMethodCount, Info.SerializedMethodCount)); - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "%u Methods, %u Regions\n", Info.MethodCount, Info.OpRegionCount)); + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "%u Methods, %u Regions\n", + Info.MethodCount, Info.OpRegionCount)); return_ACPI_STATUS (AE_OK); } diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dsmethod.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dsmethod.c index 01aa7880dd..5d1985ad2c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dsmethod.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dsmethod.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -121,6 +121,8 @@ #include "acinterp.h" #include "acnamesp.h" #include "acdisasm.h" +#include "acparser.h" +#include "amlcode.h" #define _COMPONENT ACPI_DISPATCHER @@ -128,11 +130,155 @@ /* Local prototypes */ +static ACPI_STATUS +AcpiDsDetectNamedOpcodes ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT **OutOp); + static ACPI_STATUS AcpiDsCreateMethodMutex ( ACPI_OPERAND_OBJECT *MethodDesc); +/******************************************************************************* + * + * FUNCTION: AcpiDsAutoSerializeMethod + * + * PARAMETERS: Node - Namespace Node of the method + * ObjDesc - Method object attached to node + * + * RETURN: Status + * + * DESCRIPTION: Parse a control method AML to scan for control methods that + * need serialization due to the creation of named objects. + * + * NOTE: It is a bit of overkill to mark all such methods serialized, since + * there is only a problem if the method actually blocks during execution. + * A blocking operation is, for example, a Sleep() operation, or any access + * to an operation region. However, it is probably not possible to easily + * detect whether a method will block or not, so we simply mark all suspicious + * methods as serialized. + * + * NOTE2: This code is essentially a generic routine for parsing a single + * control method. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDsAutoSerializeMethod ( + ACPI_NAMESPACE_NODE *Node, + ACPI_OPERAND_OBJECT *ObjDesc) +{ + ACPI_STATUS Status; + ACPI_PARSE_OBJECT *Op = NULL; + ACPI_WALK_STATE *WalkState; + + + ACPI_FUNCTION_TRACE_PTR (DsAutoSerializeMethod, Node); + + + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, + "Method auto-serialization parse [%4.4s] %p\n", + AcpiUtGetNodeName (Node), Node)); + + /* Create/Init a root op for the method parse tree */ + + Op = AcpiPsAllocOp (AML_METHOD_OP); + if (!Op) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + AcpiPsSetName (Op, Node->Name.Integer); + Op->Common.Node = Node; + + /* Create and initialize a new walk state */ + + WalkState = AcpiDsCreateWalkState (Node->OwnerId, NULL, NULL, NULL); + if (!WalkState) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + Status = AcpiDsInitAmlWalk (WalkState, Op, Node, ObjDesc->Method.AmlStart, + ObjDesc->Method.AmlLength, NULL, 0); + if (ACPI_FAILURE (Status)) + { + AcpiDsDeleteWalkState (WalkState); + return_ACPI_STATUS (Status); + } + + WalkState->DescendingCallback = AcpiDsDetectNamedOpcodes; + + /* Parse the method, scan for creation of named objects */ + + Status = AcpiPsParseAml (WalkState); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + AcpiPsDeleteParseTree (Op); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDsDetectNamedOpcodes + * + * PARAMETERS: WalkState - Current state of the parse tree walk + * OutOp - Unused, required for parser interface + * + * RETURN: Status + * + * DESCRIPTION: Descending callback used during the loading of ACPI tables. + * Currently used to detect methods that must be marked serialized + * in order to avoid problems with the creation of named objects. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDsDetectNamedOpcodes ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT **OutOp) +{ + + ACPI_FUNCTION_NAME (AcpiDsDetectNamedOpcodes); + + + /* We are only interested in opcodes that create a new name */ + + if (!(WalkState->OpInfo->Flags & (AML_NAMED | AML_CREATE | AML_FIELD))) + { + return (AE_OK); + } + + /* + * At this point, we know we have a Named object opcode. + * Mark the method as serialized. Later code will create a mutex for + * this method to enforce serialization. + * + * Note, ACPI_METHOD_IGNORE_SYNC_LEVEL flag means that we will ignore the + * Sync Level mechanism for this method, even though it is now serialized. + * Otherwise, there can be conflicts with existing ASL code that actually + * uses sync levels. + */ + WalkState->MethodDesc->Method.SyncLevel = 0; + WalkState->MethodDesc->Method.InfoFlags |= + (ACPI_METHOD_SERIALIZED | ACPI_METHOD_IGNORE_SYNC_LEVEL); + + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "Method serialized [%4.4s] %p - [%s] (%4.4X)\n", + WalkState->MethodNode->Name.Ascii, WalkState->MethodNode, + WalkState->OpInfo->Name, WalkState->Opcode)); + + /* Abort the parse, no need to examine this method any further */ + + return (AE_CTRL_TERMINATE); +} + + /******************************************************************************* * * FUNCTION: AcpiDsMethodError @@ -310,11 +456,16 @@ AcpiDsBeginMethodExecution ( /* * The CurrentSyncLevel (per-thread) must be less than or equal to * the sync level of the method. This mechanism provides some - * deadlock prevention + * deadlock prevention. + * + * If the method was auto-serialized, we just ignore the sync level + * mechanism, because auto-serialization of methods can interfere + * with ASL code that actually uses sync levels. * * Top-level method invocation has no walk state at this point */ if (WalkState && + (!(ObjDesc->Method.InfoFlags & ACPI_METHOD_IGNORE_SYNC_LEVEL)) && (WalkState->Thread->CurrentSyncLevel > ObjDesc->Method.Mutex->Mutex.SyncLevel)) { ACPI_ERROR ((AE_INFO, @@ -782,7 +933,8 @@ AcpiDsTerminateControlMethod ( * thread exits here. */ MethodDesc->Method.InfoFlags &= ~ACPI_METHOD_SERIALIZED_PENDING; - MethodDesc->Method.InfoFlags |= ACPI_METHOD_SERIALIZED; + MethodDesc->Method.InfoFlags |= + (ACPI_METHOD_SERIALIZED | ACPI_METHOD_IGNORE_SYNC_LEVEL); MethodDesc->Method.SyncLevel = 0; } diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dsmthdat.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dsmthdat.c index 2e034e9a07..9b664bc8c0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dsmthdat.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dsmthdat.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dsobject.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dsobject.c index b2e2e61559..d6260b5dfa 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dsobject.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dsobject.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dsopcode.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dsopcode.c index 1bca33d390..83d482d493 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dsopcode.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dsopcode.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dsutils.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dsutils.c index d3c9580938..2553ad2aff 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dsutils.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dsutils.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -851,16 +851,16 @@ AcpiDsCreateOperands ( Index++; } + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "NumOperands %d, ArgCount %d, Index %d\n", + WalkState->NumOperands, ArgCount, Index)); + + /* Create the interpreter arguments, in reverse order */ + Index--; - - /* It is the appropriate order to get objects from the Result stack */ - for (i = 0; i < ArgCount; i++) { Arg = Arguments[Index]; - - /* Force the filling of the operand stack in inverse order */ - WalkState->OperandIndex = (UINT8) Index; Status = AcpiDsCreateOperand (WalkState, Arg, Index); @@ -869,10 +869,10 @@ AcpiDsCreateOperands ( goto Cleanup; } + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "Created Arg #%u (%p) %u args total\n", + Index, Arg, ArgCount)); Index--; - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Arg #%u (%p) done, Arg1=%p\n", - Index, Arg, FirstArg)); } return_ACPI_STATUS (Status); diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dswexec.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dswexec.c index fdc79feb47..afa707d576 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dswexec.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dswexec.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -613,7 +613,8 @@ AcpiDsExecEndOp ( return_ACPI_STATUS (AE_OK); } - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Method invocation, Op=%p\n", Op)); + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "Method invocation, Op=%p\n", Op)); /* * (AML_METHODCALL) Op->Asl.Value.Arg->Asl.Node contains diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dswload.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dswload.c index 291fced479..7f811dd843 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dswload.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dswload.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -152,8 +152,21 @@ AcpiDsInitCallbacks ( switch (PassNumber) { + case 0: + + /* Parse only - caller will setup callbacks */ + + WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 | + ACPI_PARSE_DELETE_TREE | + ACPI_PARSE_DISASSEMBLE; + WalkState->DescendingCallback = NULL; + WalkState->AscendingCallback = NULL; + break; + case 1: + /* Load pass 1 */ + WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE; WalkState->DescendingCallback = AcpiDsLoad1BeginOp; @@ -162,6 +175,8 @@ AcpiDsInitCallbacks ( case 2: + /* Load pass 2 */ + WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE; WalkState->DescendingCallback = AcpiDsLoad2BeginOp; @@ -170,6 +185,8 @@ AcpiDsInitCallbacks ( case 3: + /* Execution pass */ + #ifndef ACPI_NO_METHOD_EXECUTION WalkState->ParseFlags |= ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE; @@ -265,7 +282,7 @@ AcpiDsLoad1BeginOp ( * Target of Scope() not found. Generate an External for it, and * insert the name into the namespace. */ - AcpiDmAddToExternalList (Op, Path, ACPI_TYPE_DEVICE, 0); + AcpiDmAddOpToExternalList (Op, Path, ACPI_TYPE_DEVICE, 0, 0); Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, WalkState, &Node); diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dswload2.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dswload2.c index 2362d9805a..bef85cb8af 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dswload2.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dswload2.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dswscope.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dswscope.c index 2490b8b6c7..62f2596556 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dswscope.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dswscope.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dswstate.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dswstate.c index 99def396f6..e76d4ce9c4 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dswstate.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/dispatcher/dswstate.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evevent.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evevent.c index 897c933ddb..f43eeff07a 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evevent.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evevent.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evglock.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evglock.c index f92b5de9d1..fa1954aaff 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evglock.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evglock.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evgpe.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evgpe.c index 64c116799f..ea1a3a69d1 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evgpe.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evgpe.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -504,7 +504,7 @@ AcpiEvGpeDetect ( GpeRegisterInfo->EnableForWake)) { ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, - "Ignore disabled registers for GPE%02X-GPE%02X: " + "Ignore disabled registers for GPE %02X-%02X: " "RunEnable=%02X, WakeEnable=%02X\n", GpeRegisterInfo->BaseGpeNumber, GpeRegisterInfo->BaseGpeNumber + (ACPI_GPE_REGISTER_WIDTH - 1), @@ -530,7 +530,7 @@ AcpiEvGpeDetect ( } ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, - "Read registers for GPE%02X-GPE%02X: Status=%02X, Enable=%02X, " + "Read registers for GPE %02X-%02X: Status=%02X, Enable=%02X, " "RunEnable=%02X, WakeEnable=%02X\n", GpeRegisterInfo->BaseGpeNumber, GpeRegisterInfo->BaseGpeNumber + (ACPI_GPE_REGISTER_WIDTH - 1), @@ -621,6 +621,7 @@ AcpiEvAsynchExecuteGpeMethod ( Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); if (ACPI_FAILURE (Status)) { + ACPI_FREE (LocalGpeEventInfo); return_VOID; } @@ -629,6 +630,7 @@ AcpiEvAsynchExecuteGpeMethod ( if (!AcpiEvValidGpeEvent (GpeEventInfo)) { Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS); + ACPI_FREE (LocalGpeEventInfo); return_VOID; } @@ -642,6 +644,7 @@ AcpiEvAsynchExecuteGpeMethod ( Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS); if (ACPI_FAILURE (Status)) { + ACPI_FREE (LocalGpeEventInfo); return_VOID; } @@ -829,22 +832,6 @@ AcpiEvGpeDispatch ( GpeNumber, AcpiGbl_GlobalEventHandlerContext); } - /* - * If edge-triggered, clear the GPE status bit now. Note that - * level-triggered events are cleared after the GPE is serviced. - */ - if ((GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK) == - ACPI_GPE_EDGE_TRIGGERED) - { - Status = AcpiHwClearGpe (GpeEventInfo); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Unable to clear GPE%02X", GpeNumber)); - return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED); - } - } - /* * Always disable the GPE so that it does not keep firing before * any asynchronous activity completes (either from the execution @@ -858,10 +845,28 @@ AcpiEvGpeDispatch ( if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, - "Unable to disable GPE%02X", GpeNumber)); + "Unable to disable GPE %02X", GpeNumber)); return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED); } + /* + * If edge-triggered, clear the GPE status bit now. Note that + * level-triggered events are cleared after the GPE is serviced. + */ + if ((GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK) == + ACPI_GPE_EDGE_TRIGGERED) + { + Status = AcpiHwClearGpe (GpeEventInfo); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, + "Unable to clear GPE %02X", GpeNumber)); + (void) AcpiHwLowSetGpe (GpeEventInfo, + ACPI_GPE_CONDITIONAL_ENABLE); + return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED); + } + } + /* * Dispatch the GPE to either an installed handler or the control * method associated with this GPE (_Lxx or _Exx). If a handler @@ -898,7 +903,7 @@ AcpiEvGpeDispatch ( if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, - "Unable to queue handler for GPE%02X - event disabled", + "Unable to queue handler for GPE %02X - event disabled", GpeNumber)); } break; @@ -910,7 +915,7 @@ AcpiEvGpeDispatch ( * a GPE to be enabled if it has no handler or method. */ ACPI_ERROR ((AE_INFO, - "No handler or method for GPE%02X, disabling event", + "No handler or method for GPE %02X, disabling event", GpeNumber)); break; } diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evgpeblk.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evgpeblk.c index aed636f4f5..4de91c1c1f 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evgpeblk.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evgpeblk.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -169,10 +169,9 @@ AcpiEvInstallGpeBlock ( return_ACPI_STATUS (Status); } - GpeXruptBlock = AcpiEvGetGpeXruptBlock (InterruptNumber); - if (!GpeXruptBlock) + Status = AcpiEvGetGpeXruptBlock (InterruptNumber, &GpeXruptBlock); + if (ACPI_FAILURE (Status)) { - Status = AE_NO_MEMORY; goto UnlockAndExit; } @@ -200,7 +199,7 @@ AcpiEvInstallGpeBlock ( UnlockAndExit: - Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS); + (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); return_ACPI_STATUS (Status); } @@ -355,17 +354,17 @@ AcpiEvCreateGpeInfoBlocks ( { /* Init the RegisterInfo for this GPE register (8 GPEs) */ - ThisRegister->BaseGpeNumber = (UINT8) (GpeBlock->BlockBaseNumber + - (i * ACPI_GPE_REGISTER_WIDTH)); + ThisRegister->BaseGpeNumber = (UINT16) + (GpeBlock->BlockBaseNumber + (i * ACPI_GPE_REGISTER_WIDTH)); ThisRegister->StatusAddress.Address = - GpeBlock->BlockAddress.Address + i; + GpeBlock->Address + i; ThisRegister->EnableAddress.Address = - GpeBlock->BlockAddress.Address + i + GpeBlock->RegisterCount; + GpeBlock->Address + i + GpeBlock->RegisterCount; - ThisRegister->StatusAddress.SpaceId = GpeBlock->BlockAddress.SpaceId; - ThisRegister->EnableAddress.SpaceId = GpeBlock->BlockAddress.SpaceId; + ThisRegister->StatusAddress.SpaceId = GpeBlock->SpaceId; + ThisRegister->EnableAddress.SpaceId = GpeBlock->SpaceId; ThisRegister->StatusAddress.BitWidth = ACPI_GPE_REGISTER_WIDTH; ThisRegister->EnableAddress.BitWidth = ACPI_GPE_REGISTER_WIDTH; ThisRegister->StatusAddress.BitOffset = 0; @@ -438,9 +437,10 @@ ErrorExit: ACPI_STATUS AcpiEvCreateGpeBlock ( ACPI_NAMESPACE_NODE *GpeDevice, - ACPI_GENERIC_ADDRESS *GpeBlockAddress, + UINT64 Address, + UINT8 SpaceId, UINT32 RegisterCount, - UINT8 GpeBlockBaseNumber, + UINT16 GpeBlockBaseNumber, UINT32 InterruptNumber, ACPI_GPE_BLOCK_INFO **ReturnGpeBlock) { @@ -467,15 +467,14 @@ AcpiEvCreateGpeBlock ( /* Initialize the new GPE block */ + GpeBlock->Address = Address; + GpeBlock->SpaceId = SpaceId; GpeBlock->Node = GpeDevice; GpeBlock->GpeCount = (UINT16) (RegisterCount * ACPI_GPE_REGISTER_WIDTH); GpeBlock->Initialized = FALSE; GpeBlock->RegisterCount = RegisterCount; GpeBlock->BlockBaseNumber = GpeBlockBaseNumber; - ACPI_MEMCPY (&GpeBlock->BlockAddress, GpeBlockAddress, - sizeof (ACPI_GENERIC_ADDRESS)); - /* * Create the RegisterInfo and EventInfo sub-structures * Note: disables and clears all GPEs in the block @@ -518,11 +517,11 @@ AcpiEvCreateGpeBlock ( } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - " Initialized GPE %02X to %02X [%4.4s] %u regs on interrupt 0x%X\n", + " Initialized GPE %02X to %02X [%4.4s] %u regs on interrupt 0x%X%s\n", (UINT32) GpeBlock->BlockBaseNumber, (UINT32) (GpeBlock->BlockBaseNumber + (GpeBlock->GpeCount - 1)), - GpeDevice->Name.Ascii, GpeBlock->RegisterCount, - InterruptNumber)); + GpeDevice->Name.Ascii, GpeBlock->RegisterCount, InterruptNumber, + InterruptNumber == AcpiGbl_FADT.SciInterrupt ? " (SCI)" : "")); /* Update global count of currently available GPEs */ diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evgpeinit.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evgpeinit.c index c9ae57b5e6..2e2e6b35a3 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evgpeinit.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evgpeinit.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -211,7 +211,9 @@ AcpiEvGpeInitialize ( /* Install GPE Block 0 */ Status = AcpiEvCreateGpeBlock (AcpiGbl_FadtGpeDevice, - &AcpiGbl_FADT.XGpe0Block, RegisterCount0, 0, + AcpiGbl_FADT.XGpe0Block.Address, + AcpiGbl_FADT.XGpe0Block.SpaceId, + RegisterCount0, 0, AcpiGbl_FADT.SciInterrupt, &AcpiGbl_GpeFadtBlocks[0]); if (ACPI_FAILURE (Status)) @@ -249,7 +251,9 @@ AcpiEvGpeInitialize ( /* Install GPE Block 1 */ Status = AcpiEvCreateGpeBlock (AcpiGbl_FadtGpeDevice, - &AcpiGbl_FADT.XGpe1Block, RegisterCount1, + AcpiGbl_FADT.XGpe1Block.Address, + AcpiGbl_FADT.XGpe1Block.SpaceId, + RegisterCount1, AcpiGbl_FADT.Gpe1Base, AcpiGbl_FADT.SciInterrupt, &AcpiGbl_GpeFadtBlocks[1]); diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evgpeutil.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evgpeutil.c index fd0d71762c..0410bae57f 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evgpeutil.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evgpeutil.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -289,8 +289,9 @@ AcpiEvGetGpeDevice ( * FUNCTION: AcpiEvGetGpeXruptBlock * * PARAMETERS: InterruptNumber - Interrupt for a GPE block + * GpeXruptBlock - Where the block is returned * - * RETURN: A GPE interrupt block + * RETURN: Status * * DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt * block per unique interrupt level used for GPEs. Should be @@ -299,9 +300,10 @@ AcpiEvGetGpeDevice ( * ******************************************************************************/ -ACPI_GPE_XRUPT_INFO * +ACPI_STATUS AcpiEvGetGpeXruptBlock ( - UINT32 InterruptNumber) + UINT32 InterruptNumber, + ACPI_GPE_XRUPT_INFO **GpeXruptBlock) { ACPI_GPE_XRUPT_INFO *NextGpeXrupt; ACPI_GPE_XRUPT_INFO *GpeXrupt; @@ -319,7 +321,8 @@ AcpiEvGetGpeXruptBlock ( { if (NextGpeXrupt->InterruptNumber == InterruptNumber) { - return_PTR (NextGpeXrupt); + *GpeXruptBlock = NextGpeXrupt; + return_ACPI_STATUS (AE_OK); } NextGpeXrupt = NextGpeXrupt->Next; @@ -330,7 +333,7 @@ AcpiEvGetGpeXruptBlock ( GpeXrupt = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_XRUPT_INFO)); if (!GpeXrupt) { - return_PTR (NULL); + return_ACPI_STATUS (AE_NO_MEMORY); } GpeXrupt->InterruptNumber = InterruptNumber; @@ -353,6 +356,7 @@ AcpiEvGetGpeXruptBlock ( { AcpiGbl_GpeXruptListHead = GpeXrupt; } + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); /* Install new interrupt handler if not SCI_INT */ @@ -363,14 +367,15 @@ AcpiEvGetGpeXruptBlock ( AcpiEvGpeXruptHandler, GpeXrupt); if (ACPI_FAILURE (Status)) { - ACPI_ERROR ((AE_INFO, + ACPI_EXCEPTION ((AE_INFO, Status, "Could not install GPE interrupt handler at level 0x%X", InterruptNumber)); - return_PTR (NULL); + return_ACPI_STATUS (Status); } } - return_PTR (GpeXrupt); + *GpeXruptBlock = GpeXrupt; + return_ACPI_STATUS (AE_OK); } diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evhandler.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evhandler.c index a92546f26a..d17411e942 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evhandler.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evhandler.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evmisc.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evmisc.c index b0c89833ac..8b2c3ff46f 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evmisc.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evmisc.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -253,7 +253,7 @@ AcpiEvQueueNotifyRequest ( ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Dispatching Notify on [%4.4s] (%s) Value 0x%2.2X (%s) Node %p\n", AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type), - NotifyValue, AcpiUtGetNotifyName (NotifyValue), Node)); + NotifyValue, AcpiUtGetNotifyName (NotifyValue, ACPI_TYPE_ANY), Node)); Status = AcpiOsExecute (OSL_NOTIFY_HANDLER, AcpiEvNotifyDispatch, Info); diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evregion.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evregion.c index efaf38b902..8f1b24b2dd 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evregion.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evregion.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -405,6 +405,7 @@ AcpiEvDetachRegion( { ACPI_OPERAND_OBJECT *HandlerObj; ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_OPERAND_OBJECT *StartDesc; ACPI_OPERAND_OBJECT **LastObjPtr; ACPI_ADR_SPACE_SETUP RegionSetup; void **RegionContext; @@ -435,6 +436,7 @@ AcpiEvDetachRegion( /* Find this region in the handler's list */ ObjDesc = HandlerObj->AddressSpace.RegionList; + StartDesc = ObjDesc; LastObjPtr = &HandlerObj->AddressSpace.RegionList; while (ObjDesc) @@ -529,6 +531,16 @@ AcpiEvDetachRegion( LastObjPtr = &ObjDesc->Region.Next; ObjDesc = ObjDesc->Region.Next; + + /* Prevent infinite loop if list is corrupted */ + + if (ObjDesc == StartDesc) + { + ACPI_ERROR ((AE_INFO, + "Circular handler list in region object %p", + RegionObj)); + return_VOID; + } } /* If we get here, the region was not in the handler's region list */ diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evrgnini.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evrgnini.c index 8087f8caac..ac321c7daf 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evrgnini.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evrgnini.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evsci.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evsci.c index fe5c309f13..ec6c1c1918 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evsci.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evsci.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -208,7 +208,7 @@ AcpiEvSciXruptHandler ( /* - * We are guaranteed by the ACPI CA initialization/shutdown code that + * We are guaranteed by the ACPICA initialization/shutdown code that * if this interrupt handler is installed, ACPI is enabled. */ diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evxface.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evxface.c index c95667bf38..85355a57c8 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evxface.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evxface.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -115,6 +115,7 @@ #define __EVXFACE_C__ +#define EXPORT_ACPI_INTERFACES #include "acpi.h" #include "accommon.h" @@ -337,7 +338,7 @@ AcpiRemoveNotifyHandler ( ACPI_OPERAND_OBJECT *ObjDesc; ACPI_OPERAND_OBJECT *HandlerObj; ACPI_OPERAND_OBJECT *PreviousHandlerObj; - ACPI_STATUS Status; + ACPI_STATUS Status = AE_OK; UINT32 i; @@ -352,16 +353,6 @@ AcpiRemoveNotifyHandler ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - /* Make sure all deferred notify tasks are completed */ - - AcpiOsWaitEventsComplete (); - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - /* Root Object. Global handlers are removed here */ if (Device == ACPI_ROOT_OBJECT) @@ -370,6 +361,12 @@ AcpiRemoveNotifyHandler ( { if (HandlerType & (i+1)) { + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + if (!AcpiGbl_GlobalNotify[i].Handler || (AcpiGbl_GlobalNotify[i].Handler != Handler)) { @@ -382,18 +379,23 @@ AcpiRemoveNotifyHandler ( AcpiGbl_GlobalNotify[i].Handler = NULL; AcpiGbl_GlobalNotify[i].Context = NULL; + + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + + /* Make sure all deferred notify tasks are completed */ + + AcpiOsWaitEventsComplete (); } } - goto UnlockAndExit; + return_ACPI_STATUS (AE_OK); } /* All other objects: Are Notifies allowed on this object? */ if (!AcpiEvIsNotifyObject (Node)) { - Status = AE_TYPE; - goto UnlockAndExit; + return_ACPI_STATUS (AE_TYPE); } /* Must have an existing internal object */ @@ -401,8 +403,7 @@ AcpiRemoveNotifyHandler ( ObjDesc = AcpiNsGetAttachedObject (Node); if (!ObjDesc) { - Status = AE_NOT_EXIST; - goto UnlockAndExit; + return_ACPI_STATUS (AE_NOT_EXIST); } /* Internal object exists. Find the handler and remove it */ @@ -411,6 +412,12 @@ AcpiRemoveNotifyHandler ( { if (HandlerType & (i+1)) { + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + HandlerObj = ObjDesc->CommonNotify.NotifyList[i]; PreviousHandlerObj = NULL; @@ -442,10 +449,17 @@ AcpiRemoveNotifyHandler ( HandlerObj->Notify.Next[i]; } + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + + /* Make sure all deferred notify tasks are completed */ + + AcpiOsWaitEventsComplete (); AcpiUtRemoveReference (HandlerObj); } } + return_ACPI_STATUS (Status); + UnlockAndExit: (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); @@ -591,6 +605,8 @@ Exit: return_ACPI_STATUS (Status); } +ACPI_EXPORT_SYMBOL (AcpiInstallSciHandler) + /******************************************************************************* * @@ -667,6 +683,8 @@ UnlockAndExit: return_ACPI_STATUS (Status); } +ACPI_EXPORT_SYMBOL (AcpiRemoveSciHandler) + /******************************************************************************* * @@ -1041,10 +1059,6 @@ AcpiRemoveGpeHandler ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - /* Make sure all deferred GPE tasks are completed */ - - AcpiOsWaitEventsComplete (); - Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); if (ACPI_FAILURE (Status)) { @@ -1101,10 +1115,17 @@ AcpiRemoveGpeHandler ( (void) AcpiEvAddGpeReference (GpeEventInfo); } + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); + (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); + + /* Make sure all deferred GPE tasks are completed */ + + AcpiOsWaitEventsComplete (); + /* Now we can free the handler object */ ACPI_FREE (Handler); - + return_ACPI_STATUS (Status); UnlockAndExit: AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evxfevnt.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evxfevnt.c index 47273ce317..c099bdb2e1 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evxfevnt.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evxfevnt.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -115,6 +115,7 @@ #define __EVXFEVNT_C__ +#define EXPORT_ACPI_INTERFACES #include "acpi.h" #include "accommon.h" diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evxfgpe.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evxfgpe.c index 4a756c9467..b116322357 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evxfgpe.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evxfgpe.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -115,6 +115,7 @@ #define __EVXFGPE_C__ +#define EXPORT_ACPI_INTERFACES #include "acpi.h" #include "accommon.h" @@ -212,12 +213,23 @@ AcpiEnableGpe ( Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - /* Ensure that we have a valid GPE number */ - + /* + * Ensure that we have a valid GPE number and that there is some way + * of handling the GPE (handler or a GPE method). In other words, we + * won't allow a valid GPE to be enabled if there is no way to handle it. + */ GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); if (GpeEventInfo) { - Status = AcpiEvAddGpeReference (GpeEventInfo); + if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) != + ACPI_GPE_DISPATCH_NONE) + { + Status = AcpiEvAddGpeReference (GpeEventInfo); + } + else + { + Status = AE_NO_HANDLER; + } } AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); @@ -345,6 +357,60 @@ UnlockAndExit: ACPI_EXPORT_SYMBOL (AcpiSetGpe) +/******************************************************************************* + * + * FUNCTION: AcpiMarkGpeForWake + * + * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 + * GpeNumber - GPE level within the GPE block + * + * RETURN: Status + * + * DESCRIPTION: Mark a GPE as having the ability to wake the system. Simply + * sets the ACPI_GPE_CAN_WAKE flag. + * + * Some potential callers of AcpiSetupGpeForWake may know in advance that + * there won't be any notify handlers installed for device wake notifications + * from the given GPE (one example is a button GPE in Linux). For these cases, + * AcpiMarkGpeForWake should be used instead of AcpiSetupGpeForWake. + * This will set the ACPI_GPE_CAN_WAKE flag for the GPE without trying to + * setup implicit wake notification for it (since there's no handler method). + * + ******************************************************************************/ + +ACPI_STATUS +AcpiMarkGpeForWake ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber) +{ + ACPI_GPE_EVENT_INFO *GpeEventInfo; + ACPI_STATUS Status = AE_BAD_PARAMETER; + ACPI_CPU_FLAGS Flags; + + + ACPI_FUNCTION_TRACE (AcpiMarkGpeForWake); + + + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + + /* Ensure that we have a valid GPE number */ + + GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); + if (GpeEventInfo) + { + /* Mark the GPE as a possible wake event */ + + GpeEventInfo->Flags |= ACPI_GPE_CAN_WAKE; + Status = AE_OK; + } + + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiMarkGpeForWake) + + /******************************************************************************* * * FUNCTION: AcpiSetupGpeForWake @@ -862,11 +928,26 @@ AcpiInstallGpeBlock ( goto UnlockAndExit; } + /* Validate the parent device */ + + if (Node->Type != ACPI_TYPE_DEVICE) + { + Status = AE_TYPE; + goto UnlockAndExit; + } + + if (Node->Object) + { + Status = AE_ALREADY_EXISTS; + goto UnlockAndExit; + } + /* * For user-installed GPE Block Devices, the GpeBlockBaseNumber * is always zero */ - Status = AcpiEvCreateGpeBlock (Node, GpeBlockAddress, RegisterCount, + Status = AcpiEvCreateGpeBlock (Node, GpeBlockAddress->Address, + GpeBlockAddress->SpaceId, RegisterCount, 0, InterruptNumber, &GpeBlock); if (ACPI_FAILURE (Status)) { @@ -955,6 +1036,14 @@ AcpiRemoveGpeBlock ( goto UnlockAndExit; } + /* Validate the parent device */ + + if (Node->Type != ACPI_TYPE_DEVICE) + { + Status = AE_TYPE; + goto UnlockAndExit; + } + /* Get the DeviceObject attached to the node */ ObjDesc = AcpiNsGetAttachedObject (Node); diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evxfregn.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evxfregn.c index 12ec482ebd..014e3757fa 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evxfregn.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/events/evxfregn.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -115,6 +115,7 @@ *****************************************************************************/ #define __EVXFREGN_C__ +#define EXPORT_ACPI_INTERFACES #include "acpi.h" #include "accommon.h" diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exconfig.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exconfig.c index 809adb86c7..98caa14c95 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exconfig.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exconfig.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -453,8 +453,8 @@ AcpiExLoadOp ( ACPI_WALK_STATE *WalkState) { ACPI_OPERAND_OBJECT *DdbHandle; + ACPI_TABLE_HEADER *TableHeader; ACPI_TABLE_HEADER *Table; - ACPI_TABLE_DESC TableDesc; UINT32 TableIndex; ACPI_STATUS Status; UINT32 Length; @@ -463,8 +463,6 @@ AcpiExLoadOp ( ACPI_FUNCTION_TRACE (ExLoadOp); - ACPI_MEMSET (&TableDesc, 0, sizeof (ACPI_TABLE_DESC)); - /* Source Object can be either an OpRegion or a Buffer/Field */ switch (ObjDesc->Common.Type) @@ -496,16 +494,16 @@ AcpiExLoadOp ( /* Get the table header first so we can get the table length */ - Table = ACPI_ALLOCATE (sizeof (ACPI_TABLE_HEADER)); - if (!Table) + TableHeader = ACPI_ALLOCATE (sizeof (ACPI_TABLE_HEADER)); + if (!TableHeader) { return_ACPI_STATUS (AE_NO_MEMORY); } Status = AcpiExRegionRead (ObjDesc, sizeof (ACPI_TABLE_HEADER), - ACPI_CAST_PTR (UINT8, Table)); - Length = Table->Length; - ACPI_FREE (Table); + ACPI_CAST_PTR (UINT8, TableHeader)); + Length = TableHeader->Length; + ACPI_FREE (TableHeader); if (ACPI_FAILURE (Status)) { @@ -537,8 +535,8 @@ AcpiExLoadOp ( /* Allocate a buffer for the table */ - TableDesc.Pointer = ACPI_ALLOCATE (Length); - if (!TableDesc.Pointer) + Table = ACPI_ALLOCATE (Length); + if (!Table) { return_ACPI_STATUS (AE_NO_MEMORY); } @@ -546,14 +544,12 @@ AcpiExLoadOp ( /* Read the entire table */ Status = AcpiExRegionRead (ObjDesc, Length, - ACPI_CAST_PTR (UINT8, TableDesc.Pointer)); + ACPI_CAST_PTR (UINT8, Table)); if (ACPI_FAILURE (Status)) { - ACPI_FREE (TableDesc.Pointer); + ACPI_FREE (Table); return_ACPI_STATUS (Status); } - - TableDesc.Address = ObjDesc->Region.Address; break; case ACPI_TYPE_BUFFER: /* Buffer or resolved RegionField */ @@ -570,8 +566,8 @@ AcpiExLoadOp ( /* Get the actual table length from the table header */ - Table = ACPI_CAST_PTR (ACPI_TABLE_HEADER, ObjDesc->Buffer.Pointer); - Length = Table->Length; + TableHeader = ACPI_CAST_PTR (ACPI_TABLE_HEADER, ObjDesc->Buffer.Pointer); + Length = TableHeader->Length; /* Table cannot extend beyond the buffer */ @@ -588,14 +584,13 @@ AcpiExLoadOp ( * Copy the table from the buffer because the buffer could be modified * or even deleted in the future */ - TableDesc.Pointer = ACPI_ALLOCATE (Length); - if (!TableDesc.Pointer) + Table = ACPI_ALLOCATE (Length); + if (!Table) { return_ACPI_STATUS (AE_NO_MEMORY); } - ACPI_MEMCPY (TableDesc.Pointer, Table, Length); - TableDesc.Address = ACPI_TO_INTEGER (TableDesc.Pointer); + ACPI_MEMCPY (Table, TableHeader, Length); break; default: @@ -603,28 +598,31 @@ AcpiExLoadOp ( return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } - /* Validate table checksum (will not get validated in TbAddTable) */ - - Status = AcpiTbVerifyChecksum (TableDesc.Pointer, Length); - if (ACPI_FAILURE (Status)) - { - ACPI_FREE (TableDesc.Pointer); - return_ACPI_STATUS (Status); - } - - /* Complete the table descriptor */ - - TableDesc.Length = Length; - TableDesc.Flags = ACPI_TABLE_ORIGIN_ALLOCATED; - /* Install the new table into the local data structures */ - Status = AcpiTbAddTable (&TableDesc, &TableIndex); + ACPI_INFO ((AE_INFO, "Dynamic OEM Table Load:")); + (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); + + Status = AcpiTbInstallStandardTable (ACPI_PTR_TO_PHYSADDR (Table), + ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL, TRUE, TRUE, + &TableIndex); + + (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); if (ACPI_FAILURE (Status)) { /* Delete allocated table buffer */ - AcpiTbDeleteTable (&TableDesc); + ACPI_FREE (Table); + return_ACPI_STATUS (Status); + } + + /* + * Note: Now table is "INSTALLED", it must be validated before + * loading. + */ + Status = AcpiTbValidateTable (&AcpiGbl_RootTableList.Tables[TableIndex]); + if (ACPI_FAILURE (Status)) + { return_ACPI_STATUS (Status); } @@ -656,9 +654,6 @@ AcpiExLoadOp ( return_ACPI_STATUS (Status); } - ACPI_INFO ((AE_INFO, "Dynamic OEM Table Load:")); - AcpiTbPrintTableHeader (0, TableDesc.Pointer); - /* Remove the reference by added by AcpiExStore above */ AcpiUtRemoveReference (DdbHandle); @@ -667,7 +662,7 @@ AcpiExLoadOp ( if (AcpiGbl_TableHandler) { - (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, TableDesc.Pointer, + (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table, AcpiGbl_TableHandlerContext); } @@ -700,6 +695,14 @@ AcpiExUnloadTable ( ACPI_FUNCTION_TRACE (ExUnloadTable); + /* + * Temporarily emit a warning so that the ASL for the machine can be + * hopefully obtained. This is to say that the Unload() operator is + * extremely rare if not completely unused. + */ + ACPI_WARNING ((AE_INFO, + "Received request to unload an ACPI table")); + /* * Validate the handle * Although the handle is partially validated in AcpiExReconfiguration() diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exconvrt.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exconvrt.c index 99f03da133..2b2fffd644 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exconvrt.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exconvrt.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/excreate.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/excreate.c index 0b26c481db..8f7b9e72d3 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/excreate.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/excreate.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exdebug.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exdebug.c index b4525ca730..b7d47fdd5c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exdebug.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exdebug.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -154,6 +154,7 @@ AcpiExDoDebugObject ( UINT32 Index) { UINT32 i; + UINT32 Timer; ACPI_FUNCTION_TRACE_PTR (ExDoDebugObject, SourceDesc); @@ -167,13 +168,21 @@ AcpiExDoDebugObject ( return_VOID; } + /* + * We will emit the current timer value (in microseconds) with each + * debug output. Only need the lower 26 bits. This allows for 67 + * million microseconds or 67 seconds before rollover. + */ + Timer = (UINT32) (AcpiOsGetTimer () / 10); /* (100 nanoseconds to microseconds) */ + Timer &= 0x03FFFFFF; + /* * Print line header as long as we are not in the middle of an * object display */ if (!((Level > 0) && Index == 0)) { - AcpiOsPrintf ("[ACPI Debug] %*s", Level, " "); + AcpiOsPrintf ("[ACPI Debug %.8u] %*s", Timer, Level, " "); } /* Display the index for package output only */ diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exdump.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exdump.c index af788e2439..68a0054047 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exdump.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exdump.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -186,13 +186,14 @@ static ACPI_EXDUMP_INFO AcpiExDumpBuffer[5] = {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpBuffer), NULL}, {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Buffer.Length), "Length"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Buffer.Pointer), "Pointer"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Buffer.Node), "Parent Node"}, + {ACPI_EXD_NODE, ACPI_EXD_OFFSET (Buffer.Node), "Parent Node"}, {ACPI_EXD_BUFFER, 0, NULL} }; -static ACPI_EXDUMP_INFO AcpiExDumpPackage[5] = +static ACPI_EXDUMP_INFO AcpiExDumpPackage[6] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpPackage), NULL}, + {ACPI_EXD_NODE, ACPI_EXD_OFFSET (Package.Node), "Parent Node"}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Package.Flags), "Flags"}, {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Package.Count), "Elements"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Package.Elements), "Element List"}, @@ -202,9 +203,9 @@ static ACPI_EXDUMP_INFO AcpiExDumpPackage[5] = static ACPI_EXDUMP_INFO AcpiExDumpDevice[4] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpDevice), NULL}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.Handler), "Handler"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.NotifyList[0]), "System Notify"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.NotifyList[1]), "Device Notify"} + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.NotifyList[1]), "Device Notify"}, + {ACPI_EXD_HDLR_LIST,ACPI_EXD_OFFSET (Device.Handler), "Handler"} }; static ACPI_EXDUMP_INFO AcpiExDumpEvent[2] = @@ -226,33 +227,36 @@ static ACPI_EXDUMP_INFO AcpiExDumpMethod[9] = {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Method.AmlStart), "Aml Start"} }; -static ACPI_EXDUMP_INFO AcpiExDumpMutex[5] = +static ACPI_EXDUMP_INFO AcpiExDumpMutex[6] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpMutex), NULL}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Mutex.SyncLevel), "Sync Level"}, + {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Mutex.OriginalSyncLevel), "Original Sync Level"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Mutex.OwnerThread), "Owner Thread"}, {ACPI_EXD_UINT16, ACPI_EXD_OFFSET (Mutex.AcquisitionDepth), "Acquire Depth"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Mutex.OsMutex), "OsMutex"} }; -static ACPI_EXDUMP_INFO AcpiExDumpRegion[7] = +static ACPI_EXDUMP_INFO AcpiExDumpRegion[8] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpRegion), NULL}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Region.SpaceId), "Space Id"}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Region.Flags), "Flags"}, + {ACPI_EXD_NODE, ACPI_EXD_OFFSET (Region.Node), "Parent Node"}, {ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET (Region.Address), "Address"}, {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Region.Length), "Length"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Region.Handler), "Handler"}, + {ACPI_EXD_HDLR_LIST,ACPI_EXD_OFFSET (Region.Handler), "Handler"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Region.Next), "Next"} }; -static ACPI_EXDUMP_INFO AcpiExDumpPower[5] = +static ACPI_EXDUMP_INFO AcpiExDumpPower[6] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpPower), NULL}, {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (PowerResource.SystemLevel), "System Level"}, {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (PowerResource.ResourceOrder), "Resource Order"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.NotifyList[0]), "System Notify"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.NotifyList[1]), "Device Notify"} + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.NotifyList[1]), "Device Notify"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.Handler), "Handler"} }; static ACPI_EXDUMP_INFO AcpiExDumpProcessor[7] = @@ -315,7 +319,7 @@ static ACPI_EXDUMP_INFO AcpiExDumpReference[8] = {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Reference.TargetType), "Target Type"}, {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Reference.Value), "Value"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Object), "Object Desc"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Node), "Node"}, + {ACPI_EXD_NODE, ACPI_EXD_OFFSET (Reference.Node), "Node"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Where), "Where"}, {ACPI_EXD_REFERENCE,0, NULL} }; @@ -324,16 +328,16 @@ static ACPI_EXDUMP_INFO AcpiExDumpAddressHandler[6] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpAddressHandler), NULL}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (AddressSpace.SpaceId), "Space Id"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.Next), "Next"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.RegionList), "Region List"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.Node), "Node"}, + {ACPI_EXD_HDLR_LIST,ACPI_EXD_OFFSET (AddressSpace.Next), "Next"}, + {ACPI_EXD_RGN_LIST, ACPI_EXD_OFFSET (AddressSpace.RegionList), "Region List"}, + {ACPI_EXD_NODE, ACPI_EXD_OFFSET (AddressSpace.Node), "Node"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.Context), "Context"} }; static ACPI_EXDUMP_INFO AcpiExDumpNotify[7] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpNotify), NULL}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Node), "Node"}, + {ACPI_EXD_NODE, ACPI_EXD_OFFSET (Notify.Node), "Node"}, {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Notify.HandlerType), "Handler Type"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Handler), "Handler"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Context), "Context"}, @@ -341,15 +345,32 @@ static ACPI_EXDUMP_INFO AcpiExDumpNotify[7] = {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Next[1]), "Next Device Notify"} }; +static ACPI_EXDUMP_INFO AcpiExDumpExtra[6] = +{ + {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpExtra), NULL}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Extra.Method_REG), "_REG Method"}, + {ACPI_EXD_NODE, ACPI_EXD_OFFSET (Extra.ScopeNode), "Scope Node"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Extra.RegionContext), "Region Context"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Extra.AmlStart), "Aml Start"}, + {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Extra.AmlLength), "Aml Length"} +}; + +static ACPI_EXDUMP_INFO AcpiExDumpData[3] = +{ + {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpData), NULL}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Data.Handler), "Handler"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Data.Pointer), "Raw Data"} +}; /* Miscellaneous tables */ -static ACPI_EXDUMP_INFO AcpiExDumpCommon[4] = +static ACPI_EXDUMP_INFO AcpiExDumpCommon[5] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpCommon), NULL}, {ACPI_EXD_TYPE , 0, NULL}, {ACPI_EXD_UINT16, ACPI_EXD_OFFSET (Common.ReferenceCount), "Reference Count"}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Common.Flags), "Flags"} + {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Common.Flags), "Flags"}, + {ACPI_EXD_LIST, ACPI_EXD_OFFSET (Common.NextObject), "Object List"} }; static ACPI_EXDUMP_INFO AcpiExDumpFieldCommon[7] = @@ -360,16 +381,18 @@ static ACPI_EXDUMP_INFO AcpiExDumpFieldCommon[7] = {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (CommonField.BitLength), "Bit Length"}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (CommonField.StartFieldBitOffset),"Field Bit Offset"}, {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (CommonField.BaseByteOffset), "Base Byte Offset"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (CommonField.Node), "Parent Node"} + {ACPI_EXD_NODE, ACPI_EXD_OFFSET (CommonField.Node), "Parent Node"} }; -static ACPI_EXDUMP_INFO AcpiExDumpNode[5] = +static ACPI_EXDUMP_INFO AcpiExDumpNode[7] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpNode), NULL}, {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET (Flags), "Flags"}, {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET (OwnerId), "Owner Id"}, - {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET (Child), "Child List"}, - {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET (Peer), "Next Peer"} + {ACPI_EXD_LIST, ACPI_EXD_NSOFFSET (Object), "Object List"}, + {ACPI_EXD_NODE, ACPI_EXD_NSOFFSET (Parent), "Parent"}, + {ACPI_EXD_NODE, ACPI_EXD_NSOFFSET (Child), "Child"}, + {ACPI_EXD_NODE, ACPI_EXD_NSOFFSET (Peer), "Peer"} }; @@ -404,7 +427,9 @@ static ACPI_EXDUMP_INFO *AcpiExDumpInfo[] = AcpiExDumpAddressHandler, NULL, NULL, - NULL + NULL, + AcpiExDumpExtra, + AcpiExDumpData }; @@ -431,6 +456,10 @@ AcpiExDumpObject ( char *Name; const char *ReferenceName; UINT8 Count; + ACPI_OPERAND_OBJECT *Start; + ACPI_OPERAND_OBJECT *Data = NULL; + ACPI_OPERAND_OBJECT *Next; + ACPI_NAMESPACE_NODE *Node; if (!Info) @@ -458,7 +487,8 @@ AcpiExDumpObject ( case ACPI_EXD_TYPE: - AcpiExOutString ("Type", AcpiUtGetObjectTypeName (ObjDesc)); + AcpiOsPrintf ("%20s : %2.2X [%s]\n", "Type", + ObjDesc->Common.Type, AcpiUtGetObjectTypeName (ObjDesc)); break; case ACPI_EXD_UINT8: @@ -519,6 +549,120 @@ AcpiExDumpObject ( AcpiExDumpReferenceObj (ObjDesc); break; + case ACPI_EXD_LIST: + + Start = *ACPI_CAST_PTR (void *, Target); + Next = Start; + + AcpiOsPrintf ("%20s : %p", Name, Next); + if (Next) + { + AcpiOsPrintf ("(%s %2.2X)", + AcpiUtGetObjectTypeName (Next), Next->Common.Type); + + while (Next->Common.NextObject) + { + if ((Next->Common.Type == ACPI_TYPE_LOCAL_DATA) && + !Data) + { + Data = Next; + } + + Next = Next->Common.NextObject; + AcpiOsPrintf ("->%p(%s %2.2X)", Next, + AcpiUtGetObjectTypeName (Next), Next->Common.Type); + + if ((Next == Start) || (Next == Data)) + { + AcpiOsPrintf ("\n**** Error: Object list appears to be circular linked"); + break; + } + } + } + + AcpiOsPrintf ("\n"); + break; + + case ACPI_EXD_HDLR_LIST: + + Start = *ACPI_CAST_PTR (void *, Target); + Next = Start; + + AcpiOsPrintf ("%20s : %p", Name, Next); + if (Next) + { + AcpiOsPrintf ("(%s %2.2X)", + AcpiUtGetObjectTypeName (Next), Next->Common.Type); + + while (Next->AddressSpace.Next) + { + if ((Next->Common.Type == ACPI_TYPE_LOCAL_DATA) && + !Data) + { + Data = Next; + } + + Next = Next->AddressSpace.Next; + AcpiOsPrintf ("->%p(%s %2.2X)", Next, + AcpiUtGetObjectTypeName (Next), Next->Common.Type); + + if ((Next == Start) || (Next == Data)) + { + AcpiOsPrintf ("\n**** Error: Handler list appears to be circular linked"); + break; + } + } + } + + AcpiOsPrintf ("\n"); + break; + + case ACPI_EXD_RGN_LIST: + + Start = *ACPI_CAST_PTR (void *, Target); + Next = Start; + + AcpiOsPrintf ("%20s : %p", Name, Next); + if (Next) + { + AcpiOsPrintf ("(%s %2.2X)", + AcpiUtGetObjectTypeName (Next), Next->Common.Type); + + while (Next->Region.Next) + { + if ((Next->Common.Type == ACPI_TYPE_LOCAL_DATA) && + !Data) + { + Data = Next; + } + + Next = Next->Region.Next; + AcpiOsPrintf ("->%p(%s %2.2X)", Next, + AcpiUtGetObjectTypeName (Next), Next->Common.Type); + + if ((Next == Start) || (Next == Data)) + { + AcpiOsPrintf ("\n**** Error: Region list appears to be circular linked"); + break; + } + } + } + + AcpiOsPrintf ("\n"); + break; + + case ACPI_EXD_NODE: + + Node = *ACPI_CAST_PTR (ACPI_NAMESPACE_NODE *, Target); + + AcpiOsPrintf ("%20s : %p", Name, Node); + if (Node) + { + AcpiOsPrintf (" [%4.4s]", Node->Name.Ascii); + } + AcpiOsPrintf ("\n"); + break; + default: AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n", @@ -936,9 +1080,8 @@ AcpiExDumpNamespaceNode ( } AcpiOsPrintf ("%20s : %4.4s\n", "Name", AcpiUtGetNodeName (Node)); - AcpiExOutString ("Type", AcpiUtGetTypeName (Node->Type)); - AcpiExOutPointer ("Attached Object", AcpiNsGetAttachedObject (Node)); - AcpiExOutPointer ("Parent", Node->Parent); + AcpiOsPrintf ("%20s : %2.2X [%s]\n", "Type", + Node->Type, AcpiUtGetTypeName (Node->Type)); AcpiExDumpObject (ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node), AcpiExDumpNode); @@ -1146,24 +1289,30 @@ AcpiExDumpObjectDescriptor ( AcpiOsPrintf ("\nAttached Object (%p):\n", ((ACPI_NAMESPACE_NODE *) ObjDesc)->Object); - AcpiExDumpObjectDescriptor ( - ((ACPI_NAMESPACE_NODE *) ObjDesc)->Object, Flags); - return_VOID; + ObjDesc = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Object; + goto DumpObject; } if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) { AcpiOsPrintf ( - "ExDumpObjectDescriptor: %p is not an ACPI operand object: [%s]\n", + "%p is not an ACPI operand object: [%s]\n", ObjDesc, AcpiUtGetDescriptorName (ObjDesc)); return_VOID; } - if (ObjDesc->Common.Type > ACPI_TYPE_NS_NODE_MAX) + /* Validate the object type */ + + if (ObjDesc->Common.Type > ACPI_TYPE_LOCAL_MAX) { + AcpiOsPrintf ("Not a known object type: %2.2X\n", + ObjDesc->Common.Type); return_VOID; } + +DumpObject: + /* Common Fields */ AcpiExDumpObject (ObjDesc, AcpiExDumpCommon); @@ -1171,6 +1320,22 @@ AcpiExDumpObjectDescriptor ( /* Object-specific fields */ AcpiExDumpObject (ObjDesc, AcpiExDumpInfo[ObjDesc->Common.Type]); + + if (ObjDesc->Common.Type == ACPI_TYPE_REGION) + { + ObjDesc = ObjDesc->Common.NextObject; + if (ObjDesc->Common.Type > ACPI_TYPE_LOCAL_MAX) + { + AcpiOsPrintf ("Secondary object is not a known object type: %2.2X\n", + ObjDesc->Common.Type); + + return_VOID; + } + + AcpiOsPrintf ("\nExtra attached Object (%p):\n", ObjDesc); + AcpiExDumpObject (ObjDesc, AcpiExDumpInfo[ObjDesc->Common.Type]); + } + return_VOID; } diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exfield.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exfield.c index 2ebce9d246..55934de03e 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exfield.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exfield.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -120,11 +120,80 @@ #include "accommon.h" #include "acdispat.h" #include "acinterp.h" +#include "amlcode.h" #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME ("exfield") +/* Local prototypes */ + +static UINT32 +AcpiExGetSerialAccessLength ( + UINT32 AccessorType, + UINT32 AccessLength); + + +/******************************************************************************* + * + * FUNCTION: AcpiExGetSerialAccessLength + * + * PARAMETERS: AccessorType - The type of the protocol indicated by region + * field access attributes + * AccessLength - The access length of the region field + * + * RETURN: Decoded access length + * + * DESCRIPTION: This routine returns the length of the GenericSerialBus + * protocol bytes + * + ******************************************************************************/ + +static UINT32 +AcpiExGetSerialAccessLength ( + UINT32 AccessorType, + UINT32 AccessLength) +{ + UINT32 Length; + + + switch (AccessorType) + { + case AML_FIELD_ATTRIB_QUICK: + + Length = 0; + break; + + case AML_FIELD_ATTRIB_SEND_RCV: + case AML_FIELD_ATTRIB_BYTE: + + Length = 1; + break; + + case AML_FIELD_ATTRIB_WORD: + case AML_FIELD_ATTRIB_WORD_CALL: + + Length = 2; + break; + + case AML_FIELD_ATTRIB_MULTIBYTE: + case AML_FIELD_ATTRIB_RAW_BYTES: + case AML_FIELD_ATTRIB_RAW_PROCESS: + + Length = AccessLength; + break; + + case AML_FIELD_ATTRIB_BLOCK: + case AML_FIELD_ATTRIB_BLOCK_CALL: + default: + + Length = ACPI_GSBUS_BUFFER_SIZE - 2; + break; + } + + return (Length); +} + /******************************************************************************* * @@ -152,6 +221,7 @@ AcpiExReadDataFromField ( ACPI_SIZE Length; void *Buffer; UINT32 Function; + UINT16 AccessorType; ACPI_FUNCTION_TRACE_PTR (ExReadDataFromField, ObjDesc); @@ -201,8 +271,19 @@ AcpiExReadDataFromField ( } else if (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS) { - Length = ACPI_GSBUS_BUFFER_SIZE; - Function = ACPI_READ | (ObjDesc->Field.Attribute << 16); + AccessorType = ObjDesc->Field.Attribute; + Length = AcpiExGetSerialAccessLength (AccessorType, + ObjDesc->Field.AccessLength); + + /* + * Add additional 2 bytes for the GenericSerialBus data buffer: + * + * Status; (Byte 0 of the data buffer) + * Length; (Byte 1 of the data buffer) + * Data[x-1]; (Bytes 2-x of the arbitrary length data buffer) + */ + Length += 2; + Function = ACPI_READ | (AccessorType << 16); } else /* IPMI */ { @@ -323,6 +404,7 @@ AcpiExWriteDataToField ( void *Buffer; ACPI_OPERAND_OBJECT *BufferDesc; UINT32 Function; + UINT16 AccessorType; ACPI_FUNCTION_TRACE_PTR (ExWriteDataToField, ObjDesc); @@ -382,8 +464,19 @@ AcpiExWriteDataToField ( } else if (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_GSBUS) { - Length = ACPI_GSBUS_BUFFER_SIZE; - Function = ACPI_WRITE | (ObjDesc->Field.Attribute << 16); + AccessorType = ObjDesc->Field.Attribute; + Length = AcpiExGetSerialAccessLength (AccessorType, + ObjDesc->Field.AccessLength); + + /* + * Add additional 2 bytes for the GenericSerialBus data buffer: + * + * Status; (Byte 0 of the data buffer) + * Length; (Byte 1 of the data buffer) + * Data[x-1]; (Bytes 2-x of the arbitrary length data buffer) + */ + Length += 2; + Function = ACPI_WRITE | (AccessorType << 16); } else /* IPMI */ { diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exfldio.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exfldio.c index 934f024003..51a1e6dd38 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exfldio.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exfldio.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exmisc.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exmisc.c index 793abbf37c..b78425c9c0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exmisc.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exmisc.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exmutex.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exmutex.c index 14ad6f08e9..a613c54563 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exmutex.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exmutex.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exnames.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exnames.c index 847cb5776d..e8dc00c0dd 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exnames.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exnames.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exoparg1.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exoparg1.c index 8bde71a6d2..30fc50488d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exoparg1.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exoparg1.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exoparg2.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exoparg2.c index 77308f1fce..3a65485ede 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exoparg2.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exoparg2.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exoparg3.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exoparg3.c index ce88cacf51..97df207658 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exoparg3.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exoparg3.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exoparg6.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exoparg6.c index 9d5eacd8a8..515fc59948 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exoparg6.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exoparg6.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exprep.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exprep.c index 88dc577856..f1707360fc 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exprep.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exprep.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exregion.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exregion.c index e1ebea2063..ea10a01ea0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exregion.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exregion.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exresnte.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exresnte.c index 3c0565ca39..323f9db5d2 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exresnte.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exresnte.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -206,8 +206,8 @@ AcpiExResolveNodeToValue ( if (!SourceDesc) { - ACPI_ERROR ((AE_INFO, "No object attached to node %p", - Node)); + ACPI_ERROR ((AE_INFO, "No object attached to node [%4.4s] %p", + Node->Name.Ascii, Node)); return_ACPI_STATUS (AE_AML_NO_OPERAND); } diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exresolv.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exresolv.c index c35150ae37..e035918a64 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exresolv.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exresolv.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exresop.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exresop.c index f0705f0b93..aafc1dce57 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exresop.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exresop.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exstore.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exstore.c index 4f50aa3cd5..97b8be82dd 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exstore.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exstore.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -134,6 +134,12 @@ AcpiExStoreObjectToIndex ( ACPI_OPERAND_OBJECT *DestDesc, ACPI_WALK_STATE *WalkState); +static ACPI_STATUS +AcpiExStoreDirectToNode ( + ACPI_OPERAND_OBJECT *SourceDesc, + ACPI_NAMESPACE_NODE *Node, + ACPI_WALK_STATE *WalkState); + /******************************************************************************* * @@ -465,7 +471,11 @@ AcpiExStoreObjectToIndex ( * When storing into an object the data is converted to the * target object type then stored in the object. This means * that the target object type (for an initialized target) will - * not be changed by a store operation. + * not be changed by a store operation. A CopyObject can change + * the target type, however. + * + * The ImplicitConversion flag is set to NO/FALSE only when + * storing to an ArgX -- as per the rules of the ACPI spec. * * Assumes parameters are already validated. * @@ -492,7 +502,7 @@ AcpiExStoreObjectToNode ( TargetType = AcpiNsGetType (Node); TargetDesc = AcpiNsGetAttachedObject (Node); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Storing %p(%s) into node %p(%s)\n", + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Storing %p (%s) to node %p (%s)\n", SourceDesc, AcpiUtGetObjectTypeName (SourceDesc), Node, AcpiUtGetTypeName (TargetType))); @@ -506,49 +516,35 @@ AcpiExStoreObjectToNode ( return_ACPI_STATUS (Status); } - /* If no implicit conversion, drop into the default case below */ - - if ((!ImplicitConversion) || - ((WalkState->Opcode == AML_COPY_OP) && - (TargetType != ACPI_TYPE_LOCAL_REGION_FIELD) && - (TargetType != ACPI_TYPE_LOCAL_BANK_FIELD) && - (TargetType != ACPI_TYPE_LOCAL_INDEX_FIELD))) - { - /* - * Force execution of default (no implicit conversion). Note: - * CopyObject does not perform an implicit conversion, as per the ACPI - * spec -- except in case of region/bank/index fields -- because these - * objects must retain their original type permanently. - */ - TargetType = ACPI_TYPE_ANY; - } - /* Do the actual store operation */ switch (TargetType) { - case ACPI_TYPE_BUFFER_FIELD: - case ACPI_TYPE_LOCAL_REGION_FIELD: - case ACPI_TYPE_LOCAL_BANK_FIELD: - case ACPI_TYPE_LOCAL_INDEX_FIELD: - - /* For fields, copy the source data to the target field. */ - - Status = AcpiExWriteDataToField (SourceDesc, TargetDesc, - &WalkState->ResultObj); - break; - case ACPI_TYPE_INTEGER: case ACPI_TYPE_STRING: case ACPI_TYPE_BUFFER: /* - * These target types are all of type Integer/String/Buffer, and - * therefore support implicit conversion before the store. - * - * Copy and/or convert the source object to a new target object + * The simple data types all support implicit source operand + * conversion before the store. */ + + if ((WalkState->Opcode == AML_COPY_OP) || + !ImplicitConversion) + { + /* + * However, CopyObject and Stores to ArgX do not perform + * an implicit conversion, as per the ACPI specification. + * A direct store is performed instead. + */ + Status = AcpiExStoreDirectToNode (SourceDesc, Node, + WalkState); + break; + } + + /* Store with implicit source operand conversion support */ + Status = AcpiExStoreObjectToObject (SourceDesc, TargetDesc, - &NewDesc, WalkState); + &NewDesc, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -561,11 +557,12 @@ AcpiExStoreObjectToNode ( * the Name's type to that of the value being stored in it. * SourceDesc reference count is incremented by AttachObject. * - * Note: This may change the type of the node if an explicit store - * has been performed such that the node/object type has been - * changed. + * Note: This may change the type of the node if an explicit + * store has been performed such that the node/object type + * has been changed. */ - Status = AcpiNsAttachObject (Node, NewDesc, NewDesc->Common.Type); + Status = AcpiNsAttachObject (Node, NewDesc, + NewDesc->Common.Type); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Store %s into %s via Convert/Attach\n", @@ -574,33 +571,86 @@ AcpiExStoreObjectToNode ( } break; + case ACPI_TYPE_BUFFER_FIELD: + case ACPI_TYPE_LOCAL_REGION_FIELD: + case ACPI_TYPE_LOCAL_BANK_FIELD: + case ACPI_TYPE_LOCAL_INDEX_FIELD: + /* + * For all fields, always write the source data to the target + * field. Any required implicit source operand conversion is + * performed in the function below as necessary. Note, field + * objects must retain their original type permanently. + */ + Status = AcpiExWriteDataToField (SourceDesc, TargetDesc, + &WalkState->ResultObj); + break; + default: - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Storing [%s] (%p) directly into node [%s] (%p)" - " with no implicit conversion\n", - AcpiUtGetObjectTypeName (SourceDesc), SourceDesc, - AcpiUtGetObjectTypeName (TargetDesc), Node)); - /* * No conversions for all other types. Directly store a copy of - * the source object. NOTE: This is a departure from the ACPI - * spec, which states "If conversion is impossible, abort the - * running control method". + * the source object. This is the ACPI spec-defined behavior for + * the CopyObject operator. * - * This code implements "If conversion is impossible, treat the - * Store operation as a CopyObject". + * NOTE: For the Store operator, this is a departure from the + * ACPI spec, which states "If conversion is impossible, abort + * the running control method". Instead, this code implements + * "If conversion is impossible, treat the Store operation as + * a CopyObject". */ - Status = AcpiUtCopyIobjectToIobject (SourceDesc, &NewDesc, WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiNsAttachObject (Node, NewDesc, NewDesc->Common.Type); - AcpiUtRemoveReference (NewDesc); + Status = AcpiExStoreDirectToNode (SourceDesc, Node, + WalkState); break; } return_ACPI_STATUS (Status); } + + +/******************************************************************************* + * + * FUNCTION: AcpiExStoreDirectToNode + * + * PARAMETERS: SourceDesc - Value to be stored + * Node - Named object to receive the value + * WalkState - Current walk state + * + * RETURN: Status + * + * DESCRIPTION: "Store" an object directly to a node. This involves a copy + * and an attach. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiExStoreDirectToNode ( + ACPI_OPERAND_OBJECT *SourceDesc, + ACPI_NAMESPACE_NODE *Node, + ACPI_WALK_STATE *WalkState) +{ + ACPI_STATUS Status; + ACPI_OPERAND_OBJECT *NewDesc; + + + ACPI_FUNCTION_TRACE (ExStoreDirectToNode); + + + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "Storing [%s] (%p) directly into node [%s] (%p)" + " with no implicit conversion\n", + AcpiUtGetObjectTypeName (SourceDesc), SourceDesc, + AcpiUtGetTypeName (Node->Type), Node)); + + /* Copy the source object to a new object */ + + Status = AcpiUtCopyIobjectToIobject (SourceDesc, &NewDesc, WalkState); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Attach the new object to the node */ + + Status = AcpiNsAttachObject (Node, NewDesc, NewDesc->Common.Type); + AcpiUtRemoveReference (NewDesc); + return_ACPI_STATUS (Status); +} diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exstoren.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exstoren.c index b3d78456d4..d1fc09f796 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exstoren.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exstoren.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exstorob.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exstorob.c index abd3ae7803..dc64e92c1b 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exstorob.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exstorob.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exsystem.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exsystem.c index e5bb978f32..fcf3a7f130 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exsystem.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exsystem.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -159,7 +159,7 @@ AcpiExSystemWaitSemaphore ( { /* We must wait, so unlock the interpreter */ - AcpiExRelinquishInterpreter (); + AcpiExExitInterpreter (); Status = AcpiOsWaitSemaphore (Semaphore, 1, Timeout); @@ -169,7 +169,7 @@ AcpiExSystemWaitSemaphore ( /* Reacquire the interpreter */ - AcpiExReacquireInterpreter (); + AcpiExEnterInterpreter (); } return_ACPI_STATUS (Status); @@ -212,7 +212,7 @@ AcpiExSystemWaitMutex ( { /* We must wait, so unlock the interpreter */ - AcpiExRelinquishInterpreter (); + AcpiExExitInterpreter (); Status = AcpiOsAcquireMutex (Mutex, Timeout); @@ -222,7 +222,7 @@ AcpiExSystemWaitMutex ( /* Reacquire the interpreter */ - AcpiExReacquireInterpreter (); + AcpiExEnterInterpreter (); } return_ACPI_STATUS (Status); @@ -299,7 +299,7 @@ AcpiExSystemDoSleep ( /* Since this thread will sleep, we must release the interpreter */ - AcpiExRelinquishInterpreter (); + AcpiExExitInterpreter (); /* * For compatibility with other ACPI implementations and to prevent @@ -314,7 +314,7 @@ AcpiExSystemDoSleep ( /* And now we must get the interpreter again */ - AcpiExReacquireInterpreter (); + AcpiExEnterInterpreter (); return (AE_OK); } diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exutils.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exutils.c index a520a3073a..1a4a943111 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exutils.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exutils.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -182,42 +182,6 @@ AcpiExEnterInterpreter ( } -/******************************************************************************* - * - * FUNCTION: AcpiExReacquireInterpreter - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Reacquire the interpreter execution region from within the - * interpreter code. Failure to enter the interpreter region is a - * fatal system error. Used in conjunction with - * RelinquishInterpreter - * - ******************************************************************************/ - -void -AcpiExReacquireInterpreter ( - void) -{ - ACPI_FUNCTION_TRACE (ExReacquireInterpreter); - - - /* - * If the global serialized flag is set, do not release the interpreter, - * since it was not actually released by AcpiExRelinquishInterpreter. - * This forces the interpreter to be single threaded. - */ - if (!AcpiGbl_AllMethodsSerialized) - { - AcpiExEnterInterpreter (); - } - - return_VOID; -} - - /******************************************************************************* * * FUNCTION: AcpiExExitInterpreter @@ -228,7 +192,16 @@ AcpiExReacquireInterpreter ( * * DESCRIPTION: Exit the interpreter execution region. This is the top level * routine used to exit the interpreter when all processing has - * been completed. + * been completed, or when the method blocks. + * + * Cases where the interpreter is unlocked internally: + * 1) Method will be blocked on a Sleep() AML opcode + * 2) Method will be blocked on an Acquire() AML opcode + * 3) Method will be blocked on a Wait() AML opcode + * 4) Method will be blocked to acquire the global lock + * 5) Method will be blocked waiting to execute a serialized control + * method that is currently executing + * 6) About to invoke a user-installed opregion handler * ******************************************************************************/ @@ -252,49 +225,6 @@ AcpiExExitInterpreter ( } -/******************************************************************************* - * - * FUNCTION: AcpiExRelinquishInterpreter - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Exit the interpreter execution region, from within the - * interpreter - before attempting an operation that will possibly - * block the running thread. - * - * Cases where the interpreter is unlocked internally - * 1) Method to be blocked on a Sleep() AML opcode - * 2) Method to be blocked on an Acquire() AML opcode - * 3) Method to be blocked on a Wait() AML opcode - * 4) Method to be blocked to acquire the global lock - * 5) Method to be blocked waiting to execute a serialized control method - * that is currently executing - * 6) About to invoke a user-installed opregion handler - * - ******************************************************************************/ - -void -AcpiExRelinquishInterpreter ( - void) -{ - ACPI_FUNCTION_TRACE (ExRelinquishInterpreter); - - - /* - * If the global serialized flag is set, do not release the interpreter. - * This forces the interpreter to be single threaded. - */ - if (!AcpiGbl_AllMethodsSerialized) - { - AcpiExExitInterpreter (); - } - - return_VOID; -} - - /******************************************************************************* * * FUNCTION: AcpiExTruncateFor32bitTable diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwacpi.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwacpi.c index 9bef5e9197..1facc203a1 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwacpi.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwacpi.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwesleep.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwesleep.c index c9befbfa6c..0dab77a721 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwesleep.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwesleep.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwgpe.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwgpe.c index 118b985e07..a777e581ff 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwgpe.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwgpe.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwpci.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwpci.c index 81dd281690..24b7c01e95 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwpci.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwpci.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -233,11 +233,12 @@ AcpiHwDerivePciId ( /* Walk the list, updating the PCI device/function/bus numbers */ Status = AcpiHwProcessPciList (PciId, ListHead); + + /* Delete the list */ + + AcpiHwDeletePciList (ListHead); } - /* Always delete the list */ - - AcpiHwDeletePciList (ListHead); return_ACPI_STATUS (Status); } @@ -285,6 +286,9 @@ AcpiHwBuildPciList ( Status = AcpiGetParent (CurrentDevice, &ParentDevice); if (ACPI_FAILURE (Status)) { + /* Must delete the list before exit */ + + AcpiHwDeletePciList (*ReturnListHead); return (Status); } @@ -299,6 +303,9 @@ AcpiHwBuildPciList ( ListElement = ACPI_ALLOCATE (sizeof (ACPI_PCI_DEVICE)); if (!ListElement) { + /* Must delete the list before exit */ + + AcpiHwDeletePciList (*ReturnListHead); return (AE_NO_MEMORY); } diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwregs.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwregs.c index 84895be903..24b4cf4cf2 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwregs.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwregs.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -382,17 +382,19 @@ AcpiHwClearAcpiStatus ( Status = AcpiHwRegisterWrite (ACPI_REGISTER_PM1_STATUS, ACPI_BITMASK_ALL_FIXED_STATUS); + + AcpiOsReleaseLock (AcpiGbl_HardwareLock, LockFlags); + if (ACPI_FAILURE (Status)) { - goto UnlockAndExit; + goto Exit; } /* Clear the GPE Bits in all GPE registers in all GPE blocks */ Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock, NULL); -UnlockAndExit: - AcpiOsReleaseLock (AcpiGbl_HardwareLock, LockFlags); +Exit: return_ACPI_STATUS (Status); } diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwsleep.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwsleep.c index 0952d64b9e..4501598e88 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwsleep.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwsleep.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwtimer.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwtimer.c index 80fd2aabb9..525a4e5a69 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwtimer.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwtimer.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -113,6 +113,8 @@ * *****************************************************************************/ +#define EXPORT_ACPI_INTERFACES + #include "acpi.h" #include "accommon.h" diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwvalid.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwvalid.c index 2712dc6a1e..511a6313f8 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwvalid.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwvalid.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwxface.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwxface.c index b3d9ae13f6..4687ae1c41 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwxface.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwxface.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -113,6 +113,8 @@ * *****************************************************************************/ +#define EXPORT_ACPI_INTERFACES + #include "acpi.h" #include "accommon.h" #include "acnamesp.h" @@ -162,9 +164,15 @@ AcpiReset ( * For I/O space, write directly to the OSL. This bypasses the port * validation mechanism, which may block a valid write to the reset * register. + * + * NOTE: + * The ACPI spec requires the reset register width to be 8, so we + * hardcode it here and ignore the FADT value. This maintains + * compatibility with other ACPI implementations that have allowed + * BIOS code with bad register width values to go unnoticed. */ Status = AcpiOsWritePort ((ACPI_IO_ADDRESS) ResetReg->Address, - AcpiGbl_FADT.ResetValue, ResetReg->BitWidth); + AcpiGbl_FADT.ResetValue, ACPI_RESET_REGISTER_WIDTH); } else { diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwxfsleep.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwxfsleep.c index b5ae313103..db64da6186 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwxfsleep.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/hardware/hwxfsleep.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -113,6 +113,8 @@ * *****************************************************************************/ +#define EXPORT_ACPI_INTERFACES + #include "acpi.h" #include "accommon.h" diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsaccess.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsaccess.c index d0e70f69ce..4c8bd30b33 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsaccess.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsaccess.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsalloc.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsalloc.c index cbb644ff70..d1701b8dab 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsalloc.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsalloc.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -193,6 +193,7 @@ AcpiNsDeleteNode ( ACPI_NAMESPACE_NODE *Node) { ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_OPERAND_OBJECT *NextDesc; ACPI_FUNCTION_NAME (NsDeleteNode); @@ -203,12 +204,13 @@ AcpiNsDeleteNode ( AcpiNsDetachObject (Node); /* - * Delete an attached data object if present (an object that was created - * and attached via AcpiAttachData). Note: After any normal object is - * detached above, the only possible remaining object is a data object. + * Delete an attached data object list if present (objects that were + * attached via AcpiAttachData). Note: After any normal object is + * detached above, the only possible remaining object(s) are data + * objects, in a linked list. */ ObjDesc = Node->Object; - if (ObjDesc && + while (ObjDesc && (ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA)) { /* Invoke the attached data deletion handler if present */ @@ -218,7 +220,16 @@ AcpiNsDeleteNode ( ObjDesc->Data.Handler (Node, ObjDesc->Data.Pointer); } + NextDesc = ObjDesc->Common.NextObject; AcpiUtRemoveReference (ObjDesc); + ObjDesc = NextDesc; + } + + /* Special case for the statically allocated root node */ + + if (Node == AcpiGbl_RootNode) + { + return; } /* Now we can delete the node */ diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsarguments.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsarguments.c index df9de343d6..792cd596a3 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsarguments.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsarguments.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsconvert.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsconvert.c index cacd78d052..5bd686819b 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsconvert.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsconvert.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsdump.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsdump.c index 90788307c4..4823046543 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsdump.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsdump.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -821,6 +821,13 @@ AcpiNsDumpOneObjectPath ( } Node = AcpiNsValidateHandle (ObjHandle); + if (!Node) + { + /* Ignore bad node during namespace walk */ + + return (AE_OK); + } + Pathname = AcpiNsGetExternalPathname (Node); PathIndent = 1; diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsdumpdv.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsdumpdv.c index 7f5dba4ee9..ed1b8a9964 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsdumpdv.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsdumpdv.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nseval.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nseval.c index 7ae62b5242..227a10326f 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nseval.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nseval.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsinit.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsinit.c index 8619d684f8..2e35355b10 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsinit.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsinit.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -201,9 +201,8 @@ AcpiNsInitializeObjects ( Info.PackageInit, Info.PackageCount, Info.ObjectCount)); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "%u Control Methods found\n", Info.MethodCount)); - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "%u Op Regions found\n", Info.OpRegionCount)); + "%u Control Methods found\n%u Op Regions found\n", + Info.MethodCount, Info.OpRegionCount)); return_ACPI_STATUS (AE_OK); } diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsload.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsload.c index 4c50101e98..7d68af7ccb 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsload.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsload.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -220,12 +220,12 @@ Unlock: * parse trees. */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "**** Begin Table Method Parsing and Object Initialization\n")); + "**** Begin Table Object Initialization\n")); Status = AcpiDsInitializeObjects (TableIndex, Node); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "**** Completed Table Method Parsing and Object Initialization\n")); + "**** Completed Table Object Initialization\n")); return_ACPI_STATUS (Status); } diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsnames.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsnames.c index 2274a6ea54..f345d9032c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsnames.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsnames.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsobject.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsobject.c index b493dc78e8..74470f0c3d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsobject.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsobject.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -319,17 +319,32 @@ AcpiNsDetachObject ( } } - /* Clear the entry in all cases */ + /* Clear the Node entry in all cases */ Node->Object = NULL; if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND) { + /* Unlink object from front of possible object list */ + Node->Object = ObjDesc->Common.NextObject; + + /* Handle possible 2-descriptor object */ + if (Node->Object && - ((Node->Object)->Common.Type != ACPI_TYPE_LOCAL_DATA)) + (Node->Object->Common.Type != ACPI_TYPE_LOCAL_DATA)) { Node->Object = Node->Object->Common.NextObject; } + + /* + * Detach the object from any data objects (which are still held by + * the namespace node) + */ + if (ObjDesc->Common.NextObject && + ((ObjDesc->Common.NextObject)->Common.Type == ACPI_TYPE_LOCAL_DATA)) + { + ObjDesc->Common.NextObject = NULL; + } } /* Reset the node type to untyped */ diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsparse.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsparse.c index 5d1ed91bda..847e61b286 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsparse.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsparse.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nspredef.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nspredef.c index 15ba35ef74..820710d99d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nspredef.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nspredef.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsprepkg.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsprepkg.c index f1990539fb..41dc5a7124 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsprepkg.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsprepkg.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -216,13 +216,13 @@ AcpiNsCheckPackage ( * Decode the type of the expected package contents * * PTYPE1 packages contain no subpackages - * PTYPE2 packages contain sub-packages + * PTYPE2 packages contain subpackages */ switch (Package->RetInfo.Type) { case ACPI_PTYPE1_FIXED: /* - * The package count is fixed and there are no sub-packages + * The package count is fixed and there are no subpackages * * If package is too small, exit. * If package is larger than expected, issue warning but continue @@ -249,7 +249,7 @@ AcpiNsCheckPackage ( case ACPI_PTYPE1_VAR: /* - * The package count is variable, there are no sub-packages, and all + * The package count is variable, there are no subpackages, and all * elements must be of the same type */ for (i = 0; i < Count; i++) @@ -266,7 +266,7 @@ AcpiNsCheckPackage ( case ACPI_PTYPE1_OPTION: /* - * The package count is variable, there are no sub-packages. There are + * The package count is variable, there are no subpackages. There are * a fixed number of required elements, and a variable number of * optional elements. * @@ -322,14 +322,14 @@ AcpiNsCheckPackage ( Elements++; Count--; - /* Examine the sub-packages */ + /* Examine the subpackages */ Status = AcpiNsCheckPackageList (Info, Package, Elements, Count); break; case ACPI_PTYPE2_PKG_COUNT: - /* First element is the (Integer) count of sub-packages to follow */ + /* First element is the (Integer) count of subpackages to follow */ Status = AcpiNsCheckObjectType (Info, Elements, ACPI_RTYPE_INTEGER, 0); @@ -351,7 +351,7 @@ AcpiNsCheckPackage ( Count = ExpectedCount; Elements++; - /* Examine the sub-packages */ + /* Examine the subpackages */ Status = AcpiNsCheckPackageList (Info, Package, Elements, Count); break; @@ -363,9 +363,9 @@ AcpiNsCheckPackage ( case ACPI_PTYPE2_FIX_VAR: /* * These types all return a single Package that consists of a - * variable number of sub-Packages. + * variable number of subpackages. * - * First, ensure that the first element is a sub-Package. If not, + * First, ensure that the first element is a subpackage. If not, * the BIOS may have incorrectly returned the object as a single * package instead of a Package of Packages (a common error if * there is only one entry). We may be able to repair this by @@ -388,7 +388,7 @@ AcpiNsCheckPackage ( Count = 1; } - /* Examine the sub-packages */ + /* Examine the subpackages */ Status = AcpiNsCheckPackageList (Info, Package, Elements, Count); break; @@ -451,9 +451,9 @@ AcpiNsCheckPackageList ( /* - * Validate each sub-Package in the parent Package + * Validate each subpackage in the parent Package * - * NOTE: assumes list of sub-packages contains no NULL elements. + * NOTE: assumes list of subpackages contains no NULL elements. * Any NULL elements should have been removed by earlier call * to AcpiNsRemoveNullElements. */ @@ -472,7 +472,7 @@ AcpiNsCheckPackageList ( return (Status); } - /* Examine the different types of expected sub-packages */ + /* Examine the different types of expected subpackages */ Info->ParentPackage = SubPackage; switch (Package->RetInfo.Type) @@ -524,7 +524,7 @@ AcpiNsCheckPackageList ( case ACPI_PTYPE2_FIXED: - /* Each sub-package has a fixed length */ + /* Each subpackage has a fixed length */ ExpectedCount = Package->RetInfo2.Count; if (SubPackage->Package.Count < ExpectedCount) @@ -532,7 +532,7 @@ AcpiNsCheckPackageList ( goto PackageTooSmall; } - /* Check the type of each sub-package element */ + /* Check the type of each subpackage element */ for (j = 0; j < ExpectedCount; j++) { @@ -547,7 +547,7 @@ AcpiNsCheckPackageList ( case ACPI_PTYPE2_MIN: - /* Each sub-package has a variable but minimum length */ + /* Each subpackage has a variable but minimum length */ ExpectedCount = Package->RetInfo.Count1; if (SubPackage->Package.Count < ExpectedCount) @@ -555,7 +555,7 @@ AcpiNsCheckPackageList ( goto PackageTooSmall; } - /* Check the type of each sub-package element */ + /* Check the type of each subpackage element */ Status = AcpiNsCheckPackageElements (Info, SubElements, Package->RetInfo.ObjectType1, @@ -604,7 +604,7 @@ AcpiNsCheckPackageList ( (*SubElements)->Integer.Value = ExpectedCount; } - /* Check the type of each sub-package element */ + /* Check the type of each subpackage element */ Status = AcpiNsCheckPackageElements (Info, (SubElements + 1), Package->RetInfo.ObjectType1, @@ -628,10 +628,10 @@ AcpiNsCheckPackageList ( PackageTooSmall: - /* The sub-package count was smaller than required */ + /* The subpackage count was smaller than required */ ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, - "Return Sub-Package[%u] is too small - found %u elements, expected %u", + "Return SubPackage[%u] is too small - found %u elements, expected %u", i, SubPackage->Package.Count, ExpectedCount)); return (AE_AML_OPERAND_VALUE); diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsrepair.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsrepair.c index 3593da5b75..11a43b1d04 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsrepair.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsrepair.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -284,14 +284,29 @@ AcpiNsSimpleRepair ( * this predefined name. Either one return value is expected, or none, * for both methods and other objects. * - * Exit now if there is no return object. Warning if one was expected. + * Try to fix if there was no return object. Warning if failed to fix. */ if (!ReturnObject) { if (ExpectedBtypes && (!(ExpectedBtypes & ACPI_RTYPE_NONE))) { - ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, - ACPI_WARN_ALWAYS, "Missing expected return value")); + if (PackageIndex != ACPI_NOT_PACKAGE_ELEMENT) + { + ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, + ACPI_WARN_ALWAYS, "Found unexpected NULL package element")); + + Status = AcpiNsRepairNullElement (Info, ExpectedBtypes, + PackageIndex, ReturnObjectPtr); + if (ACPI_SUCCESS (Status)) + { + return (AE_OK); /* Repair was successful */ + } + } + else + { + ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, + ACPI_WARN_ALWAYS, "Missing expected return value")); + } return (AE_AML_NO_RETURN_VALUE); } @@ -546,7 +561,7 @@ AcpiNsRepairNullElement ( * RETURN: None. * * DESCRIPTION: Remove all NULL package elements from packages that contain - * a variable number of sub-packages. For these types of + * a variable number of subpackages. For these types of * packages, NULL elements can be safely removed. * *****************************************************************************/ @@ -570,7 +585,7 @@ AcpiNsRemoveNullElements ( /* * We can safely remove all NULL elements from these package types: * PTYPE1_VAR packages contain a variable number of simple data types. - * PTYPE2 packages contain a variable number of sub-packages. + * PTYPE2 packages contain a variable number of subpackages. */ switch (PackageType) { diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsrepair2.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsrepair2.c index 46f4107c4d..ea7c0be467 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsrepair2.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsrepair2.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -550,8 +550,8 @@ AcpiNsRepair_CID ( * DESCRIPTION: Repair for the _CST object: * 1. Sort the list ascending by C state type * 2. Ensure type cannot be zero - * 3. A sub-package count of zero means _CST is meaningless - * 4. Count must match the number of C state sub-packages + * 3. A subpackage count of zero means _CST is meaningless + * 4. Count must match the number of C state subpackages * *****************************************************************************/ @@ -744,6 +744,7 @@ AcpiNsRepair_PRT ( ACPI_OPERAND_OBJECT **TopObjectList; ACPI_OPERAND_OBJECT **SubObjectList; ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_OPERAND_OBJECT *SubPackage; UINT32 ElementCount; UINT32 Index; @@ -753,9 +754,19 @@ AcpiNsRepair_PRT ( TopObjectList = PackageObject->Package.Elements; ElementCount = PackageObject->Package.Count; - for (Index = 0; Index < ElementCount; Index++) + /* Examine each subpackage */ + + for (Index = 0; Index < ElementCount; Index++, TopObjectList++) { - SubObjectList = (*TopObjectList)->Package.Elements; + SubPackage = *TopObjectList; + SubObjectList = SubPackage->Package.Elements; + + /* Check for minimum required element count */ + + if (SubPackage->Package.Count < 4) + { + continue; + } /* * If the BIOS has erroneously reversed the _PRT SourceName (index 2) @@ -770,14 +781,11 @@ AcpiNsRepair_PRT ( SubObjectList[2] = ObjDesc; Info->ReturnFlags |= ACPI_OBJECT_REPAIRED; - ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, + ACPI_WARN_PREDEFINED ((AE_INFO, + Info->FullPathname, Info->NodeFlags, "PRT[%X]: Fixed reversed SourceName and SourceIndex", Index)); } - - /* Point to the next ACPI_OPERAND_OBJECT in the top level package */ - - TopObjectList++; } return (AE_OK); @@ -817,7 +825,7 @@ AcpiNsRepair_PSS ( /* - * Entries (sub-packages) in the _PSS Package must be sorted by power + * Entries (subpackages) in the _PSS Package must be sorted by power * dissipation, in descending order. If it appears that the list is * incorrectly sorted, sort it. We sort by CpuFrequency, since this * should be proportional to the power. @@ -910,9 +918,9 @@ AcpiNsRepair_TSS ( * * PARAMETERS: Info - Method execution information block * ReturnObject - Pointer to the top-level returned object - * StartIndex - Index of the first sub-package - * ExpectedCount - Minimum length of each sub-package - * SortIndex - Sub-package entry to sort on + * StartIndex - Index of the first subpackage + * ExpectedCount - Minimum length of each subpackage + * SortIndex - Subpackage entry to sort on * SortDirection - Ascending or descending * SortKeyName - Name of the SortIndex field * @@ -953,7 +961,7 @@ AcpiNsCheckSortedList ( } /* - * NOTE: assumes list of sub-packages contains no NULL elements. + * NOTE: assumes list of subpackages contains no NULL elements. * Any NULL elements should have been removed by earlier call * to AcpiNsRemoveNullElements. */ @@ -983,7 +991,7 @@ AcpiNsCheckSortedList ( return (AE_AML_OPERAND_TYPE); } - /* Each sub-package must have the minimum length */ + /* Each subpackage must have the minimum length */ if ((*OuterElements)->Package.Count < ExpectedCount) { diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nssearch.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nssearch.c index b4102e6c36..1632f2e0e0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nssearch.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nssearch.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsutils.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsutils.c index 1f5e1887d2..cf4214e479 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsutils.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsutils.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -765,27 +765,29 @@ void AcpiNsTerminate ( void) { - ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_STATUS Status; ACPI_FUNCTION_TRACE (NsTerminate); /* - * 1) Free the entire namespace -- all nodes and objects - * - * Delete all object descriptors attached to namepsace nodes + * Free the entire namespace -- all nodes and all objects + * attached to the nodes */ AcpiNsDeleteNamespaceSubtree (AcpiGbl_RootNode); - /* Detach any objects attached to the root */ + /* Delete any objects attached to the root node */ - ObjDesc = AcpiNsGetAttachedObject (AcpiGbl_RootNode); - if (ObjDesc) + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) { - AcpiNsDetachObject (AcpiGbl_RootNode); + return_VOID; } + AcpiNsDeleteNode (AcpiGbl_RootNode); + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace freed\n")); return_VOID; } diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nswalk.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nswalk.c index 20b1b329bc..c6c5663f8e 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nswalk.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nswalk.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsxfeval.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsxfeval.c index dbfca6a812..4864e610b7 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsxfeval.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsxfeval.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -116,6 +116,7 @@ #define __NSXFEVAL_C__ +#define EXPORT_ACPI_INTERFACES #include "acpi.h" #include "accommon.h" @@ -163,7 +164,7 @@ AcpiEvaluateObjectTyped ( ACPI_OBJECT_TYPE ReturnType) { ACPI_STATUS Status; - BOOLEAN MustFree = FALSE; + BOOLEAN FreeBufferOnError = FALSE; ACPI_FUNCTION_TRACE (AcpiEvaluateObjectTyped); @@ -178,12 +179,13 @@ AcpiEvaluateObjectTyped ( if (ReturnBuffer->Length == ACPI_ALLOCATE_BUFFER) { - MustFree = TRUE; + FreeBufferOnError = TRUE; } /* Evaluate the object */ - Status = AcpiEvaluateObject (Handle, Pathname, ExternalParams, ReturnBuffer); + Status = AcpiEvaluateObject (Handle, Pathname, + ExternalParams, ReturnBuffer); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -218,10 +220,15 @@ AcpiEvaluateObjectTyped ( AcpiUtGetTypeName (((ACPI_OBJECT *) ReturnBuffer->Pointer)->Type), AcpiUtGetTypeName (ReturnType))); - if (MustFree) + if (FreeBufferOnError) { - /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */ - + /* + * Free a buffer created via ACPI_ALLOCATE_BUFFER. + * Note: We use AcpiOsFree here because AcpiOsAllocate was used + * to allocate the buffer. This purposefully bypasses the + * (optionally enabled) allocation tracking mechanism since we + * only want to track internal allocations. + */ AcpiOsFree (ReturnBuffer->Pointer); ReturnBuffer->Pointer = NULL; } diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsxfname.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsxfname.c index 530d94ad1d..475491cb03 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsxfname.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsxfname.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -115,6 +115,7 @@ *****************************************************************************/ #define __NSXFNAME_C__ +#define EXPORT_ACPI_INTERFACES #include "acpi.h" #include "accommon.h" diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsxfobj.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsxfobj.c index 147d025027..0f61a7100a 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsxfobj.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsxfobj.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -116,6 +116,7 @@ #define __NSXFOBJ_C__ +#define EXPORT_ACPI_INTERFACES #include "acpi.h" #include "accommon.h" diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psargs.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psargs.c index 938a4f1f80..5e2e43414d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psargs.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psargs.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psloop.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psloop.c index d9d4548576..ec7db25497 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psloop.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psloop.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -561,6 +561,11 @@ AcpiPsParseLoop ( Status = AE_OK; } + if (Status == AE_CTRL_TERMINATE) + { + return_ACPI_STATUS (Status); + } + Status = AcpiPsCompleteOp (WalkState, &Op, Status); if (ACPI_FAILURE (Status)) { diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psobject.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psobject.c index 8e5faedd33..f4ecc33899 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psobject.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psobject.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -301,7 +301,10 @@ AcpiPsBuildNamedOp ( Status = WalkState->DescendingCallback (WalkState, Op); if (ACPI_FAILURE (Status)) { - ACPI_EXCEPTION ((AE_INFO, Status, "During name lookup/catalog")); + if (Status != AE_CTRL_TERMINATE) + { + ACPI_EXCEPTION ((AE_INFO, Status, "During name lookup/catalog")); + } return_ACPI_STATUS (Status); } @@ -315,7 +318,7 @@ AcpiPsBuildNamedOp ( { if (Status == AE_CTRL_PENDING) { - return_ACPI_STATUS (AE_CTRL_PARSE_PENDING); + Status = AE_CTRL_PARSE_PENDING; } return_ACPI_STATUS (Status); } diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psopcode.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psopcode.c index 22f958bc7d..0af5e9ae3b 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psopcode.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psopcode.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psopinfo.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psopinfo.c index 9b97f74c85..5118ccdc22 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psopinfo.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psopinfo.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -148,6 +148,10 @@ const ACPI_OPCODE_INFO * AcpiPsGetOpcodeInfo ( UINT16 Opcode) { +#ifdef ACPI_DEBUG_OUTPUT + const char *OpcodeName = "Unknown AML opcode"; +#endif + ACPI_FUNCTION_NAME (PsGetOpcodeInfo); @@ -169,10 +173,56 @@ AcpiPsGetOpcodeInfo ( return (&AcpiGbl_AmlOpInfo [AcpiGbl_LongOpIndex [(UINT8) Opcode]]); } +#if defined ACPI_ASL_COMPILER && defined ACPI_DEBUG_OUTPUT +#include "asldefine.h" + + switch (Opcode) + { + case AML_RAW_DATA_BYTE: + OpcodeName = "-Raw Data Byte-"; + break; + + case AML_RAW_DATA_WORD: + OpcodeName = "-Raw Data Word-"; + break; + + case AML_RAW_DATA_DWORD: + OpcodeName = "-Raw Data Dword-"; + break; + + case AML_RAW_DATA_QWORD: + OpcodeName = "-Raw Data Qword-"; + break; + + case AML_RAW_DATA_BUFFER: + OpcodeName = "-Raw Data Buffer-"; + break; + + case AML_RAW_DATA_CHAIN: + OpcodeName = "-Raw Data Buffer Chain-"; + break; + + case AML_PACKAGE_LENGTH: + OpcodeName = "-Package Length-"; + break; + + case AML_UNASSIGNED_OPCODE: + OpcodeName = "-Unassigned Opcode-"; + break; + + case AML_DEFAULT_ARG_OP: + OpcodeName = "-Default Arg-"; + break; + + default: + break; + } +#endif + /* Unknown AML opcode */ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Unknown AML opcode [%4.4X]\n", Opcode)); + "%s [%4.4X]\n", OpcodeName, Opcode)); return (&AcpiGbl_AmlOpInfo [_UNK]); } diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psparse.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psparse.c index 689c2b889f..b9038f1a2f 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psparse.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psparse.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psscope.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psscope.c index c90b467959..45a5768f8b 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psscope.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psscope.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/pstree.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/pstree.c index dcb4ded12e..4a6403d55e 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/pstree.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/pstree.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psutils.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psutils.c index 4ce867b363..12d74a9587 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psutils.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psutils.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/pswalk.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/pswalk.c index 863afa5266..7226e48f3d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/pswalk.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/pswalk.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psxface.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psxface.c index 1e58b81901..65758fcdc7 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psxface.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/parser/psxface.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsaddr.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsaddr.c index dad7c9c297..d29307d9f3 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsaddr.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsaddr.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rscalc.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rscalc.c index f8eced56e4..b2742ae713 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rscalc.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rscalc.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -269,6 +269,7 @@ AcpiRsStreamOptionLength ( * FUNCTION: AcpiRsGetAmlLength * * PARAMETERS: Resource - Pointer to the resource linked list + * ResourceListSize - Size of the resource linked list * SizeNeeded - Where the required size is returned * * RETURN: Status @@ -282,9 +283,11 @@ AcpiRsStreamOptionLength ( ACPI_STATUS AcpiRsGetAmlLength ( ACPI_RESOURCE *Resource, + ACPI_SIZE ResourceListSize, ACPI_SIZE *SizeNeeded) { ACPI_SIZE AmlSizeNeeded = 0; + ACPI_RESOURCE *ResourceEnd; ACPI_RS_LENGTH TotalSize; @@ -293,7 +296,8 @@ AcpiRsGetAmlLength ( /* Traverse entire list of internal resource descriptors */ - while (Resource) + ResourceEnd = ACPI_ADD_PTR (ACPI_RESOURCE, Resource, ResourceListSize); + while (Resource < ResourceEnd) { /* Validate the descriptor type */ @@ -727,7 +731,7 @@ AcpiRsGetPciRoutingTableLength ( for (Index = 0; Index < NumberOfElements; Index++) { - /* Dereference the sub-package */ + /* Dereference the subpackage */ PackageElement = *TopObjectList; diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rscreate.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rscreate.c index 0e58aee7c4..03298f4242 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rscreate.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rscreate.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -149,6 +149,10 @@ AcpiBufferToResource ( void *Resource; void *CurrentResourcePtr; + + ACPI_FUNCTION_TRACE (AcpiBufferToResource); + + /* * Note: we allow AE_AML_NO_RESOURCE_END_TAG, since an end tag * is not required here. @@ -164,7 +168,7 @@ AcpiBufferToResource ( } if (ACPI_FAILURE (Status)) { - return (Status); + return_ACPI_STATUS (Status); } /* Allocate a buffer for the converted resource */ @@ -173,7 +177,7 @@ AcpiBufferToResource ( CurrentResourcePtr = Resource; if (!Resource) { - return (AE_NO_MEMORY); + return_ACPI_STATUS (AE_NO_MEMORY); } /* Perform the AML-to-Resource conversion */ @@ -193,9 +197,11 @@ AcpiBufferToResource ( *ResourcePtr = Resource; } - return (Status); + return_ACPI_STATUS (Status); } +ACPI_EXPORT_SYMBOL (AcpiBufferToResource) + /******************************************************************************* * @@ -369,7 +375,7 @@ AcpiRsCreatePciRoutingTable ( */ UserPrt->Length = (sizeof (ACPI_PCI_ROUTING_TABLE) - 4); - /* Each sub-package must be of length 4 */ + /* Each subpackage must be of length 4 */ if ((*TopObjectList)->Package.Count != 4) { @@ -380,7 +386,7 @@ AcpiRsCreatePciRoutingTable ( } /* - * Dereference the sub-package. + * Dereference the subpackage. * The SubObjectList will now point to an array of the four IRQ * elements: [Address, Pin, Source, SourceIndex] */ @@ -389,7 +395,7 @@ AcpiRsCreatePciRoutingTable ( /* 1) First subobject: Dereference the PRT.Address */ ObjDesc = SubObjectList[0]; - if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER) + if (!ObjDesc || ObjDesc->Common.Type != ACPI_TYPE_INTEGER) { ACPI_ERROR ((AE_INFO, "(PRT[%u].Address) Need Integer, found %s", Index, AcpiUtGetObjectTypeName (ObjDesc))); @@ -401,7 +407,7 @@ AcpiRsCreatePciRoutingTable ( /* 2) Second subobject: Dereference the PRT.Pin */ ObjDesc = SubObjectList[1]; - if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER) + if (!ObjDesc || ObjDesc->Common.Type != ACPI_TYPE_INTEGER) { ACPI_ERROR ((AE_INFO, "(PRT[%u].Pin) Need Integer, found %s", Index, AcpiUtGetObjectTypeName (ObjDesc))); @@ -482,7 +488,7 @@ AcpiRsCreatePciRoutingTable ( /* 4) Fourth subobject: Dereference the PRT.SourceIndex */ ObjDesc = SubObjectList[3]; - if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER) + if (!ObjDesc || ObjDesc->Common.Type != ACPI_TYPE_INTEGER) { ACPI_ERROR ((AE_INFO, "(PRT[%u].SourceIndex) Need Integer, found %s", @@ -507,23 +513,22 @@ AcpiRsCreatePciRoutingTable ( * * FUNCTION: AcpiRsCreateAmlResources * - * PARAMETERS: LinkedListBuffer - Pointer to the resource linked list - * OutputBuffer - Pointer to the user's buffer + * PARAMETERS: ResourceList - Pointer to the resource list buffer + * OutputBuffer - Where the AML buffer is returned * * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code. * If the OutputBuffer is too small, the error will be * AE_BUFFER_OVERFLOW and OutputBuffer->Length will point * to the size buffer needed. * - * DESCRIPTION: Takes the linked list of device resources and - * creates a bytestream to be used as input for the - * _SRS control method. + * DESCRIPTION: Converts a list of device resources to an AML bytestream + * to be used as input for the _SRS control method. * ******************************************************************************/ ACPI_STATUS AcpiRsCreateAmlResources ( - ACPI_RESOURCE *LinkedListBuffer, + ACPI_BUFFER *ResourceList, ACPI_BUFFER *OutputBuffer) { ACPI_STATUS Status; @@ -533,17 +538,15 @@ AcpiRsCreateAmlResources ( ACPI_FUNCTION_TRACE (RsCreateAmlResources); - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "LinkedListBuffer = %p\n", - LinkedListBuffer)); + /* Params already validated, no need to re-validate here */ - /* - * Params already validated, so we don't re-validate here - * - * Pass the LinkedListBuffer into a module that calculates - * the buffer size needed for the byte stream. - */ - Status = AcpiRsGetAmlLength (LinkedListBuffer, - &AmlSizeNeeded); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ResourceList Buffer = %p\n", + ResourceList->Pointer)); + + /* Get the buffer size needed for the AML byte stream */ + + Status = AcpiRsGetAmlLength (ResourceList->Pointer, + ResourceList->Length, &AmlSizeNeeded); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AmlSizeNeeded=%X, %s\n", (UINT32) AmlSizeNeeded, AcpiFormatException (Status))); @@ -562,14 +565,14 @@ AcpiRsCreateAmlResources ( /* Do the conversion */ - Status = AcpiRsConvertResourcesToAml (LinkedListBuffer, AmlSizeNeeded, - OutputBuffer->Pointer); + Status = AcpiRsConvertResourcesToAml (ResourceList->Pointer, + AmlSizeNeeded, OutputBuffer->Pointer); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer %p Length %X\n", - OutputBuffer->Pointer, (UINT32) OutputBuffer->Length)); + OutputBuffer->Pointer, (UINT32) OutputBuffer->Length)); return_ACPI_STATUS (AE_OK); } diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsdump.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsdump.c index fb1af63ae7..ae295fae30 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsdump.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsdump.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -124,7 +124,7 @@ ACPI_MODULE_NAME ("rsdump") -#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) +#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUGGER) /* Local prototypes */ diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsdumpinfo.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsdumpinfo.c index 8b3b23c252..2aef0e586c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsdumpinfo.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsdumpinfo.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -124,7 +124,7 @@ ACPI_MODULE_NAME ("rsdumpinfo") -#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) +#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUGGER) #define ACPI_RSD_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_RESOURCE_DATA,f) diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsinfo.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsinfo.c index 1861ecfb22..05f02a85da 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsinfo.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsinfo.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -213,7 +213,7 @@ ACPI_RSCONVERT_INFO *AcpiGbl_ConvertResourceSerialBusDispatch[] = }; -#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) +#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUGGER) /* Dispatch table for resource dump functions */ diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsio.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsio.c index 8a2b245db8..b0e6f1dc94 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsio.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsio.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsirq.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsirq.c index 9930eb81ce..1bd887b6bf 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsirq.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsirq.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rslist.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rslist.c index ddb62872c6..71e31645fb 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rslist.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rslist.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsmemory.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsmemory.c index 29e16520af..727d3ee7c7 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsmemory.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsmemory.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsmisc.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsmisc.c index 946d74f056..a6976028f6 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsmisc.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsmisc.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsserial.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsserial.c index fcaf0cdccc..2eee1a2a1e 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsserial.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsserial.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsutils.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsutils.c index bdc5ccfe5b..e9952f0dd3 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsutils.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsutils.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -899,7 +899,7 @@ AcpiRsSetSrsMethodData ( * Convert the linked list into a byte stream */ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiRsCreateAmlResources (InBuffer->Pointer, &Buffer); + Status = AcpiRsCreateAmlResources (InBuffer, &Buffer); if (ACPI_FAILURE (Status)) { goto Cleanup; diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsxface.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsxface.c index 0401b0d3bf..2ae63b37b1 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsxface.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/resources/rsxface.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -115,6 +115,7 @@ #define __RSXFACE_C__ +#define EXPORT_ACPI_INTERFACES #include "acpi.h" #include "accommon.h" diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbdata.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbdata.c new file mode 100644 index 0000000000..1e4cbcd48b --- /dev/null +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbdata.c @@ -0,0 +1,927 @@ +/****************************************************************************** + * + * Module Name: tbdata - Table manager data structure functions + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#define __TBDATA_C__ + +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" +#include "actables.h" + +#define _COMPONENT ACPI_TABLES + ACPI_MODULE_NAME ("tbdata") + + +/******************************************************************************* + * + * FUNCTION: AcpiTbInitTableDescriptor + * + * PARAMETERS: TableDesc - Table descriptor + * Address - Physical address of the table + * Flags - Allocation flags of the table + * Table - Pointer to the table + * + * RETURN: None + * + * DESCRIPTION: Initialize a new table descriptor + * + ******************************************************************************/ + +void +AcpiTbInitTableDescriptor ( + ACPI_TABLE_DESC *TableDesc, + ACPI_PHYSICAL_ADDRESS Address, + UINT8 Flags, + ACPI_TABLE_HEADER *Table) +{ + + /* + * Initialize the table descriptor. Set the pointer to NULL, since the + * table is not fully mapped at this time. + */ + ACPI_MEMSET (TableDesc, 0, sizeof (ACPI_TABLE_DESC)); + TableDesc->Address = Address; + TableDesc->Length = Table->Length; + TableDesc->Flags = Flags; + ACPI_MOVE_32_TO_32 (TableDesc->Signature.Ascii, Table->Signature); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiTbAcquireTable + * + * PARAMETERS: TableDesc - Table descriptor + * TablePtr - Where table is returned + * TableLength - Where table length is returned + * TableFlags - Where table allocation flags are returned + * + * RETURN: Status + * + * DESCRIPTION: Acquire an ACPI table. It can be used for tables not + * maintained in the AcpiGbl_RootTableList. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiTbAcquireTable ( + ACPI_TABLE_DESC *TableDesc, + ACPI_TABLE_HEADER **TablePtr, + UINT32 *TableLength, + UINT8 *TableFlags) +{ + ACPI_TABLE_HEADER *Table = NULL; + + + switch (TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK) + { + case ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL: + + Table = AcpiOsMapMemory (TableDesc->Address, TableDesc->Length); + break; + + case ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL: + case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL: + + Table = ACPI_CAST_PTR (ACPI_TABLE_HEADER, TableDesc->Address); + break; + + default: + + break; + } + + /* Table is not valid yet */ + + if (!Table) + { + return (AE_NO_MEMORY); + } + + /* Fill the return values */ + + *TablePtr = Table; + *TableLength = TableDesc->Length; + *TableFlags = TableDesc->Flags; + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiTbReleaseTable + * + * PARAMETERS: Table - Pointer for the table + * TableLength - Length for the table + * TableFlags - Allocation flags for the table + * + * RETURN: None + * + * DESCRIPTION: Release a table. The inverse of AcpiTbAcquireTable(). + * + ******************************************************************************/ + +void +AcpiTbReleaseTable ( + ACPI_TABLE_HEADER *Table, + UINT32 TableLength, + UINT8 TableFlags) +{ + + switch (TableFlags & ACPI_TABLE_ORIGIN_MASK) + { + case ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL: + + AcpiOsUnmapMemory (Table, TableLength); + break; + + case ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL: + case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL: + default: + + break; + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiTbAcquireTempTable + * + * PARAMETERS: TableDesc - Table descriptor to be acquired + * Address - Address of the table + * Flags - Allocation flags of the table + * + * RETURN: Status + * + * DESCRIPTION: This function validates the table header to obtain the length + * of a table and fills the table descriptor to make its state as + * "INSTALLED". Such a table descriptor is only used for verified + * installation. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiTbAcquireTempTable ( + ACPI_TABLE_DESC *TableDesc, + ACPI_PHYSICAL_ADDRESS Address, + UINT8 Flags) +{ + ACPI_TABLE_HEADER *TableHeader; + + + switch (Flags & ACPI_TABLE_ORIGIN_MASK) + { + case ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL: + + /* Get the length of the full table from the header */ + + TableHeader = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER)); + if (!TableHeader) + { + return (AE_NO_MEMORY); + } + + AcpiTbInitTableDescriptor (TableDesc, Address, Flags, TableHeader); + AcpiOsUnmapMemory (TableHeader, sizeof (ACPI_TABLE_HEADER)); + return (AE_OK); + + case ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL: + case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL: + + TableHeader = ACPI_CAST_PTR (ACPI_TABLE_HEADER, Address); + if (!TableHeader) + { + return (AE_NO_MEMORY); + } + + AcpiTbInitTableDescriptor (TableDesc, Address, Flags, TableHeader); + return (AE_OK); + + default: + + break; + } + + /* Table is not valid yet */ + + return (AE_NO_MEMORY); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiTbReleaseTempTable + * + * PARAMETERS: TableDesc - Table descriptor to be released + * + * RETURN: Status + * + * DESCRIPTION: The inverse of AcpiTbAcquireTempTable(). + * + *****************************************************************************/ + +void +AcpiTbReleaseTempTable ( + ACPI_TABLE_DESC *TableDesc) +{ + + /* + * Note that the .Address is maintained by the callers of + * AcpiTbAcquireTempTable(), thus do not invoke AcpiTbUninstallTable() + * where .Address will be freed. + */ + AcpiTbInvalidateTable (TableDesc); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiTbValidateTable + * + * PARAMETERS: TableDesc - Table descriptor + * + * RETURN: Status + * + * DESCRIPTION: This function is called to validate the table, the returned + * table descriptor is in "VALIDATED" state. + * + *****************************************************************************/ + +ACPI_STATUS +AcpiTbValidateTable ( + ACPI_TABLE_DESC *TableDesc) +{ + ACPI_STATUS Status = AE_OK; + + + ACPI_FUNCTION_TRACE (TbValidateTable); + + + /* Validate the table if necessary */ + + if (!TableDesc->Pointer) + { + Status = AcpiTbAcquireTable (TableDesc, &TableDesc->Pointer, + &TableDesc->Length, &TableDesc->Flags); + if (!TableDesc->Pointer) + { + Status = AE_NO_MEMORY; + } + } + + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiTbInvalidateTable + * + * PARAMETERS: TableDesc - Table descriptor + * + * RETURN: None + * + * DESCRIPTION: Invalidate one internal ACPI table, this is the inverse of + * AcpiTbValidateTable(). + * + ******************************************************************************/ + +void +AcpiTbInvalidateTable ( + ACPI_TABLE_DESC *TableDesc) +{ + + ACPI_FUNCTION_TRACE (TbInvalidateTable); + + + /* Table must be validated */ + + if (!TableDesc->Pointer) + { + return_VOID; + } + + AcpiTbReleaseTable (TableDesc->Pointer, TableDesc->Length, + TableDesc->Flags); + TableDesc->Pointer = NULL; + + return_VOID; +} + + +/****************************************************************************** + * + * FUNCTION: AcpiTbValidateTempTable + * + * PARAMETERS: TableDesc - Table descriptor + * + * RETURN: Status + * + * DESCRIPTION: This function is called to validate the table, the returned + * table descriptor is in "VALIDATED" state. + * + *****************************************************************************/ + +ACPI_STATUS +AcpiTbValidateTempTable ( + ACPI_TABLE_DESC *TableDesc) +{ + + if (!TableDesc->Pointer && !AcpiGbl_VerifyTableChecksum) + { + /* + * Only validates the header of the table. + * Note that Length contains the size of the mapping after invoking + * this work around, this value is required by + * AcpiTbReleaseTempTable(). + * We can do this because in AcpiInitTableDescriptor(), the Length + * field of the installed descriptor is filled with the actual + * table length obtaining from the table header. + */ + TableDesc->Length = sizeof (ACPI_TABLE_HEADER); + } + + return (AcpiTbValidateTable (TableDesc)); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiTbVerifyTempTable + * + * PARAMETERS: TableDesc - Table descriptor + * Signature - Table signature to verify + * + * RETURN: Status + * + * DESCRIPTION: This function is called to validate and verify the table, the + * returned table descriptor is in "VALIDATED" state. + * + *****************************************************************************/ + +ACPI_STATUS +AcpiTbVerifyTempTable ( + ACPI_TABLE_DESC *TableDesc, + char *Signature) +{ + ACPI_STATUS Status = AE_OK; + + + ACPI_FUNCTION_TRACE (TbVerifyTempTable); + + + /* Validate the table */ + + Status = AcpiTbValidateTempTable (TableDesc); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + /* If a particular signature is expected (DSDT/FACS), it must match */ + + if (Signature && + !ACPI_COMPARE_NAME (&TableDesc->Signature, Signature)) + { + ACPI_BIOS_ERROR ((AE_INFO, + "Invalid signature 0x%X for ACPI table, expected [%s]", + TableDesc->Signature.Integer, Signature)); + Status = AE_BAD_SIGNATURE; + goto InvalidateAndExit; + } + + /* Verify the checksum */ + + if (AcpiGbl_VerifyTableChecksum) + { + Status = AcpiTbVerifyChecksum (TableDesc->Pointer, TableDesc->Length); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, AE_NO_MEMORY, + "%4.4s " ACPI_PRINTF_UINT + " Attempted table install failed", + AcpiUtValidAcpiName (TableDesc->Signature.Ascii) ? + TableDesc->Signature.Ascii : "????", + ACPI_FORMAT_TO_UINT (TableDesc->Address))); + goto InvalidateAndExit; + } + } + + return_ACPI_STATUS (AE_OK); + +InvalidateAndExit: + AcpiTbInvalidateTable (TableDesc); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiTbResizeRootTableList + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Expand the size of global table array + * + ******************************************************************************/ + +ACPI_STATUS +AcpiTbResizeRootTableList ( + void) +{ + ACPI_TABLE_DESC *Tables; + UINT32 TableCount; + + + ACPI_FUNCTION_TRACE (TbResizeRootTableList); + + + /* AllowResize flag is a parameter to AcpiInitializeTables */ + + if (!(AcpiGbl_RootTableList.Flags & ACPI_ROOT_ALLOW_RESIZE)) + { + ACPI_ERROR ((AE_INFO, "Resize of Root Table Array is not allowed")); + return_ACPI_STATUS (AE_SUPPORT); + } + + /* Increase the Table Array size */ + + if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED) + { + TableCount = AcpiGbl_RootTableList.MaxTableCount; + } + else + { + TableCount = AcpiGbl_RootTableList.CurrentTableCount; + } + + Tables = ACPI_ALLOCATE_ZEROED ( + ((ACPI_SIZE) TableCount + ACPI_ROOT_TABLE_SIZE_INCREMENT) * + sizeof (ACPI_TABLE_DESC)); + if (!Tables) + { + ACPI_ERROR ((AE_INFO, "Could not allocate new root table array")); + return_ACPI_STATUS (AE_NO_MEMORY); + } + + /* Copy and free the previous table array */ + + if (AcpiGbl_RootTableList.Tables) + { + ACPI_MEMCPY (Tables, AcpiGbl_RootTableList.Tables, + (ACPI_SIZE) TableCount * sizeof (ACPI_TABLE_DESC)); + + if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED) + { + ACPI_FREE (AcpiGbl_RootTableList.Tables); + } + } + + AcpiGbl_RootTableList.Tables = Tables; + AcpiGbl_RootTableList.MaxTableCount = + TableCount + ACPI_ROOT_TABLE_SIZE_INCREMENT; + AcpiGbl_RootTableList.Flags |= ACPI_ROOT_ORIGIN_ALLOCATED; + + return_ACPI_STATUS (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiTbGetNextRootIndex + * + * PARAMETERS: TableIndex - Where table index is returned + * + * RETURN: Status and table index. + * + * DESCRIPTION: Allocate a new ACPI table entry to the global table list + * + ******************************************************************************/ + +ACPI_STATUS +AcpiTbGetNextRootIndex ( + UINT32 *TableIndex) +{ + ACPI_STATUS Status; + + + /* Ensure that there is room for the table in the Root Table List */ + + if (AcpiGbl_RootTableList.CurrentTableCount >= + AcpiGbl_RootTableList.MaxTableCount) + { + Status = AcpiTbResizeRootTableList(); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + } + + *TableIndex = AcpiGbl_RootTableList.CurrentTableCount; + AcpiGbl_RootTableList.CurrentTableCount++; + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiTbTerminate + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Delete all internal ACPI tables + * + ******************************************************************************/ + +void +AcpiTbTerminate ( + void) +{ + UINT32 i; + + + ACPI_FUNCTION_TRACE (TbTerminate); + + + (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); + + /* Delete the individual tables */ + + for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++) + { + AcpiTbUninstallTable (&AcpiGbl_RootTableList.Tables[i]); + } + + /* + * Delete the root table array if allocated locally. Array cannot be + * mapped, so we don't need to check for that flag. + */ + if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED) + { + ACPI_FREE (AcpiGbl_RootTableList.Tables); + } + + AcpiGbl_RootTableList.Tables = NULL; + AcpiGbl_RootTableList.Flags = 0; + AcpiGbl_RootTableList.CurrentTableCount = 0; + + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ACPI Tables freed\n")); + + (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); + return_VOID; +} + + +/******************************************************************************* + * + * FUNCTION: AcpiTbDeleteNamespaceByOwner + * + * PARAMETERS: TableIndex - Table index + * + * RETURN: Status + * + * DESCRIPTION: Delete all namespace objects created when this table was loaded. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiTbDeleteNamespaceByOwner ( + UINT32 TableIndex) +{ + ACPI_OWNER_ID OwnerId; + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (TbDeleteNamespaceByOwner); + + + Status = AcpiUtAcquireMutex (ACPI_MTX_TABLES); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + if (TableIndex >= AcpiGbl_RootTableList.CurrentTableCount) + { + /* The table index does not exist */ + + (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); + return_ACPI_STATUS (AE_NOT_EXIST); + } + + /* Get the owner ID for this table, used to delete namespace nodes */ + + OwnerId = AcpiGbl_RootTableList.Tables[TableIndex].OwnerId; + (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); + + /* + * Need to acquire the namespace writer lock to prevent interference + * with any concurrent namespace walks. The interpreter must be + * released during the deletion since the acquisition of the deletion + * lock may block, and also since the execution of a namespace walk + * must be allowed to use the interpreter. + */ + (void) AcpiUtReleaseMutex (ACPI_MTX_INTERPRETER); + Status = AcpiUtAcquireWriteLock (&AcpiGbl_NamespaceRwLock); + + AcpiNsDeleteNamespaceByOwner (OwnerId); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + AcpiUtReleaseWriteLock (&AcpiGbl_NamespaceRwLock); + + Status = AcpiUtAcquireMutex (ACPI_MTX_INTERPRETER); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiTbAllocateOwnerId + * + * PARAMETERS: TableIndex - Table index + * + * RETURN: Status + * + * DESCRIPTION: Allocates OwnerId in TableDesc + * + ******************************************************************************/ + +ACPI_STATUS +AcpiTbAllocateOwnerId ( + UINT32 TableIndex) +{ + ACPI_STATUS Status = AE_BAD_PARAMETER; + + + ACPI_FUNCTION_TRACE (TbAllocateOwnerId); + + + (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); + if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount) + { + Status = AcpiUtAllocateOwnerId ( + &(AcpiGbl_RootTableList.Tables[TableIndex].OwnerId)); + } + + (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiTbReleaseOwnerId + * + * PARAMETERS: TableIndex - Table index + * + * RETURN: Status + * + * DESCRIPTION: Releases OwnerId in TableDesc + * + ******************************************************************************/ + +ACPI_STATUS +AcpiTbReleaseOwnerId ( + UINT32 TableIndex) +{ + ACPI_STATUS Status = AE_BAD_PARAMETER; + + + ACPI_FUNCTION_TRACE (TbReleaseOwnerId); + + + (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); + if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount) + { + AcpiUtReleaseOwnerId ( + &(AcpiGbl_RootTableList.Tables[TableIndex].OwnerId)); + Status = AE_OK; + } + + (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiTbGetOwnerId + * + * PARAMETERS: TableIndex - Table index + * OwnerId - Where the table OwnerId is returned + * + * RETURN: Status + * + * DESCRIPTION: returns OwnerId for the ACPI table + * + ******************************************************************************/ + +ACPI_STATUS +AcpiTbGetOwnerId ( + UINT32 TableIndex, + ACPI_OWNER_ID *OwnerId) +{ + ACPI_STATUS Status = AE_BAD_PARAMETER; + + + ACPI_FUNCTION_TRACE (TbGetOwnerId); + + + (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); + if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount) + { + *OwnerId = AcpiGbl_RootTableList.Tables[TableIndex].OwnerId; + Status = AE_OK; + } + + (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiTbIsTableLoaded + * + * PARAMETERS: TableIndex - Index into the root table + * + * RETURN: Table Loaded Flag + * + ******************************************************************************/ + +BOOLEAN +AcpiTbIsTableLoaded ( + UINT32 TableIndex) +{ + BOOLEAN IsLoaded = FALSE; + + + (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); + if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount) + { + IsLoaded = (BOOLEAN) + (AcpiGbl_RootTableList.Tables[TableIndex].Flags & + ACPI_TABLE_IS_LOADED); + } + + (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); + return (IsLoaded); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiTbSetTableLoadedFlag + * + * PARAMETERS: TableIndex - Table index + * IsLoaded - TRUE if table is loaded, FALSE otherwise + * + * RETURN: None + * + * DESCRIPTION: Sets the table loaded flag to either TRUE or FALSE. + * + ******************************************************************************/ + +void +AcpiTbSetTableLoadedFlag ( + UINT32 TableIndex, + BOOLEAN IsLoaded) +{ + + (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); + if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount) + { + if (IsLoaded) + { + AcpiGbl_RootTableList.Tables[TableIndex].Flags |= + ACPI_TABLE_IS_LOADED; + } + else + { + AcpiGbl_RootTableList.Tables[TableIndex].Flags &= + ~ACPI_TABLE_IS_LOADED; + } + } + + (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); +} diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbfadt.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbfadt.c index d90baba08c..8cb69a9c09 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbfadt.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbfadt.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -130,20 +130,23 @@ AcpiTbInitGenericAddress ( UINT8 SpaceId, UINT8 ByteWidth, UINT64 Address, - char *RegisterName); + char *RegisterName, + UINT8 Flags); static void AcpiTbConvertFadt ( void); -static void -AcpiTbValidateFadt ( - void); - static void AcpiTbSetupFadtRegisters ( void); +static UINT64 +AcpiTbSelectAddress ( + char *RegisterName, + UINT32 Address32, + UINT64 Address64); + /* Table for conversion of FADT to common internal format and FADT validation */ @@ -154,13 +157,14 @@ typedef struct acpi_fadt_info UINT16 Address32; UINT16 Length; UINT8 DefaultLength; - UINT8 Type; + UINT8 Flags; } ACPI_FADT_INFO; #define ACPI_FADT_OPTIONAL 0 #define ACPI_FADT_REQUIRED 1 #define ACPI_FADT_SEPARATE_LENGTH 2 +#define ACPI_FADT_GPE_REGISTER 4 static ACPI_FADT_INFO FadtInfoTable[] = { @@ -211,14 +215,14 @@ static ACPI_FADT_INFO FadtInfoTable[] = ACPI_FADT_OFFSET (Gpe0Block), ACPI_FADT_OFFSET (Gpe0BlockLength), 0, - ACPI_FADT_SEPARATE_LENGTH}, + ACPI_FADT_SEPARATE_LENGTH | ACPI_FADT_GPE_REGISTER}, {"Gpe1Block", ACPI_FADT_OFFSET (XGpe1Block), ACPI_FADT_OFFSET (Gpe1Block), ACPI_FADT_OFFSET (Gpe1BlockLength), 0, - ACPI_FADT_SEPARATE_LENGTH} + ACPI_FADT_SEPARATE_LENGTH | ACPI_FADT_GPE_REGISTER} }; #define ACPI_FADT_INFO_ENTRIES \ @@ -266,6 +270,7 @@ static ACPI_FADT_PM_INFO FadtPmInfoTable[] = * SpaceId - ACPI Space ID for this register * ByteWidth - Width of this register * Address - Address of the register + * RegisterName - ASCII name of the ACPI register * * RETURN: None * @@ -281,21 +286,31 @@ AcpiTbInitGenericAddress ( UINT8 SpaceId, UINT8 ByteWidth, UINT64 Address, - char *RegisterName) + char *RegisterName, + UINT8 Flags) { UINT8 BitWidth; - /* Bit width field in the GAS is only one byte long, 255 max */ - + /* + * Bit width field in the GAS is only one byte long, 255 max. + * Check for BitWidth overflow in GAS. + */ BitWidth = (UINT8) (ByteWidth * 8); - - if (ByteWidth > 31) /* (31*8)=248 */ + if (ByteWidth > 31) /* (31*8)=248, (32*8)=256 */ { - ACPI_ERROR ((AE_INFO, - "%s - 32-bit FADT register is too long (%u bytes, %u bits) " - "to convert to GAS struct - 255 bits max, truncating", - RegisterName, ByteWidth, (ByteWidth * 8))); + /* + * No error for GPE blocks, because we do not use the BitWidth + * for GPEs, the legacy length (ByteWidth) is used instead to + * allow for a large number of GPEs. + */ + if (!(Flags & ACPI_FADT_GPE_REGISTER)) + { + ACPI_ERROR ((AE_INFO, + "%s - 32-bit FADT register is too long (%u bytes, %u bits) " + "to convert to GAS struct - 255 bits max, truncating", + RegisterName, ByteWidth, (ByteWidth * 8))); + } BitWidth = 255; } @@ -315,6 +330,72 @@ AcpiTbInitGenericAddress ( } +/******************************************************************************* + * + * FUNCTION: AcpiTbSelectAddress + * + * PARAMETERS: RegisterName - ASCII name of the ACPI register + * Address32 - 32-bit address of the register + * Address64 - 64-bit address of the register + * + * RETURN: The resolved 64-bit address + * + * DESCRIPTION: Select between 32-bit and 64-bit versions of addresses within + * the FADT. Used for the FACS and DSDT addresses. + * + * NOTES: + * + * Check for FACS and DSDT address mismatches. An address mismatch between + * the 32-bit and 64-bit address fields (FIRMWARE_CTRL/X_FIRMWARE_CTRL and + * DSDT/X_DSDT) could be a corrupted address field or it might indicate + * the presence of two FACS or two DSDT tables. + * + * November 2013: + * By default, as per the ACPICA specification, a valid 64-bit address is + * used regardless of the value of the 32-bit address. However, this + * behavior can be overridden via the AcpiGbl_Use32BitFadtAddresses flag. + * + ******************************************************************************/ + +static UINT64 +AcpiTbSelectAddress ( + char *RegisterName, + UINT32 Address32, + UINT64 Address64) +{ + + if (!Address64) + { + /* 64-bit address is zero, use 32-bit address */ + + return ((UINT64) Address32); + } + + if (Address32 && + (Address64 != (UINT64) Address32)) + { + /* Address mismatch between 32-bit and 64-bit versions */ + + ACPI_BIOS_WARNING ((AE_INFO, + "32/64X %s address mismatch in FADT: " + "0x%8.8X/0x%8.8X%8.8X, using %u-bit address", + RegisterName, Address32, ACPI_FORMAT_UINT64 (Address64), + AcpiGbl_Use32BitFadtAddresses ? 32 : 64)); + + /* 32-bit address override */ + + if (AcpiGbl_Use32BitFadtAddresses) + { + return ((UINT64) Address32); + } + } + + /* Default is to use the 64-bit address */ + + return (Address64); +} + + /******************************************************************************* * * FUNCTION: AcpiTbParseFadt @@ -368,14 +449,14 @@ AcpiTbParseFadt ( /* Obtain the DSDT and FACS tables via their addresses within the FADT */ - AcpiTbInstallTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XDsdt, + AcpiTbInstallFixedTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XDsdt, ACPI_SIG_DSDT, ACPI_TABLE_INDEX_DSDT); /* If Hardware Reduced flag is set, there is no FACS */ if (!AcpiGbl_ReducedHardware) { - AcpiTbInstallTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XFacs, + AcpiTbInstallFixedTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XFacs, ACPI_SIG_FACS, ACPI_TABLE_INDEX_FACS); } } @@ -437,10 +518,6 @@ AcpiTbCreateLocalFadt ( AcpiTbConvertFadt (); - /* Validate FADT values now, before we make any changes */ - - AcpiTbValidateFadt (); - /* Initialize the global ACPI register structures */ AcpiTbSetupFadtRegisters (); @@ -451,33 +528,43 @@ AcpiTbCreateLocalFadt ( * * FUNCTION: AcpiTbConvertFadt * - * PARAMETERS: None, uses AcpiGbl_FADT + * PARAMETERS: None - AcpiGbl_FADT is used. * * RETURN: None * * DESCRIPTION: Converts all versions of the FADT to a common internal format. - * Expand 32-bit addresses to 64-bit as necessary. + * Expand 32-bit addresses to 64-bit as necessary. Also validate + * important fields within the FADT. * - * NOTE: AcpiGbl_FADT must be of size (ACPI_TABLE_FADT), - * and must contain a copy of the actual FADT. + * NOTE: AcpiGbl_FADT must be of size (ACPI_TABLE_FADT), and must + * contain a copy of the actual BIOS-provided FADT. * * Notes on 64-bit register addresses: * * After this FADT conversion, later ACPICA code will only use the 64-bit "X" * fields of the FADT for all ACPI register addresses. * - * The 64-bit "X" fields are optional extensions to the original 32-bit FADT + * The 64-bit X fields are optional extensions to the original 32-bit FADT * V1.0 fields. Even if they are present in the FADT, they are optional and * are unused if the BIOS sets them to zero. Therefore, we must copy/expand - * 32-bit V1.0 fields if the corresponding X field is zero. + * 32-bit V1.0 fields to the 64-bit X fields if the the 64-bit X field is + * originally zero. * - * For ACPI 1.0 FADTs, all 32-bit address fields are expanded to the - * corresponding "X" fields in the internal FADT. + * For ACPI 1.0 FADTs (that contain no 64-bit addresses), all 32-bit address + * fields are expanded to the corresponding 64-bit X fields in the internal + * common FADT. * * For ACPI 2.0+ FADTs, all valid (non-zero) 32-bit address fields are expanded - * to the corresponding 64-bit X fields. For compatibility with other ACPI - * implementations, we ignore the 64-bit field if the 32-bit field is valid, - * regardless of whether the host OS is 32-bit or 64-bit. + * to the corresponding 64-bit X fields, if the 64-bit field is originally + * zero. Adhering to the ACPI specification, we completely ignore the 32-bit + * field if the 64-bit field is valid, regardless of whether the host OS is + * 32-bit or 64-bit. + * + * Possible additional checks: + * (AcpiGbl_FADT.Pm1EventLength >= 4) + * (AcpiGbl_FADT.Pm1ControlLength >= 2) + * (AcpiGbl_FADT.PmTimerLength >= 4) + * Gpe block lengths must be multiple of 2 * ******************************************************************************/ @@ -485,24 +572,14 @@ static void AcpiTbConvertFadt ( void) { + char *Name; ACPI_GENERIC_ADDRESS *Address64; UINT32 Address32; + UINT8 Length; + UINT8 Flags; UINT32 i; - /* - * Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary. - * Later code will always use the X 64-bit field. - */ - if (!AcpiGbl_FADT.XFacs) - { - AcpiGbl_FADT.XFacs = (UINT64) AcpiGbl_FADT.Facs; - } - if (!AcpiGbl_FADT.XDsdt) - { - AcpiGbl_FADT.XDsdt = (UINT64) AcpiGbl_FADT.Dsdt; - } - /* * For ACPI 1.0 FADTs (revision 1 or 2), ensure that reserved fields which * should be zero are indeed zero. This will workaround BIOSs that @@ -530,113 +607,14 @@ AcpiTbConvertFadt ( AcpiGbl_FADT.Header.Length = sizeof (ACPI_TABLE_FADT); /* - * Expand the ACPI 1.0 32-bit addresses to the ACPI 2.0 64-bit "X" - * generic address structures as necessary. Later code will always use - * the 64-bit address structures. - * - * March 2009: - * We now always use the 32-bit address if it is valid (non-null). This - * is not in accordance with the ACPI specification which states that - * the 64-bit address supersedes the 32-bit version, but we do this for - * compatibility with other ACPI implementations. Most notably, in the - * case where both the 32 and 64 versions are non-null, we use the 32-bit - * version. This is the only address that is guaranteed to have been - * tested by the BIOS manufacturer. + * Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary. + * Later ACPICA code will always use the X 64-bit field. */ - for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) - { - Address32 = *ACPI_ADD_PTR (UINT32, - &AcpiGbl_FADT, FadtInfoTable[i].Address32); + AcpiGbl_FADT.XFacs = AcpiTbSelectAddress ("FACS", + AcpiGbl_FADT.Facs, AcpiGbl_FADT.XFacs); - Address64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS, - &AcpiGbl_FADT, FadtInfoTable[i].Address64); - - /* - * If both 32- and 64-bit addresses are valid (non-zero), - * they must match. - */ - if (Address64->Address && Address32 && - (Address64->Address != (UINT64) Address32)) - { - ACPI_BIOS_ERROR ((AE_INFO, - "32/64X address mismatch in FADT/%s: " - "0x%8.8X/0x%8.8X%8.8X, using 32", - FadtInfoTable[i].Name, Address32, - ACPI_FORMAT_UINT64 (Address64->Address))); - } - - /* Always use 32-bit address if it is valid (non-null) */ - - if (Address32) - { - /* - * Copy the 32-bit address to the 64-bit GAS structure. The - * Space ID is always I/O for 32-bit legacy address fields - */ - AcpiTbInitGenericAddress (Address64, ACPI_ADR_SPACE_SYSTEM_IO, - *ACPI_ADD_PTR (UINT8, &AcpiGbl_FADT, FadtInfoTable[i].Length), - (UINT64) Address32, FadtInfoTable[i].Name); - } - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbValidateFadt - * - * PARAMETERS: Table - Pointer to the FADT to be validated - * - * RETURN: None - * - * DESCRIPTION: Validate various important fields within the FADT. If a problem - * is found, issue a message, but no status is returned. - * Used by both the table manager and the disassembler. - * - * Possible additional checks: - * (AcpiGbl_FADT.Pm1EventLength >= 4) - * (AcpiGbl_FADT.Pm1ControlLength >= 2) - * (AcpiGbl_FADT.PmTimerLength >= 4) - * Gpe block lengths must be multiple of 2 - * - ******************************************************************************/ - -static void -AcpiTbValidateFadt ( - void) -{ - char *Name; - ACPI_GENERIC_ADDRESS *Address64; - UINT8 Length; - UINT32 i; - - - /* - * Check for FACS and DSDT address mismatches. An address mismatch between - * the 32-bit and 64-bit address fields (FIRMWARE_CTRL/X_FIRMWARE_CTRL and - * DSDT/X_DSDT) would indicate the presence of two FACS or two DSDT tables. - */ - if (AcpiGbl_FADT.Facs && - (AcpiGbl_FADT.XFacs != (UINT64) AcpiGbl_FADT.Facs)) - { - ACPI_BIOS_WARNING ((AE_INFO, - "32/64X FACS address mismatch in FADT - " - "0x%8.8X/0x%8.8X%8.8X, using 32", - AcpiGbl_FADT.Facs, ACPI_FORMAT_UINT64 (AcpiGbl_FADT.XFacs))); - - AcpiGbl_FADT.XFacs = (UINT64) AcpiGbl_FADT.Facs; - } - - if (AcpiGbl_FADT.Dsdt && - (AcpiGbl_FADT.XDsdt != (UINT64) AcpiGbl_FADT.Dsdt)) - { - ACPI_BIOS_WARNING ((AE_INFO, - "32/64X DSDT address mismatch in FADT - " - "0x%8.8X/0x%8.8X%8.8X, using 32", - AcpiGbl_FADT.Dsdt, ACPI_FORMAT_UINT64 (AcpiGbl_FADT.XDsdt))); - - AcpiGbl_FADT.XDsdt = (UINT64) AcpiGbl_FADT.Dsdt; - } + AcpiGbl_FADT.XDsdt = AcpiTbSelectAddress ("DSDT", + AcpiGbl_FADT.Dsdt, AcpiGbl_FADT.XDsdt); /* If Hardware Reduced flag is set, we are all done */ @@ -650,14 +628,81 @@ AcpiTbValidateFadt ( for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) { /* - * Generate pointer to the 64-bit address, get the register - * length (width) and the register name + * Get the 32-bit and 64-bit addresses, as well as the register + * length and register name. */ + Address32 = *ACPI_ADD_PTR (UINT32, + &AcpiGbl_FADT, FadtInfoTable[i].Address32); + Address64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS, - &AcpiGbl_FADT, FadtInfoTable[i].Address64); + &AcpiGbl_FADT, FadtInfoTable[i].Address64); + Length = *ACPI_ADD_PTR (UINT8, - &AcpiGbl_FADT, FadtInfoTable[i].Length); + &AcpiGbl_FADT, FadtInfoTable[i].Length); + Name = FadtInfoTable[i].Name; + Flags = FadtInfoTable[i].Flags; + + /* + * Expand the ACPI 1.0 32-bit addresses to the ACPI 2.0 64-bit "X" + * generic address structures as necessary. Later code will always use + * the 64-bit address structures. + * + * November 2013: + * Now always use the 64-bit address if it is valid (non-zero), in + * accordance with the ACPI specification which states that a 64-bit + * address supersedes the 32-bit version. This behavior can be + * overridden by the AcpiGbl_Use32BitFadtAddresses flag. + * + * During 64-bit address construction and verification, + * these cases are handled: + * + * Address32 zero, Address64 [don't care] - Use Address64 + * + * Address32 non-zero, Address64 zero - Copy/use Address32 + * Address32 non-zero == Address64 non-zero - Use Address64 + * Address32 non-zero != Address64 non-zero - Warning, use Address64 + * + * Override: if AcpiGbl_Use32BitFadtAddresses is TRUE, and: + * Address32 non-zero != Address64 non-zero - Warning, copy/use Address32 + * + * Note: SpaceId is always I/O for 32-bit legacy address fields + */ + if (Address32) + { + if (!Address64->Address) + { + /* 64-bit address is zero, use 32-bit address */ + + AcpiTbInitGenericAddress (Address64, + ACPI_ADR_SPACE_SYSTEM_IO, + *ACPI_ADD_PTR (UINT8, &AcpiGbl_FADT, + FadtInfoTable[i].Length), + (UINT64) Address32, Name, Flags); + } + else if (Address64->Address != (UINT64) Address32) + { + /* Address mismatch */ + + ACPI_BIOS_WARNING ((AE_INFO, + "32/64X address mismatch in FADT/%s: " + "0x%8.8X/0x%8.8X%8.8X, using %u-bit address", + Name, Address32, + ACPI_FORMAT_UINT64 (Address64->Address), + AcpiGbl_Use32BitFadtAddresses ? 32 : 64)); + + if (AcpiGbl_Use32BitFadtAddresses) + { + /* 32-bit address override */ + + AcpiTbInitGenericAddress (Address64, + ACPI_ADR_SPACE_SYSTEM_IO, + *ACPI_ADD_PTR (UINT8, &AcpiGbl_FADT, + FadtInfoTable[i].Length), + (UINT64) Address32, Name, Flags); + } + } + } /* * For each extended field, check for length mismatch between the @@ -675,7 +720,7 @@ AcpiTbValidateFadt ( Name, ACPI_MUL_8 (Length), Address64->BitWidth)); } - if (FadtInfoTable[i].Type & ACPI_FADT_REQUIRED) + if (FadtInfoTable[i].Flags & ACPI_FADT_REQUIRED) { /* * Field is required (PM1aEvent, PM1aControl). @@ -689,7 +734,7 @@ AcpiTbValidateFadt ( Name, ACPI_FORMAT_UINT64 (Address64->Address), Length)); } } - else if (FadtInfoTable[i].Type & ACPI_FADT_SEPARATE_LENGTH) + else if (FadtInfoTable[i].Flags & ACPI_FADT_SEPARATE_LENGTH) { /* * Field is optional (PM2Control, GPE0, GPE1) AND has its own @@ -796,7 +841,7 @@ AcpiTbSetupFadtRegisters ( Source64->SpaceId, Pm1RegisterByteWidth, Source64->Address + (FadtPmInfoTable[i].RegisterNum * Pm1RegisterByteWidth), - "PmRegisters"); + "PmRegisters", 0); } } } diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbfind.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbfind.c index 6258ca112f..42ce181893 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbfind.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbfind.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -180,7 +180,7 @@ AcpiTbFindTable ( { /* Table is not currently mapped, map it */ - Status = AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[i]); + Status = AcpiTbValidateTable (&AcpiGbl_RootTableList.Tables[i]); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbinstal.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbinstal.c index 429abbc7c5..ab0e879424 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbinstal.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbinstal.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -113,387 +113,447 @@ * *****************************************************************************/ - #define __TBINSTAL_C__ #include "acpi.h" #include "accommon.h" -#include "acnamesp.h" #include "actables.h" - #define _COMPONENT ACPI_TABLES ACPI_MODULE_NAME ("tbinstal") +/* Local prototypes */ -/****************************************************************************** - * - * FUNCTION: AcpiTbVerifyTable - * - * PARAMETERS: TableDesc - table - * - * RETURN: Status - * - * DESCRIPTION: this function is called to verify and map table - * - *****************************************************************************/ +static BOOLEAN +AcpiTbCompareTables ( + ACPI_TABLE_DESC *TableDesc, + UINT32 TableIndex); -ACPI_STATUS -AcpiTbVerifyTable ( - ACPI_TABLE_DESC *TableDesc) + +/******************************************************************************* + * + * FUNCTION: AcpiTbCompareTables + * + * PARAMETERS: TableDesc - Table 1 descriptor to be compared + * TableIndex - Index of table 2 to be compared + * + * RETURN: TRUE if both tables are identical. + * + * DESCRIPTION: This function compares a table with another table that has + * already been installed in the root table list. + * + ******************************************************************************/ + +static BOOLEAN +AcpiTbCompareTables ( + ACPI_TABLE_DESC *TableDesc, + UINT32 TableIndex) { ACPI_STATUS Status = AE_OK; + BOOLEAN IsIdentical; + ACPI_TABLE_HEADER *Table; + UINT32 TableLength; + UINT8 TableFlags; - ACPI_FUNCTION_TRACE (TbVerifyTable); - - - /* Map the table if necessary */ - - if (!TableDesc->Pointer) + Status = AcpiTbAcquireTable (&AcpiGbl_RootTableList.Tables[TableIndex], + &Table, &TableLength, &TableFlags); + if (ACPI_FAILURE (Status)) { - if ((TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK) == - ACPI_TABLE_ORIGIN_MAPPED) - { - TableDesc->Pointer = AcpiOsMapMemory ( - TableDesc->Address, TableDesc->Length); - } - - if (!TableDesc->Pointer) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } + return (FALSE); } - /* Always calculate checksum, ignore bad checksum if requested */ + /* + * Check for a table match on the entire table length, + * not just the header. + */ + IsIdentical = (BOOLEAN)((TableDesc->Length != TableLength || + ACPI_MEMCMP (TableDesc->Pointer, Table, TableLength)) ? + FALSE : TRUE); - Status = AcpiTbVerifyChecksum (TableDesc->Pointer, TableDesc->Length); + /* Release the acquired table */ - return_ACPI_STATUS (Status); + AcpiTbReleaseTable (Table, TableLength, TableFlags); + return (IsIdentical); } /******************************************************************************* * - * FUNCTION: AcpiTbAddTable + * FUNCTION: AcpiTbInstallTableWithOverride * - * PARAMETERS: TableDesc - Table descriptor - * TableIndex - Where the table index is returned + * PARAMETERS: TableIndex - Index into root table array + * NewTableDesc - New table descriptor to install + * Override - Whether override should be performed * - * RETURN: Status + * RETURN: None * - * DESCRIPTION: This function is called to add an ACPI table. It is used to - * dynamically load tables via the Load and LoadTable AML - * operators. + * DESCRIPTION: Install an ACPI table into the global data structure. The + * table override mechanism is called to allow the host + * OS to replace any table before it is installed in the root + * table array. * ******************************************************************************/ -ACPI_STATUS -AcpiTbAddTable ( - ACPI_TABLE_DESC *TableDesc, - UINT32 *TableIndex) +void +AcpiTbInstallTableWithOverride ( + UINT32 TableIndex, + ACPI_TABLE_DESC *NewTableDesc, + BOOLEAN Override) { - UINT32 i; - ACPI_STATUS Status = AE_OK; - - ACPI_FUNCTION_TRACE (TbAddTable); - - - if (!TableDesc->Pointer) + if (TableIndex >= AcpiGbl_RootTableList.CurrentTableCount) { - Status = AcpiTbVerifyTable (TableDesc); - if (ACPI_FAILURE (Status) || !TableDesc->Pointer) - { - return_ACPI_STATUS (Status); - } - } - - /* - * Validate the incoming table signature. - * - * 1) Originally, we checked the table signature for "SSDT" or "PSDT". - * 2) We added support for OEMx tables, signature "OEM". - * 3) Valid tables were encountered with a null signature, so we just - * gave up on validating the signature, (05/2008). - * 4) We encountered non-AML tables such as the MADT, which caused - * interpreter errors and kernel faults. So now, we once again allow - * only "SSDT", "OEMx", and now, also a null signature. (05/2011). - */ - if ((TableDesc->Pointer->Signature[0] != 0x00) && - (!ACPI_COMPARE_NAME (TableDesc->Pointer->Signature, ACPI_SIG_SSDT)) && - (ACPI_STRNCMP (TableDesc->Pointer->Signature, "OEM", 3))) - { - ACPI_BIOS_ERROR ((AE_INFO, - "Table has invalid signature [%4.4s] (0x%8.8X), " - "must be SSDT or OEMx", - AcpiUtValidAcpiName (TableDesc->Pointer->Signature) ? - TableDesc->Pointer->Signature : "????", - *(UINT32 *) TableDesc->Pointer->Signature)); - - return_ACPI_STATUS (AE_BAD_SIGNATURE); - } - - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); - - /* Check if table is already registered */ - - for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i) - { - if (!AcpiGbl_RootTableList.Tables[i].Pointer) - { - Status = AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[i]); - if (ACPI_FAILURE (Status) || - !AcpiGbl_RootTableList.Tables[i].Pointer) - { - continue; - } - } - - /* - * Check for a table match on the entire table length, - * not just the header. - */ - if (TableDesc->Length != AcpiGbl_RootTableList.Tables[i].Length) - { - continue; - } - - if (ACPI_MEMCMP (TableDesc->Pointer, - AcpiGbl_RootTableList.Tables[i].Pointer, - AcpiGbl_RootTableList.Tables[i].Length)) - { - continue; - } - - /* - * Note: the current mechanism does not unregister a table if it is - * dynamically unloaded. The related namespace entries are deleted, - * but the table remains in the root table list. - * - * The assumption here is that the number of different tables that - * will be loaded is actually small, and there is minimal overhead - * in just keeping the table in case it is needed again. - * - * If this assumption changes in the future (perhaps on large - * machines with many table load/unload operations), tables will - * need to be unregistered when they are unloaded, and slots in the - * root table list should be reused when empty. - */ - - /* - * Table is already registered. - * We can delete the table that was passed as a parameter. - */ - AcpiTbDeleteTable (TableDesc); - *TableIndex = i; - - if (AcpiGbl_RootTableList.Tables[i].Flags & ACPI_TABLE_IS_LOADED) - { - /* Table is still loaded, this is an error */ - - Status = AE_ALREADY_EXISTS; - goto Release; - } - else - { - /* Table was unloaded, allow it to be reloaded */ - - TableDesc->Pointer = AcpiGbl_RootTableList.Tables[i].Pointer; - TableDesc->Address = AcpiGbl_RootTableList.Tables[i].Address; - Status = AE_OK; - goto PrintHeader; - } + return; } /* * ACPI Table Override: - * Allow the host to override dynamically loaded tables. - * NOTE: the table is fully mapped at this point, and the mapping will - * be deleted by TbTableOverride if the table is actually overridden. + * + * Before we install the table, let the host OS override it with a new + * one if desired. Any table within the RSDT/XSDT can be replaced, + * including the DSDT which is pointed to by the FADT. */ - (void) AcpiTbTableOverride (TableDesc->Pointer, TableDesc); - - /* Add the table to the global root table list */ - - Status = AcpiTbStoreTable (TableDesc->Address, TableDesc->Pointer, - TableDesc->Length, TableDesc->Flags, TableIndex); - if (ACPI_FAILURE (Status)) + if (Override) { - goto Release; + AcpiTbOverrideTable (NewTableDesc); } -PrintHeader: - AcpiTbPrintTableHeader (TableDesc->Address, TableDesc->Pointer); + AcpiTbInitTableDescriptor (&AcpiGbl_RootTableList.Tables[TableIndex], + NewTableDesc->Address, NewTableDesc->Flags, NewTableDesc->Pointer); -Release: - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); + AcpiTbPrintTableHeader (NewTableDesc->Address, NewTableDesc->Pointer); + + /* Set the global integer width (based upon revision of the DSDT) */ + + if (TableIndex == ACPI_TABLE_INDEX_DSDT) + { + AcpiUtSetIntegerWidth (NewTableDesc->Pointer->Revision); + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiTbInstallFixedTable + * + * PARAMETERS: Address - Physical address of DSDT or FACS + * Signature - Table signature, NULL if no need to + * match + * TableIndex - Index into root table array + * + * RETURN: Status + * + * DESCRIPTION: Install a fixed ACPI table (DSDT/FACS) into the global data + * structure. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiTbInstallFixedTable ( + ACPI_PHYSICAL_ADDRESS Address, + char *Signature, + UINT32 TableIndex) +{ + ACPI_TABLE_DESC NewTableDesc; + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (TbInstallFixedTable); + + + if (!Address) + { + ACPI_ERROR ((AE_INFO, "Null physical address for ACPI table [%s]", + Signature)); + return (AE_NO_MEMORY); + } + + /* Fill a table descriptor for validation */ + + Status = AcpiTbAcquireTempTable (&NewTableDesc, Address, + ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL); + if (ACPI_FAILURE (Status)) + { + ACPI_ERROR ((AE_INFO, "Could not acquire table length at %p", + ACPI_CAST_PTR (void, Address))); + return_ACPI_STATUS (Status); + } + + /* Validate and verify a table before installation */ + + Status = AcpiTbVerifyTempTable (&NewTableDesc, Signature); + if (ACPI_FAILURE (Status)) + { + goto ReleaseAndExit; + } + + AcpiTbInstallTableWithOverride (TableIndex, &NewTableDesc, TRUE); + +ReleaseAndExit: + + /* Release the temporary table descriptor */ + + AcpiTbReleaseTempTable (&NewTableDesc); return_ACPI_STATUS (Status); } /******************************************************************************* * - * FUNCTION: AcpiTbTableOverride + * FUNCTION: AcpiTbInstallStandardTable * - * PARAMETERS: TableHeader - Header for the original table - * TableDesc - Table descriptor initialized for the - * original table. May or may not be mapped. + * PARAMETERS: Address - Address of the table (might be a virtual + * address depending on the TableFlags) + * Flags - Flags for the table + * Reload - Whether reload should be performed + * Override - Whether override should be performed + * TableIndex - Where the table index is returned * - * RETURN: Pointer to the entire new table. NULL if table not overridden. - * If overridden, installs the new table within the input table - * descriptor. + * RETURN: Status * - * DESCRIPTION: Attempt table override by calling the OSL override functions. - * Note: If the table is overridden, then the entire new table - * is mapped and returned by this function. + * DESCRIPTION: This function is called to install an ACPI table that is + * neither DSDT nor FACS (a "standard" table.) + * When this function is called by "Load" or "LoadTable" opcodes, + * or by AcpiLoadTable() API, the "Reload" parameter is set. + * After sucessfully returning from this function, table is + * "INSTALLED" but not "VALIDATED". * ******************************************************************************/ -ACPI_TABLE_HEADER * -AcpiTbTableOverride ( - ACPI_TABLE_HEADER *TableHeader, - ACPI_TABLE_DESC *TableDesc) +ACPI_STATUS +AcpiTbInstallStandardTable ( + ACPI_PHYSICAL_ADDRESS Address, + UINT8 Flags, + BOOLEAN Reload, + BOOLEAN Override, + UINT32 *TableIndex) +{ + UINT32 i; + ACPI_STATUS Status = AE_OK; + ACPI_TABLE_DESC NewTableDesc; + + + ACPI_FUNCTION_TRACE (TbInstallStandardTable); + + + /* Acquire a temporary table descriptor for validation */ + + Status = AcpiTbAcquireTempTable (&NewTableDesc, Address, Flags); + if (ACPI_FAILURE (Status)) + { + ACPI_ERROR ((AE_INFO, "Could not acquire table length at %p", + ACPI_CAST_PTR (void, Address))); + return_ACPI_STATUS (Status); + } + + /* + * Optionally do not load any SSDTs from the RSDT/XSDT. This can + * be useful for debugging ACPI problems on some machines. + */ + if (!Reload && + AcpiGbl_DisableSsdtTableInstall && + ACPI_COMPARE_NAME (&NewTableDesc.Signature, ACPI_SIG_SSDT)) + { + ACPI_INFO ((AE_INFO, "Ignoring installation of %4.4s at %p", + NewTableDesc.Signature.Ascii, ACPI_CAST_PTR (void, Address))); + goto ReleaseAndExit; + } + + /* Validate and verify a table before installation */ + + Status = AcpiTbVerifyTempTable (&NewTableDesc, NULL); + if (ACPI_FAILURE (Status)) + { + goto ReleaseAndExit; + } + + if (Reload) + { + /* + * Validate the incoming table signature. + * + * 1) Originally, we checked the table signature for "SSDT" or "PSDT". + * 2) We added support for OEMx tables, signature "OEM". + * 3) Valid tables were encountered with a null signature, so we just + * gave up on validating the signature, (05/2008). + * 4) We encountered non-AML tables such as the MADT, which caused + * interpreter errors and kernel faults. So now, we once again allow + * only "SSDT", "OEMx", and now, also a null signature. (05/2011). + */ + if ((NewTableDesc.Signature.Ascii[0] != 0x00) && + (!ACPI_COMPARE_NAME (&NewTableDesc.Signature, ACPI_SIG_SSDT)) && + (ACPI_STRNCMP (NewTableDesc.Signature.Ascii, "OEM", 3))) + { + ACPI_BIOS_ERROR ((AE_INFO, + "Table has invalid signature [%4.4s] (0x%8.8X), " + "must be SSDT or OEMx", + AcpiUtValidAcpiName (NewTableDesc.Signature.Ascii) ? + NewTableDesc.Signature.Ascii : "????", + NewTableDesc.Signature.Integer)); + + Status = AE_BAD_SIGNATURE; + goto ReleaseAndExit; + } + + /* Check if table is already registered */ + + for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i) + { + /* + * Check for a table match on the entire table length, + * not just the header. + */ + if (!AcpiTbCompareTables (&NewTableDesc, i)) + { + continue; + } + + /* + * Note: the current mechanism does not unregister a table if it is + * dynamically unloaded. The related namespace entries are deleted, + * but the table remains in the root table list. + * + * The assumption here is that the number of different tables that + * will be loaded is actually small, and there is minimal overhead + * in just keeping the table in case it is needed again. + * + * If this assumption changes in the future (perhaps on large + * machines with many table load/unload operations), tables will + * need to be unregistered when they are unloaded, and slots in the + * root table list should be reused when empty. + */ + if (AcpiGbl_RootTableList.Tables[i].Flags & ACPI_TABLE_IS_LOADED) + { + /* Table is still loaded, this is an error */ + + Status = AE_ALREADY_EXISTS; + goto ReleaseAndExit; + } + else + { + /* + * Table was unloaded, allow it to be reloaded. + * As we are going to return AE_OK to the caller, we should + * take the responsibility of freeing the input descriptor. + * Refill the input descriptor to ensure + * AcpiTbInstallTableWithOverride() can be called again to + * indicate the re-installation. + */ + AcpiTbUninstallTable (&NewTableDesc); + *TableIndex = i; + (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); + return_ACPI_STATUS (AE_OK); + } + } + } + + /* Add the table to the global root table list */ + + Status = AcpiTbGetNextRootIndex (&i); + if (ACPI_FAILURE (Status)) + { + goto ReleaseAndExit; + } + + *TableIndex = i; + AcpiTbInstallTableWithOverride (i, &NewTableDesc, Override); + +ReleaseAndExit: + + /* Release the temporary table descriptor */ + + AcpiTbReleaseTempTable (&NewTableDesc); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiTbOverrideTable + * + * PARAMETERS: OldTableDesc - Validated table descriptor to be + * overridden + * + * RETURN: None + * + * DESCRIPTION: Attempt table override by calling the OSL override functions. + * Note: If the table is overridden, then the entire new table + * is acquired and returned by this function. + * Before/after invocation, the table descriptor is in a state + * that is "VALIDATED". + * + ******************************************************************************/ + +void +AcpiTbOverrideTable ( + ACPI_TABLE_DESC *OldTableDesc) { ACPI_STATUS Status; - ACPI_TABLE_HEADER *NewTable = NULL; - ACPI_PHYSICAL_ADDRESS NewAddress = 0; - UINT32 NewTableLength = 0; - UINT8 NewFlags; char *OverrideType; + ACPI_TABLE_DESC NewTableDesc; + ACPI_TABLE_HEADER *Table; + ACPI_PHYSICAL_ADDRESS Address; + UINT32 Length; /* (1) Attempt logical override (returns a logical address) */ - Status = AcpiOsTableOverride (TableHeader, &NewTable); - if (ACPI_SUCCESS (Status) && NewTable) + Status = AcpiOsTableOverride (OldTableDesc->Pointer, &Table); + if (ACPI_SUCCESS (Status) && Table) { - NewAddress = ACPI_PTR_TO_PHYSADDR (NewTable); - NewTableLength = NewTable->Length; - NewFlags = ACPI_TABLE_ORIGIN_OVERRIDE; + AcpiTbAcquireTempTable (&NewTableDesc, ACPI_PTR_TO_PHYSADDR (Table), + ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL); OverrideType = "Logical"; goto FinishOverride; } /* (2) Attempt physical override (returns a physical address) */ - Status = AcpiOsPhysicalTableOverride (TableHeader, - &NewAddress, &NewTableLength); - if (ACPI_SUCCESS (Status) && NewAddress && NewTableLength) + Status = AcpiOsPhysicalTableOverride (OldTableDesc->Pointer, + &Address, &Length); + if (ACPI_SUCCESS (Status) && Address && Length) { - /* Map the entire new table */ - - NewTable = AcpiOsMapMemory (NewAddress, NewTableLength); - if (!NewTable) - { - ACPI_EXCEPTION ((AE_INFO, AE_NO_MEMORY, - "%4.4s %p Attempted physical table override failed", - TableHeader->Signature, - ACPI_CAST_PTR (void, TableDesc->Address))); - return (NULL); - } - + AcpiTbAcquireTempTable (&NewTableDesc, Address, + ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL); OverrideType = "Physical"; - NewFlags = ACPI_TABLE_ORIGIN_MAPPED; goto FinishOverride; } - return (NULL); /* There was no override */ + return; /* There was no override */ FinishOverride: - ACPI_INFO ((AE_INFO, - "%4.4s %p %s table override, new table: %p", - TableHeader->Signature, - ACPI_CAST_PTR (void, TableDesc->Address), - OverrideType, NewTable)); + /* Validate and verify a table before overriding */ - /* We can now unmap/delete the original table (if fully mapped) */ - - AcpiTbDeleteTable (TableDesc); - - /* Setup descriptor for the new table */ - - TableDesc->Address = NewAddress; - TableDesc->Pointer = NewTable; - TableDesc->Length = NewTableLength; - TableDesc->Flags = NewFlags; - - return (NewTable); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbResizeRootTableList - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Expand the size of global table array - * - ******************************************************************************/ - -ACPI_STATUS -AcpiTbResizeRootTableList ( - void) -{ - ACPI_TABLE_DESC *Tables; - UINT32 TableCount; - - - ACPI_FUNCTION_TRACE (TbResizeRootTableList); - - - /* AllowResize flag is a parameter to AcpiInitializeTables */ - - if (!(AcpiGbl_RootTableList.Flags & ACPI_ROOT_ALLOW_RESIZE)) + Status = AcpiTbVerifyTempTable (&NewTableDesc, NULL); + if (ACPI_FAILURE (Status)) { - ACPI_ERROR ((AE_INFO, "Resize of Root Table Array is not allowed")); - return_ACPI_STATUS (AE_SUPPORT); + return; } - /* Increase the Table Array size */ + ACPI_INFO ((AE_INFO, "%4.4s " ACPI_PRINTF_UINT + " %s table override, new table: " ACPI_PRINTF_UINT, + OldTableDesc->Signature.Ascii, + ACPI_FORMAT_TO_UINT (OldTableDesc->Address), + OverrideType, ACPI_FORMAT_TO_UINT (NewTableDesc.Address))); - if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED) - { - TableCount = AcpiGbl_RootTableList.MaxTableCount; - } - else - { - TableCount = AcpiGbl_RootTableList.CurrentTableCount; - } + /* We can now uninstall the original table */ - Tables = ACPI_ALLOCATE_ZEROED ( - ((ACPI_SIZE) TableCount + ACPI_ROOT_TABLE_SIZE_INCREMENT) * - sizeof (ACPI_TABLE_DESC)); - if (!Tables) - { - ACPI_ERROR ((AE_INFO, "Could not allocate new root table array")); - return_ACPI_STATUS (AE_NO_MEMORY); - } + AcpiTbUninstallTable (OldTableDesc); - /* Copy and free the previous table array */ + /* + * Replace the original table descriptor and keep its state as + * "VALIDATED". + */ + AcpiTbInitTableDescriptor (OldTableDesc, NewTableDesc.Address, + NewTableDesc.Flags, NewTableDesc.Pointer); + AcpiTbValidateTempTable (OldTableDesc); - if (AcpiGbl_RootTableList.Tables) - { - ACPI_MEMCPY (Tables, AcpiGbl_RootTableList.Tables, - (ACPI_SIZE) TableCount * sizeof (ACPI_TABLE_DESC)); + /* Release the temporary table descriptor */ - if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED) - { - ACPI_FREE (AcpiGbl_RootTableList.Tables); - } - } - - AcpiGbl_RootTableList.Tables = Tables; - AcpiGbl_RootTableList.MaxTableCount = - TableCount + ACPI_ROOT_TABLE_SIZE_INCREMENT; - AcpiGbl_RootTableList.Flags |= ACPI_ROOT_ORIGIN_ALLOCATED; - - return_ACPI_STATUS (AE_OK); + AcpiTbReleaseTempTable (&NewTableDesc); } @@ -504,7 +564,8 @@ AcpiTbResizeRootTableList ( * PARAMETERS: Address - Table address * Table - Table header * Length - Table length - * Flags - flags + * Flags - Install flags + * TableIndex - Where the table index is returned * * RETURN: Status and table index. * @@ -521,44 +582,29 @@ AcpiTbStoreTable ( UINT32 *TableIndex) { ACPI_STATUS Status; - ACPI_TABLE_DESC *NewTable; + ACPI_TABLE_DESC *TableDesc; - /* Ensure that there is room for the table in the Root Table List */ - - if (AcpiGbl_RootTableList.CurrentTableCount >= - AcpiGbl_RootTableList.MaxTableCount) + Status = AcpiTbGetNextRootIndex (TableIndex); + if (ACPI_FAILURE (Status)) { - Status = AcpiTbResizeRootTableList(); - if (ACPI_FAILURE (Status)) - { - return (Status); - } + return (Status); } - NewTable = &AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.CurrentTableCount]; - /* Initialize added table */ - NewTable->Address = Address; - NewTable->Pointer = Table; - NewTable->Length = Length; - NewTable->OwnerId = 0; - NewTable->Flags = Flags; - - ACPI_MOVE_32_TO_32 (&NewTable->Signature, Table->Signature); - - *TableIndex = AcpiGbl_RootTableList.CurrentTableCount; - AcpiGbl_RootTableList.CurrentTableCount++; + TableDesc = &AcpiGbl_RootTableList.Tables[*TableIndex]; + AcpiTbInitTableDescriptor (TableDesc, Address, Flags, Table); + TableDesc->Pointer = Table; return (AE_OK); } /******************************************************************************* * - * FUNCTION: AcpiTbDeleteTable + * FUNCTION: AcpiTbUninstallTable * - * PARAMETERS: TableIndex - Table index + * PARAMETERS: TableDesc - Table descriptor * * RETURN: None * @@ -567,324 +613,28 @@ AcpiTbStoreTable ( ******************************************************************************/ void -AcpiTbDeleteTable ( +AcpiTbUninstallTable ( ACPI_TABLE_DESC *TableDesc) { - /* Table must be mapped or allocated */ + ACPI_FUNCTION_TRACE (TbUninstallTable); - if (!TableDesc->Pointer) + + /* Table must be installed */ + + if (!TableDesc->Address) { - return; + return_VOID; } - switch (TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK) + AcpiTbInvalidateTable (TableDesc); + + if ((TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK) == + ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL) { - case ACPI_TABLE_ORIGIN_MAPPED: - - AcpiOsUnmapMemory (TableDesc->Pointer, TableDesc->Length); - break; - - case ACPI_TABLE_ORIGIN_ALLOCATED: - - ACPI_FREE (TableDesc->Pointer); - break; - - /* Not mapped or allocated, there is nothing we can do */ - - default: - - return; + ACPI_FREE (ACPI_CAST_PTR (void, TableDesc->Address)); } - TableDesc->Pointer = NULL; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbTerminate - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Delete all internal ACPI tables - * - ******************************************************************************/ - -void -AcpiTbTerminate ( - void) -{ - UINT32 i; - - - ACPI_FUNCTION_TRACE (TbTerminate); - - - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); - - /* Delete the individual tables */ - - for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++) - { - AcpiTbDeleteTable (&AcpiGbl_RootTableList.Tables[i]); - } - - /* - * Delete the root table array if allocated locally. Array cannot be - * mapped, so we don't need to check for that flag. - */ - if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED) - { - ACPI_FREE (AcpiGbl_RootTableList.Tables); - } - - AcpiGbl_RootTableList.Tables = NULL; - AcpiGbl_RootTableList.Flags = 0; - AcpiGbl_RootTableList.CurrentTableCount = 0; - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ACPI Tables freed\n")); - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); - + TableDesc->Address = ACPI_PTR_TO_PHYSADDR (NULL); return_VOID; } - - -/******************************************************************************* - * - * FUNCTION: AcpiTbDeleteNamespaceByOwner - * - * PARAMETERS: TableIndex - Table index - * - * RETURN: Status - * - * DESCRIPTION: Delete all namespace objects created when this table was loaded. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiTbDeleteNamespaceByOwner ( - UINT32 TableIndex) -{ - ACPI_OWNER_ID OwnerId; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (TbDeleteNamespaceByOwner); - - - Status = AcpiUtAcquireMutex (ACPI_MTX_TABLES); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - if (TableIndex >= AcpiGbl_RootTableList.CurrentTableCount) - { - /* The table index does not exist */ - - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); - return_ACPI_STATUS (AE_NOT_EXIST); - } - - /* Get the owner ID for this table, used to delete namespace nodes */ - - OwnerId = AcpiGbl_RootTableList.Tables[TableIndex].OwnerId; - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); - - /* - * Need to acquire the namespace writer lock to prevent interference - * with any concurrent namespace walks. The interpreter must be - * released during the deletion since the acquisition of the deletion - * lock may block, and also since the execution of a namespace walk - * must be allowed to use the interpreter. - */ - (void) AcpiUtReleaseMutex (ACPI_MTX_INTERPRETER); - Status = AcpiUtAcquireWriteLock (&AcpiGbl_NamespaceRwLock); - - AcpiNsDeleteNamespaceByOwner (OwnerId); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - AcpiUtReleaseWriteLock (&AcpiGbl_NamespaceRwLock); - - Status = AcpiUtAcquireMutex (ACPI_MTX_INTERPRETER); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbAllocateOwnerId - * - * PARAMETERS: TableIndex - Table index - * - * RETURN: Status - * - * DESCRIPTION: Allocates OwnerId in TableDesc - * - ******************************************************************************/ - -ACPI_STATUS -AcpiTbAllocateOwnerId ( - UINT32 TableIndex) -{ - ACPI_STATUS Status = AE_BAD_PARAMETER; - - - ACPI_FUNCTION_TRACE (TbAllocateOwnerId); - - - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); - if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount) - { - Status = AcpiUtAllocateOwnerId - (&(AcpiGbl_RootTableList.Tables[TableIndex].OwnerId)); - } - - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbReleaseOwnerId - * - * PARAMETERS: TableIndex - Table index - * - * RETURN: Status - * - * DESCRIPTION: Releases OwnerId in TableDesc - * - ******************************************************************************/ - -ACPI_STATUS -AcpiTbReleaseOwnerId ( - UINT32 TableIndex) -{ - ACPI_STATUS Status = AE_BAD_PARAMETER; - - - ACPI_FUNCTION_TRACE (TbReleaseOwnerId); - - - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); - if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount) - { - AcpiUtReleaseOwnerId ( - &(AcpiGbl_RootTableList.Tables[TableIndex].OwnerId)); - Status = AE_OK; - } - - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbGetOwnerId - * - * PARAMETERS: TableIndex - Table index - * OwnerId - Where the table OwnerId is returned - * - * RETURN: Status - * - * DESCRIPTION: returns OwnerId for the ACPI table - * - ******************************************************************************/ - -ACPI_STATUS -AcpiTbGetOwnerId ( - UINT32 TableIndex, - ACPI_OWNER_ID *OwnerId) -{ - ACPI_STATUS Status = AE_BAD_PARAMETER; - - - ACPI_FUNCTION_TRACE (TbGetOwnerId); - - - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); - if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount) - { - *OwnerId = AcpiGbl_RootTableList.Tables[TableIndex].OwnerId; - Status = AE_OK; - } - - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbIsTableLoaded - * - * PARAMETERS: TableIndex - Table index - * - * RETURN: Table Loaded Flag - * - ******************************************************************************/ - -BOOLEAN -AcpiTbIsTableLoaded ( - UINT32 TableIndex) -{ - BOOLEAN IsLoaded = FALSE; - - - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); - if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount) - { - IsLoaded = (BOOLEAN) - (AcpiGbl_RootTableList.Tables[TableIndex].Flags & - ACPI_TABLE_IS_LOADED); - } - - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); - return (IsLoaded); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTbSetTableLoadedFlag - * - * PARAMETERS: TableIndex - Table index - * IsLoaded - TRUE if table is loaded, FALSE otherwise - * - * RETURN: None - * - * DESCRIPTION: Sets the table loaded flag to either TRUE or FALSE. - * - ******************************************************************************/ - -void -AcpiTbSetTableLoadedFlag ( - UINT32 TableIndex, - BOOLEAN IsLoaded) -{ - - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); - if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount) - { - if (IsLoaded) - { - AcpiGbl_RootTableList.Tables[TableIndex].Flags |= - ACPI_TABLE_IS_LOADED; - } - else - { - AcpiGbl_RootTableList.Tables[TableIndex].Flags &= - ~ACPI_TABLE_IS_LOADED; - } - } - - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); -} diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbprint.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbprint.c index 56b6ddbefe..553daf9185 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbprint.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbprint.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -219,15 +219,17 @@ AcpiTbPrintTableHeader ( /* - * The reason that the Address is cast to a void pointer is so that we - * can use %p which will work properly on both 32-bit and 64-bit hosts. + * The reason that we use ACPI_PRINTF_UINT and ACPI_FORMAT_TO_UINT is to + * support both 32-bit and 64-bit hosts/addresses in a consistent manner. + * The %p specifier does not emit uniform output on all hosts. On some, + * leading zeros are not supported. */ if (ACPI_COMPARE_NAME (Header->Signature, ACPI_SIG_FACS)) { /* FACS only has signature and length fields */ - ACPI_INFO ((AE_INFO, "%4.4s %p %05X", - Header->Signature, ACPI_CAST_PTR (void, Address), + ACPI_INFO ((AE_INFO, "%-4.4s " ACPI_PRINTF_UINT " %06X", + Header->Signature, ACPI_FORMAT_TO_UINT (Address), Header->Length)); } else if (ACPI_VALIDATE_RSDP_SIG (Header->Signature)) @@ -238,8 +240,8 @@ AcpiTbPrintTableHeader ( ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->OemId, ACPI_OEM_ID_SIZE); AcpiTbFixString (LocalHeader.OemId, ACPI_OEM_ID_SIZE); - ACPI_INFO ((AE_INFO, "RSDP %p %05X (v%.2d %6.6s)", - ACPI_CAST_PTR (void, Address), + ACPI_INFO ((AE_INFO, "RSDP " ACPI_PRINTF_UINT " %06X (v%.2d %-6.6s)", + ACPI_FORMAT_TO_UINT (Address), (ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Revision > 0) ? ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Length : 20, ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Revision, @@ -252,8 +254,9 @@ AcpiTbPrintTableHeader ( AcpiTbCleanupTableHeader (&LocalHeader, Header); ACPI_INFO ((AE_INFO, - "%4.4s %p %05X (v%.2d %6.6s %8.8s %08X %4.4s %08X)", - LocalHeader.Signature, ACPI_CAST_PTR (void, Address), + "%-4.4s " ACPI_PRINTF_UINT + " %06X (v%.2d %-6.6s %-8.8s %08X %-4.4s %08X)", + LocalHeader.Signature, ACPI_FORMAT_TO_UINT (Address), LocalHeader.Length, LocalHeader.Revision, LocalHeader.OemId, LocalHeader.OemTableId, LocalHeader.OemRevision, LocalHeader.AslCompilerId, LocalHeader.AslCompilerRevision)); diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbutils.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbutils.c index 1d4a538561..438f92fac9 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbutils.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbutils.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -265,9 +265,12 @@ AcpiTbCopyDsdt ( } ACPI_MEMCPY (NewTable, TableDesc->Pointer, TableDesc->Length); - AcpiTbDeleteTable (TableDesc); - TableDesc->Pointer = NewTable; - TableDesc->Flags = ACPI_TABLE_ORIGIN_ALLOCATED; + AcpiTbUninstallTable (TableDesc); + + AcpiTbInitTableDescriptor ( + &AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT], + ACPI_PTR_TO_PHYSADDR (NewTable), ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL, + NewTable); ACPI_INFO ((AE_INFO, "Forced DSDT copy: length 0x%05X copied locally, original unmapped", @@ -277,125 +280,6 @@ AcpiTbCopyDsdt ( } -/******************************************************************************* - * - * FUNCTION: AcpiTbInstallTable - * - * PARAMETERS: Address - Physical address of DSDT or FACS - * Signature - Table signature, NULL if no need to - * match - * TableIndex - Index into root table array - * - * RETURN: None - * - * DESCRIPTION: Install an ACPI table into the global data structure. The - * table override mechanism is called to allow the host - * OS to replace any table before it is installed in the root - * table array. - * - ******************************************************************************/ - -void -AcpiTbInstallTable ( - ACPI_PHYSICAL_ADDRESS Address, - char *Signature, - UINT32 TableIndex) -{ - ACPI_TABLE_HEADER *Table; - ACPI_TABLE_HEADER *FinalTable; - ACPI_TABLE_DESC *TableDesc; - - - if (!Address) - { - ACPI_ERROR ((AE_INFO, "Null physical address for ACPI table [%s]", - Signature)); - return; - } - - /* Map just the table header */ - - Table = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER)); - if (!Table) - { - ACPI_ERROR ((AE_INFO, "Could not map memory for table [%s] at %p", - Signature, ACPI_CAST_PTR (void, Address))); - return; - } - - /* If a particular signature is expected (DSDT/FACS), it must match */ - - if (Signature && - !ACPI_COMPARE_NAME (Table->Signature, Signature)) - { - ACPI_BIOS_ERROR ((AE_INFO, - "Invalid signature 0x%X for ACPI table, expected [%s]", - *ACPI_CAST_PTR (UINT32, Table->Signature), Signature)); - goto UnmapAndExit; - } - - /* - * Initialize the table entry. Set the pointer to NULL, since the - * table is not fully mapped at this time. - */ - TableDesc = &AcpiGbl_RootTableList.Tables[TableIndex]; - - TableDesc->Address = Address; - TableDesc->Pointer = NULL; - TableDesc->Length = Table->Length; - TableDesc->Flags = ACPI_TABLE_ORIGIN_MAPPED; - ACPI_MOVE_32_TO_32 (TableDesc->Signature.Ascii, Table->Signature); - - /* - * ACPI Table Override: - * - * Before we install the table, let the host OS override it with a new - * one if desired. Any table within the RSDT/XSDT can be replaced, - * including the DSDT which is pointed to by the FADT. - * - * NOTE: If the table is overridden, then FinalTable will contain a - * mapped pointer to the full new table. If the table is not overridden, - * or if there has been a physical override, then the table will be - * fully mapped later (in verify table). In any case, we must - * unmap the header that was mapped above. - */ - FinalTable = AcpiTbTableOverride (Table, TableDesc); - if (!FinalTable) - { - FinalTable = Table; /* There was no override */ - } - - AcpiTbPrintTableHeader (TableDesc->Address, FinalTable); - - /* Set the global integer width (based upon revision of the DSDT) */ - - if (TableIndex == ACPI_TABLE_INDEX_DSDT) - { - AcpiUtSetIntegerWidth (FinalTable->Revision); - } - - /* - * If we have a physical override during this early loading of the ACPI - * tables, unmap the table for now. It will be mapped again later when - * it is actually used. This supports very early loading of ACPI tables, - * before virtual memory is fully initialized and running within the - * host OS. Note: A logical override has the ACPI_TABLE_ORIGIN_OVERRIDE - * flag set and will not be deleted below. - */ - if (FinalTable != Table) - { - AcpiTbDeleteTable (TableDesc); - } - - -UnmapAndExit: - - /* Always unmap the table header that we mapped above */ - - AcpiOsUnmapMemory (Table, sizeof (ACPI_TABLE_HEADER)); -} - - /******************************************************************************* * * FUNCTION: AcpiTbGetRootTableEntry @@ -425,7 +309,7 @@ AcpiTbGetRootTableEntry ( * Get the table physical address (32-bit for RSDT, 64-bit for XSDT): * Note: Addresses are 32-bit aligned (not 64) in both RSDT and XSDT */ - if (TableEntrySize == sizeof (UINT32)) + if (TableEntrySize == ACPI_RSDT_ENTRY_SIZE) { /* * 32-bit platform, RSDT: Return 32-bit table entry @@ -488,14 +372,14 @@ AcpiTbParseRootTable ( UINT32 Length; UINT8 *TableEntry; ACPI_STATUS Status; + UINT32 TableIndex; ACPI_FUNCTION_TRACE (TbParseRootTable); - /* - * Map the entire RSDP and extract the address of the RSDT or XSDT - */ + /* Map the entire RSDP and extract the address of the RSDT or XSDT */ + Rsdp = AcpiOsMapMemory (RsdpAddress, sizeof (ACPI_TABLE_RSDP)); if (!Rsdp) { @@ -505,24 +389,26 @@ AcpiTbParseRootTable ( AcpiTbPrintTableHeader (RsdpAddress, ACPI_CAST_PTR (ACPI_TABLE_HEADER, Rsdp)); - /* Differentiate between RSDT and XSDT root tables */ + /* Use XSDT if present and not overridden. Otherwise, use RSDT */ - if (Rsdp->Revision > 1 && Rsdp->XsdtPhysicalAddress) + if ((Rsdp->Revision > 1) && + Rsdp->XsdtPhysicalAddress && + !AcpiGbl_DoNotUseXsdt) { /* - * Root table is an XSDT (64-bit physical addresses). We must use the - * XSDT if the revision is > 1 and the XSDT pointer is present, as per - * the ACPI specification. + * RSDP contains an XSDT (64-bit physical addresses). We must use + * the XSDT if the revision is > 1 and the XSDT pointer is present, + * as per the ACPI specification. */ Address = (ACPI_PHYSICAL_ADDRESS) Rsdp->XsdtPhysicalAddress; - TableEntrySize = sizeof (UINT64); + TableEntrySize = ACPI_XSDT_ENTRY_SIZE; } else { /* Root table is an RSDT (32-bit physical addresses) */ Address = (ACPI_PHYSICAL_ADDRESS) Rsdp->RsdtPhysicalAddress; - TableEntrySize = sizeof (UINT32); + TableEntrySize = ACPI_RSDT_ENTRY_SIZE; } /* @@ -531,7 +417,6 @@ AcpiTbParseRootTable ( */ AcpiOsUnmapMemory (Rsdp, sizeof (ACPI_TABLE_RSDP)); - /* Map the RSDT/XSDT table header to get the full table length */ Table = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER)); @@ -542,12 +427,14 @@ AcpiTbParseRootTable ( AcpiTbPrintTableHeader (Address, Table); - /* Get the length of the full table, verify length and map entire table */ - + /* + * Validate length of the table, and map entire table. + * Minimum length table must contain at least one entry. + */ Length = Table->Length; AcpiOsUnmapMemory (Table, sizeof (ACPI_TABLE_HEADER)); - if (Length < sizeof (ACPI_TABLE_HEADER)) + if (Length < (sizeof (ACPI_TABLE_HEADER) + TableEntrySize)) { ACPI_BIOS_ERROR ((AE_INFO, "Invalid table length 0x%X in RSDT/XSDT", Length)); @@ -569,71 +456,50 @@ AcpiTbParseRootTable ( return_ACPI_STATUS (Status); } - /* Calculate the number of tables described in the root table */ + /* Get the number of entries and pointer to first entry */ TableCount = (UINT32) ((Table->Length - sizeof (ACPI_TABLE_HEADER)) / TableEntrySize); + TableEntry = ACPI_ADD_PTR (UINT8, Table, sizeof (ACPI_TABLE_HEADER)); /* * First two entries in the table array are reserved for the DSDT * and FACS, which are not actually present in the RSDT/XSDT - they * come from the FADT */ - TableEntry = ACPI_CAST_PTR (UINT8, Table) + sizeof (ACPI_TABLE_HEADER); AcpiGbl_RootTableList.CurrentTableCount = 2; - /* - * Initialize the root table array from the RSDT/XSDT - */ + /* Initialize the root table array from the RSDT/XSDT */ + for (i = 0; i < TableCount; i++) { - if (AcpiGbl_RootTableList.CurrentTableCount >= - AcpiGbl_RootTableList.MaxTableCount) - { - /* There is no more room in the root table array, attempt resize */ - - Status = AcpiTbResizeRootTableList (); - if (ACPI_FAILURE (Status)) - { - ACPI_WARNING ((AE_INFO, "Truncating %u table entries!", - (unsigned) (TableCount - - (AcpiGbl_RootTableList.CurrentTableCount - 2)))); - break; - } - } - /* Get the table physical address (32-bit for RSDT, 64-bit for XSDT) */ - AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.CurrentTableCount].Address = - AcpiTbGetRootTableEntry (TableEntry, TableEntrySize); + Address = AcpiTbGetRootTableEntry (TableEntry, TableEntrySize); + + /* Skip NULL entries in RSDT/XSDT */ + + if (!Address) + { + goto NextTable; + } + + Status = AcpiTbInstallStandardTable (Address, + ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, FALSE, TRUE, &TableIndex); + + if (ACPI_SUCCESS (Status) && + ACPI_COMPARE_NAME (&AcpiGbl_RootTableList.Tables[TableIndex].Signature, + ACPI_SIG_FADT)) + { + AcpiTbParseFadt (TableIndex); + } + +NextTable: TableEntry += TableEntrySize; - AcpiGbl_RootTableList.CurrentTableCount++; } - /* - * It is not possible to map more than one entry in some environments, - * so unmap the root table here before mapping other tables - */ AcpiOsUnmapMemory (Table, Length); - /* - * Complete the initialization of the root table array by examining - * the header of each table - */ - for (i = 2; i < AcpiGbl_RootTableList.CurrentTableCount; i++) - { - AcpiTbInstallTable (AcpiGbl_RootTableList.Tables[i].Address, - NULL, i); - - /* Special case for FADT - get the DSDT and FACS */ - - if (ACPI_COMPARE_NAME ( - &AcpiGbl_RootTableList.Tables[i].Signature, ACPI_SIG_FADT)) - { - AcpiTbParseFadt (i); - } - } - return_ACPI_STATUS (AE_OK); } diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbxface.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbxface.c index cbaad116b7..cbdede5204 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbxface.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbxface.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -114,6 +114,7 @@ *****************************************************************************/ #define __TBXFACE_C__ +#define EXPORT_ACPI_INTERFACES #include "acpi.h" #include "accommon.h" @@ -233,7 +234,7 @@ AcpiInitializeTables ( return_ACPI_STATUS (Status); } -ACPI_EXPORT_SYMBOL (AcpiInitializeTables) +ACPI_EXPORT_SYMBOL_INIT (AcpiInitializeTables) /******************************************************************************* @@ -276,7 +277,7 @@ AcpiReallocateRootTable ( return_ACPI_STATUS (Status); } -ACPI_EXPORT_SYMBOL (AcpiReallocateRootTable) +ACPI_EXPORT_SYMBOL_INIT (AcpiReallocateRootTable) /******************************************************************************* @@ -333,7 +334,7 @@ AcpiGetTableHeader ( { if ((AcpiGbl_RootTableList.Tables[i].Flags & ACPI_TABLE_ORIGIN_MASK) == - ACPI_TABLE_ORIGIN_MAPPED) + ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL) { Header = AcpiOsMapMemory ( AcpiGbl_RootTableList.Tables[i].Address, @@ -416,7 +417,7 @@ AcpiGetTable ( continue; } - Status = AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[i]); + Status = AcpiTbValidateTable (&AcpiGbl_RootTableList.Tables[i]); if (ACPI_SUCCESS (Status)) { *OutTable = AcpiGbl_RootTableList.Tables[i].Pointer; @@ -477,7 +478,7 @@ AcpiGetTableByIndex ( { /* Table is not mapped, map it */ - Status = AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[TableIndex]); + Status = AcpiTbValidateTable (&AcpiGbl_RootTableList.Tables[TableIndex]); if (ACPI_FAILURE (Status)) { (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbxfload.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbxfload.c index 734d9a679e..77c1be6df9 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbxfload.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbxfload.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -114,6 +114,7 @@ *****************************************************************************/ #define __TBXFLOAD_C__ +#define EXPORT_ACPI_INTERFACES #include "acpi.h" #include "accommon.h" @@ -164,7 +165,7 @@ AcpiLoadTables ( return_ACPI_STATUS (Status); } -ACPI_EXPORT_SYMBOL (AcpiLoadTables) +ACPI_EXPORT_SYMBOL_INIT (AcpiLoadTables) /******************************************************************************* @@ -202,7 +203,7 @@ AcpiTbLoadNamespace ( !ACPI_COMPARE_NAME ( &(AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Signature), ACPI_SIG_DSDT) || - ACPI_FAILURE (AcpiTbVerifyTable ( + ACPI_FAILURE (AcpiTbValidateTable ( &AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT]))) { Status = AE_NO_ACPI_TABLES; @@ -213,7 +214,7 @@ AcpiTbLoadNamespace ( * Save the DSDT pointer for simple access. This is the mapped memory * address. We must take care here because the address of the .Tables * array can change dynamically as tables are loaded at run-time. Note: - * .Pointer field is not validated until after call to AcpiTbVerifyTable. + * .Pointer field is not validated until after call to AcpiTbValidateTable. */ AcpiGbl_DSDT = AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Pointer; @@ -258,24 +259,12 @@ AcpiTbLoadNamespace ( ACPI_SIG_SSDT) && !ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature), ACPI_SIG_PSDT)) || - ACPI_FAILURE (AcpiTbVerifyTable ( + ACPI_FAILURE (AcpiTbValidateTable ( &AcpiGbl_RootTableList.Tables[i]))) { continue; } - /* - * Optionally do not load any SSDTs from the RSDT/XSDT. This can - * be useful for debugging ACPI problems on some machines. - */ - if (AcpiGbl_DisableSsdtTableLoad) - { - ACPI_INFO ((AE_INFO, "Ignoring %4.4s at %p", - AcpiGbl_RootTableList.Tables[i].Signature.Ascii, - ACPI_CAST_PTR (void, AcpiGbl_RootTableList.Tables[i].Address))); - continue; - } - /* Ignore errors while loading tables, get as many as possible */ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); @@ -291,6 +280,53 @@ UnlockAndExit: } +/******************************************************************************* + * + * FUNCTION: AcpiInstallTable + * + * PARAMETERS: Address - Address of the ACPI table to be installed. + * Physical - Whether the address is a physical table + * address or not + * + * RETURN: Status + * + * DESCRIPTION: Dynamically install an ACPI table. + * Note: This function should only be invoked after + * AcpiInitializeTables() and before AcpiLoadTables(). + * + ******************************************************************************/ + +ACPI_STATUS +AcpiInstallTable ( + ACPI_PHYSICAL_ADDRESS Address, + BOOLEAN Physical) +{ + ACPI_STATUS Status; + UINT8 Flags; + UINT32 TableIndex; + + + ACPI_FUNCTION_TRACE (AcpiInstallTable); + + + if (Physical) + { + Flags = ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL; + } + else + { + Flags = ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL; + } + + Status = AcpiTbInstallStandardTable (Address, Flags, + FALSE, FALSE, &TableIndex); + + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL_INIT (AcpiInstallTable) + + /******************************************************************************* * * FUNCTION: AcpiLoadTable @@ -313,7 +349,6 @@ AcpiLoadTable ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_TABLE_DESC TableDesc; UINT32 TableIndex; @@ -327,14 +362,6 @@ AcpiLoadTable ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - /* Init local table descriptor */ - - ACPI_MEMSET (&TableDesc, 0, sizeof (ACPI_TABLE_DESC)); - TableDesc.Address = ACPI_PTR_TO_PHYSADDR (Table); - TableDesc.Pointer = Table; - TableDesc.Length = Table->Length; - TableDesc.Flags = ACPI_TABLE_ORIGIN_UNKNOWN; - /* Must acquire the interpreter lock during this operation */ Status = AcpiUtAcquireMutex (ACPI_MTX_INTERPRETER); @@ -346,7 +373,23 @@ AcpiLoadTable ( /* Install the table and load it into the namespace */ ACPI_INFO ((AE_INFO, "Host-directed Dynamic ACPI Table Load:")); - Status = AcpiTbAddTable (&TableDesc, &TableIndex); + (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); + + Status = AcpiTbInstallStandardTable (ACPI_PTR_TO_PHYSADDR (Table), + ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL, TRUE, FALSE, + &TableIndex); + + (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); + if (ACPI_FAILURE (Status)) + { + goto UnlockAndExit; + } + + /* + * Note: Now table is "INSTALLED", it must be validated before + * using. + */ + Status = AcpiTbValidateTable (&AcpiGbl_RootTableList.Tables[TableIndex]); if (ACPI_FAILURE (Status)) { goto UnlockAndExit; diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbxfroot.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbxfroot.c index 6ad19a5ff9..81d08a956d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbxfroot.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/tables/tbxfroot.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utaddress.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utaddress.c index 7c0197b297..750f47c794 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utaddress.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utaddress.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -320,10 +320,11 @@ AcpiUtCheckAddressRange ( while (RangeInfo) { /* - * Check if the requested Address/Length overlaps this AddressRange. - * Four cases to consider: + * Check if the requested address/length overlaps this + * address range. There are four cases to consider: * - * 1) Input address/length is contained completely in the address range + * 1) Input address/length is contained completely in the + * address range * 2) Input address/length overlaps range at the range start * 3) Input address/length overlaps range at the range end * 4) Input address/length completely encompasses the range @@ -339,10 +340,13 @@ AcpiUtCheckAddressRange ( Pathname = AcpiNsGetExternalPathname (RangeInfo->RegionNode); ACPI_WARNING ((AE_INFO, - "0x%p-0x%p %s conflicts with Region %s %d", + "%s range 0x%p-0x%p conflicts with OpRegion 0x%p-0x%p (%s)", + AcpiUtGetRegionName (SpaceId), ACPI_CAST_PTR (void, Address), ACPI_CAST_PTR (void, EndAddress), - AcpiUtGetRegionName (SpaceId), Pathname, OverlapCount)); + ACPI_CAST_PTR (void, RangeInfo->StartAddress), + ACPI_CAST_PTR (void, RangeInfo->EndAddress), + Pathname)); ACPI_FREE (Pathname); } } diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utalloc.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utalloc.c index 38feda1904..00345fcff7 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utalloc.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utalloc.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -123,6 +123,45 @@ ACPI_MODULE_NAME ("utalloc") +#if !defined (USE_NATIVE_ALLOCATE_ZEROED) +/******************************************************************************* + * + * FUNCTION: AcpiOsAllocateZeroed + * + * PARAMETERS: Size - Size of the allocation + * + * RETURN: Address of the allocated memory on success, NULL on failure. + * + * DESCRIPTION: Subsystem equivalent of calloc. Allocate and zero memory. + * This is the default implementation. Can be overridden via the + * USE_NATIVE_ALLOCATE_ZEROED flag. + * + ******************************************************************************/ + +void * +AcpiOsAllocateZeroed ( + ACPI_SIZE Size) +{ + void *Allocation; + + + ACPI_FUNCTION_ENTRY (); + + + Allocation = AcpiOsAllocate (Size); + if (Allocation) + { + /* Clear the memory block */ + + ACPI_MEMSET (Allocation, 0, Size); + } + + return (Allocation); +} + +#endif /* !USE_NATIVE_ALLOCATE_ZEROED */ + + /******************************************************************************* * * FUNCTION: AcpiUtCreateCaches @@ -357,9 +396,13 @@ AcpiUtInitializeBuffer ( return (AE_BUFFER_OVERFLOW); case ACPI_ALLOCATE_BUFFER: - - /* Allocate a new buffer */ - + /* + * Allocate a new buffer. We directectly call AcpiOsAllocate here to + * purposefully bypass the (optionally enabled) internal allocation + * tracking mechanism since we only want to track internal + * allocations. Note: The caller should use AcpiOsFree to free this + * buffer created via ACPI_ALLOCATE_BUFFER. + */ Buffer->Pointer = AcpiOsAllocate (RequiredLength); break; @@ -393,95 +436,3 @@ AcpiUtInitializeBuffer ( ACPI_MEMSET (Buffer->Pointer, 0, RequiredLength); return (AE_OK); } - - -/******************************************************************************* - * - * FUNCTION: AcpiUtAllocate - * - * PARAMETERS: Size - Size of the allocation - * Component - Component type of caller - * Module - Source file name of caller - * Line - Line number of caller - * - * RETURN: Address of the allocated memory on success, NULL on failure. - * - * DESCRIPTION: Subsystem equivalent of malloc. - * - ******************************************************************************/ - -void * -AcpiUtAllocate ( - ACPI_SIZE Size, - UINT32 Component, - const char *Module, - UINT32 Line) -{ - void *Allocation; - - - ACPI_FUNCTION_TRACE_U32 (UtAllocate, Size); - - - /* Check for an inadvertent size of zero bytes */ - - if (!Size) - { - ACPI_WARNING ((Module, Line, - "Attempt to allocate zero bytes, allocating 1 byte")); - Size = 1; - } - - Allocation = AcpiOsAllocate (Size); - if (!Allocation) - { - /* Report allocation error */ - - ACPI_WARNING ((Module, Line, - "Could not allocate size %u", (UINT32) Size)); - - return_PTR (NULL); - } - - return_PTR (Allocation); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtAllocateZeroed - * - * PARAMETERS: Size - Size of the allocation - * Component - Component type of caller - * Module - Source file name of caller - * Line - Line number of caller - * - * RETURN: Address of the allocated memory on success, NULL on failure. - * - * DESCRIPTION: Subsystem equivalent of calloc. Allocate and zero memory. - * - ******************************************************************************/ - -void * -AcpiUtAllocateZeroed ( - ACPI_SIZE Size, - UINT32 Component, - const char *Module, - UINT32 Line) -{ - void *Allocation; - - - ACPI_FUNCTION_ENTRY (); - - - Allocation = AcpiUtAllocate (Size, Component, Module, Line); - if (Allocation) - { - /* Clear the memory block */ - - ACPI_MEMSET (Allocation, 0, Size); - } - - return (Allocation); -} diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utbuffer.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utbuffer.c index 13681c5736..608e8d4aa1 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utbuffer.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utbuffer.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -290,3 +290,138 @@ AcpiUtDebugDumpBuffer ( AcpiUtDumpBuffer (Buffer, Count, Display, 0); } + + +#ifdef ACPI_APPLICATION +/******************************************************************************* + * + * FUNCTION: AcpiUtDumpBufferToFile + * + * PARAMETERS: File - File descriptor + * Buffer - Buffer to dump + * Count - Amount to dump, in bytes + * Display - BYTE, WORD, DWORD, or QWORD display: + * DB_BYTE_DISPLAY + * DB_WORD_DISPLAY + * DB_DWORD_DISPLAY + * DB_QWORD_DISPLAY + * BaseOffset - Beginning buffer offset (display only) + * + * RETURN: None + * + * DESCRIPTION: Generic dump buffer in both hex and ascii to a file. + * + ******************************************************************************/ + +void +AcpiUtDumpBufferToFile ( + ACPI_FILE File, + UINT8 *Buffer, + UINT32 Count, + UINT32 Display, + UINT32 BaseOffset) +{ + UINT32 i = 0; + UINT32 j; + UINT32 Temp32; + UINT8 BufChar; + + + if (!Buffer) + { + AcpiUtFilePrintf (File, "Null Buffer Pointer in DumpBuffer!\n"); + return; + } + + if ((Count < 4) || (Count & 0x01)) + { + Display = DB_BYTE_DISPLAY; + } + + /* Nasty little dump buffer routine! */ + + while (i < Count) + { + /* Print current offset */ + + AcpiUtFilePrintf (File, "%6.4X: ", (BaseOffset + i)); + + /* Print 16 hex chars */ + + for (j = 0; j < 16;) + { + if (i + j >= Count) + { + /* Dump fill spaces */ + + AcpiUtFilePrintf (File, "%*s", ((Display * 2) + 1), " "); + j += Display; + continue; + } + + switch (Display) + { + case DB_BYTE_DISPLAY: + default: /* Default is BYTE display */ + + AcpiUtFilePrintf (File, "%02X ", Buffer[(ACPI_SIZE) i + j]); + break; + + case DB_WORD_DISPLAY: + + ACPI_MOVE_16_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]); + AcpiUtFilePrintf (File, "%04X ", Temp32); + break; + + case DB_DWORD_DISPLAY: + + ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]); + AcpiUtFilePrintf (File, "%08X ", Temp32); + break; + + case DB_QWORD_DISPLAY: + + ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]); + AcpiUtFilePrintf (File, "%08X", Temp32); + + ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j + 4]); + AcpiUtFilePrintf (File, "%08X ", Temp32); + break; + } + + j += Display; + } + + /* + * Print the ASCII equivalent characters but watch out for the bad + * unprintable ones (printable chars are 0x20 through 0x7E) + */ + AcpiUtFilePrintf (File, " "); + for (j = 0; j < 16; j++) + { + if (i + j >= Count) + { + AcpiUtFilePrintf (File, "\n"); + return; + } + + BufChar = Buffer[(ACPI_SIZE) i + j]; + if (ACPI_IS_PRINT (BufChar)) + { + AcpiUtFilePrintf (File, "%c", BufChar); + } + else + { + AcpiUtFilePrintf (File, "."); + } + } + + /* Done with that line. */ + + AcpiUtFilePrintf (File, "\n"); + i += 16; + } + + return; +} +#endif diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utcache.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utcache.c index 22800277a2..1bd2c542ae 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utcache.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utcache.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -358,13 +358,13 @@ AcpiOsAcquireObject ( if (!Cache) { - return (NULL); + return_PTR (NULL); } Status = AcpiUtAcquireMutex (ACPI_MTX_CACHES); if (ACPI_FAILURE (Status)) { - return (NULL); + return_PTR (NULL); } ACPI_MEM_TRACKING (Cache->Requests++); @@ -387,7 +387,7 @@ AcpiOsAcquireObject ( Status = AcpiUtReleaseMutex (ACPI_MTX_CACHES); if (ACPI_FAILURE (Status)) { - return (NULL); + return_PTR (NULL); } /* Clear (zero) the previously used Object */ @@ -412,16 +412,16 @@ AcpiOsAcquireObject ( Status = AcpiUtReleaseMutex (ACPI_MTX_CACHES); if (ACPI_FAILURE (Status)) { - return (NULL); + return_PTR (NULL); } Object = ACPI_ALLOCATE_ZEROED (Cache->ObjectSize); if (!Object) { - return (NULL); + return_PTR (NULL); } } - return (Object); + return_PTR (Object); } #endif /* ACPI_USE_LOCAL_CACHE */ diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utclib.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utclib.c index 5013c5b166..a1e819df01 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utclib.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utclib.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -380,8 +380,6 @@ AcpiUtStrcmp ( } -#ifdef ACPI_FUTURE_IMPLEMENTATION -/* Not used at this time */ /******************************************************************************* * * FUNCTION: AcpiUtStrchr (strchr) @@ -412,7 +410,7 @@ AcpiUtStrchr ( return (NULL); } -#endif + /******************************************************************************* * diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utcopy.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utcopy.c index 83dcb983f6..e6a71a7b03 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utcopy.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utcopy.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -636,10 +636,10 @@ AcpiUtCopyEsimpleToIsimple ( case ACPI_TYPE_LOCAL_REFERENCE: - /* TBD: should validate incoming handle */ + /* An incoming reference is defined to be a namespace node */ - InternalObject->Reference.Class = ACPI_REFCLASS_NAME; - InternalObject->Reference.Node = ExternalObject->Reference.Handle; + InternalObject->Reference.Class = ACPI_REFCLASS_REFOF; + InternalObject->Reference.Object = ExternalObject->Reference.Handle; break; default: @@ -1135,5 +1135,12 @@ AcpiUtCopyIobjectToIobject ( Status = AcpiUtCopySimpleObject (SourceDesc, *DestDesc); } + /* Delete the allocated object if copy failed */ + + if (ACPI_FAILURE (Status)) + { + AcpiUtRemoveReference(*DestDesc); + } + return_ACPI_STATUS (Status); } diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utdebug.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utdebug.c index c38ae95b16..ddc0c38640 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utdebug.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utdebug.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -114,6 +114,7 @@ *****************************************************************************/ #define __UTDEBUG_C__ +#define EXPORT_ACPI_INTERFACES #include "acpi.h" #include "accommon.h" @@ -282,6 +283,7 @@ AcpiDebugPrint ( } AcpiGbl_PrevThreadId = ThreadId; + AcpiGbl_NestingLevel = 0; } /* @@ -290,13 +292,22 @@ AcpiDebugPrint ( */ AcpiOsPrintf ("%9s-%04ld ", ModuleName, LineNumber); +#ifdef ACPI_APPLICATION + /* + * For AcpiExec/iASL only, emit the thread ID and nesting level. + * Note: nesting level is really only useful during a single-thread + * execution. Otherwise, multiple threads will keep resetting the + * level. + */ if (ACPI_LV_THREADS & AcpiDbgLevel) { AcpiOsPrintf ("[%u] ", (UINT32) ThreadId); } - AcpiOsPrintf ("[%02ld] %-22.22s: ", - AcpiGbl_NestingLevel, AcpiUtTrimFunctionName (FunctionName)); + AcpiOsPrintf ("[%02ld] ", AcpiGbl_NestingLevel); +#endif + + AcpiOsPrintf ("%-22.22s: ", AcpiUtTrimFunctionName (FunctionName)); va_start (args, Format); AcpiOsVprintf (Format, args); @@ -546,7 +557,10 @@ AcpiUtExit ( "%s\n", AcpiGbl_FnExitStr); } - AcpiGbl_NestingLevel--; + if (AcpiGbl_NestingLevel) + { + AcpiGbl_NestingLevel--; + } } ACPI_EXPORT_SYMBOL (AcpiUtExit) @@ -598,7 +612,10 @@ AcpiUtStatusExit ( } } - AcpiGbl_NestingLevel--; + if (AcpiGbl_NestingLevel) + { + AcpiGbl_NestingLevel--; + } } ACPI_EXPORT_SYMBOL (AcpiUtStatusExit) @@ -640,7 +657,10 @@ AcpiUtValueExit ( ACPI_FORMAT_UINT64 (Value)); } - AcpiGbl_NestingLevel--; + if (AcpiGbl_NestingLevel) + { + AcpiGbl_NestingLevel--; + } } ACPI_EXPORT_SYMBOL (AcpiUtValueExit) @@ -681,7 +701,40 @@ AcpiUtPtrExit ( "%s %p\n", AcpiGbl_FnExitStr, Ptr); } - AcpiGbl_NestingLevel--; + if (AcpiGbl_NestingLevel) + { + AcpiGbl_NestingLevel--; + } } #endif + + +#ifdef ACPI_APPLICATION +/******************************************************************************* + * + * FUNCTION: AcpiLogError + * + * PARAMETERS: Format - Printf format field + * ... - Optional printf arguments + * + * RETURN: None + * + * DESCRIPTION: Print error message to the console, used by applications. + * + ******************************************************************************/ + +void ACPI_INTERNAL_VAR_XFACE +AcpiLogError ( + const char *Format, + ...) +{ + va_list Args; + + va_start (Args, Format); + (void) AcpiUtFileVprintf (ACPI_FILE_ERR, Format, Args); + va_end (Args); +} + +ACPI_EXPORT_SYMBOL (AcpiLogError) +#endif diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utdecode.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utdecode.c index e6076f321c..61826fe2f4 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utdecode.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utdecode.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -163,38 +163,6 @@ const UINT8 AcpiGbl_NsProperties[ACPI_NUM_NS_TYPES] = }; -/******************************************************************************* - * - * FUNCTION: AcpiUtHexToAsciiChar - * - * PARAMETERS: Integer - Contains the hex digit - * Position - bit position of the digit within the - * integer (multiple of 4) - * - * RETURN: The converted Ascii character - * - * DESCRIPTION: Convert a hex digit to an Ascii character - * - ******************************************************************************/ - -/* Hex to ASCII conversion table */ - -static const char AcpiGbl_HexToAscii[] = -{ - '0','1','2','3','4','5','6','7', - '8','9','A','B','C','D','E','F' -}; - -char -AcpiUtHexToAsciiChar ( - UINT64 Integer, - UINT32 Position) -{ - - return (AcpiGbl_HexToAscii[(Integer >> Position) & 0xF]); -} - - /******************************************************************************* * * FUNCTION: AcpiUtGetRegionName @@ -599,7 +567,7 @@ AcpiUtGetMutexName ( /* Names for Notify() values, used for debug output */ -static const char *AcpiGbl_NotifyValueNames[ACPI_NOTIFY_MAX + 1] = +static const char *AcpiGbl_GenericNotify[ACPI_NOTIFY_MAX + 1] = { /* 00 */ "Bus Check", /* 01 */ "Device Check", @@ -611,32 +579,88 @@ static const char *AcpiGbl_NotifyValueNames[ACPI_NOTIFY_MAX + 1] = /* 07 */ "Power Fault", /* 08 */ "Capabilities Check", /* 09 */ "Device PLD Check", - /* 10 */ "Reserved", - /* 11 */ "System Locality Update", - /* 12 */ "Shutdown Request" + /* 0A */ "Reserved", + /* 0B */ "System Locality Update", + /* 0C */ "Shutdown Request", + /* 0D */ "System Resource Affinity Update" }; +static const char *AcpiGbl_DeviceNotify[4] = +{ + /* 80 */ "Status Change", + /* 81 */ "Information Change", + /* 82 */ "Device-Specific Change", + /* 83 */ "Device-Specific Change" +}; + +static const char *AcpiGbl_ProcessorNotify[4] = +{ + /* 80 */ "Performance Capability Change", + /* 81 */ "C-State Change", + /* 82 */ "Throttling Capability Change", + /* 83 */ "Device-Specific Change" +}; + +static const char *AcpiGbl_ThermalNotify[4] = +{ + /* 80 */ "Thermal Status Change", + /* 81 */ "Thermal Trip Point Change", + /* 82 */ "Thermal Device List Change", + /* 83 */ "Thermal Relationship Change" +}; + + const char * AcpiUtGetNotifyName ( - UINT32 NotifyValue) + UINT32 NotifyValue, + ACPI_OBJECT_TYPE Type) { + /* 00 - 0D are common to all object types */ + if (NotifyValue <= ACPI_NOTIFY_MAX) { - return (AcpiGbl_NotifyValueNames[NotifyValue]); + return (AcpiGbl_GenericNotify[NotifyValue]); } - else if (NotifyValue <= ACPI_MAX_SYS_NOTIFY) + + /* 0D - 7F are reserved */ + + if (NotifyValue <= ACPI_MAX_SYS_NOTIFY) { return ("Reserved"); } - else if (NotifyValue <= ACPI_MAX_DEVICE_SPECIFIC_NOTIFY) + + /* 80 - 83 are per-object-type */ + + if (NotifyValue <= 0x83) { - return ("Device Specific"); + switch (Type) + { + case ACPI_TYPE_ANY: + case ACPI_TYPE_DEVICE: + return (AcpiGbl_DeviceNotify [NotifyValue - 0x80]); + + case ACPI_TYPE_PROCESSOR: + return (AcpiGbl_ProcessorNotify [NotifyValue - 0x80]); + + case ACPI_TYPE_THERMAL: + return (AcpiGbl_ThermalNotify [NotifyValue - 0x80]); + + default: + return ("Target object type does not support notifies"); + } } - else + + /* 84 - BF are device-specific */ + + if (NotifyValue <= ACPI_MAX_DEVICE_SPECIFIC_NOTIFY) { - return ("Hardware Specific"); + return ("Device-Specific"); } + + /* C0 and above are hardware-specific */ + + return ("Hardware-Specific"); } #endif diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utdelete.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utdelete.c index d4f68b0728..d42d8a7555 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utdelete.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utdelete.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -158,6 +158,7 @@ AcpiUtDeleteInternalObj ( ACPI_OPERAND_OBJECT *HandlerDesc; ACPI_OPERAND_OBJECT *SecondDesc; ACPI_OPERAND_OBJECT *NextDesc; + ACPI_OPERAND_OBJECT *StartDesc; ACPI_OPERAND_OBJECT **LastObjPtr; @@ -322,9 +323,10 @@ AcpiUtDeleteInternalObj ( if (HandlerDesc) { NextDesc = HandlerDesc->AddressSpace.RegionList; + StartDesc = NextDesc; LastObjPtr = &HandlerDesc->AddressSpace.RegionList; - /* Remove the region object from the handler's list */ + /* Remove the region object from the handler list */ while (NextDesc) { @@ -334,10 +336,20 @@ AcpiUtDeleteInternalObj ( break; } - /* Walk the linked list of handler */ + /* Walk the linked list of handlers */ LastObjPtr = &NextDesc->Region.Next; NextDesc = NextDesc->Region.Next; + + /* Prevent infinite loop if list is corrupted */ + + if (NextDesc == StartDesc) + { + ACPI_ERROR ((AE_INFO, + "Circular region list in address handler object %p", + HandlerDesc)); + return_VOID; + } } if (HandlerDesc->AddressSpace.HandlerFlags & diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/uterror.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/uterror.c index b3d1a8f0cc..b590af75ac 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/uterror.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/uterror.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/uteval.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/uteval.c index b8d7b6bd6e..b3a734149d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/uteval.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/uteval.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utexcep.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utexcep.c index 2d7c4e0a82..d9f047197f 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utexcep.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utexcep.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -115,6 +115,7 @@ #define __UTEXCEP_C__ +#define EXPORT_ACPI_INTERFACES #define ACPI_DEFINE_EXCEPTION_TABLE #include "acpi.h" diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utfileio.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utfileio.c new file mode 100644 index 0000000000..9501e22e0f --- /dev/null +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utfileio.c @@ -0,0 +1,434 @@ +/******************************************************************************* + * + * Module Name: utfileio - simple file I/O routines + * + ******************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + + +#include "acpi.h" +#include "accommon.h" +#include "actables.h" +#include "acapps.h" + +#ifdef ACPI_ASL_COMPILER +#include "aslcompiler.h" +#endif + + +#define _COMPONENT ACPI_CA_DEBUGGER + ACPI_MODULE_NAME ("utfileio") + + +#ifdef ACPI_APPLICATION + +/* Local prototypes */ + +static ACPI_STATUS +AcpiUtCheckTextModeCorruption ( + UINT8 *Table, + UINT32 TableLength, + UINT32 FileLength); + +static ACPI_STATUS +AcpiUtReadTable ( + FILE *fp, + ACPI_TABLE_HEADER **Table, + UINT32 *TableLength); + + +/******************************************************************************* + * + * FUNCTION: AcpiUtCheckTextModeCorruption + * + * PARAMETERS: Table - Table buffer + * TableLength - Length of table from the table header + * FileLength - Length of the file that contains the table + * + * RETURN: Status + * + * DESCRIPTION: Check table for text mode file corruption where all linefeed + * characters (LF) have been replaced by carriage return linefeed + * pairs (CR/LF). + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiUtCheckTextModeCorruption ( + UINT8 *Table, + UINT32 TableLength, + UINT32 FileLength) +{ + UINT32 i; + UINT32 Pairs = 0; + + + if (TableLength != FileLength) + { + ACPI_WARNING ((AE_INFO, + "File length (0x%X) is not the same as the table length (0x%X)", + FileLength, TableLength)); + } + + /* Scan entire table to determine if each LF has been prefixed with a CR */ + + for (i = 1; i < FileLength; i++) + { + if (Table[i] == 0x0A) + { + if (Table[i - 1] != 0x0D) + { + /* The LF does not have a preceding CR, table not corrupted */ + + return (AE_OK); + } + else + { + /* Found a CR/LF pair */ + + Pairs++; + } + i++; + } + } + + if (!Pairs) + { + return (AE_OK); + } + + /* + * Entire table scanned, each CR is part of a CR/LF pair -- + * meaning that the table was treated as a text file somewhere. + * + * NOTE: We can't "fix" the table, because any existing CR/LF pairs in the + * original table are left untouched by the text conversion process -- + * meaning that we cannot simply replace CR/LF pairs with LFs. + */ + AcpiOsPrintf ("Table has been corrupted by text mode conversion\n"); + AcpiOsPrintf ("All LFs (%u) were changed to CR/LF pairs\n", Pairs); + AcpiOsPrintf ("Table cannot be repaired!\n"); + return (AE_BAD_VALUE); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtReadTable + * + * PARAMETERS: fp - File that contains table + * Table - Return value, buffer with table + * TableLength - Return value, length of table + * + * RETURN: Status + * + * DESCRIPTION: Load the DSDT from the file pointer + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiUtReadTable ( + FILE *fp, + ACPI_TABLE_HEADER **Table, + UINT32 *TableLength) +{ + ACPI_TABLE_HEADER TableHeader; + UINT32 Actual; + ACPI_STATUS Status; + UINT32 FileSize; + BOOLEAN StandardHeader = TRUE; + INT32 Count; + + /* Get the file size */ + + FileSize = CmGetFileSize (fp); + if (FileSize == ACPI_UINT32_MAX) + { + return (AE_ERROR); + } + + if (FileSize < 4) + { + return (AE_BAD_HEADER); + } + + /* Read the signature */ + + fseek (fp, 0, SEEK_SET); + + Count = fread (&TableHeader, 1, sizeof (ACPI_TABLE_HEADER), fp); + if (Count != sizeof (ACPI_TABLE_HEADER)) + { + AcpiOsPrintf ("Could not read the table header\n"); + return (AE_BAD_HEADER); + } + + /* The RSDP table does not have standard ACPI header */ + + if (ACPI_VALIDATE_RSDP_SIG (TableHeader.Signature)) + { + *TableLength = FileSize; + StandardHeader = FALSE; + } + else + { + +#if 0 + /* Validate the table header/length */ + + Status = AcpiTbValidateTableHeader (&TableHeader); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Table header is invalid!\n"); + return (Status); + } +#endif + + /* File size must be at least as long as the Header-specified length */ + + if (TableHeader.Length > FileSize) + { + AcpiOsPrintf ( + "TableHeader length [0x%X] greater than the input file size [0x%X]\n", + TableHeader.Length, FileSize); + +#ifdef ACPI_ASL_COMPILER + Status = FlCheckForAscii (fp, NULL, FALSE); + if (ACPI_SUCCESS (Status)) + { + AcpiOsPrintf ("File appears to be ASCII only, must be binary\n"); + } +#endif + return (AE_BAD_HEADER); + } + +#ifdef ACPI_OBSOLETE_CODE + /* We only support a limited number of table types */ + + if (!ACPI_COMPARE_NAME ((char *) TableHeader.Signature, ACPI_SIG_DSDT) && + !ACPI_COMPARE_NAME ((char *) TableHeader.Signature, ACPI_SIG_PSDT) && + !ACPI_COMPARE_NAME ((char *) TableHeader.Signature, ACPI_SIG_SSDT)) + { + AcpiOsPrintf ("Table signature [%4.4s] is invalid or not supported\n", + (char *) TableHeader.Signature); + ACPI_DUMP_BUFFER (&TableHeader, sizeof (ACPI_TABLE_HEADER)); + return (AE_ERROR); + } +#endif + + *TableLength = TableHeader.Length; + } + + /* Allocate a buffer for the table */ + + *Table = AcpiOsAllocate ((size_t) FileSize); + if (!*Table) + { + AcpiOsPrintf ( + "Could not allocate memory for ACPI table %4.4s (size=0x%X)\n", + TableHeader.Signature, *TableLength); + return (AE_NO_MEMORY); + } + + /* Get the rest of the table */ + + fseek (fp, 0, SEEK_SET); + Actual = fread (*Table, 1, (size_t) FileSize, fp); + if (Actual == FileSize) + { + if (StandardHeader) + { + /* Now validate the checksum */ + + Status = AcpiTbVerifyChecksum ((void *) *Table, + ACPI_CAST_PTR (ACPI_TABLE_HEADER, *Table)->Length); + + if (Status == AE_BAD_CHECKSUM) + { + Status = AcpiUtCheckTextModeCorruption ((UINT8 *) *Table, + FileSize, (*Table)->Length); + return (Status); + } + } + return (AE_OK); + } + + if (Actual > 0) + { + AcpiOsPrintf ("Warning - reading table, asked for %X got %X\n", + FileSize, Actual); + return (AE_OK); + } + + AcpiOsPrintf ("Error - could not read the table file\n"); + AcpiOsFree (*Table); + *Table = NULL; + *TableLength = 0; + return (AE_ERROR); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtReadTableFromFile + * + * PARAMETERS: Filename - File where table is located + * Table - Where a pointer to the table is returned + * + * RETURN: Status + * + * DESCRIPTION: Get an ACPI table from a file + * + ******************************************************************************/ + +ACPI_STATUS +AcpiUtReadTableFromFile ( + char *Filename, + ACPI_TABLE_HEADER **Table) +{ + FILE *File; + UINT32 FileSize; + UINT32 TableLength; + ACPI_STATUS Status = AE_ERROR; + + + /* Open the file, get current size */ + + File = fopen (Filename, "rb"); + if (!File) + { + perror ("Could not open input file"); + return (Status); + } + + FileSize = CmGetFileSize (File); + if (FileSize == ACPI_UINT32_MAX) + { + goto Exit; + } + + /* Get the entire file */ + + fprintf (stderr, "Loading Acpi table from file %10s - Length %.8u (%06X)\n", + Filename, FileSize, FileSize); + + Status = AcpiUtReadTable (File, Table, &TableLength); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could not get table from the file\n"); + } + +Exit: + fclose(File); + return (Status); +} + +#endif diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utglobal.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utglobal.c index 865761b80f..be14ea296f 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utglobal.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utglobal.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -114,6 +114,7 @@ *****************************************************************************/ #define __UTGLOBAL_C__ +#define EXPORT_ACPI_INTERFACES #define DEFINE_ACPI_GLOBALS #include "acpi.h" @@ -129,37 +130,7 @@ * ******************************************************************************/ -/* - * We want the debug switches statically initialized so they - * are already set when the debugger is entered. - */ - -/* Debug switch - level and trace mask */ - -#ifdef ACPI_DEBUG_OUTPUT -UINT32 AcpiDbgLevel = ACPI_DEBUG_DEFAULT; -#else -UINT32 AcpiDbgLevel = ACPI_NORMAL_DEFAULT; -#endif - -/* Debug switch - layer (component) mask */ - -UINT32 AcpiDbgLayer = ACPI_COMPONENT_DEFAULT; -UINT32 AcpiGbl_NestingLevel = 0; - -/* Debugger globals */ - -BOOLEAN AcpiGbl_DbTerminateThreads = FALSE; -BOOLEAN AcpiGbl_AbortMethod = FALSE; -BOOLEAN AcpiGbl_MethodExecuting = FALSE; - -/* System flags */ - -UINT32 AcpiGbl_StartupFlags = 0; - -/* System starts uninitialized */ - -BOOLEAN AcpiGbl_Shutdown = TRUE; +/* Various state name strings */ const char *AcpiGbl_SleepStateNames[ACPI_S_STATE_COUNT] = { @@ -274,163 +245,6 @@ ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS] = }; #endif /* !ACPI_REDUCED_HARDWARE */ - -/******************************************************************************* - * - * FUNCTION: AcpiUtInitGlobals - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Initialize ACPICA globals. All globals that require specific - * initialization should be initialized here. This allows for - * a warm restart. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtInitGlobals ( - void) -{ - ACPI_STATUS Status; - UINT32 i; - - - ACPI_FUNCTION_TRACE (UtInitGlobals); - - - /* Create all memory caches */ - - Status = AcpiUtCreateCaches (); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Address Range lists */ - - for (i = 0; i < ACPI_ADDRESS_RANGE_MAX; i++) - { - AcpiGbl_AddressRangeList[i] = NULL; - } - - /* Mutex locked flags */ - - for (i = 0; i < ACPI_NUM_MUTEX; i++) - { - AcpiGbl_MutexInfo[i].Mutex = NULL; - AcpiGbl_MutexInfo[i].ThreadId = ACPI_MUTEX_NOT_ACQUIRED; - AcpiGbl_MutexInfo[i].UseCount = 0; - } - - for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++) - { - AcpiGbl_OwnerIdMask[i] = 0; - } - - /* Last OwnerID is never valid */ - - AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000; - - /* Event counters */ - - AcpiMethodCount = 0; - AcpiSciCount = 0; - AcpiGpeCount = 0; - - for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) - { - AcpiFixedEventCount[i] = 0; - } - -#if (!ACPI_REDUCED_HARDWARE) - - /* GPE/SCI support */ - - AcpiGbl_AllGpesInitialized = FALSE; - AcpiGbl_GpeXruptListHead = NULL; - AcpiGbl_GpeFadtBlocks[0] = NULL; - AcpiGbl_GpeFadtBlocks[1] = NULL; - AcpiCurrentGpeCount = 0; - - AcpiGbl_GlobalEventHandler = NULL; - AcpiGbl_SciHandlerList = NULL; - -#endif /* !ACPI_REDUCED_HARDWARE */ - - /* Global handlers */ - - AcpiGbl_GlobalNotify[0].Handler = NULL; - AcpiGbl_GlobalNotify[1].Handler = NULL; - AcpiGbl_ExceptionHandler = NULL; - AcpiGbl_InitHandler = NULL; - AcpiGbl_TableHandler = NULL; - AcpiGbl_InterfaceHandler = NULL; - - /* Global Lock support */ - - AcpiGbl_GlobalLockSemaphore = NULL; - AcpiGbl_GlobalLockMutex = NULL; - AcpiGbl_GlobalLockAcquired = FALSE; - AcpiGbl_GlobalLockHandle = 0; - AcpiGbl_GlobalLockPresent = FALSE; - - /* Miscellaneous variables */ - - AcpiGbl_DSDT = NULL; - AcpiGbl_CmSingleStep = FALSE; - AcpiGbl_DbTerminateThreads = FALSE; - AcpiGbl_Shutdown = FALSE; - AcpiGbl_NsLookupCount = 0; - AcpiGbl_PsFindCount = 0; - AcpiGbl_AcpiHardwarePresent = TRUE; - AcpiGbl_LastOwnerIdIndex = 0; - AcpiGbl_NextOwnerIdOffset = 0; - AcpiGbl_TraceMethodName = 0; - AcpiGbl_TraceDbgLevel = 0; - AcpiGbl_TraceDbgLayer = 0; - AcpiGbl_DebuggerConfiguration = DEBUGGER_THREADING; - AcpiGbl_DbOutputFlags = ACPI_DB_CONSOLE_OUTPUT; - AcpiGbl_OsiMutex = NULL; - AcpiGbl_RegMethodsExecuted = FALSE; - - /* Hardware oriented */ - - AcpiGbl_EventsInitialized = FALSE; - AcpiGbl_SystemAwakeAndRunning = TRUE; - - /* Namespace */ - - AcpiGbl_ModuleCodeList = NULL; - AcpiGbl_RootNode = NULL; - AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME; - AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED; - AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_DEVICE; - AcpiGbl_RootNodeStruct.Parent = NULL; - AcpiGbl_RootNodeStruct.Child = NULL; - AcpiGbl_RootNodeStruct.Peer = NULL; - AcpiGbl_RootNodeStruct.Object = NULL; - - -#ifdef ACPI_DISASSEMBLER - AcpiGbl_ExternalList = NULL; - AcpiGbl_NumExternalMethods = 0; - AcpiGbl_ResolvedExternalMethods = 0; -#endif - -#ifdef ACPI_DEBUG_OUTPUT - AcpiGbl_LowestStackPointer = ACPI_CAST_PTR (ACPI_SIZE, ACPI_SIZE_MAX); -#endif - -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - AcpiGbl_DisplayFinalMemStats = FALSE; - AcpiGbl_DisableMemTracking = FALSE; -#endif - - return_ACPI_STATUS (AE_OK); -} - /* Public globals */ ACPI_EXPORT_SYMBOL (AcpiGbl_FADT) diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/uthex.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/uthex.c new file mode 100644 index 0000000000..ba2b2593ef --- /dev/null +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/uthex.c @@ -0,0 +1,185 @@ +/****************************************************************************** + * + * Module Name: uthex -- Hex/ASCII support functions + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#define __UTHEX_C__ + +#include "acpi.h" +#include "accommon.h" + +#define _COMPONENT ACPI_COMPILER + ACPI_MODULE_NAME ("uthex") + + +/* Hex to ASCII conversion table */ + +static char AcpiGbl_HexToAscii[] = +{ + '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' +}; + + +/******************************************************************************* + * + * FUNCTION: AcpiUtHexToAsciiChar + * + * PARAMETERS: Integer - Contains the hex digit + * Position - bit position of the digit within the + * integer (multiple of 4) + * + * RETURN: The converted Ascii character + * + * DESCRIPTION: Convert a hex digit to an Ascii character + * + ******************************************************************************/ + +char +AcpiUtHexToAsciiChar ( + UINT64 Integer, + UINT32 Position) +{ + + return (AcpiGbl_HexToAscii[(Integer >> Position) & 0xF]); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtHexCharToValue + * + * PARAMETERS: AsciiChar - Hex character in Ascii + * + * RETURN: The binary value of the ascii/hex character + * + * DESCRIPTION: Perform ascii-to-hex translation + * + ******************************************************************************/ + +UINT8 +AcpiUtAsciiCharToHex ( + int HexChar) +{ + + if (HexChar <= 0x39) + { + return ((UINT8) (HexChar - 0x30)); + } + + if (HexChar <= 0x46) + { + return ((UINT8) (HexChar - 0x37)); + } + + return ((UINT8) (HexChar - 0x57)); +} diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utids.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utids.c index 7fec698439..4cf84e8edb 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utids.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utids.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utinit.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utinit.c index d06fc3585c..8df027765e 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utinit.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utinit.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -188,6 +188,162 @@ AcpiUtFreeGpeLists ( #endif /* !ACPI_REDUCED_HARDWARE */ +/******************************************************************************* + * + * FUNCTION: AcpiUtInitGlobals + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Initialize ACPICA globals. All globals that require specific + * initialization should be initialized here. This allows for + * a warm restart. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiUtInitGlobals ( + void) +{ + ACPI_STATUS Status; + UINT32 i; + + + ACPI_FUNCTION_TRACE (UtInitGlobals); + + + /* Create all memory caches */ + + Status = AcpiUtCreateCaches (); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Address Range lists */ + + for (i = 0; i < ACPI_ADDRESS_RANGE_MAX; i++) + { + AcpiGbl_AddressRangeList[i] = NULL; + } + + /* Mutex locked flags */ + + for (i = 0; i < ACPI_NUM_MUTEX; i++) + { + AcpiGbl_MutexInfo[i].Mutex = NULL; + AcpiGbl_MutexInfo[i].ThreadId = ACPI_MUTEX_NOT_ACQUIRED; + AcpiGbl_MutexInfo[i].UseCount = 0; + } + + for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++) + { + AcpiGbl_OwnerIdMask[i] = 0; + } + + /* Last OwnerID is never valid */ + + AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000; + + /* Event counters */ + + AcpiMethodCount = 0; + AcpiSciCount = 0; + AcpiGpeCount = 0; + + for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) + { + AcpiFixedEventCount[i] = 0; + } + +#if (!ACPI_REDUCED_HARDWARE) + + /* GPE/SCI support */ + + AcpiGbl_AllGpesInitialized = FALSE; + AcpiGbl_GpeXruptListHead = NULL; + AcpiGbl_GpeFadtBlocks[0] = NULL; + AcpiGbl_GpeFadtBlocks[1] = NULL; + AcpiCurrentGpeCount = 0; + + AcpiGbl_GlobalEventHandler = NULL; + AcpiGbl_SciHandlerList = NULL; + +#endif /* !ACPI_REDUCED_HARDWARE */ + + /* Global handlers */ + + AcpiGbl_GlobalNotify[0].Handler = NULL; + AcpiGbl_GlobalNotify[1].Handler = NULL; + AcpiGbl_ExceptionHandler = NULL; + AcpiGbl_InitHandler = NULL; + AcpiGbl_TableHandler = NULL; + AcpiGbl_InterfaceHandler = NULL; + + /* Global Lock support */ + + AcpiGbl_GlobalLockSemaphore = NULL; + AcpiGbl_GlobalLockMutex = NULL; + AcpiGbl_GlobalLockAcquired = FALSE; + AcpiGbl_GlobalLockHandle = 0; + AcpiGbl_GlobalLockPresent = FALSE; + + /* Miscellaneous variables */ + + AcpiGbl_DSDT = NULL; + AcpiGbl_CmSingleStep = FALSE; + AcpiGbl_Shutdown = FALSE; + AcpiGbl_NsLookupCount = 0; + AcpiGbl_PsFindCount = 0; + AcpiGbl_AcpiHardwarePresent = TRUE; + AcpiGbl_LastOwnerIdIndex = 0; + AcpiGbl_NextOwnerIdOffset = 0; + AcpiGbl_TraceDbgLevel = 0; + AcpiGbl_TraceDbgLayer = 0; + AcpiGbl_DebuggerConfiguration = DEBUGGER_THREADING; + AcpiGbl_OsiMutex = NULL; + AcpiGbl_RegMethodsExecuted = FALSE; + + /* Hardware oriented */ + + AcpiGbl_EventsInitialized = FALSE; + AcpiGbl_SystemAwakeAndRunning = TRUE; + + /* Namespace */ + + AcpiGbl_ModuleCodeList = NULL; + AcpiGbl_RootNode = NULL; + AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME; + AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED; + AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_DEVICE; + AcpiGbl_RootNodeStruct.Parent = NULL; + AcpiGbl_RootNodeStruct.Child = NULL; + AcpiGbl_RootNodeStruct.Peer = NULL; + AcpiGbl_RootNodeStruct.Object = NULL; + + +#ifdef ACPI_DISASSEMBLER + AcpiGbl_ExternalList = NULL; + AcpiGbl_NumExternalMethods = 0; + AcpiGbl_ResolvedExternalMethods = 0; +#endif + +#ifdef ACPI_DEBUG_OUTPUT + AcpiGbl_LowestStackPointer = ACPI_CAST_PTR (ACPI_SIZE, ACPI_SIZE_MAX); +#endif + +#ifdef ACPI_DBG_TRACK_ALLOCATIONS + AcpiGbl_DisplayFinalMemStats = FALSE; + AcpiGbl_DisableMemTracking = FALSE; +#endif + + ACPI_DEBUGGER_EXEC (AcpiGbl_DbTerminateThreads = FALSE); + + return_ACPI_STATUS (AE_OK); +} + + /****************************************************************************** * * FUNCTION: AcpiUtTerminate diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utlock.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utlock.c index b19ee4f810..b3e4cb4e3e 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utlock.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utlock.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utmath.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utmath.c index d50e7483d1..c781c7e1a0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utmath.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utmath.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utmisc.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utmisc.c index 8f5e43cdaf..69d8350666 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utmisc.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utmisc.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utmutex.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utmutex.c index dc26999c4e..168afa3e08 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utmutex.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utmutex.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utobject.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utobject.c index 1129fa7279..0fdef14e1d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utobject.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utobject.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -472,7 +472,7 @@ AcpiUtValidInternalObject ( default: ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "%p is not not an ACPI operand obj [%s]\n", + "%p is not an ACPI operand obj [%s]\n", Object, AcpiUtGetDescriptorName (Object))); break; } diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utosi.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utosi.c index 55a1d92653..a001d06bd8 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utosi.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utosi.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -122,6 +122,34 @@ #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utosi") + +/****************************************************************************** + * + * ACPICA policy for new _OSI strings: + * + * It is the stated policy of ACPICA that new _OSI strings will be integrated + * into this module as soon as possible after they are defined. It is strongly + * recommended that all ACPICA hosts mirror this policy and integrate any + * changes to this module as soon as possible. There are several historical + * reasons behind this policy: + * + * 1) New BIOSs tend to test only the case where the host responds TRUE to + * the latest version of Windows, which would respond to the latest/newest + * _OSI string. Not responding TRUE to the latest version of Windows will + * risk executing untested code paths throughout the DSDT and SSDTs. + * + * 2) If a new _OSI string is recognized only after a significant delay, this + * has the potential to cause problems on existing working machines because + * of the possibility that a new and different path through the ASL code + * will be executed. + * + * 3) New _OSI strings are tending to come out about once per year. A delay + * in recognizing a new string for a significant amount of time risks the + * release of another string which only compounds the initial problem. + * + *****************************************************************************/ + + /* * Strings supported by the _OSI predefined control method (which is * implemented internally within this module.) @@ -150,6 +178,7 @@ static ACPI_INTERFACE_INFO AcpiDefaultSupportedInterfaces[] = {"Windows 2006 SP2", NULL, 0, ACPI_OSI_WIN_VISTA_SP2}, /* Windows Vista SP2 - Added 09/2010 */ {"Windows 2009", NULL, 0, ACPI_OSI_WIN_7}, /* Windows 7 and Server 2008 R2 - Added 09/2009 */ {"Windows 2012", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8 and Server 2012 - Added 08/2012 */ + {"Windows 2013", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8.1 and Server 2012 R2 - Added 01/2014 */ /* Feature Group Strings */ diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utownerid.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utownerid.c index a6cd6b901b..ae42970eac 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utownerid.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utownerid.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utpredef.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utpredef.c index d02acdd96b..d20e90583a 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utpredef.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utpredef.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utprint.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utprint.c new file mode 100644 index 0000000000..543bad8fce --- /dev/null +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utprint.c @@ -0,0 +1,883 @@ +/****************************************************************************** + * + * Module Name: utprint - Formatted printing routines + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#include "acpi.h" +#include "accommon.h" + +#define _COMPONENT ACPI_UTILITIES + ACPI_MODULE_NAME ("utprint") + + +#define ACPI_FORMAT_SIGN 0x01 +#define ACPI_FORMAT_SIGN_PLUS 0x02 +#define ACPI_FORMAT_SIGN_PLUS_SPACE 0x04 +#define ACPI_FORMAT_ZERO 0x08 +#define ACPI_FORMAT_LEFT 0x10 +#define ACPI_FORMAT_UPPER 0x20 +#define ACPI_FORMAT_PREFIX 0x40 + + +/* Local prototypes */ + +static ACPI_SIZE +AcpiUtBoundStringLength ( + const char *String, + ACPI_SIZE Count); + +static char * +AcpiUtBoundStringOutput ( + char *String, + const char *End, + char c); + +static char * +AcpiUtFormatNumber ( + char *String, + char *End, + UINT64 Number, + UINT8 Base, + INT32 Width, + INT32 Precision, + UINT8 Type); + +static char * +AcpiUtPutNumber ( + char *String, + UINT64 Number, + UINT8 Base, + BOOLEAN Upper); + + +/* Module globals */ + +static const char AcpiGbl_LowerHexDigits[] = "0123456789abcdef"; +static const char AcpiGbl_UpperHexDigits[] = "0123456789ABCDEF"; + + +/******************************************************************************* + * + * FUNCTION: AcpiUtBoundStringLength + * + * PARAMETERS: String - String with boundary + * Count - Boundary of the string + * + * RETURN: Length of the string. Less than or equal to Count. + * + * DESCRIPTION: Calculate the length of a string with boundary. + * + ******************************************************************************/ + +static ACPI_SIZE +AcpiUtBoundStringLength ( + const char *String, + ACPI_SIZE Count) +{ + UINT32 Length = 0; + + + while (*String && Count) + { + Length++; + String++; + Count--; + } + + return (Length); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtBoundStringOutput + * + * PARAMETERS: String - String with boundary + * End - Boundary of the string + * c - Character to be output to the string + * + * RETURN: Updated position for next valid character + * + * DESCRIPTION: Output a character into a string with boundary check. + * + ******************************************************************************/ + +static char * +AcpiUtBoundStringOutput ( + char *String, + const char *End, + char c) +{ + + if (String < End) + { + *String = c; + } + + ++String; + return (String); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtPutNumber + * + * PARAMETERS: String - Buffer to hold reverse-ordered string + * Number - Integer to be converted + * Base - Base of the integer + * Upper - Whether or not using upper cased digits + * + * RETURN: Updated position for next valid character + * + * DESCRIPTION: Convert an integer into a string, note that, the string holds a + * reversed ordered number without the trailing zero. + * + ******************************************************************************/ + +static char * +AcpiUtPutNumber ( + char *String, + UINT64 Number, + UINT8 Base, + BOOLEAN Upper) +{ + const char *Digits; + UINT64 DigitIndex; + char *Pos; + + + Pos = String; + Digits = Upper ? AcpiGbl_UpperHexDigits : AcpiGbl_LowerHexDigits; + + if (Number == 0) + { + *(Pos++) = '0'; + } + else + { + while (Number) + { + (void) AcpiUtDivide (Number, Base, &Number, &DigitIndex); + *(Pos++) = Digits[DigitIndex]; + } + } + + /* *(Pos++) = '0'; */ + return (Pos); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtScanNumber + * + * PARAMETERS: String - String buffer + * NumberPtr - Where the number is returned + * + * RETURN: Updated position for next valid character + * + * DESCRIPTION: Scan a string for a decimal integer. + * + ******************************************************************************/ + +const char * +AcpiUtScanNumber ( + const char *String, + UINT64 *NumberPtr) +{ + UINT64 Number = 0; + + + while (ACPI_IS_DIGIT (*String)) + { + Number *= 10; + Number += *(String++) - '0'; + } + + *NumberPtr = Number; + return (String); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtPrintNumber + * + * PARAMETERS: String - String buffer + * Number - The number to be converted + * + * RETURN: Updated position for next valid character + * + * DESCRIPTION: Print a decimal integer into a string. + * + ******************************************************************************/ + +const char * +AcpiUtPrintNumber ( + char *String, + UINT64 Number) +{ + char AsciiString[20]; + const char *Pos1; + char *Pos2; + + + Pos1 = AcpiUtPutNumber (AsciiString, Number, 10, FALSE); + Pos2 = String; + + while (Pos1 != AsciiString) + { + *(Pos2++) = *(--Pos1); + } + + *Pos2 = 0; + return (String); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtFormatNumber + * + * PARAMETERS: String - String buffer with boundary + * End - Boundary of the string + * Number - The number to be converted + * Base - Base of the integer + * Width - Field width + * Precision - Precision of the integer + * Type - Special printing flags + * + * RETURN: Updated position for next valid character + * + * DESCRIPTION: Print an integer into a string with any base and any precision. + * + ******************************************************************************/ + +static char * +AcpiUtFormatNumber ( + char *String, + char *End, + UINT64 Number, + UINT8 Base, + INT32 Width, + INT32 Precision, + UINT8 Type) +{ + char *Pos; + char Sign; + char Zero; + BOOLEAN NeedPrefix; + BOOLEAN Upper; + INT32 i; + char ReversedString[66]; + + + /* Parameter validation */ + + if (Base < 2 || Base > 16) + { + return (NULL); + } + + if (Type & ACPI_FORMAT_LEFT) + { + Type &= ~ACPI_FORMAT_ZERO; + } + + NeedPrefix = ((Type & ACPI_FORMAT_PREFIX) && Base != 10) ? TRUE : FALSE; + Upper = (Type & ACPI_FORMAT_UPPER) ? TRUE : FALSE; + Zero = (Type & ACPI_FORMAT_ZERO) ? '0' : ' '; + + /* Calculate size according to sign and prefix */ + + Sign = '\0'; + if (Type & ACPI_FORMAT_SIGN) + { + if ((INT64) Number < 0) + { + Sign = '-'; + Number = - (INT64) Number; + Width--; + } + else if (Type & ACPI_FORMAT_SIGN_PLUS) + { + Sign = '+'; + Width--; + } + else if (Type & ACPI_FORMAT_SIGN_PLUS_SPACE) + { + Sign = ' '; + Width--; + } + } + if (NeedPrefix) + { + Width--; + if (Base == 16) + { + Width--; + } + } + + /* Generate full string in reverse order */ + + Pos = AcpiUtPutNumber (ReversedString, Number, Base, Upper); + i = ACPI_PTR_DIFF (Pos, ReversedString); + + /* Printing 100 using %2d gives "100", not "00" */ + + if (i > Precision) + { + Precision = i; + } + + Width -= Precision; + + /* Output the string */ + + if (!(Type & (ACPI_FORMAT_ZERO | ACPI_FORMAT_LEFT))) + { + while (--Width >= 0) + { + String = AcpiUtBoundStringOutput (String, End, ' '); + } + } + if (Sign) + { + String = AcpiUtBoundStringOutput (String, End, Sign); + } + if (NeedPrefix) + { + String = AcpiUtBoundStringOutput (String, End, '0'); + if (Base == 16) + { + String = AcpiUtBoundStringOutput (String, End, + Upper ? 'X' : 'x'); + } + } + if (!(Type & ACPI_FORMAT_LEFT)) + { + while (--Width >= 0) + { + String = AcpiUtBoundStringOutput (String, End, Zero); + } + } + + while (i <= --Precision) + { + String = AcpiUtBoundStringOutput (String, End, '0'); + } + while (--i >= 0) + { + String = AcpiUtBoundStringOutput (String, End, + ReversedString[i]); + } + while (--Width >= 0) + { + String = AcpiUtBoundStringOutput (String, End, ' '); + } + + return (String); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtVsnprintf + * + * PARAMETERS: String - String with boundary + * Size - Boundary of the string + * Format - Standard printf format + * Args - Argument list + * + * RETURN: Number of bytes actually written. + * + * DESCRIPTION: Formatted output to a string using argument list pointer. + * + ******************************************************************************/ + +int +AcpiUtVsnprintf ( + char *String, + ACPI_SIZE Size, + const char *Format, + va_list Args) +{ + UINT8 Base = 10; + UINT8 Type = 0; + INT32 Width = -1; + INT32 Precision = -1; + char Qualifier = 0; + UINT64 Number; + char *Pos; + char *End; + char c; + const char *s; + const void *p; + INT32 Length; + int i; + + + Pos = String; + End = String + Size; + + for (; *Format; ++Format) + { + if (*Format != '%') + { + Pos = AcpiUtBoundStringOutput (Pos, End, *Format); + continue; + } + + /* Process sign */ + + do + { + ++Format; + if (*Format == '#') + { + Type |= ACPI_FORMAT_PREFIX; + } + else if (*Format == '0') + { + Type |= ACPI_FORMAT_ZERO; + } + else if (*Format == '+') + { + Type |= ACPI_FORMAT_SIGN_PLUS; + } + else if (*Format == ' ') + { + Type |= ACPI_FORMAT_SIGN_PLUS_SPACE; + } + else if (*Format == '-') + { + Type |= ACPI_FORMAT_LEFT; + } + else + { + break; + } + } while (1); + + /* Process width */ + + Width = -1; + if (ACPI_IS_DIGIT (*Format)) + { + Format = AcpiUtScanNumber (Format, &Number); + Width = (INT32) Number; + } + else if (*Format == '*') + { + ++Format; + Width = va_arg (Args, int); + if (Width < 0) + { + Width = -Width; + Type |= ACPI_FORMAT_LEFT; + } + } + + /* Process precision */ + + Precision = -1; + if (*Format == '.') + { + ++Format; + if (ACPI_IS_DIGIT(*Format)) + { + Format = AcpiUtScanNumber (Format, &Number); + Precision = (INT32) Number; + } + else if (*Format == '*') + { + ++Format; + Precision = va_arg (Args, int); + } + if (Precision < 0) + { + Precision = 0; + } + } + + /* Process qualifier */ + + Qualifier = -1; + if (*Format == 'h' || *Format == 'l' || *Format == 'L') + { + Qualifier = *Format; + ++Format; + + if (Qualifier == 'l' && *Format == 'l') + { + Qualifier = 'L'; + ++Format; + } + } + + switch (*Format) + { + case '%': + + Pos = AcpiUtBoundStringOutput (Pos, End, '%'); + continue; + + case 'c': + + if (!(Type & ACPI_FORMAT_LEFT)) + { + while (--Width > 0) + { + Pos = AcpiUtBoundStringOutput (Pos, End, ' '); + } + } + + c = (char) va_arg (Args, int); + Pos = AcpiUtBoundStringOutput (Pos, End, c); + + while (--Width > 0) + { + Pos = AcpiUtBoundStringOutput (Pos, End, ' '); + } + continue; + + case 's': + + s = va_arg (Args, char *); + if (!s) + { + s = ""; + } + Length = AcpiUtBoundStringLength (s, Precision); + if (!(Type & ACPI_FORMAT_LEFT)) + { + while (Length < Width--) + { + Pos = AcpiUtBoundStringOutput (Pos, End, ' '); + } + } + for (i = 0; i < Length; ++i) + { + Pos = AcpiUtBoundStringOutput (Pos, End, *s); + ++s; + } + while (Length < Width--) + { + Pos = AcpiUtBoundStringOutput (Pos, End, ' '); + } + continue; + + case 'o': + + Base = 8; + break; + + case 'X': + + Type |= ACPI_FORMAT_UPPER; + + case 'x': + + Base = 16; + break; + + case 'd': + case 'i': + + Type |= ACPI_FORMAT_SIGN; + + case 'u': + + break; + + case 'p': + + if (Width == -1) + { + Width = 2 * sizeof (void *); + Type |= ACPI_FORMAT_ZERO; + } + + p = va_arg (Args, void *); + Pos = AcpiUtFormatNumber (Pos, End, + ACPI_TO_INTEGER (p), 16, Width, Precision, Type); + continue; + + default: + + Pos = AcpiUtBoundStringOutput (Pos, End, '%'); + if (*Format) + { + Pos = AcpiUtBoundStringOutput (Pos, End, *Format); + } + else + { + --Format; + } + continue; + } + + if (Qualifier == 'L') + { + Number = va_arg (Args, UINT64); + if (Type & ACPI_FORMAT_SIGN) + { + Number = (INT64) Number; + } + } + else if (Qualifier == 'l') + { + Number = va_arg (Args, unsigned long); + if (Type & ACPI_FORMAT_SIGN) + { + Number = (INT32) Number; + } + } + else if (Qualifier == 'h') + { + Number = (UINT16) va_arg (Args, int); + if (Type & ACPI_FORMAT_SIGN) + { + Number = (INT16) Number; + } + } + else + { + Number = va_arg (Args, unsigned int); + if (Type & ACPI_FORMAT_SIGN) + { + Number = (signed int) Number; + } + } + + Pos = AcpiUtFormatNumber (Pos, End, Number, Base, + Width, Precision, Type); + } + + if (Size > 0) + { + if (Pos < End) + { + *Pos = '\0'; + } + else + { + End[-1] = '\0'; + } + } + + return (ACPI_PTR_DIFF (Pos, String)); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtSnprintf + * + * PARAMETERS: String - String with boundary + * Size - Boundary of the string + * Format, ... - Standard printf format + * + * RETURN: Number of bytes actually written. + * + * DESCRIPTION: Formatted output to a string. + * + ******************************************************************************/ + +int +AcpiUtSnprintf ( + char *String, + ACPI_SIZE Size, + const char *Format, + ...) +{ + va_list Args; + int Length; + + + va_start (Args, Format); + Length = AcpiUtVsnprintf (String, Size, Format, Args); + va_end (Args); + + return (Length); +} + + +#ifdef ACPI_APPLICATION +/******************************************************************************* + * + * FUNCTION: AcpiUtFileVprintf + * + * PARAMETERS: File - File descriptor + * Format - Standard printf format + * Args - Argument list + * + * RETURN: Number of bytes actually written. + * + * DESCRIPTION: Formatted output to a file using argument list pointer. + * + ******************************************************************************/ + +int +AcpiUtFileVprintf ( + ACPI_FILE File, + const char *Format, + va_list Args) +{ + ACPI_CPU_FLAGS Flags; + int Length; + + + Flags = AcpiOsAcquireLock (AcpiGbl_PrintLock); + Length = AcpiUtVsnprintf (AcpiGbl_PrintBuffer, + sizeof (AcpiGbl_PrintBuffer), Format, Args); + + (void) AcpiOsWriteFile (File, AcpiGbl_PrintBuffer, Length, 1); + AcpiOsReleaseLock (AcpiGbl_PrintLock, Flags); + + return (Length); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtFilePrintf + * + * PARAMETERS: File - File descriptor + * Format, ... - Standard printf format + * + * RETURN: Number of bytes actually written. + * + * DESCRIPTION: Formatted output to a file. + * + ******************************************************************************/ + +int +AcpiUtFilePrintf ( + ACPI_FILE File, + const char *Format, + ...) +{ + va_list Args; + int Length; + + + va_start (Args, Format); + Length = AcpiUtFileVprintf (File, Format, Args); + va_end (Args); + + return (Length); +} +#endif diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utresrc.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utresrc.c index cf11295c9f..f5af86f972 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utresrc.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utresrc.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -125,7 +125,7 @@ ACPI_MODULE_NAME ("utresrc") -#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) +#if defined(ACPI_DEBUG_OUTPUT) || defined (ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) /* * Strings used to decode resource descriptors. diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utstate.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utstate.c index 2ea6ca035e..fc99c56424 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utstate.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utstate.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utstring.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utstring.c index a8c928dc12..c4ead029f3 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utstring.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utstring.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -492,7 +492,7 @@ AcpiUtPrintString ( } AcpiOsPrintf ("\""); - for (i = 0; String[i] && (i < MaxLength); i++) + for (i = 0; (i < MaxLength) && String[i]; i++) { /* Escape sequences */ @@ -757,3 +757,78 @@ UtConvertBackslashes ( } } #endif + +#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) +/******************************************************************************* + * + * FUNCTION: AcpiUtSafeStrcpy, AcpiUtSafeStrcat, AcpiUtSafeStrncat + * + * PARAMETERS: Adds a "DestSize" parameter to each of the standard string + * functions. This is the size of the Destination buffer. + * + * RETURN: TRUE if the operation would overflow the destination buffer. + * + * DESCRIPTION: Safe versions of standard Clib string functions. Ensure that + * the result of the operation will not overflow the output string + * buffer. + * + * NOTE: These functions are typically only helpful for processing + * user input and command lines. For most ACPICA code, the + * required buffer length is precisely calculated before buffer + * allocation, so the use of these functions is unnecessary. + * + ******************************************************************************/ + +BOOLEAN +AcpiUtSafeStrcpy ( + char *Dest, + ACPI_SIZE DestSize, + char *Source) +{ + + if (ACPI_STRLEN (Source) >= DestSize) + { + return (TRUE); + } + + ACPI_STRCPY (Dest, Source); + return (FALSE); +} + +BOOLEAN +AcpiUtSafeStrcat ( + char *Dest, + ACPI_SIZE DestSize, + char *Source) +{ + + if ((ACPI_STRLEN (Dest) + ACPI_STRLEN (Source)) >= DestSize) + { + return (TRUE); + } + + ACPI_STRCAT (Dest, Source); + return (FALSE); +} + +BOOLEAN +AcpiUtSafeStrncat ( + char *Dest, + ACPI_SIZE DestSize, + char *Source, + ACPI_SIZE MaxTransferLength) +{ + ACPI_SIZE ActualTransferLength; + + + ActualTransferLength = ACPI_MIN (MaxTransferLength, ACPI_STRLEN (Source)); + + if ((ACPI_STRLEN (Dest) + ActualTransferLength) >= DestSize) + { + return (TRUE); + } + + ACPI_STRNCAT (Dest, Source, MaxTransferLength); + return (FALSE); +} +#endif diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/uttrack.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/uttrack.c index 26a514bbbc..df04aa3a57 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/uttrack.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/uttrack.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -223,10 +223,23 @@ AcpiUtAllocateAndTrack ( ACPI_STATUS Status; - Allocation = AcpiUtAllocate (Size + sizeof (ACPI_DEBUG_MEM_HEADER), - Component, Module, Line); + /* Check for an inadvertent size of zero bytes */ + + if (!Size) + { + ACPI_WARNING ((Module, Line, + "Attempt to allocate zero bytes, allocating 1 byte")); + Size = 1; + } + + Allocation = AcpiOsAllocate (Size + sizeof (ACPI_DEBUG_MEM_HEADER)); if (!Allocation) { + /* Report allocation error */ + + ACPI_WARNING ((Module, Line, + "Could not allocate size %u", (UINT32) Size)); + return (NULL); } @@ -276,8 +289,16 @@ AcpiUtAllocateZeroedAndTrack ( ACPI_STATUS Status; - Allocation = AcpiUtAllocateZeroed (Size + sizeof (ACPI_DEBUG_MEM_HEADER), - Component, Module, Line); + /* Check for an inadvertent size of zero bytes */ + + if (!Size) + { + ACPI_WARNING ((Module, Line, + "Attempt to allocate zero bytes, allocating 1 byte")); + Size = 1; + } + + Allocation = AcpiOsAllocateZeroed (Size + sizeof (ACPI_DEBUG_MEM_HEADER)); if (!Allocation) { /* Report allocation error */ @@ -358,7 +379,8 @@ AcpiUtFreeAndTrack ( } AcpiOsFree (DebugBlock); - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p freed\n", Allocation)); + ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p freed (block %p)\n", + Allocation, DebugBlock)); return_VOID; } diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utuuid.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utuuid.c new file mode 100644 index 0000000000..f5c2e40c03 --- /dev/null +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utuuid.c @@ -0,0 +1,175 @@ +/****************************************************************************** + * + * Module Name: utuuid -- UUID support functions + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#define __UTUUID_C__ + +#include "acpi.h" +#include "accommon.h" + +#define _COMPONENT ACPI_COMPILER + ACPI_MODULE_NAME ("utuuid") + + +/* + * UUID support functions. + * + * This table is used to convert an input UUID ascii string to a 16 byte + * buffer and the reverse. The table maps a UUID buffer index 0-15 to + * the index within the 36-byte UUID string where the associated 2-byte + * hex value can be found. + * + * 36-byte UUID strings are of the form: + * aabbccdd-eeff-gghh-iijj-kkllmmnnoopp + * Where aa-pp are one byte hex numbers, made up of two hex digits + * + * Note: This table is basically the inverse of the string-to-offset table + * found in the ACPI spec in the description of the ToUUID macro. + */ +const UINT8 AcpiGbl_MapToUuidOffset[UUID_BUFFER_LENGTH] = +{ + 6,4,2,0,11,9,16,14,19,21,24,26,28,30,32,34 +}; + + +/******************************************************************************* + * + * FUNCTION: AcpiUtConvertStringToUuid + * + * PARAMETERS: InString - 36-byte formatted UUID string + * UuidBuffer - Where the 16-byte UUID buffer is returned + * + * RETURN: None. Output data is returned in the UuidBuffer + * + * DESCRIPTION: Convert a 36-byte formatted UUID string to 16-byte UUID buffer + * + ******************************************************************************/ + +void +AcpiUtConvertStringToUuid ( + char *InString, + UINT8 *UuidBuffer) +{ + UINT32 i; + + + for (i = 0; i < UUID_BUFFER_LENGTH; i++) + { + UuidBuffer[i] = + (AcpiUtAsciiCharToHex (InString[AcpiGbl_MapToUuidOffset[i]]) << 4); + + UuidBuffer[i] |= + AcpiUtAsciiCharToHex (InString[AcpiGbl_MapToUuidOffset[i] + 1]); + } +} diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utxface.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utxface.c index c1b3c4628d..e915b84385 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utxface.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utxface.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -115,6 +115,7 @@ #define __UTXFACE_C__ +#define EXPORT_ACPI_INTERFACES #include "acpi.h" #include "accommon.h" @@ -186,7 +187,7 @@ AcpiTerminate ( return_ACPI_STATUS (Status); } -ACPI_EXPORT_SYMBOL (AcpiTerminate) +ACPI_EXPORT_SYMBOL_INIT (AcpiTerminate) #ifndef ACPI_ASL_COMPILER diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utxferror.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utxferror.c index 341305022c..081bfd917b 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utxferror.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utxferror.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -114,6 +114,7 @@ *****************************************************************************/ #define __UTXFERROR_C__ +#define EXPORT_ACPI_INTERFACES #include "acpi.h" #include "accommon.h" @@ -127,6 +128,8 @@ * tools/applications. */ +#ifndef ACPI_NO_ERROR_MESSAGES /* Entire module */ + /******************************************************************************* * * FUNCTION: AcpiError @@ -361,3 +364,5 @@ AcpiBiosWarning ( } ACPI_EXPORT_SYMBOL (AcpiBiosWarning) + +#endif /* ACPI_NO_ERROR_MESSAGES */ diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utxfinit.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utxfinit.c index a01a1d9664..b9b1326cc3 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utxfinit.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utxfinit.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -115,6 +115,7 @@ #define __UTXFINIT_C__ +#define EXPORT_ACPI_INTERFACES #include "acpi.h" #include "accommon.h" @@ -202,11 +203,19 @@ AcpiInitializeSubsystem ( /* If configured, initialize the AML debugger */ - ACPI_DEBUGGER_EXEC (Status = AcpiDbInitialize ()); - return_ACPI_STATUS (Status); +#ifdef ACPI_DEBUGGER + Status = AcpiDbInitialize (); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, "During Debugger initialization")); + return_ACPI_STATUS (Status); + } +#endif + + return_ACPI_STATUS (AE_OK); } -ACPI_EXPORT_SYMBOL (AcpiInitializeSubsystem) +ACPI_EXPORT_SYMBOL_INIT (AcpiInitializeSubsystem) /******************************************************************************* @@ -328,7 +337,7 @@ AcpiEnableSubsystem ( return_ACPI_STATUS (Status); } -ACPI_EXPORT_SYMBOL (AcpiEnableSubsystem) +ACPI_EXPORT_SYMBOL_INIT (AcpiEnableSubsystem) /******************************************************************************* @@ -427,4 +436,4 @@ AcpiInitializeObjects ( return_ACPI_STATUS (Status); } -ACPI_EXPORT_SYMBOL (AcpiInitializeObjects) +ACPI_EXPORT_SYMBOL_INIT (AcpiInitializeObjects) diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utxfmutex.c b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utxfmutex.c index af335d3c84..52ca318db0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utxfmutex.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utxfmutex.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acapps.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acapps.h index eefa5d6b74..6536048d63 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acapps.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acapps.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -124,7 +124,7 @@ /* Common info for tool signons */ #define ACPICA_NAME "Intel ACPI Component Architecture" -#define ACPICA_COPYRIGHT "Copyright (c) 2000 - 2013 Intel Corporation" +#define ACPICA_COPYRIGHT "Copyright (c) 2000 - 2014 Intel Corporation" #if ACPI_MACHINE_WIDTH == 64 #define ACPI_WIDTH "-64" @@ -156,10 +156,13 @@ /* Macros for usage messages */ #define ACPI_USAGE_HEADER(Usage) \ - printf ("Usage: %s\nOptions:\n", Usage); + AcpiOsPrintf ("Usage: %s\nOptions:\n", Usage); + +#define ACPI_USAGE_TEXT(Description) \ + AcpiOsPrintf (Description); #define ACPI_OPTION(Name, Description) \ - printf (" %-18s%s\n", Name, Description); + AcpiOsPrintf (" %-18s%s\n", Name, Description); #define FILE_SUFFIX_DISASSEMBLY "dsl" @@ -186,6 +189,14 @@ extern int AcpiGbl_SubOptChar; extern char *AcpiGbl_Optarg; +/* + * cmfsize - Common get file size function + */ +UINT32 +CmGetFileSize ( + ACPI_FILE File); + + #ifndef ACPI_DUMP_APP /* * adisasm @@ -195,8 +206,7 @@ AdAmlDisassemble ( BOOLEAN OutToFile, char *Filename, char *Prefix, - char **OutFilename, - BOOLEAN GetAllTables); + char **OutFilename); void AdPrintStatistics ( @@ -213,8 +223,7 @@ AdDumpTables ( ACPI_STATUS AdGetLocalTables ( - char *Filename, - BOOLEAN GetAllTables); + void); ACPI_STATUS AdParseTable ( diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acbuffer.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acbuffer.h index e68dc0f211..3228bcad2f 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acbuffer.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acbuffer.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/accommon.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/accommon.h index 4b7f6bc481..57735c5dec 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/accommon.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/accommon.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acconfig.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acconfig.h index dd0799a4cf..3c7a3bd1df 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acconfig.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acconfig.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -156,7 +156,9 @@ * Should the subsystem abort the loading of an ACPI table if the * table checksum is incorrect? */ +#ifndef ACPI_CHECKSUM_ABORT #define ACPI_CHECKSUM_ABORT FALSE +#endif /* * Generate a version of ACPICA that only supports "reduced hardware" @@ -173,7 +175,9 @@ * ACPI PM timer * FACS table (Waking vectors and Global Lock) */ +#ifndef ACPI_REDUCED_HARDWARE #define ACPI_REDUCED_HARDWARE FALSE +#endif /****************************************************************************** @@ -289,6 +293,25 @@ #define ACPI_NUM_SxW_METHODS 5 +/****************************************************************************** + * + * Miscellaneous constants + * + *****************************************************************************/ + +/* UUID constants */ + +#define UUID_BUFFER_LENGTH 16 /* Length of UUID in memory */ +#define UUID_STRING_LENGTH 36 /* Total length of a UUID string */ + +/* Positions for required hyphens (dashes) in UUID strings */ + +#define UUID_HYPHEN1_OFFSET 8 +#define UUID_HYPHEN2_OFFSET 13 +#define UUID_HYPHEN3_OFFSET 18 +#define UUID_HYPHEN4_OFFSET 23 + + /****************************************************************************** * * ACPI AML Debugger diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acdebug.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acdebug.h index 9486b214cc..b6105c2f7b 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acdebug.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acdebug.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -236,6 +236,11 @@ void AcpiDbGenerateSci ( void)) +void +AcpiDbExecuteTest ( + char *TypeArg); + + /* * dbconvert - miscellaneous conversion routines */ @@ -444,11 +449,6 @@ AcpiDbGetTableFromFile ( char *Filename, ACPI_TABLE_HEADER **Table); -ACPI_STATUS -AcpiDbReadTableFromFile ( - char *Filename, - ACPI_TABLE_HEADER **Table); - /* * dbhistry - debugger HISTORY command @@ -465,6 +465,10 @@ char * AcpiDbGetFromHistory ( char *CommandNumArg); +char * +AcpiDbGetHistoryByIndex ( + UINT32 CommanddNum); + /* * dbinput - user front-end to the AML debugger diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acdisasm.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acdisasm.h index 571efcee9a..21e26e6d4b 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acdisasm.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acdisasm.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -141,14 +141,14 @@ typedef const struct acpi_dmtable_info } ACPI_DMTABLE_INFO; +/* Values for Flags field above */ + #define DT_LENGTH 0x01 /* Field is a subtable length */ #define DT_FLAG 0x02 /* Field is a flag value */ #define DT_NON_ZERO 0x04 /* Field must be non-zero */ - -/* TBD: Not used at this time */ - -#define DT_OPTIONAL 0x08 -#define DT_COUNT 0x10 +#define DT_OPTIONAL 0x08 /* Field is optional */ +#define DT_DESCRIBES_OPTIONAL 0x10 /* Field describes an optional field (length, etc.) */ +#define DT_COUNT 0x20 /* Currently not used */ /* * Values for Opcode above. @@ -209,16 +209,20 @@ typedef enum ACPI_DMT_ASF, ACPI_DMT_DMAR, + ACPI_DMT_DMAR_SCOPE, ACPI_DMT_EINJACT, ACPI_DMT_EINJINST, ACPI_DMT_ERSTACT, ACPI_DMT_ERSTINST, ACPI_DMT_FADTPM, + ACPI_DMT_GTDT, ACPI_DMT_HEST, ACPI_DMT_HESTNTFY, ACPI_DMT_HESTNTYP, ACPI_DMT_IVRS, + ACPI_DMT_LPIT, ACPI_DMT_MADT, + ACPI_DMT_PCCT, ACPI_DMT_PMTT, ACPI_DMT_SLIC, ACPI_DMT_SRAT, @@ -316,6 +320,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2Device[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2Addr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2Size[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2Name[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2OemData[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbgp[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmarHdr[]; @@ -324,6 +329,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar3[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar4[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoEcdt[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoEinj[]; @@ -341,6 +347,10 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoFpdt0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoFpdt1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoGas[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoGtdt[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoGtdtHdr[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoGtdt0[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoGtdt0a[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoGtdt1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHeader[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest0[]; @@ -353,6 +363,9 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest9[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHestNotify[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHestBank[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHpet[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoLpitHdr[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoLpit0[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoLpit1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs1[]; @@ -375,6 +388,8 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt9[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt10[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt11[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt12[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt13[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt14[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadtHdr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg0[]; @@ -396,7 +411,9 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt1a[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmttHdr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcctHdr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct0[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoS3pt[]; @@ -509,6 +526,10 @@ void AcpiDmDumpFpdt ( ACPI_TABLE_HEADER *Table); +void +AcpiDmDumpGtdt ( + ACPI_TABLE_HEADER *Table); + void AcpiDmDumpHest ( ACPI_TABLE_HEADER *Table); @@ -517,6 +538,10 @@ void AcpiDmDumpIvrs ( ACPI_TABLE_HEADER *Table); +void +AcpiDmDumpLpit ( + ACPI_TABLE_HEADER *Table); + void AcpiDmDumpMadt ( ACPI_TABLE_HEADER *Table); @@ -620,6 +645,14 @@ void AcpiDmMethodFlags ( ACPI_PARSE_OBJECT *Op); +void +AcpiDmDisplayTargetPathname ( + ACPI_PARSE_OBJECT *Op); + +void +AcpiDmNotifyDescription ( + ACPI_PARSE_OBJECT *Op); + void AcpiDmPredefinedDescription ( ACPI_PARSE_OBJECT *Op); @@ -700,13 +733,17 @@ AcpiDmByteList ( ACPI_PARSE_OBJECT *Op); void -AcpiDmIsEisaId ( +AcpiDmCheckForHardwareId ( ACPI_PARSE_OBJECT *Op); void -AcpiDmEisaId ( +AcpiDmDecompressEisaId ( UINT32 EncodedId); +BOOLEAN +AcpiDmIsUuidBuffer ( + ACPI_PARSE_OBJECT *Op); + BOOLEAN AcpiDmIsUnicodeBuffer ( ACPI_PARSE_OBJECT *Op); @@ -740,11 +777,19 @@ AcpiDmClearExternalFileList ( void); void -AcpiDmAddToExternalList ( +AcpiDmAddOpToExternalList ( ACPI_PARSE_OBJECT *Op, char *Path, UINT8 Type, - UINT32 Value); + UINT32 Value, + UINT16 Flags); + +void +AcpiDmAddNodeToExternalList ( + ACPI_NAMESPACE_NODE *Node, + UINT8 Type, + UINT32 Value, + UINT16 Flags); void AcpiDmAddExternalsToNamespace ( diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acdispat.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acdispat.h index 3b1ff6de16..bfccbf1a62 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acdispat.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acdispat.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -245,13 +245,15 @@ AcpiDsInitFieldObjects ( /* - * dsload - Parser/Interpreter interface, pass 1 namespace load callbacks + * dsload - Parser/Interpreter interface */ ACPI_STATUS AcpiDsInitCallbacks ( ACPI_WALK_STATE *WalkState, UINT32 PassNumber); +/* dsload - pass 1 namespace load callbacks */ + ACPI_STATUS AcpiDsLoad1BeginOp ( ACPI_WALK_STATE *WalkState, @@ -262,9 +264,8 @@ AcpiDsLoad1EndOp ( ACPI_WALK_STATE *WalkState); -/* - * dsload - Parser/Interpreter interface, pass 2 namespace load callbacks - */ +/* dsload - pass 2 namespace load callbacks */ + ACPI_STATUS AcpiDsLoad2BeginOp ( ACPI_WALK_STATE *WalkState, @@ -329,8 +330,9 @@ AcpiDsMethodDataInit ( * dsmethod - Parser/Interpreter interface - control method parsing */ ACPI_STATUS -AcpiDsParseMethod ( - ACPI_NAMESPACE_NODE *Node); +AcpiDsAutoSerializeMethod ( + ACPI_NAMESPACE_NODE *Node, + ACPI_OPERAND_OBJECT *ObjDesc); ACPI_STATUS AcpiDsCallControlMethod ( diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acevents.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acevents.h index 320511330a..8ca726cfce 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acevents.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acevents.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -216,9 +216,10 @@ AcpiEvFinishGpe ( ACPI_STATUS AcpiEvCreateGpeBlock ( ACPI_NAMESPACE_NODE *GpeDevice, - ACPI_GENERIC_ADDRESS *GpeBlockAddress, + UINT64 Address, + UINT8 SpaceId, UINT32 RegisterCount, - UINT8 GpeBlockBaseNumber, + UINT16 GpeBlockBaseNumber, UINT32 InterruptNumber, ACPI_GPE_BLOCK_INFO **ReturnGpeBlock); @@ -278,9 +279,10 @@ AcpiEvGetGpeDevice ( ACPI_GPE_BLOCK_INFO *GpeBlock, void *Context); -ACPI_GPE_XRUPT_INFO * +ACPI_STATUS AcpiEvGetGpeXruptBlock ( - UINT32 InterruptNumber); + UINT32 InterruptNumber, + ACPI_GPE_XRUPT_INFO **GpeXruptBlock); ACPI_STATUS AcpiEvDeleteGpeXrupt ( diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acexcep.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acexcep.h index 69feb535d8..89d98523be 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acexcep.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acexcep.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acglobal.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acglobal.h index b9ebec5e1f..a3783a4b4d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acglobal.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acglobal.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -117,167 +117,42 @@ #define __ACGLOBAL_H__ -/* - * Ensure that the globals are actually defined and initialized only once. - * - * The use of these macros allows a single list of globals (here) in order - * to simplify maintenance of the code. - */ -#ifdef DEFINE_ACPI_GLOBALS -#define ACPI_EXTERN -#define ACPI_INIT_GLOBAL(a,b) a=b -#else -#define ACPI_EXTERN extern -#define ACPI_INIT_GLOBAL(a,b) a -#endif - - -#ifdef DEFINE_ACPI_GLOBALS - -/* Public globals, available from outside ACPICA subsystem */ - /***************************************************************************** * - * Runtime configuration (static defaults that can be overriden at runtime) + * Globals related to the ACPI tables * ****************************************************************************/ -/* - * Enable "slack" in the AML interpreter? Default is FALSE, and the - * interpreter strictly follows the ACPI specification. Setting to TRUE - * allows the interpreter to ignore certain errors and/or bad AML constructs. - * - * Currently, these features are enabled by this flag: - * - * 1) Allow "implicit return" of last value in a control method - * 2) Allow access beyond the end of an operation region - * 3) Allow access to uninitialized locals/args (auto-init to integer 0) - * 4) Allow ANY object type to be a source operand for the Store() operator - * 5) Allow unresolved references (invalid target name) in package objects - * 6) Enable warning messages for behavior that is not ACPI spec compliant - */ -UINT8 ACPI_INIT_GLOBAL (AcpiGbl_EnableInterpreterSlack, FALSE); +/* Master list of all ACPI tables that were found in the RSDT/XSDT */ -/* - * Automatically serialize ALL control methods? Default is FALSE, meaning - * to use the Serialized/NotSerialized method flags on a per method basis. - * Only change this if the ASL code is poorly written and cannot handle - * reentrancy even though methods are marked "NotSerialized". - */ -UINT8 ACPI_INIT_GLOBAL (AcpiGbl_AllMethodsSerialized, FALSE); +ACPI_GLOBAL (ACPI_TABLE_LIST, AcpiGbl_RootTableList); -/* - * Create the predefined _OSI method in the namespace? Default is TRUE - * because ACPI CA is fully compatible with other ACPI implementations. - * Changing this will revert ACPI CA (and machine ASL) to pre-OSI behavior. - */ -UINT8 ACPI_INIT_GLOBAL (AcpiGbl_CreateOsiMethod, TRUE); +/* DSDT information. Used to check for DSDT corruption */ -/* - * Optionally use default values for the ACPI register widths. Set this to - * TRUE to use the defaults, if an FADT contains incorrect widths/lengths. - */ -UINT8 ACPI_INIT_GLOBAL (AcpiGbl_UseDefaultRegisterWidths, TRUE); - -/* - * Optionally enable output from the AML Debug Object. - */ -UINT8 ACPI_INIT_GLOBAL (AcpiGbl_EnableAmlDebugObject, FALSE); - -/* - * Optionally copy the entire DSDT to local memory (instead of simply - * mapping it.) There are some BIOSs that corrupt or replace the original - * DSDT, creating the need for this option. Default is FALSE, do not copy - * the DSDT. - */ -UINT8 ACPI_INIT_GLOBAL (AcpiGbl_CopyDsdtLocally, FALSE); - -/* - * Optionally truncate I/O addresses to 16 bits. Provides compatibility - * with other ACPI implementations. NOTE: During ACPICA initialization, - * this value is set to TRUE if any Windows OSI strings have been - * requested by the BIOS. - */ -UINT8 ACPI_INIT_GLOBAL (AcpiGbl_TruncateIoAddresses, FALSE); - -/* - * Disable runtime checking and repair of values returned by control methods. - * Use only if the repair is causing a problem on a particular machine. - */ -UINT8 ACPI_INIT_GLOBAL (AcpiGbl_DisableAutoRepair, FALSE); - -/* - * Optionally do not load any SSDTs from the RSDT/XSDT during initialization. - * This can be useful for debugging ACPI problems on some machines. - */ -UINT8 ACPI_INIT_GLOBAL (AcpiGbl_DisableSsdtTableLoad, FALSE); - -/* - * We keep track of the latest version of Windows that has been requested by - * the BIOS. - */ -UINT8 ACPI_INIT_GLOBAL (AcpiGbl_OsiData, 0); - - -/* AcpiGbl_FADT is a local copy of the FADT, converted to a common format. */ - -ACPI_TABLE_FADT AcpiGbl_FADT; -UINT32 AcpiCurrentGpeCount; -UINT32 AcpiGbl_TraceFlags; -ACPI_NAME AcpiGbl_TraceMethodName; -BOOLEAN AcpiGbl_SystemAwakeAndRunning; - -/* - * ACPI 5.0 introduces the concept of a "reduced hardware platform", meaning - * that the ACPI hardware is no longer required. A flag in the FADT indicates - * a reduced HW machine, and that flag is duplicated here for convenience. - */ -BOOLEAN AcpiGbl_ReducedHardware; - -#endif /* DEFINE_ACPI_GLOBALS */ - -/* Do not disassemble buffers to resource descriptors */ - -ACPI_EXTERN UINT8 ACPI_INIT_GLOBAL (AcpiGbl_NoResourceDisassembly, FALSE); - -/***************************************************************************** - * - * ACPI Table globals - * - ****************************************************************************/ - -/* - * AcpiGbl_RootTableList is the master list of ACPI tables that were - * found in the RSDT/XSDT. - */ -ACPI_EXTERN ACPI_TABLE_LIST AcpiGbl_RootTableList; +ACPI_GLOBAL (ACPI_TABLE_HEADER *, AcpiGbl_DSDT); +ACPI_GLOBAL (ACPI_TABLE_HEADER, AcpiGbl_OriginalDsdtHeader); #if (!ACPI_REDUCED_HARDWARE) -ACPI_EXTERN ACPI_TABLE_FACS *AcpiGbl_FACS; +ACPI_GLOBAL (ACPI_TABLE_FACS *, AcpiGbl_FACS); #endif /* !ACPI_REDUCED_HARDWARE */ /* These addresses are calculated from the FADT Event Block addresses */ -ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1aStatus; -ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1aEnable; +ACPI_GLOBAL (ACPI_GENERIC_ADDRESS, AcpiGbl_XPm1aStatus); +ACPI_GLOBAL (ACPI_GENERIC_ADDRESS, AcpiGbl_XPm1aEnable); -ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1bStatus; -ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1bEnable; - -/* DSDT information. Used to check for DSDT corruption */ - -ACPI_EXTERN ACPI_TABLE_HEADER *AcpiGbl_DSDT; -ACPI_EXTERN ACPI_TABLE_HEADER AcpiGbl_OriginalDsdtHeader; +ACPI_GLOBAL (ACPI_GENERIC_ADDRESS, AcpiGbl_XPm1bStatus); +ACPI_GLOBAL (ACPI_GENERIC_ADDRESS, AcpiGbl_XPm1bEnable); /* - * Handle both ACPI 1.0 and ACPI 2.0 Integer widths. The integer width is + * Handle both ACPI 1.0 and ACPI 2.0+ Integer widths. The integer width is * determined by the revision of the DSDT: If the DSDT revision is less than * 2, use only the lower 32 bits of the internal 64-bit Integer. */ -ACPI_EXTERN UINT8 AcpiGbl_IntegerBitWidth; -ACPI_EXTERN UINT8 AcpiGbl_IntegerByteWidth; -ACPI_EXTERN UINT8 AcpiGbl_IntegerNybbleWidth; +ACPI_GLOBAL (UINT8, AcpiGbl_IntegerBitWidth); +ACPI_GLOBAL (UINT8, AcpiGbl_IntegerByteWidth); +ACPI_GLOBAL (UINT8, AcpiGbl_IntegerNybbleWidth); /***************************************************************************** @@ -291,36 +166,36 @@ ACPI_EXTERN UINT8 AcpiGbl_IntegerNybbleWidth; * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs. * (The table maps local handles to the real OS handles) */ -ACPI_EXTERN ACPI_MUTEX_INFO AcpiGbl_MutexInfo[ACPI_NUM_MUTEX]; +ACPI_GLOBAL (ACPI_MUTEX_INFO, AcpiGbl_MutexInfo[ACPI_NUM_MUTEX]); /* * Global lock mutex is an actual AML mutex object * Global lock semaphore works in conjunction with the actual global lock * Global lock spinlock is used for "pending" handshake */ -ACPI_EXTERN ACPI_OPERAND_OBJECT *AcpiGbl_GlobalLockMutex; -ACPI_EXTERN ACPI_SEMAPHORE AcpiGbl_GlobalLockSemaphore; -ACPI_EXTERN ACPI_SPINLOCK AcpiGbl_GlobalLockPendingLock; -ACPI_EXTERN UINT16 AcpiGbl_GlobalLockHandle; -ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockAcquired; -ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockPresent; -ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockPending; +ACPI_GLOBAL (ACPI_OPERAND_OBJECT *, AcpiGbl_GlobalLockMutex); +ACPI_GLOBAL (ACPI_SEMAPHORE, AcpiGbl_GlobalLockSemaphore); +ACPI_GLOBAL (ACPI_SPINLOCK, AcpiGbl_GlobalLockPendingLock); +ACPI_GLOBAL (UINT16, AcpiGbl_GlobalLockHandle); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_GlobalLockAcquired); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_GlobalLockPresent); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_GlobalLockPending); /* * Spinlocks are used for interfaces that can be possibly called at * interrupt level */ -ACPI_EXTERN ACPI_SPINLOCK AcpiGbl_GpeLock; /* For GPE data structs and registers */ -ACPI_EXTERN ACPI_SPINLOCK AcpiGbl_HardwareLock; /* For ACPI H/W except GPE registers */ -ACPI_EXTERN ACPI_SPINLOCK AcpiGbl_ReferenceCountLock; +ACPI_GLOBAL (ACPI_SPINLOCK, AcpiGbl_GpeLock); /* For GPE data structs and registers */ +ACPI_GLOBAL (ACPI_SPINLOCK, AcpiGbl_HardwareLock); /* For ACPI H/W except GPE registers */ +ACPI_GLOBAL (ACPI_SPINLOCK, AcpiGbl_ReferenceCountLock); /* Mutex for _OSI support */ -ACPI_EXTERN ACPI_MUTEX AcpiGbl_OsiMutex; +ACPI_GLOBAL (ACPI_MUTEX, AcpiGbl_OsiMutex); /* Reader/Writer lock is used for namespace walk and dynamic table unload */ -ACPI_EXTERN ACPI_RW_LOCK AcpiGbl_NamespaceRwLock; +ACPI_GLOBAL (ACPI_RW_LOCK, AcpiGbl_NamespaceRwLock); /***************************************************************************** @@ -331,69 +206,67 @@ ACPI_EXTERN ACPI_RW_LOCK AcpiGbl_NamespaceRwLock; /* Object caches */ -ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_NamespaceCache; -ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_StateCache; -ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_PsNodeCache; -ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_PsNodeExtCache; -ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_OperandCache; +ACPI_GLOBAL (ACPI_CACHE_T *, AcpiGbl_NamespaceCache); +ACPI_GLOBAL (ACPI_CACHE_T *, AcpiGbl_StateCache); +ACPI_GLOBAL (ACPI_CACHE_T *, AcpiGbl_PsNodeCache); +ACPI_GLOBAL (ACPI_CACHE_T *, AcpiGbl_PsNodeExtCache); +ACPI_GLOBAL (ACPI_CACHE_T *, AcpiGbl_OperandCache); + +/* System */ + +ACPI_INIT_GLOBAL (UINT32, AcpiGbl_StartupFlags, 0); +ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_Shutdown, TRUE); /* Global handlers */ -ACPI_EXTERN ACPI_GLOBAL_NOTIFY_HANDLER AcpiGbl_GlobalNotify[2]; -ACPI_EXTERN ACPI_EXCEPTION_HANDLER AcpiGbl_ExceptionHandler; -ACPI_EXTERN ACPI_INIT_HANDLER AcpiGbl_InitHandler; -ACPI_EXTERN ACPI_TABLE_HANDLER AcpiGbl_TableHandler; -ACPI_EXTERN void *AcpiGbl_TableHandlerContext; -ACPI_EXTERN ACPI_WALK_STATE *AcpiGbl_BreakpointWalk; -ACPI_EXTERN ACPI_INTERFACE_HANDLER AcpiGbl_InterfaceHandler; -ACPI_EXTERN ACPI_SCI_HANDLER_INFO *AcpiGbl_SciHandlerList; +ACPI_GLOBAL (ACPI_GLOBAL_NOTIFY_HANDLER,AcpiGbl_GlobalNotify[2]); +ACPI_GLOBAL (ACPI_EXCEPTION_HANDLER, AcpiGbl_ExceptionHandler); +ACPI_GLOBAL (ACPI_INIT_HANDLER, AcpiGbl_InitHandler); +ACPI_GLOBAL (ACPI_TABLE_HANDLER, AcpiGbl_TableHandler); +ACPI_GLOBAL (void *, AcpiGbl_TableHandlerContext); +ACPI_GLOBAL (ACPI_INTERFACE_HANDLER, AcpiGbl_InterfaceHandler); +ACPI_GLOBAL (ACPI_SCI_HANDLER_INFO *, AcpiGbl_SciHandlerList); /* Owner ID support */ -ACPI_EXTERN UINT32 AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS]; -ACPI_EXTERN UINT8 AcpiGbl_LastOwnerIdIndex; -ACPI_EXTERN UINT8 AcpiGbl_NextOwnerIdOffset; +ACPI_GLOBAL (UINT32, AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS]); +ACPI_GLOBAL (UINT8, AcpiGbl_LastOwnerIdIndex); +ACPI_GLOBAL (UINT8, AcpiGbl_NextOwnerIdOffset); /* Initialization sequencing */ -ACPI_EXTERN BOOLEAN AcpiGbl_RegMethodsExecuted; +ACPI_GLOBAL (BOOLEAN, AcpiGbl_RegMethodsExecuted); /* Misc */ -ACPI_EXTERN UINT32 AcpiGbl_OriginalMode; -ACPI_EXTERN UINT32 AcpiGbl_RsdpOriginalLocation; -ACPI_EXTERN UINT32 AcpiGbl_NsLookupCount; -ACPI_EXTERN UINT32 AcpiGbl_PsFindCount; -ACPI_EXTERN UINT16 AcpiGbl_Pm1EnableRegisterSave; -ACPI_EXTERN UINT8 AcpiGbl_DebuggerConfiguration; -ACPI_EXTERN BOOLEAN AcpiGbl_StepToNextCall; -ACPI_EXTERN BOOLEAN AcpiGbl_AcpiHardwarePresent; -ACPI_EXTERN BOOLEAN AcpiGbl_EventsInitialized; -ACPI_EXTERN ACPI_INTERFACE_INFO *AcpiGbl_SupportedInterfaces; -ACPI_EXTERN ACPI_ADDRESS_RANGE *AcpiGbl_AddressRangeList[ACPI_ADDRESS_RANGE_MAX]; +ACPI_GLOBAL (UINT32, AcpiGbl_OriginalMode); +ACPI_GLOBAL (UINT32, AcpiGbl_NsLookupCount); +ACPI_GLOBAL (UINT32, AcpiGbl_PsFindCount); +ACPI_GLOBAL (UINT16, AcpiGbl_Pm1EnableRegisterSave); +ACPI_GLOBAL (UINT8, AcpiGbl_DebuggerConfiguration); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_StepToNextCall); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_AcpiHardwarePresent); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_EventsInitialized); +ACPI_GLOBAL (ACPI_INTERFACE_INFO *, AcpiGbl_SupportedInterfaces); +ACPI_GLOBAL (ACPI_ADDRESS_RANGE *, AcpiGbl_AddressRangeList[ACPI_ADDRESS_RANGE_MAX]); -#ifndef DEFINE_ACPI_GLOBALS +/* Other miscellaneous, declared and initialized in utglobal */ -/* Other miscellaneous */ - -extern BOOLEAN AcpiGbl_Shutdown; -extern UINT32 AcpiGbl_StartupFlags; extern const char *AcpiGbl_SleepStateNames[ACPI_S_STATE_COUNT]; extern const char *AcpiGbl_LowestDstateNames[ACPI_NUM_SxW_METHODS]; extern const char *AcpiGbl_HighestDstateNames[ACPI_NUM_SxD_METHODS]; -extern const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES]; extern const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS]; -#endif +extern const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES]; #ifdef ACPI_DBG_TRACK_ALLOCATIONS -/* Lists for tracking memory allocations */ +/* Lists for tracking memory allocations (debug only) */ -ACPI_EXTERN ACPI_MEMORY_LIST *AcpiGbl_GlobalList; -ACPI_EXTERN ACPI_MEMORY_LIST *AcpiGbl_NsNodeList; -ACPI_EXTERN BOOLEAN AcpiGbl_DisplayFinalMemStats; -ACPI_EXTERN BOOLEAN AcpiGbl_DisableMemTracking; +ACPI_GLOBAL (ACPI_MEMORY_LIST *, AcpiGbl_GlobalList); +ACPI_GLOBAL (ACPI_MEMORY_LIST *, AcpiGbl_NsNodeList); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_DisplayFinalMemStats); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_DisableMemTracking); #endif @@ -409,22 +282,23 @@ ACPI_EXTERN BOOLEAN AcpiGbl_DisableMemTracking; #define NUM_PREDEFINED_NAMES 9 #endif -ACPI_EXTERN ACPI_NAMESPACE_NODE AcpiGbl_RootNodeStruct; -ACPI_EXTERN ACPI_NAMESPACE_NODE *AcpiGbl_RootNode; -ACPI_EXTERN ACPI_NAMESPACE_NODE *AcpiGbl_FadtGpeDevice; -ACPI_EXTERN ACPI_OPERAND_OBJECT *AcpiGbl_ModuleCodeList; +ACPI_GLOBAL (ACPI_NAMESPACE_NODE, AcpiGbl_RootNodeStruct); +ACPI_GLOBAL (ACPI_NAMESPACE_NODE *, AcpiGbl_RootNode); +ACPI_GLOBAL (ACPI_NAMESPACE_NODE *, AcpiGbl_FadtGpeDevice); +ACPI_GLOBAL (ACPI_OPERAND_OBJECT *, AcpiGbl_ModuleCodeList); extern const UINT8 AcpiGbl_NsProperties [ACPI_NUM_NS_TYPES]; extern const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames [NUM_PREDEFINED_NAMES]; #ifdef ACPI_DEBUG_OUTPUT -ACPI_EXTERN UINT32 AcpiGbl_CurrentNodeCount; -ACPI_EXTERN UINT32 AcpiGbl_CurrentNodeSize; -ACPI_EXTERN UINT32 AcpiGbl_MaxConcurrentNodeCount; -ACPI_EXTERN ACPI_SIZE *AcpiGbl_EntryStackPointer; -ACPI_EXTERN ACPI_SIZE *AcpiGbl_LowestStackPointer; -ACPI_EXTERN UINT32 AcpiGbl_DeepestNesting; +ACPI_GLOBAL (UINT32, AcpiGbl_CurrentNodeCount); +ACPI_GLOBAL (UINT32, AcpiGbl_CurrentNodeSize); +ACPI_GLOBAL (UINT32, AcpiGbl_MaxConcurrentNodeCount); +ACPI_GLOBAL (ACPI_SIZE *, AcpiGbl_EntryStackPointer); +ACPI_GLOBAL (ACPI_SIZE *, AcpiGbl_LowestStackPointer); +ACPI_GLOBAL (UINT32, AcpiGbl_DeepestNesting); +ACPI_INIT_GLOBAL (UINT32, AcpiGbl_NestingLevel, 0); #endif @@ -434,11 +308,11 @@ ACPI_EXTERN UINT32 AcpiGbl_DeepestNesting; * ****************************************************************************/ -ACPI_EXTERN ACPI_THREAD_STATE *AcpiGbl_CurrentWalkList; +ACPI_GLOBAL (ACPI_THREAD_STATE *, AcpiGbl_CurrentWalkList); /* Control method single step flag */ -ACPI_EXTERN UINT8 AcpiGbl_CmSingleStep; +ACPI_GLOBAL (UINT8, AcpiGbl_CmSingleStep); /***************************************************************************** @@ -447,9 +321,10 @@ ACPI_EXTERN UINT8 AcpiGbl_CmSingleStep; * ****************************************************************************/ -extern ACPI_BIT_REGISTER_INFO AcpiGbl_BitRegisterInfo[ACPI_NUM_BITREG]; -ACPI_EXTERN UINT8 AcpiGbl_SleepTypeA; -ACPI_EXTERN UINT8 AcpiGbl_SleepTypeB; +extern ACPI_BIT_REGISTER_INFO AcpiGbl_BitRegisterInfo[ACPI_NUM_BITREG]; + +ACPI_GLOBAL (UINT8, AcpiGbl_SleepTypeA); +ACPI_GLOBAL (UINT8, AcpiGbl_SleepTypeB); /***************************************************************************** @@ -460,13 +335,14 @@ ACPI_EXTERN UINT8 AcpiGbl_SleepTypeB; #if (!ACPI_REDUCED_HARDWARE) -ACPI_EXTERN UINT8 AcpiGbl_AllGpesInitialized; -ACPI_EXTERN ACPI_GPE_XRUPT_INFO *AcpiGbl_GpeXruptListHead; -ACPI_EXTERN ACPI_GPE_BLOCK_INFO *AcpiGbl_GpeFadtBlocks[ACPI_MAX_GPE_BLOCKS]; -ACPI_EXTERN ACPI_GBL_EVENT_HANDLER AcpiGbl_GlobalEventHandler; -ACPI_EXTERN void *AcpiGbl_GlobalEventHandlerContext; -ACPI_EXTERN ACPI_FIXED_EVENT_HANDLER AcpiGbl_FixedEventHandlers[ACPI_NUM_FIXED_EVENTS]; -extern ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS]; +ACPI_GLOBAL (UINT8, AcpiGbl_AllGpesInitialized); +ACPI_GLOBAL (ACPI_GPE_XRUPT_INFO *, AcpiGbl_GpeXruptListHead); +ACPI_GLOBAL (ACPI_GPE_BLOCK_INFO *, AcpiGbl_GpeFadtBlocks[ACPI_MAX_GPE_BLOCKS]); +ACPI_GLOBAL (ACPI_GBL_EVENT_HANDLER, AcpiGbl_GlobalEventHandler); +ACPI_GLOBAL (void *, AcpiGbl_GlobalEventHandlerContext); +ACPI_GLOBAL (ACPI_FIXED_EVENT_HANDLER, AcpiGbl_FixedEventHandlers[ACPI_NUM_FIXED_EVENTS]); + +extern ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS]; #endif /* !ACPI_REDUCED_HARDWARE */ @@ -476,23 +352,19 @@ extern ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EV * ****************************************************************************/ -/* Procedure nesting level for debug output */ - -extern UINT32 AcpiGbl_NestingLevel; - /* Event counters */ -ACPI_EXTERN UINT32 AcpiMethodCount; -ACPI_EXTERN UINT32 AcpiGpeCount; -ACPI_EXTERN UINT32 AcpiSciCount; -ACPI_EXTERN UINT32 AcpiFixedEventCount[ACPI_NUM_FIXED_EVENTS]; +ACPI_GLOBAL (UINT32, AcpiMethodCount); +ACPI_GLOBAL (UINT32, AcpiGpeCount); +ACPI_GLOBAL (UINT32, AcpiSciCount); +ACPI_GLOBAL (UINT32, AcpiFixedEventCount[ACPI_NUM_FIXED_EVENTS]); /* Support for dynamic control method tracing mechanism */ -ACPI_EXTERN UINT32 AcpiGbl_OriginalDbgLevel; -ACPI_EXTERN UINT32 AcpiGbl_OriginalDbgLayer; -ACPI_EXTERN UINT32 AcpiGbl_TraceDbgLevel; -ACPI_EXTERN UINT32 AcpiGbl_TraceDbgLayer; +ACPI_GLOBAL (UINT32, AcpiGbl_OriginalDbgLevel); +ACPI_GLOBAL (UINT32, AcpiGbl_OriginalDbgLayer); +ACPI_GLOBAL (UINT32, AcpiGbl_TraceDbgLevel); +ACPI_GLOBAL (UINT32, AcpiGbl_TraceDbgLayer); /***************************************************************************** @@ -501,74 +373,90 @@ ACPI_EXTERN UINT32 AcpiGbl_TraceDbgLayer; * ****************************************************************************/ -ACPI_EXTERN UINT8 AcpiGbl_DbOutputFlags; +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DbOutputFlags, ACPI_DB_CONSOLE_OUTPUT); #ifdef ACPI_DISASSEMBLER -ACPI_EXTERN BOOLEAN ACPI_INIT_GLOBAL (AcpiGbl_IgnoreNoopOperator, FALSE); +/* Do not disassemble buffers to resource descriptors */ -ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_disasm; -ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_verbose; -ACPI_EXTERN BOOLEAN AcpiGbl_NumExternalMethods; -ACPI_EXTERN UINT32 AcpiGbl_ResolvedExternalMethods; -ACPI_EXTERN ACPI_EXTERNAL_LIST *AcpiGbl_ExternalList; -ACPI_EXTERN ACPI_EXTERNAL_FILE *AcpiGbl_ExternalFileList; +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_NoResourceDisassembly, FALSE); +ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_IgnoreNoopOperator, FALSE); + +ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_disasm); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_verbose); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_NumExternalMethods); +ACPI_GLOBAL (UINT32, AcpiGbl_ResolvedExternalMethods); +ACPI_GLOBAL (ACPI_EXTERNAL_LIST *, AcpiGbl_ExternalList); +ACPI_GLOBAL (ACPI_EXTERNAL_FILE *, AcpiGbl_ExternalFileList); #endif - #ifdef ACPI_DEBUGGER -extern BOOLEAN AcpiGbl_MethodExecuting; -extern BOOLEAN AcpiGbl_AbortMethod; -extern BOOLEAN AcpiGbl_DbTerminateThreads; +ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DbTerminateThreads, FALSE); +ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_AbortMethod, FALSE); +ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_MethodExecuting, FALSE); -ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_tables; -ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_stats; -ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_ini_methods; -ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_NoRegionSupport; -ACPI_EXTERN BOOLEAN AcpiGbl_DbOutputToFile; -ACPI_EXTERN char *AcpiGbl_DbBuffer; -ACPI_EXTERN char *AcpiGbl_DbFilename; -ACPI_EXTERN UINT32 AcpiGbl_DbDebugLevel; -ACPI_EXTERN UINT32 AcpiGbl_DbConsoleDebugLevel; -ACPI_EXTERN ACPI_NAMESPACE_NODE *AcpiGbl_DbScopeNode; +ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_tables); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_stats); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_ini_methods); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_NoRegionSupport); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOutputToFile); +ACPI_GLOBAL (char *, AcpiGbl_DbBuffer); +ACPI_GLOBAL (char *, AcpiGbl_DbFilename); +ACPI_GLOBAL (UINT32, AcpiGbl_DbDebugLevel); +ACPI_GLOBAL (UINT32, AcpiGbl_DbConsoleDebugLevel); +ACPI_GLOBAL (ACPI_NAMESPACE_NODE *, AcpiGbl_DbScopeNode); -ACPI_EXTERN char *AcpiGbl_DbArgs[ACPI_DEBUGGER_MAX_ARGS]; -ACPI_EXTERN ACPI_OBJECT_TYPE AcpiGbl_DbArgTypes[ACPI_DEBUGGER_MAX_ARGS]; +ACPI_GLOBAL (char *, AcpiGbl_DbArgs[ACPI_DEBUGGER_MAX_ARGS]); +ACPI_GLOBAL (ACPI_OBJECT_TYPE, AcpiGbl_DbArgTypes[ACPI_DEBUGGER_MAX_ARGS]); /* These buffers should all be the same size */ -ACPI_EXTERN char AcpiGbl_DbLineBuf[ACPI_DB_LINE_BUFFER_SIZE]; -ACPI_EXTERN char AcpiGbl_DbParsedBuf[ACPI_DB_LINE_BUFFER_SIZE]; -ACPI_EXTERN char AcpiGbl_DbScopeBuf[ACPI_DB_LINE_BUFFER_SIZE]; -ACPI_EXTERN char AcpiGbl_DbDebugFilename[ACPI_DB_LINE_BUFFER_SIZE]; +ACPI_GLOBAL (char, AcpiGbl_DbLineBuf[ACPI_DB_LINE_BUFFER_SIZE]); +ACPI_GLOBAL (char, AcpiGbl_DbParsedBuf[ACPI_DB_LINE_BUFFER_SIZE]); +ACPI_GLOBAL (char, AcpiGbl_DbScopeBuf[ACPI_DB_LINE_BUFFER_SIZE]); +ACPI_GLOBAL (char, AcpiGbl_DbDebugFilename[ACPI_DB_LINE_BUFFER_SIZE]); /* * Statistic globals */ -ACPI_EXTERN UINT16 AcpiGbl_ObjTypeCount[ACPI_TYPE_NS_NODE_MAX+1]; -ACPI_EXTERN UINT16 AcpiGbl_NodeTypeCount[ACPI_TYPE_NS_NODE_MAX+1]; -ACPI_EXTERN UINT16 AcpiGbl_ObjTypeCountMisc; -ACPI_EXTERN UINT16 AcpiGbl_NodeTypeCountMisc; -ACPI_EXTERN UINT32 AcpiGbl_NumNodes; -ACPI_EXTERN UINT32 AcpiGbl_NumObjects; - - -ACPI_EXTERN UINT32 AcpiGbl_SizeOfParseTree; -ACPI_EXTERN UINT32 AcpiGbl_SizeOfMethodTrees; -ACPI_EXTERN UINT32 AcpiGbl_SizeOfNodeEntries; -ACPI_EXTERN UINT32 AcpiGbl_SizeOfAcpiObjects; +ACPI_GLOBAL (UINT16, AcpiGbl_ObjTypeCount[ACPI_TYPE_NS_NODE_MAX+1]); +ACPI_GLOBAL (UINT16, AcpiGbl_NodeTypeCount[ACPI_TYPE_NS_NODE_MAX+1]); +ACPI_GLOBAL (UINT16, AcpiGbl_ObjTypeCountMisc); +ACPI_GLOBAL (UINT16, AcpiGbl_NodeTypeCountMisc); +ACPI_GLOBAL (UINT32, AcpiGbl_NumNodes); +ACPI_GLOBAL (UINT32, AcpiGbl_NumObjects); #endif /* ACPI_DEBUGGER */ +/***************************************************************************** + * + * Application globals + * + ****************************************************************************/ + +#ifdef ACPI_APPLICATION + +ACPI_INIT_GLOBAL (ACPI_FILE, AcpiGbl_DebugFile, NULL); +ACPI_INIT_GLOBAL (ACPI_FILE, AcpiGbl_OutputFile, NULL); + +/* Print buffer */ + +ACPI_GLOBAL (ACPI_SPINLOCK, AcpiGbl_PrintLock); /* For print buffer */ +ACPI_GLOBAL (char, AcpiGbl_PrintBuffer[1024]); + +#endif /* ACPI_APPLICATION */ + + /***************************************************************************** * * Info/help support * ****************************************************************************/ -extern const AH_PREDEFINED_NAME AslPredefinedInfo[]; +extern const AH_PREDEFINED_NAME AslPredefinedInfo[]; +extern const AH_DEVICE_ID AslDeviceIds[]; #endif /* __ACGLOBAL_H__ */ diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/achware.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/achware.h index 8655954f5d..ed39a36e25 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/achware.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/achware.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acinterp.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acinterp.h index ff53ea9300..739a0de40c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acinterp.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acinterp.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -161,6 +161,10 @@ typedef const struct acpi_exdump_info #define ACPI_EXD_PACKAGE 11 #define ACPI_EXD_FIELD 12 #define ACPI_EXD_REFERENCE 13 +#define ACPI_EXD_LIST 14 /* Operand object list */ +#define ACPI_EXD_HDLR_LIST 15 /* Address Handler list */ +#define ACPI_EXD_RGN_LIST 16 /* Region list */ +#define ACPI_EXD_NODE 17 /* Namespace Node */ /* restore default alignment */ @@ -684,14 +688,6 @@ void AcpiExExitInterpreter ( void); -void -AcpiExReacquireInterpreter ( - void); - -void -AcpiExRelinquishInterpreter ( - void); - BOOLEAN AcpiExTruncateFor32bitTable ( ACPI_OPERAND_OBJECT *ObjDesc); diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/aclocal.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/aclocal.h index 52b61f56ca..1ea772eeee 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/aclocal.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/aclocal.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -588,9 +588,9 @@ typedef struct acpi_gpe_register_info { ACPI_GENERIC_ADDRESS StatusAddress; /* Address of status reg */ ACPI_GENERIC_ADDRESS EnableAddress; /* Address of enable reg */ + UINT16 BaseGpeNumber; /* Base GPE number for this register */ UINT8 EnableForWake; /* GPEs to keep enabled when sleeping */ UINT8 EnableForRun; /* GPEs to keep enabled when running */ - UINT8 BaseGpeNumber; /* Base GPE number for this register */ } ACPI_GPE_REGISTER_INFO; @@ -606,10 +606,11 @@ typedef struct acpi_gpe_block_info struct acpi_gpe_xrupt_info *XruptBlock; /* Backpointer to interrupt block */ ACPI_GPE_REGISTER_INFO *RegisterInfo; /* One per GPE register pair */ ACPI_GPE_EVENT_INFO *EventInfo; /* One for each GPE */ - ACPI_GENERIC_ADDRESS BlockAddress; /* Base address of the block */ + UINT64 Address; /* Base address of the block */ UINT32 RegisterCount; /* Number of register pairs in block */ UINT16 GpeCount; /* Number of individual GPEs in block */ - UINT8 BlockBaseNumber;/* Base GPE number for this block */ + UINT16 BlockBaseNumber;/* Base GPE number for this block */ + UINT8 SpaceId; BOOLEAN Initialized; /* TRUE if this block is initialized */ } ACPI_GPE_BLOCK_INFO; @@ -949,11 +950,13 @@ typedef union acpi_parse_value #define ACPI_DASM_STRING 0x02 /* Buffer is a ASCII string */ #define ACPI_DASM_UNICODE 0x03 /* Buffer is a Unicode string */ #define ACPI_DASM_PLD_METHOD 0x04 /* Buffer is a _PLD method bit-packed buffer */ -#define ACPI_DASM_EISAID 0x05 /* Integer is an EISAID */ -#define ACPI_DASM_MATCHOP 0x06 /* Parent opcode is a Match() operator */ -#define ACPI_DASM_LNOT_PREFIX 0x07 /* Start of a LNotEqual (etc.) pair of opcodes */ -#define ACPI_DASM_LNOT_SUFFIX 0x08 /* End of a LNotEqual (etc.) pair of opcodes */ -#define ACPI_DASM_IGNORE 0x09 /* Not used at this time */ +#define ACPI_DASM_UUID 0x05 /* Buffer is a UUID/GUID */ +#define ACPI_DASM_EISAID 0x06 /* Integer is an EISAID */ +#define ACPI_DASM_MATCHOP 0x07 /* Parent opcode is a Match() operator */ +#define ACPI_DASM_LNOT_PREFIX 0x08 /* Start of a LNotEqual (etc.) pair of opcodes */ +#define ACPI_DASM_LNOT_SUFFIX 0x09 /* End of a LNotEqual (etc.) pair of opcodes */ +#define ACPI_DASM_HID_STRING 0x0A /* String is a _HID or _CID */ +#define ACPI_DASM_IGNORE 0x0B /* Not used at this time */ /* * Generic operation (for example: If, While, Store) @@ -1290,17 +1293,17 @@ typedef struct acpi_external_list struct acpi_external_list *Next; UINT32 Value; UINT16 Length; + UINT16 Flags; UINT8 Type; - UINT8 Flags; - BOOLEAN Resolved; - BOOLEAN Emitted; } ACPI_EXTERNAL_LIST; /* Values for Flags field above */ -#define ACPI_IPATH_ALLOCATED 0x01 -#define ACPI_FROM_REFERENCE_FILE 0x02 +#define ACPI_EXT_RESOLVED_REFERENCE 0x01 /* Object was resolved during cross ref */ +#define ACPI_EXT_ORIGIN_FROM_FILE 0x02 /* External came from a file */ +#define ACPI_EXT_INTERNAL_PATH_ALLOCATED 0x04 /* Deallocate internal path on completion */ +#define ACPI_EXT_EXTERNAL_EMITTED 0x08 /* External() statement has been emitted */ typedef struct acpi_external_file @@ -1331,7 +1334,7 @@ typedef struct acpi_db_method_info char *Name; UINT32 Flags; UINT32 NumLoops; - char Pathname[128]; + char Pathname[ACPI_DB_LINE_BUFFER_SIZE]; char **Args; ACPI_OBJECT_TYPE *Types; @@ -1358,6 +1361,7 @@ typedef struct acpi_integrity_info } ACPI_INTEGRITY_INFO; +#define ACPI_DB_DISABLE_OUTPUT 0x00 #define ACPI_DB_REDIRECTABLE_OUTPUT 0x01 #define ACPI_DB_CONSOLE_OUTPUT 0x02 #define ACPI_DB_DUPLICATE_OUTPUT 0x03 @@ -1420,4 +1424,18 @@ typedef struct ah_predefined_name } AH_PREDEFINED_NAME; +typedef struct ah_device_id +{ + char *Name; + char *Description; + +} AH_DEVICE_ID; + +typedef struct ah_uuid +{ + char *Description; + char *String; + +} AH_UUID; + #endif /* __ACLOCAL_H__ */ diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acmacros.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acmacros.h index f53c317f7f..aa8bd563c6 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acmacros.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acmacros.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -136,17 +136,21 @@ #define ACPI_SET64(ptr, val) (*ACPI_CAST64 (ptr) = (UINT64) (val)) /* - * printf() format helpers + * printf() format helpers. These macros are workarounds for the difficulties + * with emitting 64-bit integers and 64-bit pointers with the same code + * for both 32-bit and 64-bit hosts. */ - -/* Split 64-bit integer into two 32-bit values. Use with %8.8X%8.8X */ - #define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i), ACPI_LODWORD(i) #if ACPI_MACHINE_WIDTH == 64 #define ACPI_FORMAT_NATIVE_UINT(i) ACPI_FORMAT_UINT64(i) +#define ACPI_FORMAT_TO_UINT(i) ACPI_FORMAT_UINT64(i) +#define ACPI_PRINTF_UINT "0x%8.8X%8.8X" + #else -#define ACPI_FORMAT_NATIVE_UINT(i) 0, (i) +#define ACPI_FORMAT_NATIVE_UINT(i) 0, (UINT32) (i) +#define ACPI_FORMAT_TO_UINT(i) (UINT32) (i) +#define ACPI_PRINTF_UINT "0x%8.8X" #endif @@ -486,32 +490,6 @@ #endif -/* - * Memory allocation tracking (DEBUG ONLY) - */ -#define ACPI_MEM_PARAMETERS _COMPONENT, _AcpiModuleName, __LINE__ - -#ifndef ACPI_DBG_TRACK_ALLOCATIONS - -/* Memory allocation */ - -#define ACPI_ALLOCATE(a) AcpiUtAllocate((ACPI_SIZE) (a), ACPI_MEM_PARAMETERS) -#define ACPI_ALLOCATE_ZEROED(a) AcpiUtAllocateZeroed((ACPI_SIZE) (a), ACPI_MEM_PARAMETERS) -#define ACPI_FREE(a) AcpiOsFree(a) -#define ACPI_MEM_TRACKING(a) - -#else - -/* Memory allocation */ - -#define ACPI_ALLOCATE(a) AcpiUtAllocateAndTrack((ACPI_SIZE) (a), ACPI_MEM_PARAMETERS) -#define ACPI_ALLOCATE_ZEROED(a) AcpiUtAllocateZeroedAndTrack((ACPI_SIZE) (a), ACPI_MEM_PARAMETERS) -#define ACPI_FREE(a) AcpiUtFreeAndTrack(a, ACPI_MEM_PARAMETERS) -#define ACPI_MEM_TRACKING(a) a - -#endif /* ACPI_DBG_TRACK_ALLOCATIONS */ - - /* * Macros used for ACPICA utilities only */ diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acnames.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acnames.h index f9e651b01d..6ccf47ff96 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acnames.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acnames.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -118,24 +118,26 @@ /* Method names - these methods can appear anywhere in the namespace */ -#define METHOD_NAME__SB_ "_SB_" -#define METHOD_NAME__HID "_HID" -#define METHOD_NAME__CID "_CID" -#define METHOD_NAME__UID "_UID" -#define METHOD_NAME__SUB "_SUB" #define METHOD_NAME__ADR "_ADR" -#define METHOD_NAME__INI "_INI" -#define METHOD_NAME__STA "_STA" -#define METHOD_NAME__REG "_REG" -#define METHOD_NAME__SEG "_SEG" -#define METHOD_NAME__BBN "_BBN" -#define METHOD_NAME__PRT "_PRT" -#define METHOD_NAME__CRS "_CRS" -#define METHOD_NAME__PRS "_PRS" #define METHOD_NAME__AEI "_AEI" -#define METHOD_NAME__PRW "_PRW" -#define METHOD_NAME__SRS "_SRS" +#define METHOD_NAME__BBN "_BBN" +#define METHOD_NAME__CBA "_CBA" +#define METHOD_NAME__CID "_CID" +#define METHOD_NAME__CRS "_CRS" +#define METHOD_NAME__HID "_HID" +#define METHOD_NAME__INI "_INI" #define METHOD_NAME__PLD "_PLD" +#define METHOD_NAME__DSD "_DSD" +#define METHOD_NAME__PRS "_PRS" +#define METHOD_NAME__PRT "_PRT" +#define METHOD_NAME__PRW "_PRW" +#define METHOD_NAME__REG "_REG" +#define METHOD_NAME__SB_ "_SB_" +#define METHOD_NAME__SEG "_SEG" +#define METHOD_NAME__SRS "_SRS" +#define METHOD_NAME__STA "_STA" +#define METHOD_NAME__SUB "_SUB" +#define METHOD_NAME__UID "_UID" /* Method names - these methods must appear at the namespace root */ diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acnamesp.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acnamesp.h index 7489e59ce9..883e9c41c2 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acnamesp.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acnamesp.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acobject.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acobject.h index 5b28b5716e..e90af0b52d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acobject.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acobject.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -304,7 +304,8 @@ typedef struct acpi_object_method #define ACPI_METHOD_INTERNAL_ONLY 0x02 /* Method is implemented internally (_OSI) */ #define ACPI_METHOD_SERIALIZED 0x04 /* Method is serialized */ #define ACPI_METHOD_SERIALIZED_PENDING 0x08 /* Method is to be marked serialized */ -#define ACPI_METHOD_MODIFIED_NAMESPACE 0x10 /* Method modified the namespace */ +#define ACPI_METHOD_IGNORE_SYNC_LEVEL 0x10 /* Method was auto-serialized at table load time */ +#define ACPI_METHOD_MODIFIED_NAMESPACE 0x20 /* Method modified the namespace */ /****************************************************************************** diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acopcode.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acopcode.h index 2e4b535602..4ee04975e4 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acopcode.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acopcode.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acoutput.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acoutput.h index 9c835cd018..2311c441c9 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acoutput.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acoutput.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acparser.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acparser.h index 81cca7054a..5827a8cc99 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acparser.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acparser.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acpi.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acpi.h index 8da57af294..3f39932d18 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acpi.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acpi.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -134,5 +134,6 @@ #include "acrestyp.h" /* Resource Descriptor structs */ #include "acpiosxf.h" /* OSL interfaces (ACPICA-to-OS) */ #include "acpixf.h" /* ACPI core subsystem external interfaces */ +#include "platform/acenvex.h" /* Extra environment-specific items */ #endif /* __ACPI_H__ */ diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acpiosxf.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acpiosxf.h index 2317dfefc7..21e6ed916a 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acpiosxf.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acpiosxf.h @@ -6,12 +6,11 @@ * *****************************************************************************/ - /****************************************************************************** * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -32,8 +31,7 @@ * license (with the right to sublicense), under only those claims of Intel * patents that are infringed by the Original Intel Code, to make, use, sell, * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exer - se the above copyright + * solely to the minimum extent necessary to exercise the above copyright * license, and in no event shall the patent license extend to any additions * to or modifications of the Original Intel Code. No other license or right * is granted directly or by implication, estoppel or otherwise; @@ -158,85 +156,111 @@ typedef struct acpi_signal_fatal_info /* * OSL Initialization and shutdown primitives */ +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsInitialize ACPI_STATUS AcpiOsInitialize ( void); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTerminate ACPI_STATUS AcpiOsTerminate ( void); +#endif /* * ACPI Table interfaces */ +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetRootPointer ACPI_PHYSICAL_ADDRESS AcpiOsGetRootPointer ( void); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsPredefinedOverride ACPI_STATUS AcpiOsPredefinedOverride ( const ACPI_PREDEFINED_NAMES *InitVal, ACPI_STRING *NewVal); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTableOverride ACPI_STATUS AcpiOsTableOverride ( ACPI_TABLE_HEADER *ExistingTable, ACPI_TABLE_HEADER **NewTable); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsPhysicalTableOverride ACPI_STATUS AcpiOsPhysicalTableOverride ( ACPI_TABLE_HEADER *ExistingTable, ACPI_PHYSICAL_ADDRESS *NewAddress, UINT32 *NewTableLength); +#endif /* * Spinlock primitives */ -#ifndef AcpiOsCreateLock +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateLock ACPI_STATUS AcpiOsCreateLock ( ACPI_SPINLOCK *OutHandle); #endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsDeleteLock void AcpiOsDeleteLock ( ACPI_SPINLOCK Handle); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAcquireLock ACPI_CPU_FLAGS AcpiOsAcquireLock ( ACPI_SPINLOCK Handle); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReleaseLock void AcpiOsReleaseLock ( ACPI_SPINLOCK Handle, ACPI_CPU_FLAGS Flags); +#endif /* * Semaphore primitives */ +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateSemaphore ACPI_STATUS AcpiOsCreateSemaphore ( UINT32 MaxUnits, UINT32 InitialUnits, ACPI_SEMAPHORE *OutHandle); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsDeleteSemaphore ACPI_STATUS AcpiOsDeleteSemaphore ( ACPI_SEMAPHORE Handle); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWaitSemaphore ACPI_STATUS AcpiOsWaitSemaphore ( ACPI_SEMAPHORE Handle, UINT32 Units, UINT16 Timeout); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsSignalSemaphore ACPI_STATUS AcpiOsSignalSemaphore ( ACPI_SEMAPHORE Handle, UINT32 Units); +#endif /* @@ -245,151 +269,208 @@ AcpiOsSignalSemaphore ( */ #if (ACPI_MUTEX_TYPE != ACPI_BINARY_SEMAPHORE) +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateMutex ACPI_STATUS AcpiOsCreateMutex ( ACPI_MUTEX *OutHandle); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsDeleteMutex void AcpiOsDeleteMutex ( ACPI_MUTEX Handle); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAcquireMutex ACPI_STATUS AcpiOsAcquireMutex ( ACPI_MUTEX Handle, UINT16 Timeout); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReleaseMutex void AcpiOsReleaseMutex ( ACPI_MUTEX Handle); #endif +#endif + /* * Memory allocation and mapping */ +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAllocate void * AcpiOsAllocate ( ACPI_SIZE Size); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAllocateZeroed +void * +AcpiOsAllocateZeroed ( + ACPI_SIZE Size); +#endif + +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsFree void AcpiOsFree ( void * Memory); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsMapMemory void * AcpiOsMapMemory ( ACPI_PHYSICAL_ADDRESS Where, ACPI_SIZE Length); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsUnmapMemory void AcpiOsUnmapMemory ( void *LogicalAddress, ACPI_SIZE Size); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetPhysicalAddress ACPI_STATUS AcpiOsGetPhysicalAddress ( void *LogicalAddress, ACPI_PHYSICAL_ADDRESS *PhysicalAddress); +#endif /* * Memory/Object Cache */ +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateCache ACPI_STATUS AcpiOsCreateCache ( char *CacheName, UINT16 ObjectSize, UINT16 MaxDepth, ACPI_CACHE_T **ReturnCache); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsDeleteCache ACPI_STATUS AcpiOsDeleteCache ( ACPI_CACHE_T *Cache); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsPurgeCache ACPI_STATUS AcpiOsPurgeCache ( ACPI_CACHE_T *Cache); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAcquireObject void * AcpiOsAcquireObject ( ACPI_CACHE_T *Cache); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReleaseObject ACPI_STATUS AcpiOsReleaseObject ( ACPI_CACHE_T *Cache, void *Object); +#endif /* * Interrupt handlers */ +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsInstallInterruptHandler ACPI_STATUS AcpiOsInstallInterruptHandler ( UINT32 InterruptNumber, ACPI_OSD_HANDLER ServiceRoutine, void *Context); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsRemoveInterruptHandler ACPI_STATUS AcpiOsRemoveInterruptHandler ( UINT32 InterruptNumber, ACPI_OSD_HANDLER ServiceRoutine); +#endif /* * Threads and Scheduling */ +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetThreadId ACPI_THREAD_ID AcpiOsGetThreadId ( void); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsExecute ACPI_STATUS AcpiOsExecute ( ACPI_EXECUTE_TYPE Type, ACPI_OSD_EXEC_CALLBACK Function, void *Context); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWaitEventsComplete void AcpiOsWaitEventsComplete ( void); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsSleep void AcpiOsSleep ( UINT64 Milliseconds); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsStall void AcpiOsStall ( UINT32 Microseconds); +#endif /* * Platform and hardware-independent I/O interfaces */ +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadPort ACPI_STATUS AcpiOsReadPort ( ACPI_IO_ADDRESS Address, UINT32 *Value, UINT32 Width); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWritePort ACPI_STATUS AcpiOsWritePort ( ACPI_IO_ADDRESS Address, UINT32 Value, UINT32 Width); +#endif /* * Platform and hardware-independent physical memory interfaces */ +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadMemory ACPI_STATUS AcpiOsReadMemory ( ACPI_PHYSICAL_ADDRESS Address, UINT64 *Value, UINT32 Width); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWriteMemory ACPI_STATUS AcpiOsWriteMemory ( ACPI_PHYSICAL_ADDRESS Address, UINT64 Value, UINT32 Width); +#endif /* @@ -397,103 +478,131 @@ AcpiOsWriteMemory ( * Note: Can't use "Register" as a parameter, changed to "Reg" -- * certain compilers complain. */ +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadPciConfiguration ACPI_STATUS AcpiOsReadPciConfiguration ( ACPI_PCI_ID *PciId, UINT32 Reg, UINT64 *Value, UINT32 Width); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWritePciConfiguration ACPI_STATUS AcpiOsWritePciConfiguration ( ACPI_PCI_ID *PciId, UINT32 Reg, UINT64 Value, UINT32 Width); +#endif /* * Miscellaneous */ +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadable BOOLEAN AcpiOsReadable ( void *Pointer, ACPI_SIZE Length); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWritable BOOLEAN AcpiOsWritable ( void *Pointer, ACPI_SIZE Length); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTimer UINT64 AcpiOsGetTimer ( void); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsSignal ACPI_STATUS AcpiOsSignal ( UINT32 Function, void *Info); +#endif /* * Debug print routines */ +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsPrintf void ACPI_INTERNAL_VAR_XFACE AcpiOsPrintf ( const char *Format, ...); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsVprintf void AcpiOsVprintf ( const char *Format, va_list Args); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsRedirectOutput void AcpiOsRedirectOutput ( void *Destination); +#endif /* * Debug input */ +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetLine ACPI_STATUS AcpiOsGetLine ( char *Buffer, UINT32 BufferLength, UINT32 *BytesRead); +#endif /* * Obtain ACPI table(s) */ +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByName ACPI_STATUS AcpiOsGetTableByName ( char *Signature, UINT32 Instance, ACPI_TABLE_HEADER **Table, ACPI_PHYSICAL_ADDRESS *Address); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByIndex ACPI_STATUS AcpiOsGetTableByIndex ( UINT32 Index, ACPI_TABLE_HEADER **Table, UINT32 *Instance, ACPI_PHYSICAL_ADDRESS *Address); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByAddress ACPI_STATUS AcpiOsGetTableByAddress ( ACPI_PHYSICAL_ADDRESS Address, ACPI_TABLE_HEADER **Table); +#endif /* * Directory manipulation */ +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsOpenDirectory void * AcpiOsOpenDirectory ( char *Pathname, char *WildcardSpec, char RequestedFileType); +#endif /* RequesteFileType values */ @@ -501,13 +610,66 @@ AcpiOsOpenDirectory ( #define REQUEST_DIR_ONLY 1 +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetNextFilename char * AcpiOsGetNextFilename ( void *DirHandle); +#endif +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCloseDirectory void AcpiOsCloseDirectory ( void *DirHandle); +#endif + + +/* + * File I/O and related support + */ +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsOpenFile +ACPI_FILE +AcpiOsOpenFile ( + const char *Path, + UINT8 Modes); +#endif + +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCloseFile +void +AcpiOsCloseFile ( + ACPI_FILE File); +#endif + +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadFile +int +AcpiOsReadFile ( + ACPI_FILE File, + void *Buffer, + ACPI_SIZE Size, + ACPI_SIZE Count); +#endif + +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWriteFile +int +AcpiOsWriteFile ( + ACPI_FILE File, + void *Buffer, + ACPI_SIZE Size, + ACPI_SIZE Count); +#endif + +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetFileOffset +long +AcpiOsGetFileOffset ( + ACPI_FILE File); +#endif + +#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsSetFileOffset +ACPI_STATUS +AcpiOsSetFileOffset ( + ACPI_FILE File, + long Offset, + UINT8 From); +#endif #endif /* __ACPIOSXF_H__ */ diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acpixf.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acpixf.h index 0d161a7f54..cafc37b5b0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acpixf.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acpixf.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -113,62 +113,258 @@ * *****************************************************************************/ - #ifndef __ACXFACE_H__ #define __ACXFACE_H__ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20130823 +#define ACPI_CA_VERSION 0x20140724 #include "acconfig.h" #include "actypes.h" #include "actbl.h" #include "acbuffer.h" + +/***************************************************************************** + * + * Macros used for ACPICA globals and configuration + * + ****************************************************************************/ + /* - * Globals that are publically available + * Ensure that global variables are defined and initialized only once. + * + * The use of these macros allows for a single list of globals (here) + * in order to simplify maintenance of the code. */ -extern UINT32 AcpiCurrentGpeCount; -extern ACPI_TABLE_FADT AcpiGbl_FADT; -extern BOOLEAN AcpiGbl_SystemAwakeAndRunning; -extern BOOLEAN AcpiGbl_ReducedHardware; /* ACPI 5.0 */ -extern UINT8 AcpiGbl_OsiData; +#ifdef DEFINE_ACPI_GLOBALS +#define ACPI_GLOBAL(type,name) \ + extern type name; \ + type name -/* Runtime configuration of debug print levels */ +#define ACPI_INIT_GLOBAL(type,name,value) \ + type name=value -extern UINT32 AcpiDbgLevel; -extern UINT32 AcpiDbgLayer; - -/* ACPICA runtime options */ - -extern UINT8 AcpiGbl_EnableInterpreterSlack; -extern UINT8 AcpiGbl_AllMethodsSerialized; -extern UINT8 AcpiGbl_CreateOsiMethod; -extern UINT8 AcpiGbl_UseDefaultRegisterWidths; -extern ACPI_NAME AcpiGbl_TraceMethodName; -extern UINT32 AcpiGbl_TraceFlags; -extern UINT8 AcpiGbl_EnableAmlDebugObject; -extern UINT8 AcpiGbl_CopyDsdtLocally; -extern UINT8 AcpiGbl_TruncateIoAddresses; -extern UINT8 AcpiGbl_DisableAutoRepair; -extern UINT8 AcpiGbl_DisableSsdtTableLoad; +#else +#ifndef ACPI_GLOBAL +#define ACPI_GLOBAL(type,name) \ + extern type name +#endif +#ifndef ACPI_INIT_GLOBAL +#define ACPI_INIT_GLOBAL(type,name,value) \ + extern type name +#endif +#endif /* - * Hardware-reduced prototypes. All interfaces that use these macros will - * be configured out of the ACPICA build if the ACPI_REDUCED_HARDWARE flag + * These macros configure the various ACPICA interfaces. They are + * useful for generating stub inline functions for features that are + * configured out of the current kernel or ACPICA application. + */ +#ifndef ACPI_EXTERNAL_RETURN_STATUS +#define ACPI_EXTERNAL_RETURN_STATUS(Prototype) \ + Prototype; +#endif + +#ifndef ACPI_EXTERNAL_RETURN_OK +#define ACPI_EXTERNAL_RETURN_OK(Prototype) \ + Prototype; +#endif + +#ifndef ACPI_EXTERNAL_RETURN_VOID +#define ACPI_EXTERNAL_RETURN_VOID(Prototype) \ + Prototype; +#endif + +#ifndef ACPI_EXTERNAL_RETURN_UINT32 +#define ACPI_EXTERNAL_RETURN_UINT32(Prototype) \ + Prototype; +#endif + +#ifndef ACPI_EXTERNAL_RETURN_PTR +#define ACPI_EXTERNAL_RETURN_PTR(Prototype) \ + Prototype; +#endif + + +/***************************************************************************** + * + * Public globals and runtime configuration options + * + ****************************************************************************/ + +/* + * Enable "slack mode" of the AML interpreter? Default is FALSE, and the + * interpreter strictly follows the ACPI specification. Setting to TRUE + * allows the interpreter to ignore certain errors and/or bad AML constructs. + * + * Currently, these features are enabled by this flag: + * + * 1) Allow "implicit return" of last value in a control method + * 2) Allow access beyond the end of an operation region + * 3) Allow access to uninitialized locals/args (auto-init to integer 0) + * 4) Allow ANY object type to be a source operand for the Store() operator + * 5) Allow unresolved references (invalid target name) in package objects + * 6) Enable warning messages for behavior that is not ACPI spec compliant + */ +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_EnableInterpreterSlack, FALSE); + +/* + * Automatically serialize all methods that create named objects? Default + * is TRUE, meaning that all NonSerialized methods are scanned once at + * table load time to determine those that create named objects. Methods + * that create named objects are marked Serialized in order to prevent + * possible run-time problems if they are entered by more than one thread. + */ +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_AutoSerializeMethods, TRUE); + +/* + * Create the predefined _OSI method in the namespace? Default is TRUE + * because ACPICA is fully compatible with other ACPI implementations. + * Changing this will revert ACPICA (and machine ASL) to pre-OSI behavior. + */ +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_CreateOsiMethod, TRUE); + +/* + * Optionally use default values for the ACPI register widths. Set this to + * TRUE to use the defaults, if an FADT contains incorrect widths/lengths. + */ +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_UseDefaultRegisterWidths, TRUE); + +/* + * Whether or not to verify the table checksum before installation. Set + * this to TRUE to verify the table checksum before install it to the table + * manager. Note that enabling this option causes errors to happen in some + * OSPMs during early initialization stages. Default behavior is to do such + * verification. + */ +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_VerifyTableChecksum, TRUE); + +/* + * Optionally enable output from the AML Debug Object. + */ +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_EnableAmlDebugObject, FALSE); + +/* + * Optionally copy the entire DSDT to local memory (instead of simply + * mapping it.) There are some BIOSs that corrupt or replace the original + * DSDT, creating the need for this option. Default is FALSE, do not copy + * the DSDT. + */ +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_CopyDsdtLocally, FALSE); + +/* + * Optionally ignore an XSDT if present and use the RSDT instead. + * Although the ACPI specification requires that an XSDT be used instead + * of the RSDT, the XSDT has been found to be corrupt or ill-formed on + * some machines. Default behavior is to use the XSDT if present. + */ +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DoNotUseXsdt, FALSE); + +/* + * Optionally use 32-bit FADT addresses if and when there is a conflict + * (address mismatch) between the 32-bit and 64-bit versions of the + * address. Although ACPICA adheres to the ACPI specification which + * requires the use of the corresponding 64-bit address if it is non-zero, + * some machines have been found to have a corrupted non-zero 64-bit + * address. Default is FALSE, do not favor the 32-bit addresses. + */ +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_Use32BitFadtAddresses, FALSE); + +/* + * Optionally truncate I/O addresses to 16 bits. Provides compatibility + * with other ACPI implementations. NOTE: During ACPICA initialization, + * this value is set to TRUE if any Windows OSI strings have been + * requested by the BIOS. + */ +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_TruncateIoAddresses, FALSE); + +/* + * Disable runtime checking and repair of values returned by control methods. + * Use only if the repair is causing a problem on a particular machine. + */ +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DisableAutoRepair, FALSE); + +/* + * Optionally do not install any SSDTs from the RSDT/XSDT during initialization. + * This can be useful for debugging ACPI problems on some machines. + */ +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DisableSsdtTableInstall, FALSE); + +/* + * We keep track of the latest version of Windows that has been requested by + * the BIOS. ACPI 5.0. + */ +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_OsiData, 0); + +/* + * ACPI 5.0 introduces the concept of a "reduced hardware platform", meaning + * that the ACPI hardware is no longer required. A flag in the FADT indicates + * a reduced HW machine, and that flag is duplicated here for convenience. + */ +ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_ReducedHardware, FALSE); + +/* + * This mechanism is used to trace a specified AML method. The method is + * traced each time it is executed. + */ +ACPI_INIT_GLOBAL (UINT32, AcpiGbl_TraceFlags, 0); +ACPI_INIT_GLOBAL (ACPI_NAME, AcpiGbl_TraceMethodName, 0); + +/* + * Runtime configuration of debug output control masks. We want the debug + * switches statically initialized so they are already set when the debugger + * is entered. + */ +#ifdef ACPI_DEBUG_OUTPUT +ACPI_INIT_GLOBAL (UINT32, AcpiDbgLevel, ACPI_DEBUG_DEFAULT); +#else +ACPI_INIT_GLOBAL (UINT32, AcpiDbgLevel, ACPI_NORMAL_DEFAULT); +#endif +ACPI_INIT_GLOBAL (UINT32, AcpiDbgLayer, ACPI_COMPONENT_DEFAULT); + +/* + * Other miscellaneous globals + */ +ACPI_GLOBAL (ACPI_TABLE_FADT, AcpiGbl_FADT); +ACPI_GLOBAL (UINT32, AcpiCurrentGpeCount); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_SystemAwakeAndRunning); + + +/***************************************************************************** + * + * ACPICA public interface configuration. + * + * Interfaces that are configured out of the ACPICA build are replaced + * by inlined stubs by default. + * + ****************************************************************************/ + +/* + * Hardware-reduced prototypes (default: Not hardware reduced). + * + * All ACPICA hardware-related interfaces that use these macros will be + * configured out of the ACPICA build if the ACPI_REDUCED_HARDWARE flag * is set to TRUE. + * + * Note: This static build option for reduced hardware is intended to + * reduce ACPICA code size if desired or necessary. However, even if this + * option is not specified, the runtime behavior of ACPICA is dependent + * on the actual FADT reduced hardware flag (HW_REDUCED_ACPI). If set, + * the flag will enable similar behavior -- ACPICA will not attempt + * to access any ACPI-relate hardware (SCI, GPEs, Fixed Events, etc.) */ #if (!ACPI_REDUCED_HARDWARE) #define ACPI_HW_DEPENDENT_RETURN_STATUS(Prototype) \ - Prototype; + ACPI_EXTERNAL_RETURN_STATUS(Prototype) #define ACPI_HW_DEPENDENT_RETURN_OK(Prototype) \ - Prototype; + ACPI_EXTERNAL_RETURN_OK(Prototype) #define ACPI_HW_DEPENDENT_RETURN_VOID(Prototype) \ - Prototype; + ACPI_EXTERNAL_RETURN_VOID(Prototype) #else #define ACPI_HW_DEPENDENT_RETURN_STATUS(Prototype) \ @@ -178,35 +374,100 @@ extern UINT8 AcpiGbl_DisableSsdtTableLoad; static ACPI_INLINE Prototype {return(AE_OK);} #define ACPI_HW_DEPENDENT_RETURN_VOID(Prototype) \ - static ACPI_INLINE Prototype {} + static ACPI_INLINE Prototype {return;} #endif /* !ACPI_REDUCED_HARDWARE */ +/* + * Error message prototypes (default: error messages enabled). + * + * All interfaces related to error and warning messages + * will be configured out of the ACPICA build if the + * ACPI_NO_ERROR_MESSAGE flag is defined. + */ +#ifndef ACPI_NO_ERROR_MESSAGES +#define ACPI_MSG_DEPENDENT_RETURN_VOID(Prototype) \ + Prototype; + +#else +#define ACPI_MSG_DEPENDENT_RETURN_VOID(Prototype) \ + static ACPI_INLINE Prototype {return;} + +#endif /* ACPI_NO_ERROR_MESSAGES */ + + +/* + * Debugging output prototypes (default: no debug output). + * + * All interfaces related to debug output messages + * will be configured out of the ACPICA build unless the + * ACPI_DEBUG_OUTPUT flag is defined. + */ +#ifdef ACPI_DEBUG_OUTPUT +#define ACPI_DBG_DEPENDENT_RETURN_VOID(Prototype) \ + Prototype; + +#else +#define ACPI_DBG_DEPENDENT_RETURN_VOID(Prototype) \ + static ACPI_INLINE Prototype {return;} + +#endif /* ACPI_DEBUG_OUTPUT */ + + +/* + * Application prototypes + * + * All interfaces used by application will be configured + * out of the ACPICA build unless the ACPI_APPLICATION + * flag is defined. + */ +#ifdef ACPI_APPLICATION +#define ACPI_APP_DEPENDENT_RETURN_VOID(Prototype) \ + Prototype; + +#else +#define ACPI_APP_DEPENDENT_RETURN_VOID(Prototype) \ + static ACPI_INLINE Prototype {return;} + +#endif /* ACPI_APPLICATION */ + + +/***************************************************************************** + * + * ACPICA public interface prototypes + * + ****************************************************************************/ + /* * Initialization */ +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiInitializeTables ( ACPI_TABLE_DESC *InitialStorage, UINT32 InitialTableCount, - BOOLEAN AllowResize); + BOOLEAN AllowResize)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiInitializeSubsystem ( - void); + void)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiEnableSubsystem ( - UINT32 Flags); + UINT32 Flags)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiInitializeObjects ( - UINT32 Flags); + UINT32 Flags)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiTerminate ( - void); + void)) /* @@ -222,124 +483,136 @@ ACPI_STATUS AcpiDisable ( void)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiSubsystemStatus ( - void); + void)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetSystemInfo ( - ACPI_BUFFER *RetBuffer); + ACPI_BUFFER *RetBuffer)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetStatistics ( - ACPI_STATISTICS *Stats); + ACPI_STATISTICS *Stats)) +ACPI_EXTERNAL_RETURN_PTR ( const char * AcpiFormatException ( - ACPI_STATUS Exception); + ACPI_STATUS Exception)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiPurgeCachedObjects ( - void); + void)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiInstallInterface ( - ACPI_STRING InterfaceName); + ACPI_STRING InterfaceName)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiRemoveInterface ( - ACPI_STRING InterfaceName); + ACPI_STRING InterfaceName)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiUpdateInterfaces ( - UINT8 Action); + UINT8 Action)) +ACPI_EXTERNAL_RETURN_UINT32 ( UINT32 AcpiCheckAddressRange ( ACPI_ADR_SPACE_TYPE SpaceId, ACPI_PHYSICAL_ADDRESS Address, ACPI_SIZE Length, - BOOLEAN Warn); + BOOLEAN Warn)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiDecodePldBuffer ( UINT8 *InBuffer, ACPI_SIZE Length, - ACPI_PLD_INFO **ReturnBuffer); - -/* - * ACPI Memory management - */ -void * -AcpiAllocate ( - UINT32 Size); - -void * -AcpiCallocate ( - UINT32 Size); - -void -AcpiFree ( - void *Address); + ACPI_PLD_INFO **ReturnBuffer)) /* * ACPI table load/unload interfaces */ +ACPI_EXTERNAL_RETURN_STATUS ( +ACPI_STATUS +AcpiInstallTable ( + ACPI_PHYSICAL_ADDRESS Address, + BOOLEAN Physical)) + +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiLoadTable ( - ACPI_TABLE_HEADER *Table); + ACPI_TABLE_HEADER *Table)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiUnloadParentTable ( - ACPI_HANDLE Object); + ACPI_HANDLE Object)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiLoadTables ( - void); + void)) /* * ACPI table manipulation interfaces */ +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiReallocateRootTable ( - void); + void)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiFindRootPointer ( - ACPI_SIZE *RsdpAddress); + ACPI_SIZE *RsdpAddress)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetTableHeader ( ACPI_STRING Signature, UINT32 Instance, - ACPI_TABLE_HEADER *OutTableHeader); + ACPI_TABLE_HEADER *OutTableHeader)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetTable ( ACPI_STRING Signature, UINT32 Instance, - ACPI_TABLE_HEADER **OutTable); + ACPI_TABLE_HEADER **OutTable)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetTableByIndex ( UINT32 TableIndex, - ACPI_TABLE_HEADER **OutTable); + ACPI_TABLE_HEADER **OutTable)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiInstallTableHandler ( ACPI_TABLE_HANDLER Handler, - void *Context); + void *Context)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiRemoveTableHandler ( - ACPI_TABLE_HANDLER Handler); + ACPI_TABLE_HANDLER Handler)) /* * Namespace and name interfaces */ +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiWalkNamespace ( ACPI_OBJECT_TYPE Type, @@ -348,104 +621,119 @@ AcpiWalkNamespace ( ACPI_WALK_CALLBACK DescendingCallback, ACPI_WALK_CALLBACK AscendingCallback, void *Context, - void **ReturnValue); + void **ReturnValue)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetDevices ( char *HID, ACPI_WALK_CALLBACK UserFunction, void *Context, - void **ReturnValue); + void **ReturnValue)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetName ( ACPI_HANDLE Object, UINT32 NameType, - ACPI_BUFFER *RetPathPtr); + ACPI_BUFFER *RetPathPtr)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetHandle ( ACPI_HANDLE Parent, ACPI_STRING Pathname, - ACPI_HANDLE *RetHandle); + ACPI_HANDLE *RetHandle)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiAttachData ( ACPI_HANDLE Object, ACPI_OBJECT_HANDLER Handler, - void *Data); + void *Data)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiDetachData ( ACPI_HANDLE Object, - ACPI_OBJECT_HANDLER Handler); + ACPI_OBJECT_HANDLER Handler)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetData ( ACPI_HANDLE Object, ACPI_OBJECT_HANDLER Handler, - void **Data); + void **Data)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiDebugTrace ( char *Name, UINT32 DebugLevel, UINT32 DebugLayer, - UINT32 Flags); + UINT32 Flags)) /* * Object manipulation and enumeration */ +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiEvaluateObject ( ACPI_HANDLE Object, ACPI_STRING Pathname, ACPI_OBJECT_LIST *ParameterObjects, - ACPI_BUFFER *ReturnObjectBuffer); + ACPI_BUFFER *ReturnObjectBuffer)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiEvaluateObjectTyped ( ACPI_HANDLE Object, ACPI_STRING Pathname, ACPI_OBJECT_LIST *ExternalParams, ACPI_BUFFER *ReturnBuffer, - ACPI_OBJECT_TYPE ReturnType); + ACPI_OBJECT_TYPE ReturnType)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetObjectInfo ( ACPI_HANDLE Object, - ACPI_DEVICE_INFO **ReturnBuffer); + ACPI_DEVICE_INFO **ReturnBuffer)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiInstallMethod ( - UINT8 *Buffer); + UINT8 *Buffer)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetNextObject ( ACPI_OBJECT_TYPE Type, ACPI_HANDLE Parent, ACPI_HANDLE Child, - ACPI_HANDLE *OutHandle); + ACPI_HANDLE *OutHandle)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetType ( ACPI_HANDLE Object, - ACPI_OBJECT_TYPE *OutType); + ACPI_OBJECT_TYPE *OutType)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetParent ( ACPI_HANDLE Object, - ACPI_HANDLE *OutHandle); + ACPI_HANDLE *OutHandle)) /* * Handler interfaces */ +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiInstallInitializationHandler ( ACPI_INIT_HANDLER Handler, - UINT32 Function); + UINT32 Function)) ACPI_HW_DEPENDENT_RETURN_STATUS ( ACPI_STATUS @@ -493,40 +781,46 @@ AcpiRemoveGpeHandler ( UINT32 GpeNumber, ACPI_GPE_HANDLER Address)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiInstallNotifyHandler ( ACPI_HANDLE Device, UINT32 HandlerType, ACPI_NOTIFY_HANDLER Handler, - void *Context); + void *Context)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiRemoveNotifyHandler ( ACPI_HANDLE Device, UINT32 HandlerType, - ACPI_NOTIFY_HANDLER Handler); + ACPI_NOTIFY_HANDLER Handler)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiInstallAddressSpaceHandler ( ACPI_HANDLE Device, ACPI_ADR_SPACE_TYPE SpaceId, ACPI_ADR_SPACE_HANDLER Handler, ACPI_ADR_SPACE_SETUP Setup, - void *Context); + void *Context)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiRemoveAddressSpaceHandler ( ACPI_HANDLE Device, ACPI_ADR_SPACE_TYPE SpaceId, - ACPI_ADR_SPACE_HANDLER Handler); + ACPI_ADR_SPACE_HANDLER Handler)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiInstallExceptionHandler ( - ACPI_EXCEPTION_HANDLER Handler); + ACPI_EXCEPTION_HANDLER Handler)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiInstallInterfaceHandler ( - ACPI_INTERFACE_HANDLER Handler); + ACPI_INTERFACE_HANDLER Handler)) /* @@ -547,16 +841,18 @@ AcpiReleaseGlobalLock ( /* * Interfaces to AML mutex objects */ +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiAcquireMutex ( ACPI_HANDLE Handle, ACPI_STRING Pathname, - UINT16 Timeout); + UINT16 Timeout)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiReleaseMutex ( ACPI_HANDLE Handle, - ACPI_STRING Pathname); + ACPI_STRING Pathname)) /* @@ -625,6 +921,12 @@ AcpiFinishGpe ( ACPI_HANDLE GpeDevice, UINT32 GpeNumber)) +ACPI_HW_DEPENDENT_RETURN_STATUS ( +ACPI_STATUS +AcpiMarkGpeForWake ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber)) + ACPI_HW_DEPENDENT_RETURN_STATUS ( ACPI_STATUS AcpiSetupGpeForWake ( @@ -684,79 +986,92 @@ ACPI_STATUS (*ACPI_WALK_RESOURCE_CALLBACK) ( ACPI_RESOURCE *Resource, void *Context); +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetVendorResource ( ACPI_HANDLE Device, char *Name, ACPI_VENDOR_UUID *Uuid, - ACPI_BUFFER *RetBuffer); + ACPI_BUFFER *RetBuffer)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetCurrentResources ( ACPI_HANDLE Device, - ACPI_BUFFER *RetBuffer); + ACPI_BUFFER *RetBuffer)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetPossibleResources ( ACPI_HANDLE Device, - ACPI_BUFFER *RetBuffer); + ACPI_BUFFER *RetBuffer)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetEventResources ( ACPI_HANDLE DeviceHandle, - ACPI_BUFFER *RetBuffer); + ACPI_BUFFER *RetBuffer)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiWalkResourceBuffer ( ACPI_BUFFER *Buffer, ACPI_WALK_RESOURCE_CALLBACK UserFunction, - void *Context); + void *Context)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiWalkResources ( ACPI_HANDLE Device, char *Name, ACPI_WALK_RESOURCE_CALLBACK UserFunction, - void *Context); + void *Context)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiSetCurrentResources ( ACPI_HANDLE Device, - ACPI_BUFFER *InBuffer); + ACPI_BUFFER *InBuffer)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetIrqRoutingTable ( ACPI_HANDLE Device, - ACPI_BUFFER *RetBuffer); + ACPI_BUFFER *RetBuffer)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiResourceToAddress64 ( ACPI_RESOURCE *Resource, - ACPI_RESOURCE_ADDRESS64 *Out); + ACPI_RESOURCE_ADDRESS64 *Out)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiBufferToResource ( UINT8 *AmlBuffer, UINT16 AmlBufferLength, - ACPI_RESOURCE **ResourcePtr); + ACPI_RESOURCE **ResourcePtr)) /* * Hardware (ACPI device) interfaces */ +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiReset ( - void); + void)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiRead ( UINT64 *Value, - ACPI_GENERIC_ADDRESS *Reg); + ACPI_GENERIC_ADDRESS *Reg)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiWrite ( UINT64 Value, - ACPI_GENERIC_ADDRESS *Reg); + ACPI_GENERIC_ADDRESS *Reg)) ACPI_HW_DEPENDENT_RETURN_STATUS ( ACPI_STATUS @@ -774,32 +1089,37 @@ AcpiWriteBitRegister ( /* * Sleep/Wake interfaces */ +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiGetSleepTypeData ( UINT8 SleepState, UINT8 *Slp_TypA, - UINT8 *Slp_TypB); + UINT8 *Slp_TypB)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiEnterSleepStatePrep ( - UINT8 SleepState); + UINT8 SleepState)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiEnterSleepState ( - UINT8 SleepState); + UINT8 SleepState)) ACPI_HW_DEPENDENT_RETURN_STATUS ( ACPI_STATUS AcpiEnterSleepStateS4bios ( void)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiLeaveSleepStatePrep ( - UINT8 SleepState); + UINT8 SleepState)) +ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiLeaveSleepState ( - UINT8 SleepState); + UINT8 SleepState)) ACPI_HW_DEPENDENT_RETURN_STATUS ( ACPI_STATUS @@ -838,55 +1158,67 @@ AcpiGetTimerDuration ( /* * Error/Warning output */ +ACPI_MSG_DEPENDENT_RETURN_VOID ( +ACPI_PRINTF_LIKE(3) void ACPI_INTERNAL_VAR_XFACE AcpiError ( const char *ModuleName, UINT32 LineNumber, const char *Format, - ...) ACPI_PRINTF_LIKE(3); + ...)) +ACPI_MSG_DEPENDENT_RETURN_VOID ( +ACPI_PRINTF_LIKE(4) void ACPI_INTERNAL_VAR_XFACE AcpiException ( const char *ModuleName, UINT32 LineNumber, ACPI_STATUS Status, const char *Format, - ...) ACPI_PRINTF_LIKE(4); + ...)) +ACPI_MSG_DEPENDENT_RETURN_VOID ( +ACPI_PRINTF_LIKE(3) void ACPI_INTERNAL_VAR_XFACE AcpiWarning ( const char *ModuleName, UINT32 LineNumber, const char *Format, - ...) ACPI_PRINTF_LIKE(3); + ...)) +ACPI_MSG_DEPENDENT_RETURN_VOID ( +ACPI_PRINTF_LIKE(3) void ACPI_INTERNAL_VAR_XFACE AcpiInfo ( const char *ModuleName, UINT32 LineNumber, const char *Format, - ...) ACPI_PRINTF_LIKE(3); + ...)) +ACPI_MSG_DEPENDENT_RETURN_VOID ( +ACPI_PRINTF_LIKE(3) void ACPI_INTERNAL_VAR_XFACE AcpiBiosError ( const char *ModuleName, UINT32 LineNumber, const char *Format, - ...) ACPI_PRINTF_LIKE(3); + ...)) +ACPI_MSG_DEPENDENT_RETURN_VOID ( +ACPI_PRINTF_LIKE(3) void ACPI_INTERNAL_VAR_XFACE AcpiBiosWarning ( const char *ModuleName, UINT32 LineNumber, const char *Format, - ...) ACPI_PRINTF_LIKE(3); + ...)) /* * Debug output */ -#ifdef ACPI_DEBUG_OUTPUT - +ACPI_DBG_DEPENDENT_RETURN_VOID ( +ACPI_PRINTF_LIKE(6) void ACPI_INTERNAL_VAR_XFACE AcpiDebugPrint ( UINT32 RequestedDebugLevel, @@ -895,8 +1227,10 @@ AcpiDebugPrint ( const char *ModuleName, UINT32 ComponentId, const char *Format, - ...) ACPI_PRINTF_LIKE(6); + ...)) +ACPI_DBG_DEPENDENT_RETURN_VOID ( +ACPI_PRINTF_LIKE(6) void ACPI_INTERNAL_VAR_XFACE AcpiDebugPrintRaw ( UINT32 RequestedDebugLevel, @@ -905,7 +1239,13 @@ AcpiDebugPrintRaw ( const char *ModuleName, UINT32 ComponentId, const char *Format, - ...) ACPI_PRINTF_LIKE(6); -#endif + ...)) + +ACPI_APP_DEPENDENT_RETURN_VOID ( +ACPI_PRINTF_LIKE(1) +void ACPI_INTERNAL_VAR_XFACE +AcpiLogError ( + const char *Format, + ...)) #endif /* __ACXFACE_H__ */ diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acpredef.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acpredef.h index 834efe7191..1c1776a9f6 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acpredef.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acpredef.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -121,7 +121,7 @@ * * Return Package types * - * 1) PTYPE1 packages do not contain sub-packages. + * 1) PTYPE1 packages do not contain subpackages. * * ACPI_PTYPE1_FIXED: Fixed-length length, 1 or 2 object types: * object type @@ -136,8 +136,8 @@ * (Used for _PRW) * * - * 2) PTYPE2 packages contain a Variable-length number of sub-packages. Each - * of the different types describe the contents of each of the sub-packages. + * 2) PTYPE2 packages contain a Variable-length number of subpackages. Each + * of the different types describe the contents of each of the subpackages. * * ACPI_PTYPE2: Each subpackage contains 1 or 2 object types. Zero-length * parent package is allowed: @@ -178,6 +178,11 @@ * count = 0 (optional) * (Used for _DLM) * + * ACPI_PTYPE2_UUID_PAIR: Each subpackage is preceded by a UUID Buffer. The UUID + * defines the format of the package. Zero-length parent package is + * allowed. + * (Used for _DSD) + * *****************************************************************************/ enum AcpiReturnPackageTypes @@ -191,7 +196,8 @@ enum AcpiReturnPackageTypes ACPI_PTYPE2_FIXED = 7, ACPI_PTYPE2_MIN = 8, ACPI_PTYPE2_REV_FIXED = 9, - ACPI_PTYPE2_FIX_VAR = 10 + ACPI_PTYPE2_FIX_VAR = 10, + ACPI_PTYPE2_UUID_PAIR = 11 }; @@ -438,6 +444,9 @@ const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] = {{"_CBA", METHOD_0ARGS, METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, /* See PCI firmware spec 3.0 */ + {{"_CCA", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, /* ACPI 5.1 */ + {{"_CDM", METHOD_0ARGS, METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, @@ -506,6 +515,10 @@ const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] = {{"_DOS", METHOD_1ARGS (ACPI_TYPE_INTEGER), METHOD_NO_RETURN_VALUE}}, + {{"_DSD", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each: 1 Buf, 1 Pkg */ + PACKAGE_INFO (ACPI_PTYPE2_UUID_PAIR, ACPI_RTYPE_BUFFER, 1, ACPI_RTYPE_PACKAGE, 1,0), + {{"_DSM", METHOD_4ARGS (ACPI_TYPE_BUFFER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_PACKAGE), METHOD_RETURNS (ACPI_RTYPE_ALL)}}, /* Must return a value, but it can be of any type */ @@ -626,7 +639,7 @@ const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] = /* * For _HPX, a single package is returned, containing a variable-length number - * of sub-packages. Each sub-package contains a PCI record setting. + * of subpackages. Each subpackage contains a PCI record setting. * There are several different type of record settings, of different * lengths, but all elements of all settings are Integers. */ @@ -652,6 +665,10 @@ const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] = {{"_LID", METHOD_0ARGS, METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + {{"_LPD", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (1 Int(rev), n Pkg (2 Int) */ + PACKAGE_INFO (ACPI_PTYPE2_REV_FIXED, ACPI_RTYPE_INTEGER, 2,0,0,0), + {{"_MAT", METHOD_0ARGS, METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acresrc.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acresrc.h index 0c51c152be..d1366f0814 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acresrc.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acresrc.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -270,7 +270,7 @@ AcpiRsCreateResourceList ( ACPI_STATUS AcpiRsCreateAmlResources ( - ACPI_RESOURCE *LinkedListBuffer, + ACPI_BUFFER *ResourceList, ACPI_BUFFER *OutputBuffer); ACPI_STATUS @@ -324,7 +324,8 @@ AcpiRsGetListLength ( ACPI_STATUS AcpiRsGetAmlLength ( - ACPI_RESOURCE *LinkedListBuffer, + ACPI_RESOURCE *ResourceList, + ACPI_SIZE ResourceListSize, ACPI_SIZE *SizeNeeded); ACPI_STATUS diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acrestyp.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acrestyp.h index 0f565d2b94..9cf948bc72 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acrestyp.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acrestyp.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acstruct.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acstruct.h index aa0f9dd2bd..fd8eab016d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acstruct.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acstruct.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -211,6 +211,9 @@ typedef struct acpi_init_walk_info UINT32 TableIndex; UINT32 ObjectCount; UINT32 MethodCount; + UINT32 SerialMethodCount; + UINT32 NonSerialMethodCount; + UINT32 SerializedMethodCount; UINT32 DeviceCount; UINT32 OpRegionCount; UINT32 FieldCount; diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/actables.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/actables.h index 219f4c0540..b95dd28487 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/actables.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/actables.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -134,6 +134,49 @@ AcpiTbScanMemoryForRsdp ( UINT32 Length); +/* + * tbdata - table data structure management + */ +ACPI_STATUS +AcpiTbGetNextRootIndex ( + UINT32 *TableIndex); + +void +AcpiTbInitTableDescriptor ( + ACPI_TABLE_DESC *TableDesc, + ACPI_PHYSICAL_ADDRESS Address, + UINT8 Flags, + ACPI_TABLE_HEADER *Table); + +ACPI_STATUS +AcpiTbAcquireTempTable ( + ACPI_TABLE_DESC *TableDesc, + ACPI_PHYSICAL_ADDRESS Address, + UINT8 Flags); + +void +AcpiTbReleaseTempTable ( + ACPI_TABLE_DESC *TableDesc); + +ACPI_STATUS +AcpiTbValidateTempTable ( + ACPI_TABLE_DESC *TableDesc); + +ACPI_STATUS +AcpiTbVerifyTempTable ( + ACPI_TABLE_DESC *TableDesc, + char *Signature); + +BOOLEAN +AcpiTbIsTableLoaded ( + UINT32 TableIndex); + +void +AcpiTbSetTableLoadedFlag ( + UINT32 TableIndex, + BOOLEAN IsLoaded); + + /* * tbfadt - FADT parse/convert/validate */ @@ -166,17 +209,36 @@ AcpiTbResizeRootTableList ( void); ACPI_STATUS -AcpiTbVerifyTable ( +AcpiTbValidateTable ( ACPI_TABLE_DESC *TableDesc); -ACPI_TABLE_HEADER * -AcpiTbTableOverride ( - ACPI_TABLE_HEADER *TableHeader, +void +AcpiTbInvalidateTable ( ACPI_TABLE_DESC *TableDesc); +void +AcpiTbOverrideTable ( + ACPI_TABLE_DESC *OldTableDesc); + ACPI_STATUS -AcpiTbAddTable ( +AcpiTbAcquireTable ( ACPI_TABLE_DESC *TableDesc, + ACPI_TABLE_HEADER **TablePtr, + UINT32 *TableLength, + UINT8 *TableFlags); + +void +AcpiTbReleaseTable ( + ACPI_TABLE_HEADER *Table, + UINT32 TableLength, + UINT8 TableFlags); + +ACPI_STATUS +AcpiTbInstallStandardTable ( + ACPI_PHYSICAL_ADDRESS Address, + UINT8 Flags, + BOOLEAN Reload, + BOOLEAN Override, UINT32 *TableIndex); ACPI_STATUS @@ -188,7 +250,7 @@ AcpiTbStoreTable ( UINT32 *TableIndex); void -AcpiTbDeleteTable ( +AcpiTbUninstallTable ( ACPI_TABLE_DESC *TableDesc); void @@ -212,15 +274,6 @@ AcpiTbGetOwnerId ( UINT32 TableIndex, ACPI_OWNER_ID *OwnerId); -BOOLEAN -AcpiTbIsTableLoaded ( - UINT32 TableIndex); - -void -AcpiTbSetTableLoadedFlag ( - UINT32 TableIndex, - BOOLEAN IsLoaded); - /* * tbutils - table manager utilities @@ -257,7 +310,13 @@ AcpiTbCopyDsdt ( UINT32 TableIndex); void -AcpiTbInstallTable ( +AcpiTbInstallTableWithOverride ( + UINT32 TableIndex, + ACPI_TABLE_DESC *NewTableDesc, + BOOLEAN Override); + +ACPI_STATUS +AcpiTbInstallFixedTable ( ACPI_PHYSICAL_ADDRESS Address, char *Signature, UINT32 TableIndex); diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/actbl.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/actbl.h index 77ae82c078..ea9fc58987 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/actbl.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/actbl.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -275,6 +275,9 @@ typedef struct acpi_table_xsdt } ACPI_TABLE_XSDT; +#define ACPI_RSDT_ENTRY_SIZE (sizeof (UINT32)) +#define ACPI_XSDT_ENTRY_SIZE (sizeof (UINT64)) + /******************************************************************************* * @@ -365,7 +368,8 @@ typedef struct acpi_table_fadt UINT32 Flags; /* Miscellaneous flag bits (see below for individual flags) */ ACPI_GENERIC_ADDRESS ResetRegister; /* 64-bit address of the Reset register */ UINT8 ResetValue; /* Value to write to the ResetRegister port to reset the system */ - UINT8 Reserved4[3]; /* Reserved, must be zero */ + UINT16 ArmBootFlags; /* ARM-Specific Boot Flags (see below for individual flags) (ACPI 5.1) */ + UINT8 MinorRevision; /* FADT Minor Revision (ACPI 5.1) */ UINT64 XFacs; /* 64-bit physical address of FACS */ UINT64 XDsdt; /* 64-bit physical address of DSDT */ ACPI_GENERIC_ADDRESS XPm1aEventBlock; /* 64-bit Extended Power Mgt 1a Event Reg Blk address */ @@ -382,7 +386,7 @@ typedef struct acpi_table_fadt } ACPI_TABLE_FADT; -/* Masks for FADT Boot Architecture Flags (BootFlags) [Vx]=Introduced in this FADT revision */ +/* Masks for FADT IA-PC Boot Architecture Flags (boot_flags) [Vx]=Introduced in this FADT revision */ #define ACPI_FADT_LEGACY_DEVICES (1) /* 00: [V2] System has LPC or ISA bus devices */ #define ACPI_FADT_8042 (1<<1) /* 01: [V3] System has an 8042 controller on port 60/64 */ @@ -391,6 +395,11 @@ typedef struct acpi_table_fadt #define ACPI_FADT_NO_ASPM (1<<4) /* 04: [V4] PCIe ASPM control must not be enabled */ #define ACPI_FADT_NO_CMOS_RTC (1<<5) /* 05: [V5] No CMOS real-time clock present */ +/* Masks for FADT ARM Boot Architecture Flags (arm_boot_flags) ACPI 5.1 */ + +#define ACPI_FADT_PSCI_COMPLIANT (1) /* 00: [V5+] PSCI 0.2+ is implemented */ +#define ACPI_FADT_PSCI_USE_HVC (1<<1) /* 01: [V5+] HVC must be used instead of SMC as the PSCI conduit */ + /* Masks for FADT flags */ #define ACPI_FADT_WBINVD (1) /* 00: [V1] The WBINVD instruction works properly */ @@ -471,12 +480,11 @@ typedef struct acpi_table_desc /* Masks for Flags field above */ -#define ACPI_TABLE_ORIGIN_UNKNOWN (0) -#define ACPI_TABLE_ORIGIN_MAPPED (1) -#define ACPI_TABLE_ORIGIN_ALLOCATED (2) -#define ACPI_TABLE_ORIGIN_OVERRIDE (4) -#define ACPI_TABLE_ORIGIN_MASK (7) -#define ACPI_TABLE_IS_LOADED (8) +#define ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL (0) /* Virtual address, external maintained */ +#define ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL (1) /* Physical address, internally mapped */ +#define ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL (2) /* Virtual address, internallly allocated */ +#define ACPI_TABLE_ORIGIN_MASK (3) +#define ACPI_TABLE_IS_LOADED (8) /* @@ -505,7 +513,7 @@ typedef struct acpi_table_desc * FADT V5 size: 0x10C */ #define ACPI_FADT_V1_SIZE (UINT32) (ACPI_FADT_OFFSET (Flags) + 4) -#define ACPI_FADT_V2_SIZE (UINT32) (ACPI_FADT_OFFSET (Reserved4[0]) + 3) +#define ACPI_FADT_V2_SIZE (UINT32) (ACPI_FADT_OFFSET (MinorRevision) + 1) #define ACPI_FADT_V3_SIZE (UINT32) (ACPI_FADT_OFFSET (SleepControl)) #define ACPI_FADT_V5_SIZE (UINT32) (sizeof (ACPI_TABLE_FADT)) diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/actbl1.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/actbl1.h index 883547c524..d28faa33f0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/actbl1.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/actbl1.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -596,7 +596,7 @@ typedef struct acpi_hest_aer_common UINT8 Enabled; UINT32 RecordsToPreallocate; UINT32 MaxSectionsPerRecord; - UINT32 Bus; + UINT32 Bus; /* Bus and Segment numbers */ UINT16 Device; UINT16 Function; UINT16 DeviceControl; @@ -613,6 +613,14 @@ typedef struct acpi_hest_aer_common #define ACPI_HEST_FIRMWARE_FIRST (1) #define ACPI_HEST_GLOBAL (1<<1) +/* + * Macros to access the bus/segment numbers in Bus field above: + * Bus number is encoded in bits 7:0 + * Segment number is encoded in bits 23:8 + */ +#define ACPI_HEST_BUS(Bus) ((Bus) & 0xFF) +#define ACPI_HEST_SEGMENT(Bus) (((Bus) >> 8) & 0xFFFF) + /* Hardware Error Notification */ @@ -826,25 +834,27 @@ typedef struct acpi_table_madt enum AcpiMadtType { - ACPI_MADT_TYPE_LOCAL_APIC = 0, - ACPI_MADT_TYPE_IO_APIC = 1, - ACPI_MADT_TYPE_INTERRUPT_OVERRIDE = 2, - ACPI_MADT_TYPE_NMI_SOURCE = 3, - ACPI_MADT_TYPE_LOCAL_APIC_NMI = 4, - ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE = 5, - ACPI_MADT_TYPE_IO_SAPIC = 6, - ACPI_MADT_TYPE_LOCAL_SAPIC = 7, - ACPI_MADT_TYPE_INTERRUPT_SOURCE = 8, - ACPI_MADT_TYPE_LOCAL_X2APIC = 9, - ACPI_MADT_TYPE_LOCAL_X2APIC_NMI = 10, - ACPI_MADT_TYPE_GENERIC_INTERRUPT = 11, - ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR = 12, - ACPI_MADT_TYPE_RESERVED = 13 /* 13 and greater are reserved */ + ACPI_MADT_TYPE_LOCAL_APIC = 0, + ACPI_MADT_TYPE_IO_APIC = 1, + ACPI_MADT_TYPE_INTERRUPT_OVERRIDE = 2, + ACPI_MADT_TYPE_NMI_SOURCE = 3, + ACPI_MADT_TYPE_LOCAL_APIC_NMI = 4, + ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE = 5, + ACPI_MADT_TYPE_IO_SAPIC = 6, + ACPI_MADT_TYPE_LOCAL_SAPIC = 7, + ACPI_MADT_TYPE_INTERRUPT_SOURCE = 8, + ACPI_MADT_TYPE_LOCAL_X2APIC = 9, + ACPI_MADT_TYPE_LOCAL_X2APIC_NMI = 10, + ACPI_MADT_TYPE_GENERIC_INTERRUPT = 11, + ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR = 12, + ACPI_MADT_TYPE_GENERIC_MSI_FRAME = 13, + ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR = 14, + ACPI_MADT_TYPE_RESERVED = 15 /* 15 and greater are reserved */ }; /* - * MADT Sub-tables, correspond to Type in ACPI_SUBTABLE_HEADER + * MADT Subtables, correspond to Type in ACPI_SUBTABLE_HEADER */ /* 0: Processor Local APIC */ @@ -1000,16 +1010,27 @@ typedef struct acpi_madt_generic_interrupt { ACPI_SUBTABLE_HEADER Header; UINT16 Reserved; /* Reserved - must be zero */ - UINT32 GicId; + UINT32 CpuInterfaceNumber; UINT32 Uid; UINT32 Flags; UINT32 ParkingVersion; UINT32 PerformanceInterrupt; UINT64 ParkedAddress; UINT64 BaseAddress; + UINT64 GicvBaseAddress; + UINT64 GichBaseAddress; + UINT32 VgicInterrupt; + UINT64 GicrBaseAddress; + UINT64 ArmMpidr; } ACPI_MADT_GENERIC_INTERRUPT; +/* Masks for Flags field above */ + +/* ACPI_MADT_ENABLED (1) Processor is usable if set */ +#define ACPI_MADT_PERFORMANCE_IRQ_MODE (1<<1) /* 01: Performance Interrupt Mode */ +#define ACPI_MADT_VGIC_IRQ_MODE (1<<2) /* 02: VGIC Maintenance Interrupt mode */ + /* 12: Generic Distributor (ACPI 5.0) */ @@ -1025,11 +1046,42 @@ typedef struct acpi_madt_generic_distributor } ACPI_MADT_GENERIC_DISTRIBUTOR; +/* 13: Generic MSI Frame (ACPI 5.1) */ + +typedef struct acpi_madt_generic_msi_frame +{ + ACPI_SUBTABLE_HEADER Header; + UINT16 Reserved; /* Reserved - must be zero */ + UINT32 MsiFrameId; + UINT64 BaseAddress; + UINT32 Flags; + UINT16 SpiCount; + UINT16 SpiBase; + +} ACPI_MADT_GENERIC_MSI_FRAME; + +/* Masks for Flags field above */ + +#define ACPI_MADT_OVERRIDE_SPI_VALUES (1) + + +/* 14: Generic Redistributor (ACPI 5.1) */ + +typedef struct acpi_madt_generic_redistributor +{ + ACPI_SUBTABLE_HEADER Header; + UINT16 Reserved; /* reserved - must be zero */ + UINT64 BaseAddress; + UINT32 Length; + +} ACPI_MADT_GENERIC_REDISTRIBUTOR; + + /* * Common flags fields for MADT subtables */ -/* MADT Local APIC flags (LapicFlags) and GIC flags */ +/* MADT Local APIC flags */ #define ACPI_MADT_ENABLED (1) /* 00: Processor is usable if set */ @@ -1142,7 +1194,7 @@ enum AcpiSratType }; /* - * SRAT Sub-tables, correspond to Type in ACPI_SUBTABLE_HEADER + * SRAT Subtables, correspond to Type in ACPI_SUBTABLE_HEADER */ /* 0: Processor Local APIC/SAPIC Affinity */ diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/actbl2.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/actbl2.h index 3479648f6b..7d628624ff 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/actbl2.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/actbl2.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -144,6 +144,7 @@ #define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */ #define ACPI_SIG_IBFT "IBFT" /* iSCSI Boot Firmware Table */ #define ACPI_SIG_IVRS "IVRS" /* I/O Virtualization Reporting Structure */ +#define ACPI_SIG_LPIT "LPIT" /* Low Power Idle Table */ #define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */ #define ACPI_SIG_MCHI "MCHI" /* Management Controller Host Interface table */ #define ACPI_SIG_MTMR "MTMR" /* MID Timer table */ @@ -445,6 +446,14 @@ typedef struct acpi_table_dbg2 } ACPI_TABLE_DBG2; +typedef struct acpi_dbg2_header +{ + UINT32 InfoOffset; + UINT32 InfoCount; + +} ACPI_DBG2_HEADER; + + /* Debug Device Information Subtable */ typedef struct acpi_dbg2_device @@ -513,7 +522,7 @@ typedef struct acpi_table_dbgp * Version 1 * * Conforms to "Intel Virtualization Technology for Directed I/O", - * Version 1.2, Sept. 2008 + * Version 2.2, Sept. 2013 * ******************************************************************************/ @@ -546,9 +555,10 @@ enum AcpiDmarType { ACPI_DMAR_TYPE_HARDWARE_UNIT = 0, ACPI_DMAR_TYPE_RESERVED_MEMORY = 1, - ACPI_DMAR_TYPE_ATSR = 2, - ACPI_DMAR_HARDWARE_AFFINITY = 3, - ACPI_DMAR_TYPE_RESERVED = 4 /* 4 and greater are reserved */ + ACPI_DMAR_TYPE_ROOT_ATS = 2, + ACPI_DMAR_TYPE_HARDWARE_AFFINITY = 3, + ACPI_DMAR_TYPE_NAMESPACE = 4, + ACPI_DMAR_TYPE_RESERVED = 5 /* 5 and greater are reserved */ }; @@ -564,7 +574,7 @@ typedef struct acpi_dmar_device_scope } ACPI_DMAR_DEVICE_SCOPE; -/* Values for EntryType in ACPI_DMAR_DEVICE_SCOPE */ +/* Values for EntryType in ACPI_DMAR_DEVICE_SCOPE - device types */ enum AcpiDmarScopeType { @@ -573,7 +583,8 @@ enum AcpiDmarScopeType ACPI_DMAR_SCOPE_TYPE_BRIDGE = 2, ACPI_DMAR_SCOPE_TYPE_IOAPIC = 3, ACPI_DMAR_SCOPE_TYPE_HPET = 4, - ACPI_DMAR_SCOPE_TYPE_RESERVED = 5 /* 5 and greater are reserved */ + ACPI_DMAR_SCOPE_TYPE_NAMESPACE = 5, + ACPI_DMAR_SCOPE_TYPE_RESERVED = 6 /* 6 and greater are reserved */ }; typedef struct acpi_dmar_pci_path @@ -585,7 +596,7 @@ typedef struct acpi_dmar_pci_path /* - * DMAR Sub-tables, correspond to Type in ACPI_DMAR_HEADER + * DMAR Subtables, correspond to Type in ACPI_DMAR_HEADER */ /* 0: Hardware Unit Definition */ @@ -650,6 +661,18 @@ typedef struct acpi_dmar_rhsa } ACPI_DMAR_RHSA; +/* 4: ACPI Namespace Device Declaration Structure */ + +typedef struct acpi_dmar_andd +{ + ACPI_DMAR_HEADER Header; + UINT8 Reserved[3]; + UINT8 DeviceNumber; + char DeviceName[1]; + +} ACPI_DMAR_ANDD; + + /******************************************************************************* * * HPET - High Precision Event Timer table @@ -998,7 +1021,83 @@ typedef struct acpi_ivrs_memory /******************************************************************************* * - * MCFG - PCI Memory Mapped Configuration table and sub-table + * LPIT - Low Power Idle Table + * + * Conforms to "ACPI Low Power Idle Table (LPIT) and _LPD Proposal (DRAFT)" + * + ******************************************************************************/ + +typedef struct acpi_table_lpit +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + +} ACPI_TABLE_LPIT; + + +/* LPIT subtable header */ + +typedef struct acpi_lpit_header +{ + UINT32 Type; /* Subtable type */ + UINT32 Length; /* Subtable length */ + UINT16 UniqueId; + UINT16 Reserved; + UINT32 Flags; + +} ACPI_LPIT_HEADER; + +/* Values for subtable Type above */ + +enum AcpiLpitType +{ + ACPI_LPIT_TYPE_NATIVE_CSTATE = 0x00, + ACPI_LPIT_TYPE_SIMPLE_IO = 0x01 +}; + +/* Masks for Flags field above */ + +#define ACPI_LPIT_STATE_DISABLED (1) +#define ACPI_LPIT_NO_COUNTER (1<<1) + +/* + * LPIT subtables, correspond to Type in ACPI_LPIT_HEADER + */ + +/* 0x00: Native C-state instruction based LPI structure */ + +typedef struct acpi_lpit_native +{ + ACPI_LPIT_HEADER Header; + ACPI_GENERIC_ADDRESS EntryTrigger; + UINT32 Residency; + UINT32 Latency; + ACPI_GENERIC_ADDRESS ResidencyCounter; + UINT64 CounterFrequency; + +} ACPI_LPIT_NATIVE; + + +/* 0x01: Simple I/O based LPI structure */ + +typedef struct acpi_lpit_io +{ + ACPI_LPIT_HEADER Header; + ACPI_GENERIC_ADDRESS EntryTrigger; + UINT32 TriggerAction; + UINT64 TriggerValue; + UINT64 TriggerMask; + ACPI_GENERIC_ADDRESS MinimumIdleState; + UINT32 Residency; + UINT32 Latency; + ACPI_GENERIC_ADDRESS ResidencyCounter; + UINT64 CounterFrequency; + +} ACPI_LPIT_IO; + + +/******************************************************************************* + * + * MCFG - PCI Memory Mapped Configuration table and subtable * Version 1 * * Conforms to "PCI Firmware Specification", Revision 3.0, June 20, 2005 @@ -1122,7 +1221,7 @@ enum AcpiSlicType /* - * SLIC Sub-tables, correspond to Type in ACPI_SLIC_HEADER + * SLIC Subtables, correspond to Type in ACPI_SLIC_HEADER */ /* 0: Public Key Structure */ diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/actbl3.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/actbl3.h index 85ff620692..b30e80f566 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/actbl3.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/actbl3.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -352,35 +352,111 @@ typedef struct acpi_s3pt_suspend /******************************************************************************* * - * GTDT - Generic Timer Description Table (ACPI 5.0) - * Version 1 + * GTDT - Generic Timer Description Table (ACPI 5.1) + * Version 2 * ******************************************************************************/ typedef struct acpi_table_gtdt { ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT64 Address; - UINT32 Flags; - UINT32 SecurePl1Interrupt; - UINT32 SecurePl1Flags; - UINT32 NonSecurePl1Interrupt; - UINT32 NonSecurePl1Flags; + UINT64 CounterBlockAddresss; + UINT32 Reserved; + UINT32 SecureEl1Interrupt; + UINT32 SecureEl1Flags; + UINT32 NonSecureEl1Interrupt; + UINT32 NonSecureEl1Flags; UINT32 VirtualTimerInterrupt; UINT32 VirtualTimerFlags; - UINT32 NonSecurePl2Interrupt; - UINT32 NonSecurePl2Flags; + UINT32 NonSecureEl2Interrupt; + UINT32 NonSecureEl2Flags; + UINT64 CounterReadBlockAddress; + UINT32 PlatformTimerCount; + UINT32 PlatformTimerOffset; } ACPI_TABLE_GTDT; -/* Values for Flags field above */ +/* Flag Definitions: Timer Block Physical Timers and Virtual timers */ -#define ACPI_GTDT_MAPPED_BLOCK_PRESENT 1 +#define ACPI_GTDT_INTERRUPT_MODE (1) +#define ACPI_GTDT_INTERRUPT_POLARITY (1<<1) +#define ACPI_GTDT_ALWAYS_ON (1<<2) -/* Values for all "TimerFlags" fields above */ -#define ACPI_GTDT_INTERRUPT_MODE 1 -#define ACPI_GTDT_INTERRUPT_POLARITY 2 +/* Common GTDT subtable header */ + +typedef struct acpi_gtdt_header +{ + UINT8 Type; + UINT16 Length; + +} ACPI_GTDT_HEADER; + +/* Values for GTDT subtable type above */ + +enum AcpiGtdtType +{ + ACPI_GTDT_TYPE_TIMER_BLOCK = 0, + ACPI_GTDT_TYPE_WATCHDOG = 1, + ACPI_GTDT_TYPE_RESERVED = 2 /* 2 and greater are reserved */ +}; + + +/* GTDT Subtables, correspond to Type in acpi_gtdt_header */ + +/* 0: Generic Timer Block */ + +typedef struct acpi_gtdt_timer_block +{ + ACPI_GTDT_HEADER Header; + UINT8 Reserved; + UINT64 BlockAddress; + UINT32 TimerCount; + UINT32 TimerOffset; + +} ACPI_GTDT_TIMER_BLOCK; + +/* Timer Sub-Structure, one per timer */ + +typedef struct acpi_gtdt_timer_entry +{ + UINT8 FrameNumber; + UINT8 Reserved[3]; + UINT64 BaseAddress; + UINT64 El0BaseAddress; + UINT32 TimerInterrupt; + UINT32 TimerFlags; + UINT32 VirtualTimerInterrupt; + UINT32 VirtualTimerFlags; + UINT32 CommonFlags; + +} ACPI_GTDT_TIMER_ENTRY; + + +/* Flag Definitions: CommonFlags above */ + +#define ACPI_GTDT_GT_IS_SECURE_TIMER (1) +#define ACPI_GTDT_GT_ALWAYS_ON (1<<1) + + +/* 1: SBSA Generic Watchdog Structure */ + +typedef struct acpi_gtdt_watchdog +{ + ACPI_GTDT_HEADER Header; + UINT8 Reserved; + UINT64 RefreshFrameAddress; + UINT64 ControlFrameAddress; + UINT32 TimerInterrupt; + UINT32 TimerFlags; + +} ACPI_GTDT_WATCHDOG; + +/* Flag Definitions: TimerFlags above */ + +#define ACPI_GTDT_WATCHDOG_IRQ_MODE (1) +#define ACPI_GTDT_WATCHDOG_IRQ_POLARITY (1<<1) +#define ACPI_GTDT_WATCHDOG_SECURE (1<<2) /******************************************************************************* @@ -512,8 +588,7 @@ typedef struct acpi_table_pcct { ACPI_TABLE_HEADER Header; /* Common ACPI table header */ UINT32 Flags; - UINT32 Latency; - UINT32 Reserved; + UINT64 Reserved; } ACPI_TABLE_PCCT; @@ -521,8 +596,17 @@ typedef struct acpi_table_pcct #define ACPI_PCCT_DOORBELL 1 +/* Values for subtable type in ACPI_SUBTABLE_HEADER */ + +enum AcpiPcctType +{ + ACPI_PCCT_TYPE_GENERIC_SUBSPACE = 0, + ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE = 1, + ACPI_PCCT_TYPE_RESERVED = 2 /* 2 and greater are reserved */ +}; + /* - * PCCT subtables + * PCCT Subtables, correspond to Type in ACPI_SUBTABLE_HEADER */ /* 0: Generic Communications Subspace */ @@ -536,10 +620,38 @@ typedef struct acpi_pcct_subspace ACPI_GENERIC_ADDRESS DoorbellRegister; UINT64 PreserveMask; UINT64 WriteMask; + UINT32 Latency; + UINT32 MaxAccessRate; + UINT16 MinTurnaroundTime; } ACPI_PCCT_SUBSPACE; +/* 1: HW-reduced Communications Subspace (ACPI 5.1) */ + +typedef struct acpi_pcct_hw_reduced +{ + ACPI_SUBTABLE_HEADER Header; + UINT32 DoorbellInterrupt; + UINT8 Flags; + UINT8 Reserved; + UINT64 BaseAddress; + UINT64 Length; + ACPI_GENERIC_ADDRESS DoorbellRegister; + UINT64 PreserveMask; + UINT64 WriteMask; + UINT32 Latency; + UINT32 MaxAccessRate; + UINT16 MinTurnaroundTime; + +} ACPI_PCCT_HW_REDUCED; + +/* Values for doorbell flags above */ + +#define ACPI_PCCT_INTERRUPT_POLARITY (1) +#define ACPI_PCCT_INTERRUPT_MODE (1<<1) + + /* * PCC memory structures (not part of the ACPI table) */ diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/actypes.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/actypes.h index ebeced55ef..b6371aeb69 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/actypes.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/actypes.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -127,8 +127,6 @@ #error ACPI_MACHINE_WIDTH not defined #endif -/*! [Begin] no source code translation */ - /* * Data type ranges * Note: These macros are designed to be compiler independent as well as @@ -196,13 +194,16 @@ * ******************************************************************************/ +#ifndef ACPI_USE_SYSTEM_INTTYPES + typedef unsigned char BOOLEAN; typedef unsigned char UINT8; typedef unsigned short UINT16; +typedef short INT16; typedef COMPILER_DEPENDENT_UINT64 UINT64; typedef COMPILER_DEPENDENT_INT64 INT64; -/*! [End] no source code translation !*/ +#endif /* ACPI_USE_SYSTEM_INTTYPES */ /* * Value returned by AcpiOsGetThreadId. There is no standard "thread_id" @@ -223,12 +224,12 @@ typedef COMPILER_DEPENDENT_INT64 INT64; #if ACPI_MACHINE_WIDTH == 64 -/*! [Begin] no source code translation (keep the typedefs as-is) */ +#ifndef ACPI_USE_SYSTEM_INTTYPES typedef unsigned int UINT32; typedef int INT32; -/*! [End] no source code translation !*/ +#endif /* ACPI_USE_SYSTEM_INTTYPES */ typedef INT64 ACPI_NATIVE_INT; @@ -262,12 +263,12 @@ typedef UINT64 ACPI_PHYSICAL_ADDRESS; #elif ACPI_MACHINE_WIDTH == 32 -/*! [Begin] no source code translation (keep the typedefs as-is) */ +#ifndef ACPI_USE_SYSTEM_INTTYPES typedef unsigned int UINT32; typedef int INT32; -/*! [End] no source code translation !*/ +#endif /* ACPI_USE_SYSTEM_INTTYPES */ typedef INT32 ACPI_NATIVE_INT; @@ -375,9 +376,18 @@ typedef UINT32 ACPI_PHYSICAL_ADDRESS; #endif /* - * All ACPICA functions that are available to the rest of the kernel are - * tagged with this macro which can be defined as appropriate for the host. + * All ACPICA external functions that are available to the rest of the kernel + * are tagged with thes macros which can be defined as appropriate for the host. + * + * Notes: + * ACPI_EXPORT_SYMBOL_INIT is used for initialization and termination + * interfaces that may need special processing. + * ACPI_EXPORT_SYMBOL is used for all other public external functions. */ +#ifndef ACPI_EXPORT_SYMBOL_INIT +#define ACPI_EXPORT_SYMBOL_INIT(Symbol) +#endif + #ifndef ACPI_EXPORT_SYMBOL #define ACPI_EXPORT_SYMBOL(Symbol) #endif @@ -391,6 +401,45 @@ typedef UINT32 ACPI_PHYSICAL_ADDRESS; #endif +/******************************************************************************* + * + * Configuration + * + ******************************************************************************/ + +#ifdef ACPI_NO_MEM_ALLOCATIONS + +#define ACPI_ALLOCATE(a) NULL +#define ACPI_ALLOCATE_ZEROED(a) NULL +#define ACPI_FREE(a) +#define ACPI_MEM_TRACKING(a) + +#else /* ACPI_NO_MEM_ALLOCATIONS */ + +#ifdef ACPI_DBG_TRACK_ALLOCATIONS +/* + * Memory allocation tracking (used by AcpiExec to detect memory leaks) + */ +#define ACPI_MEM_PARAMETERS _COMPONENT, _AcpiModuleName, __LINE__ +#define ACPI_ALLOCATE(a) AcpiUtAllocateAndTrack ((ACPI_SIZE) (a), ACPI_MEM_PARAMETERS) +#define ACPI_ALLOCATE_ZEROED(a) AcpiUtAllocateZeroedAndTrack ((ACPI_SIZE) (a), ACPI_MEM_PARAMETERS) +#define ACPI_FREE(a) AcpiUtFreeAndTrack (a, ACPI_MEM_PARAMETERS) +#define ACPI_MEM_TRACKING(a) a + +#else +/* + * Normal memory allocation directly via the OS services layer + */ +#define ACPI_ALLOCATE(a) AcpiOsAllocate ((ACPI_SIZE) (a)) +#define ACPI_ALLOCATE_ZEROED(a) AcpiOsAllocateZeroed ((ACPI_SIZE) (a)) +#define ACPI_FREE(a) AcpiOsFree (a) +#define ACPI_MEM_TRACKING(a) + +#endif /* ACPI_DBG_TRACK_ALLOCATIONS */ + +#endif /* ACPI_NO_MEM_ALLOCATIONS */ + + /****************************************************************************** * * ACPI Specification constants (Do not change unless the specification changes) @@ -407,6 +456,7 @@ typedef UINT32 ACPI_PHYSICAL_ADDRESS; #define ACPI_PM1_REGISTER_WIDTH 16 #define ACPI_PM2_REGISTER_WIDTH 8 #define ACPI_PM_TIMER_WIDTH 32 +#define ACPI_RESET_REGISTER_WIDTH 8 /* Names within the namespace are 4 bytes long */ @@ -546,7 +596,7 @@ typedef UINT64 ACPI_INTEGER; #define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void, (void *) NULL,(ACPI_SIZE) i) #define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p, (void *) NULL) -#define ACPI_OFFSET(d, f) (ACPI_SIZE) ACPI_PTR_DIFF (&(((d *)0)->f), (void *) NULL) +#define ACPI_OFFSET(d, f) ACPI_PTR_DIFF (&(((d *) 0)->f), (void *) NULL) #define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i) #define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) @@ -640,8 +690,9 @@ typedef UINT64 ACPI_INTEGER; #define ACPI_NOTIFY_RESERVED (UINT8) 0x0A #define ACPI_NOTIFY_LOCALITY_UPDATE (UINT8) 0x0B #define ACPI_NOTIFY_SHUTDOWN_REQUEST (UINT8) 0x0C +#define ACPI_NOTIFY_AFFINITY_UPDATE (UINT8) 0x0D -#define ACPI_NOTIFY_MAX 0x0C +#define ACPI_NOTIFY_MAX 0x0D /* * Types associated with ACPI names and objects. The first group of @@ -988,8 +1039,18 @@ typedef struct acpi_object_list * Miscellaneous common Data Structures used by the interfaces */ #define ACPI_NO_BUFFER 0 -#define ACPI_ALLOCATE_BUFFER (ACPI_SIZE) (-1) -#define ACPI_ALLOCATE_LOCAL_BUFFER (ACPI_SIZE) (-2) + +#ifdef ACPI_NO_MEM_ALLOCATIONS + +#define ACPI_ALLOCATE_BUFFER (ACPI_SIZE) (0) +#define ACPI_ALLOCATE_LOCAL_BUFFER (ACPI_SIZE) (0) + +#else /* ACPI_NO_MEM_ALLOCATIONS */ + +#define ACPI_ALLOCATE_BUFFER (ACPI_SIZE) (-1) /* Let ACPICA allocate buffer */ +#define ACPI_ALLOCATE_LOCAL_BUFFER (ACPI_SIZE) (-2) /* For internal use only (enables tracking) */ + +#endif /* ACPI_NO_MEM_ALLOCATIONS */ typedef struct acpi_buffer { @@ -998,10 +1059,6 @@ typedef struct acpi_buffer } ACPI_BUFFER; -/* Free a buffer created in an ACPI_BUFFER via ACPI_ALLOCATE_LOCAL_BUFFER */ - -#define ACPI_FREE_BUFFER(b) ACPI_FREE(b.Pointer) - /* * NameType for AcpiGetName @@ -1353,4 +1410,19 @@ typedef struct acpi_memory_list #define ACPI_OSI_WIN_8 0x0C +/* Definitions of file IO */ + +#define ACPI_FILE_READING 0x01 +#define ACPI_FILE_WRITING 0x02 +#define ACPI_FILE_BINARY 0x04 + +#define ACPI_FILE_BEGIN 0x01 +#define ACPI_FILE_END 0x02 + + +/* Definitions of getopt */ + +#define ACPI_OPT_END -1 + + #endif /* __ACTYPES_H__ */ diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acutils.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acutils.h index e6ae828228..2aea248ade 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/acutils.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/acutils.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -122,7 +122,7 @@ extern const UINT8 AcpiGbl_ResourceAmlSerialBusSizes[]; /* Strings used by the disassembler and debugger resource dump routines */ -#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) +#if defined(ACPI_DEBUG_OUTPUT) || defined (ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) extern const char *AcpiGbl_BmDecode[]; extern const char *AcpiGbl_ConfigDecode[]; @@ -168,7 +168,6 @@ extern const char *AcpiGbl_PtDecode[]; #ifdef ACPI_ASL_COMPILER #include -extern FILE *AcpiGbl_OutputFile; #define ACPI_MSG_REDIRECT_BEGIN \ FILE *OutputFile = AcpiGbl_OutputFile; \ @@ -261,8 +260,8 @@ AcpiUtGetMutexName ( const char * AcpiUtGetNotifyName ( - UINT32 NotifyValue); - + UINT32 NotifyValue, + ACPI_OBJECT_TYPE Type); #endif char * @@ -298,6 +297,10 @@ AcpiUtHexToAsciiChar ( UINT64 Integer, UINT32 Position); +UINT8 +AcpiUtAsciiCharToHex ( + int HexChar); + BOOLEAN AcpiUtValidObjectType ( ACPI_OBJECT_TYPE Type); @@ -324,6 +327,11 @@ ACPI_SIZE AcpiUtStrlen ( const char *String); +char * +AcpiUtStrchr ( + const char *String, + int ch); + char * AcpiUtStrcpy ( char *DstString, @@ -412,7 +420,7 @@ extern const UINT8 _acpi_ctype[]; #define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD)) #define ACPI_IS_UPPER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP)) #define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO)) -#define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU)) +#define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_XS | _ACPI_PU)) #define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP)) #endif /* !ACPI_USE_SYSTEM_CLIBRARY */ @@ -554,6 +562,16 @@ AcpiUtDumpBuffer ( UINT32 Display, UINT32 Offset); +#ifdef ACPI_APPLICATION +void +AcpiUtDumpBufferToFile ( + ACPI_FILE File, + UINT8 *Buffer, + UINT32 Count, + UINT32 Display, + UINT32 BaseOffset); +#endif + void AcpiUtReportError ( char *ModuleName, @@ -622,6 +640,17 @@ AcpiUtExecutePowerMethods ( UINT8 *OutValues); +/* + * utfileio - file operations + */ +#ifdef ACPI_APPLICATION +ACPI_STATUS +AcpiUtReadTableFromFile ( + char *Filename, + ACPI_TABLE_HEADER **Table); +#endif + + /* * utids - device ID support */ @@ -998,6 +1027,27 @@ void AcpiUtRepairName ( char *Name); +#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) +BOOLEAN +AcpiUtSafeStrcpy ( + char *Dest, + ACPI_SIZE DestSize, + char *Source); + +BOOLEAN +AcpiUtSafeStrcat ( + char *Dest, + ACPI_SIZE DestSize, + char *Source); + +BOOLEAN +AcpiUtSafeStrncat ( + char *Dest, + ACPI_SIZE DestSize, + char *Source, + ACPI_SIZE MaxTransferLength); +#endif + /* * utmutex - mutex support @@ -1039,20 +1089,6 @@ AcpiUtInitializeBuffer ( ACPI_BUFFER *Buffer, ACPI_SIZE RequiredLength); -void * -AcpiUtAllocate ( - ACPI_SIZE Size, - UINT32 Component, - const char *Module, - UINT32 Line); - -void * -AcpiUtAllocateZeroed ( - ACPI_SIZE Size, - UINT32 Component, - const char *Module, - UINT32 Line); - #ifdef ACPI_DBG_TRACK_ALLOCATIONS void * AcpiUtAllocateAndTrack ( @@ -1164,4 +1200,68 @@ AcpiUtMethodError ( const char *Path, ACPI_STATUS LookupStatus); +/* + * Utility functions for ACPI names and IDs + */ +const AH_PREDEFINED_NAME * +AcpiAhMatchPredefinedName ( + char *Nameseg); + +const AH_DEVICE_ID * +AcpiAhMatchHardwareId ( + char *Hid); + +const char * +AcpiAhMatchUuid ( + UINT8 *Data); + +/* + * utprint - printf/vprintf output functions + */ +const char * +AcpiUtScanNumber ( + const char *String, + UINT64 *NumberPtr); + +const char * +AcpiUtPrintNumber ( + char *String, + UINT64 Number); + +int +AcpiUtVsnprintf ( + char *String, + ACPI_SIZE Size, + const char *Format, + va_list Args); + +int +AcpiUtSnprintf ( + char *String, + ACPI_SIZE Size, + const char *Format, + ...); + +#ifdef ACPI_APPLICATION +int +AcpiUtFileVprintf ( + ACPI_FILE File, + const char *Format, + va_list Args); + +int +AcpiUtFilePrintf ( + ACPI_FILE File, + const char *Format, + ...); +#endif + +/* + * utuuid -- UUID support functions + */ +void +AcpiUtConvertStringToUuid ( + char *InString, + UINT8 *UuidBuffer); + #endif /* _ACUTILS_H */ diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/amlcode.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/amlcode.h index 3d56e32608..5eaf30c603 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/amlcode.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/amlcode.h @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/amlresrc.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/amlresrc.h index f71eb32147..3fcd9edd61 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/amlresrc.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/amlresrc.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/platform/acenv.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/platform/acenv.h index 3838e79fe9..80038c8a1d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/platform/acenv.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/platform/acenv.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -160,32 +160,55 @@ #define ACPI_DBG_TRACK_ALLOCATIONS #endif -/* AcpiNames configuration. Single threaded with debugger output enabled. */ - -#ifdef ACPI_NAMES_APP -#define ACPI_DEBUGGER -#define ACPI_APPLICATION -#define ACPI_SINGLE_THREADED -#endif - /* - * AcpiBin/AcpiDump/AcpiSrc/AcpiXtract configuration. All single - * threaded, with no debug output. + * AcpiBin/AcpiDump/AcpiHelp/AcpiNames/AcpiSrc/AcpiXtract/Example configuration. + * All single threaded. */ -#if (defined ACPI_BIN_APP) || \ - (defined ACPI_DUMP_APP) || \ - (defined ACPI_SRC_APP) || \ - (defined ACPI_XTRACT_APP) +#if (defined ACPI_BIN_APP) || \ + (defined ACPI_DUMP_APP) || \ + (defined ACPI_HELP_APP) || \ + (defined ACPI_NAMES_APP) || \ + (defined ACPI_SRC_APP) || \ + (defined ACPI_XTRACT_APP) || \ + (defined ACPI_EXAMPLE_APP) #define ACPI_APPLICATION #define ACPI_SINGLE_THREADED #endif +/* AcpiHelp configuration. Error messages disabled. */ + #ifdef ACPI_HELP_APP -#define ACPI_APPLICATION -#define ACPI_SINGLE_THREADED #define ACPI_NO_ERROR_MESSAGES #endif +/* AcpiNames configuration. Debug output enabled. */ + +#ifdef ACPI_NAMES_APP +#define ACPI_DEBUG_OUTPUT +#endif + +/* AcpiExec/AcpiNames/Example configuration. Native RSDP used. */ + +#if (defined ACPI_EXEC_APP) || \ + (defined ACPI_EXAMPLE_APP) || \ + (defined ACPI_NAMES_APP) +#define ACPI_USE_NATIVE_RSDP_POINTER +#endif + +/* AcpiDump configuration. Native mapping used if provied by OSPMs */ + +#ifdef ACPI_DUMP_APP +#define ACPI_USE_NATIVE_MEMORY_MAPPING +#define USE_NATIVE_ALLOCATE_ZEROED +#endif + +/* AcpiNames/Example configuration. Hardware disabled */ + +#if (defined ACPI_EXAMPLE_APP) || \ + (defined ACPI_NAMES_APP) +#define ACPI_REDUCED_HARDWARE 1 +#endif + /* Linkable ACPICA library */ #ifdef ACPI_LIBRARY @@ -256,6 +279,9 @@ #elif defined(_AED_EFI) #include "acefi.h" +#elif defined(_GNU_EFI) +#include "acefi.h" + #elif defined(__HAIKU__) #include "achaiku.h" @@ -468,4 +494,17 @@ typedef char *va_list; #endif /* ACPI_USE_SYSTEM_CLIBRARY */ +#ifndef ACPI_FILE +#ifdef ACPI_APPLICATION +#include +#define ACPI_FILE FILE * +#define ACPI_FILE_OUT stdout +#define ACPI_FILE_ERR stderr +#else +#define ACPI_FILE void * +#define ACPI_FILE_OUT NULL +#define ACPI_FILE_ERR NULL +#endif /* ACPI_APPLICATION */ +#endif /* ACPI_FILE */ + #endif /* __ACENV_H__ */ diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/platform/acenvex.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/platform/acenvex.h new file mode 100644 index 0000000000..2c50162b65 --- /dev/null +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/platform/acenvex.h @@ -0,0 +1,135 @@ +/****************************************************************************** + * + * Name: acenvex.h - Extra host and compiler configuration + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef __ACENVEX_H__ +#define __ACENVEX_H__ + +/*! [Begin] no source code translation */ + +/****************************************************************************** + * + * Extra host configuration files. All ACPICA headers are included before + * including these files. + * + *****************************************************************************/ + +#if defined(_LINUX) || defined(__linux__) +#include "aclinuxex.h" + +#endif + +/*! [End] no source code translation !*/ + +#endif /* __ACENVEX_H__ */ diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/platform/acgcc.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/platform/acgcc.h index 6ff7743ff9..9cb3cbe5c0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/platform/acgcc.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/platform/acgcc.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -120,7 +120,7 @@ /* Function name is used for debug output. Non-ANSI, compiler-dependent */ -#define ACPI_GET_FUNCTION_NAME __FUNCTION__ +#define ACPI_GET_FUNCTION_NAME __func__ /* * This macro is used to tag functions as "printf-like" because @@ -136,4 +136,15 @@ */ #define ACPI_UNUSED_VAR __attribute__ ((unused)) +/* + * Some versions of gcc implement strchr() with a buggy macro. So, + * undef it here. Prevents error messages of this form (usually from the + * file getopt.c): + * + * error: logical '&&' with non-zero constant will always evaluate as true + */ +#ifdef strchr +#undef strchr +#endif + #endif /* __ACGCC_H__ */ diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/platform/achaiku.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/platform/achaiku.h index e78945734b..5a90c7109c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/platform/achaiku.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/platform/achaiku.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License @@ -132,7 +132,8 @@ struct mutex; #define ACPI_USE_NATIVE_DIVIDE -// #define ACPI_THREAD_ID thread_id +/* #define ACPI_THREAD_ID thread_id */ + #define ACPI_SEMAPHORE sem_id #define ACPI_SPINLOCK spinlock * #define ACPI_CPU_FLAGS cpu_status diff --git a/src/add-ons/kernel/bus_managers/acpi/acpica/include/platform/acintel.h b/src/add-ons/kernel/bus_managers/acpi/acpica/include/platform/acintel.h index 1c2d562039..b64146712b 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpica/include/platform/acintel.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpica/include/platform/acintel.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/system/kernel/device_manager/device_manager.cpp b/src/system/kernel/device_manager/device_manager.cpp index 5537aa0d8d..06c10d7632 100644 --- a/src/system/kernel/device_manager/device_manager.cpp +++ b/src/system/kernel/device_manager/device_manager.cpp @@ -35,7 +35,7 @@ #include "IOSchedulerRoster.h" -//#define TRACE_DEVICE_MANAGER +#define TRACE_DEVICE_MANAGER #ifdef TRACE_DEVICE_MANAGER # define TRACE(a) dprintf a #else