hrev47730 adds 1 changeset to branch 'master' old head: 1b8bbb509aacb9b7a200bfdcf82e4ea0bb66a7d2 new head: ad5bbfb8e1be05ad72aab31d4149034d4078fe0d overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=ad5bbfb+%5E1b8bbb5 ---------------------------------------------------------------------------- ad5bbfb: 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/ [ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ] ---------------------------------------------------------------------------- Revision: hrev47730 Commit: ad5bbfb8e1be05ad72aab31d4149034d4078fe0d URL: http://cgit.haiku-os.org/haiku/commit/?id=ad5bbfb Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> Date: Sat Aug 23 14:21:05 2014 UTC ---------------------------------------------------------------------------- 212 files changed, 9586 insertions(+), 3152 deletions(-) .gitignore | 2 + src/add-ons/kernel/bus_managers/acpi/Jamfile | 9 + .../bus_managers/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 ++++++ .../bus_managers/acpi/acpica/common/ahpredef.c | 39 +- .../bus_managers/acpi/acpica/common/ahuuids.c | 201 ++++ .../bus_managers/acpi/acpica/common/cmfsize.c | 185 ++++ .../bus_managers/acpi/acpica/common/dmextern.c | 718 ++++++++------ .../bus_managers/acpi/acpica/common/dmrestag.c | 2 +- .../bus_managers/acpi/acpica/common/dmtable.c | 150 ++- .../bus_managers/acpi/acpica/common/dmtbdump.c | 391 ++++++-- .../bus_managers/acpi/acpica/common/dmtbinfo.c | 266 +++++- .../bus_managers/acpi/acpica/common/getopt.c | 16 +- .../acpi/acpica/components/dispatcher/dsargs.c | 2 +- .../acpica/components/dispatcher/dscontrol.c | 2 +- .../acpi/acpica/components/dispatcher/dsfield.c | 4 +- .../acpi/acpica/components/dispatcher/dsinit.c | 63 +- .../acpi/acpica/components/dispatcher/dsmethod.c | 158 +++- .../acpi/acpica/components/dispatcher/dsmthdat.c | 2 +- .../acpi/acpica/components/dispatcher/dsobject.c | 2 +- .../acpi/acpica/components/dispatcher/dsopcode.c | 2 +- .../acpi/acpica/components/dispatcher/dsutils.c | 18 +- .../acpi/acpica/components/dispatcher/dswexec.c | 5 +- .../acpi/acpica/components/dispatcher/dswload.c | 21 +- .../acpi/acpica/components/dispatcher/dswload2.c | 2 +- .../acpi/acpica/components/dispatcher/dswscope.c | 2 +- .../acpi/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 +- .../acpi/acpica/components/executer/exconfig.c | 81 +- .../acpi/acpica/components/executer/exconvrt.c | 2 +- .../acpi/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 +- .../acpi/acpica/components/executer/exoparg1.c | 2 +- .../acpi/acpica/components/executer/exoparg2.c | 2 +- .../acpi/acpica/components/executer/exoparg3.c | 2 +- .../acpi/acpica/components/executer/exoparg6.c | 2 +- .../acpi/acpica/components/executer/exprep.c | 2 +- .../acpi/acpica/components/executer/exregion.c | 2 +- .../acpi/acpica/components/executer/exresnte.c | 6 +- .../acpi/acpica/components/executer/exresolv.c | 2 +- .../acpi/acpica/components/executer/exresop.c | 2 +- .../acpi/acpica/components/executer/exstore.c | 170 ++-- .../acpi/acpica/components/executer/exstoren.c | 2 +- .../acpi/acpica/components/executer/exstorob.c | 2 +- .../acpi/acpica/components/executer/exsystem.c | 14 +- .../acpi/acpica/components/executer/exutils.c | 92 +- .../acpi/acpica/components/hardware/hwacpi.c | 2 +- .../acpi/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 +- .../acpi/acpica/components/hardware/hwxfsleep.c | 4 +- .../acpi/acpica/components/namespace/nsaccess.c | 2 +- .../acpi/acpica/components/namespace/nsalloc.c | 21 +- .../acpica/components/namespace/nsarguments.c | 2 +- .../acpi/acpica/components/namespace/nsconvert.c | 2 +- .../acpi/acpica/components/namespace/nsdump.c | 9 +- .../acpi/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 +- .../acpi/acpica/components/namespace/nsnames.c | 2 +- .../acpi/acpica/components/namespace/nsobject.c | 21 +- .../acpi/acpica/components/namespace/nsparse.c | 2 +- .../acpi/acpica/components/namespace/nspredef.c | 2 +- .../acpi/acpica/components/namespace/nsprepkg.c | 42 +- .../acpi/acpica/components/namespace/nsrepair.c | 27 +- .../acpi/acpica/components/namespace/nsrepair2.c | 40 +- .../acpi/acpica/components/namespace/nssearch.c | 2 +- .../acpi/acpica/components/namespace/nsutils.c | 20 +- .../acpi/acpica/components/namespace/nswalk.c | 2 +- .../acpi/acpica/components/namespace/nsxfeval.c | 21 +- [ *** stats truncated: 113 lines dropped *** ] ---------------------------------------------------------------------------- diff --git a/.gitignore b/.gitignore index e20de9c..02456c5 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 85cdb1a..f630621 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 0000000..77ca341 --- /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 <stdio.h> + +/* + * 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 1af4cc2..3426107 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 f14ae17..df70001 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, @@ -229,38 +225,6 @@ 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 * * PARAMETERS: None @@ -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 */ - - AcpiOsPrintf ("\n"); + AdWriteTable (NewTable, NewTable->Length, + ACPI_SIG_DSDT, NewTable->OemTableId); - /* Get all SSDTs */ + /* Store DSDT in the Table Manager */ - 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 76ef5df..808e4e2 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 0000000..af6771b --- /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 78e1960..7123b7f 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 0000000..1bf362c --- /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 0000000..1511683 --- /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 <stdio.h> + +#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 9ad8093..30196df 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); + return (AE_NO_MEMORY); + } - ExternalFile = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EXTERNAL_FILE)); - if (!ExternalFile) - { - ACPI_FREE (TmpPath); - return (AE_NO_MEMORY); - } + ExternalFile = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EXTERNAL_FILE)); + if (!ExternalFile) + { + ACPI_FREE (LocalPathname); + return (AE_NO_MEMORY); + } - ExternalFile->Path = TmpPath; + /* Take a copy of the file pathname */ - if (AcpiGbl_ExternalFileList) - { - ExternalFile->Next = AcpiGbl_ExternalFileList; - } + strcpy (LocalPathname, Pathname); + ExternalFile->Path = LocalPathname; - AcpiGbl_ExternalFileList = ExternalFile; - Path = strtok (NULL, ","); + if (AcpiGbl_ExternalFileList) + { + ExternalFile->Next = AcpiGbl_ExternalFileList; } + AcpiGbl_ExternalFileList = ExternalFile; return (AE_OK); } @@ -428,12 +430,139 @@ AcpiDmClearExternalFileList ( /******************************************************************************* * - * FUNCTION: AcpiDmAddToExternalList + * FUNCTION: AcpiDmGetExternalsFromFile + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Process the optional external reference file. + * + * Each line in the file should be of the form: + * External (<Method namepath>, MethodObj, <ArgCount>) + * + * Example: + * External (_SB_.PCI0.XHC_.PS0X, MethodObj, 4) + * + ******************************************************************************/ + +void +AcpiDmGetExternalsFromFile ( + void) +{ + FILE *ExternalRefFile; + char *Token; + char *MethodName; + UINT32 ArgCount; + UINT32 ImportCount = 0; + + + if (!Gbl_ExternalRefFilename) + { + return; + } + + /* Open the file */ + + ExternalRefFile = fopen (Gbl_ExternalRefFilename, "r"); + if (!ExternalRefFile) + { + fprintf (stderr, "Could not open external reference file \"%s\"\n", + Gbl_ExternalRefFilename); + AslAbort (); + return; + } + + /* Each line defines a method */ + + while (fgets (StringBuffer, ASL_MSG_BUFFER_SIZE, ExternalRefFile)) + { + Token = strtok (StringBuffer, METHOD_SEPARATORS); /* "External" */ + if (!Token) + { + continue; + } + if (strcmp (Token, "External")) + { + continue; + } + + MethodName = strtok (NULL, METHOD_SEPARATORS); /* Method namepath */ + if (!MethodName) + { + continue; + } + + Token = strtok (NULL, METHOD_SEPARATORS); /* "MethodObj" */ + if (!Token) + { + continue; + } + + if (strcmp (Token, "MethodObj")) + { + continue; + } + + Token = strtok (NULL, METHOD_SEPARATORS); /* Arg count */ + if (!Token) + { + continue; + } + + /* Convert arg count string to an integer */ + + errno = 0; + ArgCount = strtoul (Token, NULL, 0); + if (errno) + { + fprintf (stderr, "Invalid argument count (%s)\n", Token); + continue; + } + if (ArgCount > 7) + { + fprintf (stderr, "Invalid argument count (%u)\n", ArgCount); + continue; + } + + /* Add this external to the global list */ + + AcpiOsPrintf ("%s: Importing method external (%u arguments) %s\n", + Gbl_ExternalRefFilename, ArgCount, MethodName); + + AcpiDmAddPathToExternalList (MethodName, ACPI_TYPE_METHOD, + ArgCount, (ACPI_EXT_RESOLVED_REFERENCE | ACPI_EXT_ORIGIN_FROM_FILE)); + ImportCount++; + } + + if (!ImportCount) + { + fprintf (stderr, "Did not find any external methods in reference file \"%s\"\n", + Gbl_ExternalRefFilename); + } + else + { + /* Add the external(s) to the namespace */ + + AcpiDmAddExternalsToNamespace (); + + AcpiOsPrintf ("%s: Imported %u external method definitions\n", + Gbl_ExternalRefFilename, ImportCount); + } + + fclose (ExternalRefFile); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmAddOpToExternalList * * 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 * @@ -441,60 +570,47 @@ AcpiDmClearExternalFileList ( * 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. + * ******************************************************************************/ void -AcpiDmAddToExternalList ( +AcpiDmAddOpToExternalList ( ACPI_PARSE_OBJECT *Op, char *Path, UINT8 Type, - UINT32 Value) + UINT32 Value, + UINT16 Flags) { char *ExternalPath; - char *Fullpath = NULL; - 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; } - if (Type == ACPI_TYPE_METHOD) - { - if (Value & 0x80) - { - Resolved = TRUE; - } - Value &= 0x07; - } + /* Remove a root backslash if present */ - /* - * 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 */ + /* Externalize the pathname */ Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, Path, - NULL, &ExternalPath); + NULL, &ExternalPath); if (ACPI_FAILURE (Status)) { - return; + return_VOID; } /* @@ -503,231 +619,140 @@ AcpiDmAddToExternalList ( */ if (*Path == (UINT8) AML_PARENT_PREFIX) { - Fullpath = AcpiDmNormalizeParentPrefix (Op, ExternalPath); - if (Fullpath) - { - /* Set new external path */ - - ACPI_FREE (ExternalPath); - ExternalPath = Fullpath; - } - } + Temp = AcpiDmNormalizeParentPrefix (Op, ExternalPath); - /* Check all existing externals to ensure no duplicates */ + /* Set new external path */ - NextExternal = AcpiGbl_ExternalList; - while (NextExternal) - { - if (!ACPI_STRCMP (ExternalPath, NextExternal->Path)) + ACPI_FREE (ExternalPath); + ExternalPath = Temp; + if (!Temp) { - /* 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; + return_VOID; } - 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 */ + /* Create the new internal pathname */ - Status = AcpiNsInternalizeName (ExternalPath, &Path); + Flags |= ACPI_EXT_INTERNAL_PATH_ALLOCATED; + Status = AcpiNsInternalizeName (ExternalPath, &InternalPath); if (ACPI_FAILURE (Status)) { ACPI_FREE (ExternalPath); - ACPI_FREE (NewExternal); - return; + return_VOID; } - - /* 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 */ + /* Create the new External() declaration node */ - NextExternal = AcpiGbl_ExternalList; - while (NextExternal) + Status = AcpiDmCreateNewExternal (ExternalPath, InternalPath, + Type, Value, Flags); + if (ACPI_FAILURE (Status)) { - if (AcpiUtStricmp (NewExternal->Path, NextExternal->Path) < 0) + ACPI_FREE (ExternalPath); + if (Flags & ACPI_EXT_INTERNAL_PATH_ALLOCATED) { - if (PrevExternal) - { - PrevExternal->Next = NewExternal; - } - else - { - AcpiGbl_ExternalList = NewExternal; - } - - NewExternal->Next = NextExternal; - return; + ACPI_FREE (InternalPath); } - - PrevExternal = NextExternal; - NextExternal = NextExternal->Next; } - if (PrevExternal) - { - PrevExternal->Next = NewExternal; - } - else - { - AcpiGbl_ExternalList = NewExternal; - } + return_VOID; } /******************************************************************************* * - * FUNCTION: AcpiDmGetExternalsFromFile + * FUNCTION: AcpiDmAddNodeToExternalList * - * PARAMETERS: None + * 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: Process the optional external reference file. - * - * Each line in the file should be of the form: - * External (<Method namepath>, MethodObj, <ArgCount>) + * 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. * - * Example: - * External (_SB_.PCI0.XHC_.PS0X, MethodObj, 4) + * 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). [ *** diff truncated: 18433 lines dropped *** ]