1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-19 10:53:58 +00:00

Import ACPICA 20140325.

This commit is contained in:
Jung-uk Kim 2014-03-27 23:50:54 +00:00
parent 526d99544b
commit 7c6f304a2e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor-sys/acpica/dist/; revision=263851
svn path=/vendor-sys/acpica/20140325/; revision=263852; tag=vendor/acpica/20140325
102 changed files with 2821 additions and 1816 deletions

View File

@ -1,3 +1,103 @@
----------------------------------------
25 March 2014. Summary of changes for version 20140325:
1) ACPICA kernel-resident subsystem:
Updated the auto-serialize feature for control methods. This feature
automatically serializes all methods that create named objects in order
to prevent runtime errors. The update adds support to ignore the
currently executing AML SyncLevel when invoking such a method, in order
to prevent disruption of any existing SyncLevel priorities that may exist
in the AML code. Although the use of SyncLevels is relatively rare, this
change fixes a regression where an AE_AML_MUTEX_ORDER exception can
appear on some machines starting with the 20140214 release.
Added a new external interface to allow the host to install ACPI tables
very early, before the namespace is even created. AcpiInstallTable gives
the host additional flexibility for ACPI table management. Tables can be
installed directly by the host as if they had originally appeared in the
XSDT/RSDT. Installed tables can be SSDTs or other ACPI data tables
(anything except the DSDT and FACS). Adds a new file, tbdata.c, along
with additional internal restructuring and cleanup. See the ACPICA
Reference for interface details. Lv Zheng.
Added validation of the checksum for all incoming dynamically loaded
tables (via external interfaces or via AML Load/LoadTable operators). Lv
Zheng.
Updated the use of the AcpiOsWaitEventsComplete interface during Notify
and GPE handler removal. Restructured calls to eliminate possible race
conditions. Lv Zheng.
Added a warning for the use/execution of the ASL/AML Unload (table)
operator. This will help detect and identify machines that use this
operator if and when it is ever used. This operator has never been seen
in the field and the usage model and possible side-effects of the drastic
runtime action of a full table removal are unknown.
Reverted the use of #pragma push/pop which was introduced in the 20140214
release. It appears that push and pop are not implemented by enough
compilers to make the use of this feature feasible for ACPICA at this
time. However, these operators may be deployed in a future ACPICA
release.
Added the missing EXPORT_SYMBOL macros for the install and remove SCI
handler interfaces.
Source code generation:
1) Disabled the use of the "strchr" macro for the gcc-specific
generation. For some versions of gcc, this macro can periodically expose
a compiler bug which in turn causes compile-time error(s).
2) Added support for PPC64 compilation. Colin Ian King.
Example Code and Data Size: These are the sizes for the OS-independent
acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The
debug version of the code includes the debug output trace mechanism and
has a much larger code and data size.
Current Release:
Non-Debug Version: 97.0K Code, 27.2K Data, 124.2K Total
Debug Version: 189.7K Code, 79.5K Data, 269.2K Total
Previous Release:
Non-Debug Version: 96.5K Code, 27.2K Data, 123.7K Total
Debug Version: 188.6K Code, 79.0K Data, 267.6K Total
2) iASL Compiler/Disassembler and Tools:
Disassembler: Added several new features to improve the readability of
the resulting ASL code. Extra information is emitted within comment
fields in the ASL code:
1) Known _HID/_CID values are decoded to descriptive text.
2) Standard values for the Notify() operator are decoded to descriptive
text.
3) Target operands are expanded to full pathnames (in a comment) when
possible.
Disassembler: Miscellaneous updates for extern() handling:
1) Abort compiler if file specified by -fe option does not exist.
2) Silence unnecessary warnings about argument count mismatches.
3) Update warning messages concerning unresolved method externals.
4) Emit "UnknownObj" keyword for externals whose type cannot be
determined.
AcpiHelp utility:
1) Added the -a option to display both the ASL syntax and the AML
encoding for an input ASL operator. This effectively displays all known
information about an ASL operator with one AcpiHelp invocation.
2) Added substring match support (similar to a wildcard) for the -i
(_HID/PNP IDs) option.
iASL/Disassembler: Since this tool does not yet support execution on big-
endian machines, added detection of endianness and an error message if
execution is attempted on big-endian. Support for big-endian within iASL
is a feature that is on the ACPICA to-be-done list.
AcpiBin utility:
1) Remove option to extract binary files from an acpidump; this function
is made obsolete by the AcpiXtract utility.
2) General cleanup of open files and allocated buffers.
----------------------------------------
14 February 2014. Summary of changes for version 20140214:

View File

@ -29,6 +29,8 @@ HEADERS = \
OBJECTS = \
$(OBJDIR)/abcompare.o\
$(OBJDIR)/abmain.o\
$(OBJDIR)/cmfsize.o\
$(OBJDIR)/getopt.o\
$(OBJDIR)/utalloc.o\
$(OBJDIR)/utbuffer.o\
$(OBJDIR)/utcache.o\
@ -42,8 +44,7 @@ OBJECTS = \
$(OBJDIR)/utstate.o\
$(OBJDIR)/utstring.o\
$(OBJDIR)/utxferror.o\
$(OBJDIR)/osunixxf.o\
$(OBJDIR)/getopt.o
$(OBJDIR)/osunixxf.o
#
# Flags specific to acpibin

View File

@ -31,6 +31,8 @@ OBJECTS = \
$(OBJDIR)/apdump.o\
$(OBJDIR)/apfiles.o\
$(OBJDIR)/apmain.o\
$(OBJDIR)/cmfsize.o\
$(OBJDIR)/getopt.o\
$(OBJDIR)/osunixdir.o\
$(OBJDIR)/osunixmap.o\
$(OBJDIR)/tbprint.o\
@ -39,8 +41,7 @@ OBJECTS = \
$(OBJDIR)/utexcep.o\
$(OBJDIR)/utmath.o\
$(OBJDIR)/utstring.o\
$(OBJDIR)/utxferror.o\
$(OBJDIR)/getopt.o
$(OBJDIR)/utxferror.o
#
# Per-host interfaces

View File

@ -103,6 +103,7 @@ OBJECTS = \
$(OBJDIR)/psutils.o\
$(OBJDIR)/pswalk.o\
$(OBJDIR)/psxface.o\
$(OBJDIR)/tbdata.o\
$(OBJDIR)/tbfadt.o\
$(OBJDIR)/tbfind.o\
$(OBJDIR)/tbinstal.o\

View File

@ -44,6 +44,8 @@ OBJECTS = \
$(OBJDIR)/aehandlers.o\
$(OBJDIR)/aemain.o\
$(OBJDIR)/aetables.o\
$(OBJDIR)/ahids.o\
$(OBJDIR)/cmfsize.o\
$(OBJDIR)/dbcmds.o\
$(OBJDIR)/dbconvert.o\
$(OBJDIR)/dbdisply.o\
@ -179,6 +181,7 @@ OBJECTS = \
$(OBJDIR)/rsserial.o\
$(OBJDIR)/rsutils.o\
$(OBJDIR)/rsxface.o\
$(OBJDIR)/tbdata.o\
$(OBJDIR)/tbfadt.o\
$(OBJDIR)/tbfind.o\
$(OBJDIR)/tbinstal.o\

View File

@ -31,6 +31,7 @@ OBJECTS = \
$(OBJDIR)/ahaslkey.o\
$(OBJDIR)/ahaslops.o\
$(OBJDIR)/ahdecode.o\
$(OBJDIR)/ahids.o\
$(OBJDIR)/ahpredef.o\
$(OBJDIR)/ahmain.o\
$(OBJDIR)/getopt.o\

View File

@ -38,6 +38,7 @@ OBJECTS = \
$(OBJDIR)/anmain.o\
$(OBJDIR)/anstubs.o\
$(OBJDIR)/antables.o\
$(OBJDIR)/cmfsize.o\
$(OBJDIR)/dbfileio.o\
$(OBJDIR)/dsfield.o\
$(OBJDIR)/dsmthdat.o\
@ -79,6 +80,7 @@ OBJECTS = \
$(OBJDIR)/psutils.o\
$(OBJDIR)/pswalk.o\
$(OBJDIR)/psxface.o\
$(OBJDIR)/tbdata.o\
$(OBJDIR)/tbfadt.o\
$(OBJDIR)/tbfind.o\
$(OBJDIR)/tbinstal.o\

View File

@ -33,8 +33,9 @@ OBJECTS = \
$(OBJDIR)/asremove.o\
$(OBJDIR)/astable.o\
$(OBJDIR)/asutils.o\
$(OBJDIR)/osunixdir.o\
$(OBJDIR)/getopt.o
$(OBJDIR)/cmfsize.o\
$(OBJDIR)/getopt.o \
$(OBJDIR)/osunixdir.o
#
# Compile flags specific to acpisrc

View File

@ -46,6 +46,7 @@ OBJECTS = \
$(OBJDIR)/adfile.o\
$(OBJDIR)/adisasm.o\
$(OBJDIR)/adwalk.o\
$(OBJDIR)/ahids.o\
$(OBJDIR)/ahpredef.o\
$(OBJDIR)/aslanalyze.o\
$(OBJDIR)/aslbtypes.o\
@ -89,6 +90,7 @@ OBJECTS = \
$(OBJDIR)/asluuid.o\
$(OBJDIR)/aslwalks.o\
$(OBJDIR)/aslxref.o\
$(OBJDIR)/cmfsize.o\
$(OBJDIR)/dtcompile.o\
$(OBJDIR)/dtexpress.o\
$(OBJDIR)/dtfield.o\
@ -171,6 +173,7 @@ OBJECTS = \
$(OBJDIR)/pstree.o\
$(OBJDIR)/psutils.o\
$(OBJDIR)/pswalk.o\
$(OBJDIR)/tbdata.o\
$(OBJDIR)/tbfadt.o\
$(OBJDIR)/tbinstal.o\
$(OBJDIR)/tbprint.o\

View File

@ -203,11 +203,16 @@ FlGenerateFilename (
/*
* 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 */

View File

@ -79,10 +79,6 @@ NsSetupNamespaceListing (
/* Local prototypes */
static UINT32
AdGetFileSize (
FILE *File);
static void
AdCreateTableHeader (
char *Filename,
@ -155,38 +151,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
@ -206,7 +170,7 @@ AdInitialize (
ACPI_STATUS Status;
/* ACPI CA subsystem initialization */
/* ACPICA subsystem initialization */
Status = AcpiOsInitialize ();
if (ACPI_FAILURE (Status))
@ -381,7 +345,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;
@ -413,7 +377,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
{
@ -469,9 +433,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;
@ -485,6 +450,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 */
@ -497,6 +465,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");
@ -531,7 +507,7 @@ AdAmlDisassemble (
fprintf (stderr, "Disassembly completed\n");
fprintf (stderr, "ASL Output: %s - %u bytes\n",
DisasmFilename, AdGetFileSize (File));
DisasmFilename, CmGetFileSize (File));
}
}
@ -568,7 +544,7 @@ AdAmlDisassemble (
*
* 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.
*
*****************************************************************************/
@ -600,7 +576,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.
*
*****************************************************************************/
@ -678,8 +654,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 */
@ -872,7 +857,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);
@ -907,9 +893,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");

View File

@ -760,11 +760,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)
@ -801,6 +803,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;

214
source/common/ahids.c Normal file
View File

@ -0,0 +1,214 @@
/******************************************************************************
*
* Module Name: ahids - Table of ACPI/PNP _HID/_CID values
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2014, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#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"},
{"PNP0D40", "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);
}

View File

@ -44,6 +44,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.
@ -321,3 +324,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);
}

111
source/common/cmfsize.c Normal file
View File

@ -0,0 +1,111 @@
/******************************************************************************
*
* Module Name: cfsize - Common get file size function
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2014, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#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. Uses perror for
* error messages.
*
******************************************************************************/
UINT32
CmGetFileSize (
FILE *File)
{
long FileSize;
long CurrentOffset;
/* Save the current file pointer, seek to EOF to obtain file size */
CurrentOffset = ftell (File);
if (CurrentOffset < 0)
{
goto OffsetError;
}
if (fseek (File, 0, SEEK_END))
{
goto SeekError;
}
FileSize = ftell (File);
if (FileSize < 0)
{
goto OffsetError;
}
/* Restore original file pointer */
if (fseek (File, CurrentOffset, SEEK_SET))
{
goto SeekError;
}
return ((UINT32) FileSize);
OffsetError:
perror ("Could not get file offset");
return (ACPI_UINT32_MAX);
SeekError:
perror ("Could not seek file");
return (ACPI_UINT32_MAX);
}

View File

@ -67,7 +67,7 @@
*/
static const char *AcpiGbl_DmTypeNames[] =
{
/* 00 */ "", /* Type ANY */
/* 00 */ ", UnknownObj", /* Type ANY */
/* 01 */ ", IntObj",
/* 02 */ ", StrObj",
/* 03 */ ", BuffObj",
@ -397,6 +397,7 @@ AcpiDmGetExternalsFromFile (
{
fprintf (stderr, "Could not open external reference file \"%s\"\n",
Gbl_ExternalRefFilename);
AslAbort ();
return;
}
@ -791,7 +792,8 @@ AcpiDmCreateNewExternal (
/* 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,
"External method arg count mismatch %s: Current %u, attempted %u",
@ -1065,9 +1067,8 @@ AcpiDmEmitExternals (
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->Flags |= ACPI_EXT_EXTERNAL_EMITTED;
@ -1275,8 +1276,14 @@ AcpiDmUnresolvedWarning (
" * control method external declarations with the associated method\n"
" * argument counts. Each line of the file must be of the form:\n"
" * External (<method pathname>, MethodObj, <argument count>)\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)
{
@ -1294,6 +1301,12 @@ AcpiDmUnresolvedWarning (
" * control method external declarations with the associated method\n"
" * argument counts. Each line of the file must be of the form:\n"
" * External (<method pathname>, MethodObj, <argument count>)\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"),
@ -1321,7 +1334,9 @@ AcpiDmUnresolvedWarning (
"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 (<method pathname>, MethodObj, <argument count>)\n",
" External (<method pathname>, MethodObj, <argument count>)\n"
"Invocation:\n"
" iasl -fe refs.txt -d dsdt.aml\n",
AcpiGbl_NumExternalMethods);
}
else if (AcpiGbl_NumExternalMethods != AcpiGbl_ResolvedExternalMethods)
@ -1339,7 +1354,9 @@ AcpiDmUnresolvedWarning (
"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 (<method pathname>, MethodObj, <argument count>)\n",
" External (<method pathname>, MethodObj, <argument count>)\n"
"Invocation:\n"
" iasl -fe refs.txt -d dsdt.aml\n",
AcpiGbl_NumExternalMethods, AcpiGbl_ResolvedExternalMethods,
(AcpiGbl_ResolvedExternalMethods > 1 ? "were" : "was"),
(AcpiGbl_NumExternalMethods - AcpiGbl_ResolvedExternalMethods));

View File

@ -390,7 +390,7 @@ FlCheckForAcpiTable (
/* Header length field must match the file size */
FileSize = DtGetFileSize (Handle);
FileSize = CmGetFileSize (Handle);
if (Table.Length != FileSize)
{
return (AE_ERROR);

View File

@ -874,14 +874,14 @@ AslError (
* FUNCTION: AslCoreSubsystemError
*
* PARAMETERS: Op - Parse node where error happened
* Status - The ACPI CA Exception
* Status - The ACPICA Exception
* ExtraMessage - additional error message
* Abort - TRUE -> Abort compilation
*
* RETURN: None
*
* DESCRIPTION: Error reporting routine for exceptions returned by the ACPI
* CA core subsystem.
* DESCRIPTION: Error reporting routine for exceptions returned by the ACPICA
* core subsystem.
*
******************************************************************************/

View File

@ -42,14 +42,11 @@
*/
#include "aslcompiler.h"
#include "acapps.h"
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslfileio")
long
UtGetFileSize (
FILE *fp);
/*******************************************************************************
*
@ -113,65 +110,6 @@ FlOpenFile (
}
/*******************************************************************************
*
* FUNCTION: UtGetFileSize
*
* PARAMETERS: fp - Open file handle
*
* RETURN: File Size. -1 on error.
*
* DESCRIPTION: Get current file size. Uses seek-to-EOF. File must be open.
* TBD: This function should be used to replace other similar
* functions in ACPICA.
*
******************************************************************************/
long
UtGetFileSize (
FILE *fp)
{
long FileSize;
long CurrentOffset;
CurrentOffset = ftell (fp);
if (CurrentOffset < 0)
{
goto OffsetError;
}
if (fseek (fp, 0, SEEK_END))
{
goto SeekError;
}
FileSize = ftell (fp);
if (FileSize < 0)
{
goto OffsetError;
}
/* Restore file pointer */
if (fseek (fp, CurrentOffset, SEEK_SET))
{
goto SeekError;
}
return (FileSize);
OffsetError:
perror ("Could not get file offset");
return (-1);
SeekError:
perror ("Could not seek file");
return (-1);
}
/*******************************************************************************
*
* FUNCTION: FlGetFileSize
@ -189,16 +127,16 @@ UINT32
FlGetFileSize (
UINT32 FileId)
{
long FileSize;
UINT32 FileSize;
FileSize = UtGetFileSize (Gbl_Files[FileId].Handle);
if (FileSize == -1)
FileSize = CmGetFileSize (Gbl_Files[FileId].Handle);
if (FileSize == ACPI_UINT32_MAX)
{
AslAbort();
}
return ((UINT32) FileSize);
return (FileSize);
}

View File

@ -73,6 +73,36 @@ static void
AslInitialize (
void);
UINT8
AcpiIsBigEndianMachine (
void);
/*******************************************************************************
*
* FUNCTION: AcpiIsBigEndianMachine
*
* PARAMETERS: None
*
* RETURN: TRUE if machine is big endian
* FALSE if machine is little endian
*
* DESCRIPTION: Detect whether machine is little endian or big endian.
*
******************************************************************************/
UINT8
AcpiIsBigEndianMachine (
void)
{
union {
UINT32 Integer;
UINT8 Bytes[4];
} Overlay = {0xFF000000};
return (Overlay.Bytes[0]); /* Returns 0xFF (TRUE) for big endian */
}
/*******************************************************************************
*
@ -299,6 +329,18 @@ main (
int Index2;
/*
* Big-endian machines are not currently supported. ACPI tables must
* be little-endian, and support for big-endian machines needs to
* be implemented.
*/
if (AcpiIsBigEndianMachine ())
{
fprintf (stderr,
"iASL is not currently supported on big-endian machines.\n");
return (-1);
}
ACPI_DEBUG_INITIALIZE (); /* For debug version only */
/* Initialize preprocessor and compiler before command line processing */

View File

@ -296,7 +296,7 @@ char *AslMessages [] =
/* ASL_MSG_CONNECTION_INVALID */ "Invalid OpRegion SpaceId for use of Connection operator",
/* ASL_MSG_CONSTANT_EVALUATION */ "Could not evaluate constant expression",
/* ASL_MSG_CONSTANT_FOLDED */ "Constant expression evaluated and reduced",
/* ASL_MSG_CORE_EXCEPTION */ "From ACPI CA Subsystem",
/* ASL_MSG_CORE_EXCEPTION */ "From ACPICA Subsystem",
/* ASL_MSG_DEBUG_FILE_OPEN */ "Could not open debug file",
/* ASL_MSG_DEBUG_FILENAME */ "Could not create debug filename",
/* ASL_MSG_DEPENDENT_NESTING */ "Dependent function macros cannot be nested",\

View File

@ -269,6 +269,7 @@ AslDoOptions (
/* Get entire list of external files */
AcpiGbl_Optind--;
argv[AcpiGbl_Optind] = AcpiGbl_Optarg;
while (argv[AcpiGbl_Optind] &&
(argv[AcpiGbl_Optind][0] != '-'))

View File

@ -53,7 +53,7 @@
/*
* Stubs to simplify linkage to the ACPI CA core subsystem.
* Stubs to simplify linkage to the ACPICA core subsystem.
* Things like Events, Global Lock, etc. are not used
* by the compiler, so they are stubbed out here.
*/

View File

@ -918,7 +918,7 @@ UtDoConstant (
}
/* TBD: use version in ACPI CA main code base? */
/* TBD: use version in ACPICA main code base? */
/*******************************************************************************
*

View File

@ -343,10 +343,6 @@ DtStrtoul64 (
char *String,
UINT64 *ReturnInteger);
UINT32
DtGetFileSize (
FILE *Handle);
char*
DtGetFieldValue (
DT_FIELD *Field);

View File

@ -45,6 +45,7 @@
#include "aslcompiler.h"
#include "dtcompiler.h"
#include "acapps.h"
#define _COMPONENT DT_COMPILER
ACPI_MODULE_NAME ("dtio")
@ -737,7 +738,11 @@ DtScanFile (
/* Get the file size */
Gbl_InputByteCount = DtGetFileSize (Handle);
Gbl_InputByteCount = CmGetFileSize (Handle);
if (Gbl_InputByteCount == ACPI_UINT32_MAX)
{
AslAbort ();
}
Gbl_CurrentLineNumber = 0;
Gbl_CurrentLineOffset = 0;
@ -816,7 +821,12 @@ DtOutputBinary (
/* Walk the entire parse tree, emitting the binary data */
DtWalkTableTree (RootTable, DtWriteBinary, NULL, NULL);
Gbl_TableLength = DtGetFileSize (Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
Gbl_TableLength = CmGetFileSize (Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
if (Gbl_TableLength == ACPI_UINT32_MAX)
{
AslAbort ();
}
}

View File

@ -284,36 +284,6 @@ DtStrtoul64 (
}
/******************************************************************************
*
* FUNCTION: DtGetFileSize
*
* PARAMETERS: Handle - Open file handler
*
* RETURN: Current file size
*
* DESCRIPTION: Get the current size of a file. Seek to the EOF and get the
* offset. Seek back to the original location.
*
*****************************************************************************/
UINT32
DtGetFileSize (
FILE *Handle)
{
int CurrentOffset;
int LastOffset;
CurrentOffset = ftell (Handle);
fseek (Handle, 0, SEEK_END);
LastOffset = ftell (Handle);
fseek (Handle, CurrentOffset, SEEK_SET);
return ((UINT32) LastOffset);
}
/******************************************************************************
*
* FUNCTION: DtGetFieldValue

View File

@ -116,7 +116,7 @@ AcpiDbConvertToNode (
Node = ACPI_TO_POINTER (Address);
if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE)))
{
AcpiOsPrintf ("Address %p is invalid in this address space\n",
AcpiOsPrintf ("Address %p is invalid",
Node);
return (NULL);
}
@ -125,7 +125,7 @@ AcpiDbConvertToNode (
if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
{
AcpiOsPrintf ("Address %p is not a valid NS node [%s]\n",
AcpiOsPrintf ("Address %p is not a valid namespace node [%s]\n",
Node, AcpiUtGetDescriptorName (Node));
return (NULL);
}
@ -139,6 +139,8 @@ AcpiDbConvertToNode (
Node = AcpiDbLocalNsLookup (InString);
if (!Node)
{
AcpiOsPrintf ("Could not find [%s] in namespace, defaulting to root node\n",
InString);
Node = AcpiGbl_RootNode;
}
}
@ -362,24 +364,19 @@ AcpiDbDisplayTableInfo (
switch (TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK)
{
case ACPI_TABLE_ORIGIN_UNKNOWN:
case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL:
AcpiOsPrintf ("Unknown ");
AcpiOsPrintf ("External virtual ");
break;
case ACPI_TABLE_ORIGIN_MAPPED:
case ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL:
AcpiOsPrintf ("Mapped ");
AcpiOsPrintf ("Internal physical ");
break;
case ACPI_TABLE_ORIGIN_ALLOCATED:
case ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL:
AcpiOsPrintf ("Allocated ");
break;
case ACPI_TABLE_ORIGIN_OVERRIDE:
AcpiOsPrintf ("Override ");
AcpiOsPrintf ("Internal virtual ");
break;
default:
@ -390,7 +387,7 @@ AcpiDbDisplayTableInfo (
/* Make sure that the table is mapped */
Status = AcpiTbVerifyTable (TableDesc);
Status = AcpiTbValidateTable (TableDesc);
if (ACPI_FAILURE (Status))
{
return;
@ -440,8 +437,6 @@ AcpiDbUnloadAcpiTable (
Node = AcpiDbConvertToNode (ObjectName);
if (!Node)
{
AcpiOsPrintf ("Could not find [%s] in namespace\n",
ObjectName);
return;
}

View File

@ -142,6 +142,8 @@ AcpiDbOpenDebugFile (
#ifdef ACPI_APPLICATION
#include "acapps.h"
/*******************************************************************************
*
* FUNCTION: AcpiDbCheckTextModeCorruption
@ -246,9 +248,11 @@ AcpiDbReadTable (
/* Get the file size */
fseek (fp, 0, SEEK_END);
FileSize = (UINT32) ftell (fp);
fseek (fp, 0, SEEK_SET);
FileSize = CmGetFileSize (fp);
if (FileSize == ACPI_UINT32_MAX)
{
return (AE_ERROR);
}
if (FileSize < 4)
{
@ -421,7 +425,7 @@ AeLocalLoadTable (
/* Install the new table into the local data structures */
Status = AcpiTbInstallTable (&TableInfo);
Status = AcpiTbInitTableDescriptor (&TableInfo);
if (ACPI_FAILURE (Status))
{
if (Status == AE_ALREADY_EXISTS)
@ -475,23 +479,23 @@ AcpiDbReadTableFromFile (
FILE *File;
UINT32 FileSize;
UINT32 TableLength;
ACPI_STATUS Status;
ACPI_STATUS Status = AE_ERROR;
/* Open the file */
/* Open the file, get current size */
File = fopen (Filename, "rb");
if (!File)
{
perror ("Could not open input file");
return (AE_ERROR);
return (Status);
}
/* Get the file size */
fseek (File, 0, SEEK_END);
FileSize = (UINT32) ftell (File);
fseek (File, 0, SEEK_SET);
FileSize = CmGetFileSize (File);
if (FileSize == ACPI_UINT32_MAX)
{
goto Exit;
}
/* Get the entire file */
@ -499,15 +503,14 @@ AcpiDbReadTableFromFile (
Filename, FileSize, FileSize);
Status = AcpiDbReadTable (File, Table, &TableLength);
fclose(File);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not get table from the file\n");
return (Status);
}
return (AE_OK);
Exit:
fclose(File);
return (Status);
}
#endif
@ -567,6 +570,8 @@ AcpiDbGetTableFromFile (
return (Status);
}
AcpiTbPrintTableHeader (0, Table);
fprintf (stderr,
"Acpi table [%4.4s] successfully installed and loaded\n",
Table->Signature);

View File

@ -180,6 +180,11 @@ AcpiDbSetMethodData (
if (Type == 'N')
{
Node = AcpiDbConvertToNode (IndexArg);
if (!Node)
{
return;
}
if (Node->Type != ACPI_TYPE_INTEGER)
{
AcpiOsPrintf ("Can only set Integer nodes\n");

View File

@ -47,6 +47,7 @@
#include "acdisasm.h"
#include "acparser.h"
#include "amlcode.h"
#include "acinterp.h"
#ifdef ACPI_DISASSEMBLER
@ -61,7 +62,7 @@ AcpiDmUnicode (
ACPI_PARSE_OBJECT *Op);
static void
AcpiDmIsEisaIdElement (
AcpiDmGetHardwareIdType (
ACPI_PARSE_OBJECT *Op);
static void
@ -537,19 +538,20 @@ AcpiDmUnicode (
/*******************************************************************************
*
* FUNCTION: AcpiDmIsEisaIdElement
* FUNCTION: AcpiDmGetHardwareIdType
*
* PARAMETERS: Op - Op to be examined
*
* RETURN: None
*
* DESCRIPTION: Determine if an Op (argument to _HID or _CID) can be converted
* to an EISA ID.
* DESCRIPTION: Determine the type of the argument to a _HID or _CID
* 1) Strings are allowed
* 2) If Integer, determine if it is a valid EISAID
*
******************************************************************************/
static void
AcpiDmIsEisaIdElement (
AcpiDmGetHardwareIdType (
ACPI_PARSE_OBJECT *Op)
{
UINT32 BigEndianId;
@ -557,55 +559,66 @@ AcpiDmIsEisaIdElement (
UINT32 i;
/* The parameter must be either a word or a dword */
if ((Op->Common.AmlOpcode != AML_DWORD_OP) &&
(Op->Common.AmlOpcode != AML_WORD_OP))
switch (Op->Common.AmlOpcode)
{
return;
}
case AML_STRING_OP:
/* Swap from little-endian to big-endian to simplify conversion */
/* Mark this string as an _HID/_CID string */
BigEndianId = AcpiUtDwordByteSwap ((UINT32) Op->Common.Value.Integer);
Op->Common.DisasmOpcode = ACPI_DASM_HID_STRING;
break;
/* Create the 3 leading ASCII letters */
case AML_WORD_OP:
case AML_DWORD_OP:
Prefix[0] = ((BigEndianId >> 26) & 0x1F) + 0x40;
Prefix[1] = ((BigEndianId >> 21) & 0x1F) + 0x40;
Prefix[2] = ((BigEndianId >> 16) & 0x1F) + 0x40;
/* Determine if a Word/Dword is a valid encoded EISAID */
/* Verify that all 3 are ascii and alpha */
/* Swap from little-endian to big-endian to simplify conversion */
for (i = 0; i < 3; i++)
{
if (!ACPI_IS_ASCII (Prefix[i]) ||
!ACPI_IS_ALPHA (Prefix[i]))
BigEndianId = AcpiUtDwordByteSwap ((UINT32) Op->Common.Value.Integer);
/* Create the 3 leading ASCII letters */
Prefix[0] = ((BigEndianId >> 26) & 0x1F) + 0x40;
Prefix[1] = ((BigEndianId >> 21) & 0x1F) + 0x40;
Prefix[2] = ((BigEndianId >> 16) & 0x1F) + 0x40;
/* Verify that all 3 are ascii and alpha */
for (i = 0; i < 3; i++)
{
return;
if (!ACPI_IS_ASCII (Prefix[i]) ||
!ACPI_IS_ALPHA (Prefix[i]))
{
return;
}
}
/* Mark this node as convertable to an EISA ID string */
Op->Common.DisasmOpcode = ACPI_DASM_EISAID;
break;
default:
break;
}
/* OK - mark this node as convertable to an EISA ID */
Op->Common.DisasmOpcode = ACPI_DASM_EISAID;
}
/*******************************************************************************
*
* FUNCTION: AcpiDmIsEisaId
* FUNCTION: AcpiDmCheckForHardwareId
*
* PARAMETERS: Op - Op to be examined
*
* RETURN: None
*
* DESCRIPTION: Determine if a Name() Op can be converted to an EisaId.
* DESCRIPTION: Determine if a Name() Op is a _HID/_CID.
*
******************************************************************************/
void
AcpiDmIsEisaId (
AcpiDmCheckForHardwareId (
ACPI_PARSE_OBJECT *Op)
{
UINT32 Name;
@ -630,7 +643,7 @@ AcpiDmIsEisaId (
if (ACPI_COMPARE_NAME (&Name, METHOD_NAME__HID))
{
AcpiDmIsEisaIdElement (NextOp);
AcpiDmGetHardwareIdType (NextOp);
return;
}
@ -645,11 +658,11 @@ AcpiDmIsEisaId (
if (NextOp->Common.AmlOpcode != AML_PACKAGE_OP)
{
AcpiDmIsEisaIdElement (NextOp);
AcpiDmGetHardwareIdType (NextOp);
return;
}
/* _CID with Package: get the package length */
/* _CID with Package: get the package length, check all elements */
NextOp = AcpiPsGetDepthNext (NULL, NextOp);
@ -658,7 +671,7 @@ AcpiDmIsEisaId (
NextOp = NextOp->Common.Next;
while (NextOp)
{
AcpiDmIsEisaIdElement (NextOp);
AcpiDmGetHardwareIdType (NextOp);
NextOp = NextOp->Common.Next;
}
}
@ -666,41 +679,38 @@ AcpiDmIsEisaId (
/*******************************************************************************
*
* FUNCTION: AcpiDmEisaId
* FUNCTION: AcpiDmDecompressEisaId
*
* PARAMETERS: EncodedId - Raw encoded EISA ID.
*
* RETURN: None
*
* DESCRIPTION: Convert an encoded EISAID back to the original ASCII String.
* DESCRIPTION: Convert an encoded EISAID back to the original ASCII String
* and emit the correct ASL statement. If the ID is known, emit
* a description of the ID as a comment.
*
******************************************************************************/
void
AcpiDmEisaId (
AcpiDmDecompressEisaId (
UINT32 EncodedId)
{
UINT32 BigEndianId;
char IdBuffer[ACPI_EISAID_STRING_SIZE];
const AH_DEVICE_ID *Info;
/* Swap from little-endian to big-endian to simplify conversion */
/* Convert EISAID to a string an emit the statement */
BigEndianId = AcpiUtDwordByteSwap (EncodedId);
AcpiExEisaIdToString (IdBuffer, EncodedId);
AcpiOsPrintf ("EisaId (\"%s\")", IdBuffer);
/* If we know about the ID, emit the description */
/* Split to form "AAANNNN" string */
AcpiOsPrintf ("EisaId (\"%c%c%c%4.4X\")",
/* Three Alpha characters (AAA), 5 bits each */
(int) ((BigEndianId >> 26) & 0x1F) + 0x40,
(int) ((BigEndianId >> 21) & 0x1F) + 0x40,
(int) ((BigEndianId >> 16) & 0x1F) + 0x40,
/* Numeric part (NNNN) is simply the lower 16 bits */
(UINT32) (BigEndianId & 0xFFFF));
Info = AcpiAhMatchHardwareId (IdBuffer);
if (Info)
{
AcpiOsPrintf (" /* %s */", Info->Description);
}
}
#endif

View File

@ -46,6 +46,8 @@
#include "acparser.h"
#include "amlcode.h"
#include "acdisasm.h"
#include "acinterp.h"
#include "acnamesp.h"
#ifdef ACPI_DISASSEMBLER
@ -59,6 +61,159 @@ AcpiDmMatchKeyword (
ACPI_PARSE_OBJECT *Op);
/*******************************************************************************
*
* FUNCTION: AcpiDmDisplayTargetPathname
*
* PARAMETERS: Op - Parse object
*
* RETURN: None
*
* DESCRIPTION: For AML opcodes that have a target operand, display the full
* pathname for the target, in a comment field. Handles Return()
* statements also.
*
******************************************************************************/
void
AcpiDmDisplayTargetPathname (
ACPI_PARSE_OBJECT *Op)
{
ACPI_PARSE_OBJECT *NextOp;
ACPI_PARSE_OBJECT *PrevOp = NULL;
char *Pathname;
const ACPI_OPCODE_INFO *OpInfo;
if (Op->Common.AmlOpcode == AML_RETURN_OP)
{
PrevOp = Op->Asl.Value.Arg;
}
else
{
OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
if (!(OpInfo->Flags & AML_HAS_TARGET))
{
return;
}
/* Target is the last Op in the arg list */
NextOp = Op->Asl.Value.Arg;
while (NextOp)
{
PrevOp = NextOp;
NextOp = PrevOp->Asl.Next;
}
}
if (!PrevOp)
{
return;
}
/* We must have a namepath AML opcode */
if (PrevOp->Asl.AmlOpcode != AML_INT_NAMEPATH_OP)
{
return;
}
/* A null string is the "no target specified" case */
if (!PrevOp->Asl.Value.String)
{
return;
}
/* No node means "unresolved external reference" */
if (!PrevOp->Asl.Node)
{
AcpiOsPrintf (" /* External reference */");
return;
}
/* Ignore if path is already from the root */
if (*PrevOp->Asl.Value.String == '\\')
{
return;
}
/* Now: we can get the full pathname */
Pathname = AcpiNsGetExternalPathname (PrevOp->Asl.Node);
if (!Pathname)
{
return;
}
AcpiOsPrintf (" /* %s */", Pathname);
ACPI_FREE (Pathname);
}
/*******************************************************************************
*
* FUNCTION: AcpiDmNotifyDescription
*
* PARAMETERS: Op - Name() parse object
*
* RETURN: None
*
* DESCRIPTION: Emit a description comment for the value associated with a
* Notify() operator.
*
******************************************************************************/
void
AcpiDmNotifyDescription (
ACPI_PARSE_OBJECT *Op)
{
ACPI_PARSE_OBJECT *NextOp;
ACPI_NAMESPACE_NODE *Node;
UINT8 NotifyValue;
UINT8 Type = ACPI_TYPE_ANY;
/* The notify value is the second argument */
NextOp = Op->Asl.Value.Arg;
NextOp = NextOp->Asl.Next;
switch (NextOp->Common.AmlOpcode)
{
case AML_ZERO_OP:
case AML_ONE_OP:
NotifyValue = (UINT8) NextOp->Common.AmlOpcode;
break;
case AML_BYTE_OP:
NotifyValue = (UINT8) NextOp->Asl.Value.Integer;
break;
default:
return;
}
/*
* Attempt to get the namespace node so we can determine the object type.
* Some notify values are dependent on the object type (Device, Thermal,
* or Processor).
*/
Node = Op->Asl.Node;
if (Node)
{
Type = Node->Type;
}
AcpiOsPrintf (" // %s", AcpiUtGetNotifyName (NotifyValue, Type));
}
/*******************************************************************************
*
* FUNCTION: AcpiDmPredefinedDescription
@ -183,14 +338,11 @@ AcpiDmPredefinedDescription (
/* Match the name in the info table */
for (Info = AslPredefinedInfo; Info->Name; Info++)
Info = AcpiAhMatchPredefinedName (NameString);
if (Info)
{
if (ACPI_COMPARE_NAME (NameString, Info->Name))
{
AcpiOsPrintf (" // %4.4s: %s",
NameString, ACPI_CAST_PTR (char, Info->Description));
return;
}
AcpiOsPrintf (" // %4.4s: %s",
NameString, ACPI_CAST_PTR (char, Info->Description));
}
#endif
@ -267,14 +419,11 @@ AcpiDmFieldPredefinedDescription (
/* Match the name in the info table */
for (Info = AslPredefinedInfo; Info->Name; Info++)
Info = AcpiAhMatchPredefinedName (Tag);
if (Info)
{
if (ACPI_COMPARE_NAME (Tag, Info->Name))
{
AcpiOsPrintf (" // %4.4s: %s", Tag,
ACPI_CAST_PTR (char, Info->Description));
return;
}
AcpiOsPrintf (" // %4.4s: %s", Tag,
ACPI_CAST_PTR (char, Info->Description));
}
#endif
@ -527,6 +676,7 @@ AcpiDmDisassembleOneOp (
ACPI_PARSE_OBJECT *Child;
ACPI_STATUS Status;
UINT8 *Aml;
const AH_DEVICE_ID *IdInfo;
if (!Op)
@ -605,7 +755,7 @@ AcpiDmDisassembleOneOp (
if (Op->Common.DisasmOpcode == ACPI_DASM_EISAID)
{
AcpiDmEisaId ((UINT32) Op->Common.Value.Integer);
AcpiDmDecompressEisaId ((UINT32) Op->Common.Value.Integer);
}
else
{
@ -617,7 +767,7 @@ AcpiDmDisassembleOneOp (
if (Op->Common.DisasmOpcode == ACPI_DASM_EISAID)
{
AcpiDmEisaId ((UINT32) Op->Common.Value.Integer);
AcpiDmDecompressEisaId ((UINT32) Op->Common.Value.Integer);
}
else
{
@ -634,6 +784,19 @@ AcpiDmDisassembleOneOp (
case AML_STRING_OP:
AcpiUtPrintString (Op->Common.Value.String, ACPI_UINT16_MAX);
/* For _HID/_CID strings, attempt to output a descriptive comment */
if (Op->Common.DisasmOpcode == ACPI_DASM_HID_STRING)
{
/* If we know about the ID, emit the description */
IdInfo = AcpiAhMatchHardwareId (Op->Common.Value.String);
if (IdInfo)
{
AcpiOsPrintf (" /* %s */", IdInfo->Description);
}
}
break;
case AML_BUFFER_OP:

View File

@ -568,7 +568,7 @@ AcpiDmDescendingOp (
/* Check for _HID and related EISAID() */
AcpiDmIsEisaId (Op);
AcpiDmCheckForHardwareId (Op);
AcpiOsPrintf (", ");
break;
@ -842,6 +842,15 @@ AcpiDmAscendingOp (
AcpiDmFieldPredefinedDescription (Op);
}
/* Decode Notify() values */
if (Op->Common.AmlOpcode == AML_NOTIFY_OP)
{
AcpiDmNotifyDescription (Op);
}
AcpiDmDisplayTargetPathname (Op);
/* Could be a nested operator, check if comma required */
if (!AcpiDmCommaIfListMember (Op))

View File

@ -186,8 +186,15 @@ AcpiDsDetectNamedOpcodes (
* 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.InfoFlags |= ACPI_METHOD_SERIALIZED;
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",
@ -377,11 +384,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,
@ -849,7 +861,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;
}

View File

@ -181,7 +181,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);

View File

@ -135,7 +135,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.
*/

View File

@ -266,7 +266,7 @@ AcpiRemoveNotifyHandler (
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_OPERAND_OBJECT *HandlerObj;
ACPI_OPERAND_OBJECT *PreviousHandlerObj;
ACPI_STATUS Status;
ACPI_STATUS Status = AE_OK;
UINT32 i;
@ -281,16 +281,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)
@ -299,6 +289,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))
{
@ -311,18 +307,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 */
@ -330,8 +331,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 */
@ -340,6 +340,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;
@ -371,10 +377,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);
@ -520,6 +533,8 @@ AcpiInstallSciHandler (
return_ACPI_STATUS (Status);
}
ACPI_EXPORT_SYMBOL (AcpiInstallSciHandler)
/*******************************************************************************
*
@ -596,6 +611,8 @@ AcpiRemoveSciHandler (
return_ACPI_STATUS (Status);
}
ACPI_EXPORT_SYMBOL (AcpiRemoveSciHandler)
/*******************************************************************************
*
@ -970,10 +987,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))
{
@ -1030,10 +1043,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);

View File

@ -380,8 +380,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;
@ -390,8 +390,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)
@ -423,16 +421,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))
{
@ -464,8 +462,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);
}
@ -473,14 +471,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 */
@ -497,8 +493,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 */
@ -515,14 +511,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:
@ -530,28 +525,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);
}
@ -583,9 +581,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);
@ -594,7 +589,7 @@ AcpiExLoadOp (
if (AcpiGbl_TableHandler)
{
(void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, TableDesc.Pointer,
(void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table,
AcpiGbl_TableHandlerContext);
}
@ -627,6 +622,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()

View File

@ -155,10 +155,11 @@ 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"}

View File

@ -0,0 +1,816 @@
/******************************************************************************
*
* Module Name: tbdata - Table manager data structure functions
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2014, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#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: AcpiTbVerifyTable
*
* 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
AcpiTbVerifyTable (
ACPI_TABLE_DESC *TableDesc,
char *Signature)
{
ACPI_STATUS Status = AE_OK;
ACPI_FUNCTION_TRACE (TbVerifyTable);
/* Validate the table */
Status = AcpiTbValidateTable (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 */
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);
}

View File

@ -365,14 +365,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);
}
}

View File

@ -108,7 +108,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);

File diff suppressed because it is too large Load Diff

View File

@ -197,9 +197,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",
@ -209,125 +212,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
@ -506,6 +390,7 @@ AcpiTbParseRootTable (
UINT32 Length;
UINT8 *TableEntry;
ACPI_STATUS Status;
UINT32 TableIndex;
ACPI_FUNCTION_TRACE (TbParseRootTable);
@ -625,28 +510,20 @@ AcpiTbParseRootTable (
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);
Status = AcpiTbInstallStandardTable (
AcpiTbGetRootTableEntry (TableEntry, TableEntrySize),
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);
}
TableEntry += TableEntrySize;
AcpiGbl_RootTableList.CurrentTableCount++;
}
/*
@ -655,23 +532,5 @@ AcpiTbParseRootTable (
*/
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 - validate it then get the DSDT and FACS */
if (ACPI_COMPARE_NAME (
&AcpiGbl_RootTableList.Tables[i].Signature, ACPI_SIG_FADT))
{
AcpiTbParseFadt (i);
}
}
return_ACPI_STATUS (AE_OK);
}

View File

@ -262,7 +262,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,
@ -345,7 +345,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;
@ -406,7 +406,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);

View File

@ -131,7 +131,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;
@ -142,7 +142,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;
@ -187,24 +187,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);
@ -220,6 +208,53 @@ AcpiTbLoadNamespace (
}
/*******************************************************************************
*
* 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
@ -242,7 +277,6 @@ AcpiLoadTable (
ACPI_TABLE_HEADER *Table)
{
ACPI_STATUS Status;
ACPI_TABLE_DESC TableDesc;
UINT32 TableIndex;
@ -256,14 +290,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);
@ -275,7 +301,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;

View File

@ -527,7 +527,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",
@ -539,32 +539,87 @@ 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"
};
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 - 0C 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

View File

@ -420,7 +420,7 @@ AcpiUtPrintString (
}
AcpiOsPrintf ("\"");
for (i = 0; String[i] && (i < MaxLength); i++)
for (i = 0; (i < MaxLength) && String[i]; i++)
{
/* Escape sequences */

View File

@ -45,8 +45,6 @@
#define _ACAPPS
#pragma pack(push) /* Set default struct packing */
#ifdef _MSC_VER /* disable some level-4 warnings */
#pragma warning(disable:4100) /* warning C4100: unreferenced formal parameter */
#endif
@ -116,6 +114,14 @@ extern int AcpiGbl_SubOptChar;
extern char *AcpiGbl_Optarg;
/*
* cmfsize - Common get file size function
*/
UINT32
CmGetFileSize (
FILE *File);
#ifndef ACPI_DUMP_APP
/*
* adisasm
@ -221,6 +227,4 @@ AdWriteTable (
char *OemTableId);
#endif
#pragma pack(pop) /* Restore original struct packing */
#endif /* _ACAPPS */

View File

@ -44,9 +44,6 @@
#ifndef __ACBUFFER_H__
#define __ACBUFFER_H__
#pragma pack(push) /* Set default struct packing */
/*
* Contains buffer structures for these predefined names:
* _FDE, _GRT, _GTM, _PLD, _SRT
@ -246,6 +243,4 @@ typedef struct acpi_pld_info
#define ACPI_PLD_SET_HORIZ_OFFSET(dword,value) ACPI_SET_BITS (dword, 16, ACPI_16BIT_MASK, value) /* Offset 128+16=144, Len 16 */
#pragma pack(pop) /* Restore original struct packing */
#endif /* ACBUFFER_H */

View File

@ -45,8 +45,6 @@
#define _ACCONFIG_H
#pragma pack(push) /* Set default struct packing */
/******************************************************************************
*
* Configuration options
@ -236,6 +234,4 @@
#define ACPI_DEBUGGER_EXECUTE_PROMPT '%'
#pragma pack(pop) /* Restore original struct packing */
#endif /* _ACCONFIG_H */

View File

@ -45,8 +45,6 @@
#define __ACDEBUG_H__
#pragma pack(push) /* Set default struct packing */
#define ACPI_DEBUG_BUFFER_SIZE 0x4000 /* 16K buffer for return objects */
typedef struct acpi_db_command_info
@ -468,6 +466,4 @@ AcpiDbUint32ToHexString (
UINT32 Value,
char *Buffer);
#pragma pack(pop) /* Restore original struct packing */
#endif /* __ACDEBUG_H__ */

View File

@ -47,8 +47,6 @@
#include "amlresrc.h"
#pragma pack(push) /* Set default struct packing */
#define BLOCK_NONE 0
#define BLOCK_PAREN 1
#define BLOCK_BRACE 2
@ -553,6 +551,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);
@ -633,11 +639,11 @@ AcpiDmByteList (
ACPI_PARSE_OBJECT *Op);
void
AcpiDmIsEisaId (
AcpiDmCheckForHardwareId (
ACPI_PARSE_OBJECT *Op);
void
AcpiDmEisaId (
AcpiDmDecompressEisaId (
UINT32 EncodedId);
BOOLEAN
@ -931,6 +937,4 @@ AdDisassemblerHeader (
char *Filename);
#pragma pack(pop) /* Restore original struct packing */
#endif /* __ACDISASM_H__ */

View File

@ -46,8 +46,6 @@
#define _ACDISPAT_H_
#pragma pack(push) /* Set default struct packing */
#define NAMEOF_LOCAL_NTE "__L0"
#define NAMEOF_ARG_NTE "__A0"
@ -464,6 +462,4 @@ AcpiDsResultPush (
ACPI_OPERAND_OBJECT *Object,
ACPI_WALK_STATE *WalkState);
#pragma pack(pop) /* Restore original struct packing */
#endif /* _ACDISPAT_H_ */

View File

@ -45,8 +45,6 @@
#define __ACEVENTS_H__
#pragma pack(push) /* Set default struct packing */
/*
* evevent
*/
@ -358,6 +356,4 @@ void
AcpiEvTerminate (
void))
#pragma pack(pop) /* Restore original struct packing */
#endif /* __ACEVENTS_H__ */

View File

@ -45,8 +45,6 @@
#define __ACEXCEP_H__
#pragma pack(push) /* Set default struct packing */
/* This module contains all possible exception codes for ACPI_STATUS */
/*
@ -347,6 +345,4 @@ static const ACPI_EXCEPTION_INFO AcpiGbl_ExceptionNames_Ctrl[] =
#endif /* EXCEPTION_TABLE */
#pragma pack(pop) /* Restore original struct packing */
#endif /* __ACEXCEP_H__ */

View File

@ -45,8 +45,6 @@
#define __ACGLOBAL_H__
#pragma pack(push) /* Set default struct packing */
/*
* Ensure that the globals are actually defined and initialized only once.
*
@ -107,8 +105,8 @@ ACPI_INIT_GLOBAL (UINT8, AcpiGbl_AutoSerializeMethods, TRUE);
/*
* 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.
* 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);
@ -164,10 +162,10 @@ ACPI_INIT_GLOBAL (UINT8, AcpiGbl_TruncateIoAddresses, FALSE);
ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DisableAutoRepair, FALSE);
/*
* Optionally do not load any SSDTs from the RSDT/XSDT during initialization.
* 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_DisableSsdtTableLoad, FALSE);
ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DisableSsdtTableInstall, FALSE);
/*
* We keep track of the latest version of Windows that has been requested by
@ -362,7 +360,7 @@ 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);
ACPI_INIT_GLOBAL (UINT32, AcpiGbl_NestingLevel, 0);
#endif
@ -519,8 +517,7 @@ ACPI_INIT_GLOBAL (ACPI_FILE, AcpiGbl_DebugFile, NULL);
****************************************************************************/
extern const AH_PREDEFINED_NAME AslPredefinedInfo[];
extern const AH_DEVICE_ID AslDeviceIds[];
#pragma pack(pop) /* Restore original struct packing */
#endif /* __ACGLOBAL_H__ */

View File

@ -45,8 +45,6 @@
#define __ACHWARE_H__
#pragma pack(push) /* Set default struct packing */
/* Values for the _SST predefined method */
#define ACPI_SST_INDICATOR_OFF 0
@ -226,6 +224,4 @@ AcpiHwDerivePciId (
ACPI_HANDLE PciRegion);
#pragma pack(pop) /* Restore original struct packing */
#endif /* __ACHWARE_H__ */

View File

@ -45,8 +45,6 @@
#define __ACINTERP_H__
#pragma pack(push) /* Set default struct packing */
#define ACPI_WALK_OPERANDS (&(WalkState->Operands [WalkState->NumOperands -1]))
/* Macros for tables used for debug output */
@ -721,6 +719,4 @@ AcpiExDataTableSpaceHandler (
void *HandlerContext,
void *RegionContext);
#pragma pack(pop) /* Restore original struct packing */
#endif /* __INTERP_H__ */

View File

@ -45,8 +45,6 @@
#define __ACLOCAL_H__
#pragma pack(push) /* Set default struct packing */
/* acpisrc:StructDefs -- for acpisrc conversion */
#define ACPI_SERIALIZED 0xFF
@ -883,7 +881,8 @@ typedef union acpi_parse_value
#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_HID_STRING 0x09 /* String is a _HID or _CID */
#define ACPI_DASM_IGNORE 0x0A /* Not used at this time */
/*
* Generic operation (for example: If, While, Store)
@ -1351,6 +1350,11 @@ typedef struct ah_predefined_name
} AH_PREDEFINED_NAME;
#pragma pack(pop) /* Restore original struct packing */
typedef struct ah_device_id
{
char *Name;
char *Description;
} AH_DEVICE_ID;
#endif /* __ACLOCAL_H__ */

View File

@ -45,8 +45,6 @@
#define __ACMACROS_H__
#pragma pack(push) /* Set default struct packing */
/*
* Extract data using a pointer. Any more than a byte and we
* get into potential aligment issues -- see the STORE macros below.
@ -435,6 +433,4 @@
#define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7'))
#pragma pack(pop) /* Restore original struct packing */
#endif /* ACMACROS_H */

View File

@ -45,8 +45,6 @@
#define __ACNAMESP_H__
#pragma pack(push) /* Set default struct packing */
/* To search the entire name space, pass this as SearchBase */
#define ACPI_NS_ALL ((ACPI_HANDLE)0)
@ -537,6 +535,4 @@ void
AcpiNsTerminate (
void);
#pragma pack(pop) /* Restore original struct packing */
#endif /* __ACNAMESP_H__ */

View File

@ -44,8 +44,6 @@
#ifndef _ACOBJECT_H
#define _ACOBJECT_H
#pragma pack(push) /* Set default struct packing */
/* acpisrc:StructDefs -- for acpisrc conversion */
@ -234,7 +232,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 */
/******************************************************************************
@ -583,6 +582,6 @@ typedef union acpi_descriptor
} ACPI_DESCRIPTOR;
#pragma pack(pop) /* Restore original struct packing */
#pragma pack()
#endif /* _ACOBJECT_H */

View File

@ -44,8 +44,6 @@
#ifndef __ACOUTPUT_H__
#define __ACOUTPUT_H__
#pragma pack(push) /* Set default struct packing */
/*
* Debug levels and component IDs. These are used to control the
* granularity of the output of the ACPI_DEBUG_PRINT macro -- on a
@ -466,6 +464,4 @@
#endif /* ACPI_DEBUG_OUTPUT */
#pragma pack(pop) /* Restore original struct packing */
#endif /* __ACOUTPUT_H__ */

View File

@ -46,8 +46,6 @@
#define __ACPARSER_H__
#pragma pack(push) /* Set default struct packing */
#define OP_HAS_RETURN_VALUE 1
/* Variable number of arguments. This field must be 32 bits */
@ -355,6 +353,4 @@ AcpiPsShow (
ACPI_PARSE_OBJECT *op);
#pragma pack(pop) /* Restore original struct packing */
#endif /* __ACPARSER_H__ */

View File

@ -50,8 +50,6 @@
#include "actypes.h"
#pragma pack(push) /* Set default struct packing */
/* Types for AcpiOsExecute */
typedef enum
@ -553,6 +551,4 @@ AcpiOsCloseDirectory (
#endif
#pragma pack(pop) /* Restore original struct packing */
#endif /* __ACPIOSXF_H__ */

View File

@ -47,15 +47,13 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
#define ACPI_CA_VERSION 0x20140214
#define ACPI_CA_VERSION 0x20140325
#include "acconfig.h"
#include "actypes.h"
#include "actbl.h"
#include "acbuffer.h"
#pragma pack(push) /* Set default struct packing */
/*
* Globals that are publically available
*/
@ -76,7 +74,7 @@ extern UINT8 AcpiGbl_AutoSerializeMethods;
extern UINT8 AcpiGbl_CopyDsdtLocally;
extern UINT8 AcpiGbl_CreateOsiMethod;
extern UINT8 AcpiGbl_DisableAutoRepair;
extern UINT8 AcpiGbl_DisableSsdtTableLoad;
extern UINT8 AcpiGbl_DisableSsdtTableInstall;
extern UINT8 AcpiGbl_DoNotUseXsdt;
extern UINT8 AcpiGbl_EnableAmlDebugObject;
extern UINT8 AcpiGbl_EnableInterpreterSlack;
@ -204,6 +202,11 @@ AcpiDecodePldBuffer (
* ACPI table load/unload interfaces
*/
ACPI_STATUS
AcpiInstallTable (
ACPI_PHYSICAL_ADDRESS Address,
BOOLEAN Physical);
ACPI_STATUS
AcpiLoadTable (
ACPI_TABLE_HEADER *Table);
@ -833,6 +836,4 @@ AcpiDebugPrintRaw (
...);
#endif
#pragma pack(pop) /* Restore original struct packing */
#endif /* __ACXFACE_H__ */

View File

@ -45,8 +45,6 @@
#define __ACPREDEF_H__
#pragma pack(push) /* Set default struct packing */
/******************************************************************************
*
* Return Package types
@ -1069,6 +1067,4 @@ static const ACPI_PREDEFINED_INFO AcpiGbl_ScopeNames[] = {
extern const ACPI_PREDEFINED_INFO AcpiGbl_ResourceNames[];
#endif
#pragma pack(pop) /* Restore original struct packing */
#endif

View File

@ -49,8 +49,6 @@
#include "amlresrc.h"
#pragma pack(push) /* Set default struct packing */
/*
* If possible, pack the following structures to byte alignment, since we
* don't care about performance for debug output. Two cases where we cannot
@ -439,6 +437,4 @@ extern ACPI_RSDUMP_INFO AcpiRsDumpUartSerialBus[];
extern ACPI_RSDUMP_INFO AcpiRsDumpGeneralFlags[];
#endif
#pragma pack(pop) /* Restore original struct packing */
#endif /* __ACRESRC_H__ */

View File

@ -45,8 +45,6 @@
#define __ACRESTYP_H__
#pragma pack(push) /* Set default struct packing */
/*
* Definitions for Resource Attributes
*/
@ -699,6 +697,4 @@ typedef struct acpi_pci_routing_table
} ACPI_PCI_ROUTING_TABLE;
#pragma pack(pop) /* Restore original struct packing */
#endif /* __ACRESTYP_H__ */

View File

@ -44,9 +44,6 @@
#ifndef __ACSTRUCT_H__
#define __ACSTRUCT_H__
#pragma pack(push) /* Set default struct packing */
/* acpisrc:StructDefs -- for acpisrc conversion */
/*****************************************************************************
@ -273,6 +270,4 @@ typedef struct acpi_walk_info
#define ACPI_DISPLAY_SHORT (UINT8) 2
#pragma pack(pop) /* Restore original struct packing */
#endif

View File

@ -45,8 +45,6 @@
#define __ACTABLES_H__
#pragma pack(push) /* Set default struct packing */
ACPI_STATUS
AcpiAllocateRootTable (
UINT32 InitialTableCount);
@ -64,6 +62,40 @@ 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);
BOOLEAN
AcpiTbIsTableLoaded (
UINT32 TableIndex);
void
AcpiTbSetTableLoadedFlag (
UINT32 TableIndex,
BOOLEAN IsLoaded);
/*
* tbfadt - FADT parse/convert/validate
*/
@ -96,17 +128,41 @@ AcpiTbResizeRootTableList (
void);
ACPI_STATUS
AcpiTbVerifyTable (
AcpiTbValidateTable (
ACPI_TABLE_DESC *TableDesc);
ACPI_TABLE_HEADER *
AcpiTbTableOverride (
ACPI_TABLE_HEADER *TableHeader,
void
AcpiTbInvalidateTable (
ACPI_TABLE_DESC *TableDesc);
ACPI_STATUS
AcpiTbAddTable (
AcpiTbVerifyTable (
ACPI_TABLE_DESC *TableDesc,
char *Signature);
void
AcpiTbOverrideTable (
ACPI_TABLE_DESC *OldTableDesc);
ACPI_STATUS
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
@ -118,7 +174,7 @@ AcpiTbStoreTable (
UINT32 *TableIndex);
void
AcpiTbDeleteTable (
AcpiTbUninstallTable (
ACPI_TABLE_DESC *TableDesc);
void
@ -142,15 +198,6 @@ AcpiTbGetOwnerId (
UINT32 TableIndex,
ACPI_OWNER_ID *OwnerId);
BOOLEAN
AcpiTbIsTableLoaded (
UINT32 TableIndex);
void
AcpiTbSetTableLoadedFlag (
UINT32 TableIndex,
BOOLEAN IsLoaded);
/*
* tbutils - table manager utilities
@ -187,7 +234,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);
@ -196,6 +249,4 @@ ACPI_STATUS
AcpiTbParseRootTable (
ACPI_PHYSICAL_ADDRESS RsdpAddress);
#pragma pack(pop) /* Restore original struct packing */
#endif /* __ACTABLES_H__ */

View File

@ -45,8 +45,6 @@
#define __ACTBL_H__
#pragma pack(push) /* Set default struct packing */
/*******************************************************************************
*
* Fundamental ACPI tables
@ -404,12 +402,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)
/*
@ -442,6 +439,4 @@ typedef struct acpi_table_desc
#define ACPI_FADT_V3_SIZE (UINT32) (ACPI_FADT_OFFSET (SleepControl))
#define ACPI_FADT_V5_SIZE (UINT32) (sizeof (ACPI_TABLE_FADT))
#pragma pack(pop) /* Restore original struct packing */
#endif /* __ACTBL_H__ */

View File

@ -45,8 +45,6 @@
#define __ACTBL1_H__
#pragma pack(push) /* Set default struct packing */
/*******************************************************************************
*
* Additional ACPI Tables (1)
@ -1143,6 +1141,8 @@ typedef struct acpi_srat_x2apic_cpu_affinity
#define ACPI_SRAT_CPU_ENABLED (1) /* 00: Use affinity structure */
#pragma pack(pop) /* Restore original struct packing */
/* Reset to default packing */
#pragma pack()
#endif /* __ACTBL1_H__ */

View File

@ -45,8 +45,6 @@
#define __ACTBL2_H__
#pragma pack(push) /* Set default struct packing */
/*******************************************************************************
*
* Additional ACPI Tables (2)
@ -1418,6 +1416,8 @@ typedef struct acpi_table_wdrt
} ACPI_TABLE_WDRT;
#pragma pack(pop) /* Restore original struct packing */
/* Reset to default packing */
#pragma pack()
#endif /* __ACTBL2_H__ */

View File

@ -45,8 +45,6 @@
#define __ACTBL3_H__
#pragma pack(push) /* Set default struct packing */
/*******************************************************************************
*
* Additional ACPI Tables (3)
@ -734,6 +732,8 @@ typedef struct acpi_tpm2_control
} ACPI_TPM2_CONTROL;
#pragma pack(pop) /* Restore original struct packing */
/* Reset to default packing */
#pragma pack()
#endif /* __ACTBL3_H__ */

View File

@ -44,8 +44,6 @@
#ifndef __ACTYPES_H__
#define __ACTYPES_H__
#pragma pack(push) /* Set default struct packing */
/* acpisrc:StructDefs -- for acpisrc conversion */
/*
@ -1317,6 +1315,4 @@ typedef struct acpi_memory_list
#define ACPI_OSI_WIN_8 0x0C
#pragma pack(pop) /* Restore original struct packing */
#endif /* __ACTYPES_H__ */

View File

@ -45,8 +45,6 @@
#define _ACUTILS_H
#pragma pack(push) /* Set default struct packing */
extern const UINT8 AcpiGbl_ResourceAmlSizes[];
extern const UINT8 AcpiGbl_ResourceAmlSerialBusSizes[];
@ -191,8 +189,8 @@ AcpiUtGetMutexName (
const char *
AcpiUtGetNotifyName (
UINT32 NotifyValue);
UINT32 NotifyValue,
ACPI_OBJECT_TYPE Type);
#endif
char *
@ -1101,7 +1099,15 @@ AcpiUtMethodError (
const char *Path,
ACPI_STATUS LookupStatus);
/*
* Utility functions for ACPI names and IDs
*/
const AH_PREDEFINED_NAME *
AcpiAhMatchPredefinedName (
char *Nameseg);
#pragma pack(pop) /* Restore original struct packing */
const AH_DEVICE_ID *
AcpiAhMatchHardwareId (
char *Hid);
#endif /* _ACUTILS_H */

View File

@ -46,9 +46,6 @@
#ifndef __AMLCODE_H__
#define __AMLCODE_H__
#pragma pack(push) /* Set default struct packing */
/* primary opcodes */
#define AML_NULL_CHAR (UINT16) 0x00
@ -512,6 +509,4 @@ typedef enum
#define AML_METHOD_SYNC_LEVEL 0xF0
#pragma pack(pop) /* Restore original struct packing */
#endif /* __AMLCODE_H__ */

View File

@ -47,8 +47,6 @@
#define __AMLRESRC_H
#pragma pack(push) /* Set default struct packing */
/*
* Resource descriptor tags, as defined in the ACPI specification.
* Used to symbolically reference fields within a descriptor.
@ -576,7 +574,4 @@ typedef union aml_resource
} AML_RESOURCE;
#pragma pack(pop) /* Restore original struct packing */
#endif

View File

@ -64,4 +64,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__ */

View File

@ -84,12 +84,23 @@
#include <ctype.h>
#include <unistd.h>
/* Define/disable kernel-specific declarators */
#ifndef __init
#define __init
#endif
#ifndef __iomem
#define __iomem
#endif
/* Host-dependent types and defines for user-space ACPICA */
#define ACPI_FLUSH_CPU_CACHE()
#define ACPI_CAST_PTHREAD_T(Pthread) ((ACPI_THREAD_ID) (Pthread))
#if defined(__ia64__) || defined(__x86_64__) || defined(__aarch64__)
#if defined(__ia64__) || defined(__x86_64__) ||\
defined(__aarch64__) || defined(__PPC64__)
#define ACPI_MACHINE_WIDTH 64
#define COMPILER_DEPENDENT_INT64 long
#define COMPILER_DEPENDENT_UINT64 unsigned long

View File

@ -55,9 +55,9 @@
/* List of information about obtained ACPI tables */
typedef struct table_info
typedef struct osl_table_info
{
struct table_info *Next;
struct osl_table_info *Next;
UINT32 Instance;
char Signature[ACPI_NAME_SIZE];
@ -253,22 +253,22 @@ AcpiOsGetTableByAddress (
if (TableLength == 0)
{
Status = AE_BAD_HEADER;
goto ErrorExit;
goto Exit;
}
LocalTable = calloc (1, TableLength);
if (!LocalTable)
{
Status = AE_NO_MEMORY;
goto ErrorExit;
goto Exit;
}
ACPI_MEMCPY (LocalTable, MappedTable, TableLength);
ErrorExit:
Exit:
OslUnmapTable (MappedTable);
*Table = LocalTable;
return (AE_OK);
return (Status);
}
@ -1003,7 +1003,7 @@ OslGetBiosTable (
if (TableLength == 0)
{
Status = AE_BAD_HEADER;
goto ErrorExit;
goto Exit;
}
/* Copy table to local buffer and return it */
@ -1012,16 +1012,16 @@ OslGetBiosTable (
if (!LocalTable)
{
Status = AE_NO_MEMORY;
goto ErrorExit;
goto Exit;
}
ACPI_MEMCPY (LocalTable, MappedTable, TableLength);
*Address = TableAddress;
*Table = LocalTable;
ErrorExit:
Exit:
OslUnmapTable (MappedTable);
return (AE_OK);
return (Status);
}
@ -1290,7 +1290,7 @@ OslReadTableFromFile (
{
fprintf (stderr, "Could not read table header: %s\n", Filename);
Status = AE_BAD_HEADER;
goto ErrorExit;
goto Exit;
}
/* If signature is specified, it must match the table */
@ -1301,14 +1301,14 @@ OslReadTableFromFile (
fprintf (stderr, "Incorrect signature: Expecting %4.4s, found %4.4s\n",
Signature, Header.Signature);
Status = AE_BAD_SIGNATURE;
goto ErrorExit;
goto Exit;
}
TableLength = ApGetTableLength (&Header);
if (TableLength == 0)
{
Status = AE_BAD_HEADER;
goto ErrorExit;
goto Exit;
}
/* Read the entire table into a local buffer */
@ -1320,7 +1320,7 @@ OslReadTableFromFile (
"%4.4s: Could not allocate buffer for table of length %X\n",
Header.Signature, TableLength);
Status = AE_NO_MEMORY;
goto ErrorExit;
goto Exit;
}
fseek (TableFile, FileOffset, SEEK_SET);
@ -1333,7 +1333,7 @@ OslReadTableFromFile (
fprintf (stderr, "%4.4s: Could not read table content\n",
Header.Signature);
Status = AE_INVALID_TABLE_LENGTH;
goto ErrorExit;
goto Exit;
}
Total += Count;
@ -1343,7 +1343,7 @@ OslReadTableFromFile (
(void) ApIsValidChecksum (LocalTable);
ErrorExit:
Exit:
fclose (TableFile);
*Table = LocalTable;
return (Status);

View File

@ -41,7 +41,7 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi.h>
#include "acpi.h"
#include <stdio.h>
#include <stdlib.h>

View File

@ -1345,7 +1345,7 @@ AcpiOsWritable (
*
* FUNCTION: AcpiOsSignal
*
* PARAMETERS: Function - ACPI CA signal function code
* PARAMETERS: Function - ACPI A signal function code
* Info - Pointer to function-dependent structure
*
* RETURN: Status

View File

@ -222,6 +222,7 @@ AcpiOsGetTableByName (
HKEY SubKey;
ULONG i;
ACPI_TABLE_HEADER *ReturnTable;
ACPI_STATUS Status = AE_OK;
/*
@ -294,7 +295,8 @@ AcpiOsGetTableByName (
{
fprintf (stderr, "Could not open %s entry: %s\n",
Signature, WindowsFormatException (WinStatus));
return (AE_ERROR);
Status = AE_ERROR;
goto Cleanup;
}
RegCloseKey (Handle);
@ -313,7 +315,8 @@ AcpiOsGetTableByName (
{
fprintf (stderr, "Could not get %s registry entry: %s\n",
Signature, WindowsFormatException (WinStatus));
return (AE_ERROR);
Status = AE_ERROR;
goto Cleanup;
}
if (Type == REG_BINARY)
@ -326,11 +329,12 @@ AcpiOsGetTableByName (
WinStatus = RegQueryValueEx (Handle, KeyBuffer, NULL, NULL,
NULL, &DataSize);
if (WinStatus != ERROR_SUCCESS)
if (WinStatus = ERROR_SUCCESS)
{
fprintf (stderr, "Could not read the %s table size: %s\n",
Signature, WindowsFormatException (WinStatus));
return (AE_ERROR);
Status = AE_ERROR;
goto Cleanup;
}
/* Allocate a new buffer for the table */
@ -338,6 +342,7 @@ AcpiOsGetTableByName (
ReturnTable = malloc (DataSize);
if (!ReturnTable)
{
Status = AE_NO_MEMORY;
goto Cleanup;
}
@ -345,20 +350,21 @@ AcpiOsGetTableByName (
WinStatus = RegQueryValueEx (Handle, KeyBuffer, NULL, NULL,
(UCHAR *) ReturnTable, &DataSize);
if (WinStatus != ERROR_SUCCESS)
if (WinStatus = ERROR_SUCCESS)
{
fprintf (stderr, "Could not read %s data: %s\n",
Signature, WindowsFormatException (WinStatus));
free (ReturnTable);
return (AE_ERROR);
Status = AE_ERROR;
goto Cleanup;
}
Cleanup:
RegCloseKey (Handle);
*Table = ReturnTable;
*Address = 0;
return (AE_OK);
Cleanup:
RegCloseKey (Handle);
return (Status);
}

View File

@ -1324,7 +1324,7 @@ AcpiOsWriteMemory (
*
* FUNCTION: AcpiOsSignal
*
* PARAMETERS: Function - ACPI CA signal function code
* PARAMETERS: Function - ACPICA signal function code
* Info - Pointer to function-dependent structure
*
* RETURN: Status

View File

@ -42,10 +42,9 @@
*/
#include "acpibin.h"
#include "acapps.h"
FILE *File1;
FILE *File2;
ACPI_TABLE_HEADER Header1;
ACPI_TABLE_HEADER Header2;
@ -69,10 +68,6 @@ AbGetFile (
char *Filename,
UINT32 *FileSize);
static UINT32
AbGetFileSize (
FILE *File);
static void
AbPrintHeaderInfo (
ACPI_TABLE_HEADER *Header);
@ -87,68 +82,6 @@ AeLocalGetRootPointer (
void);
/*******************************************************************************
*
* FUNCTION: UtHexCharToValue
*
* PARAMETERS: HexChar - Hex character in Ascii
*
* RETURN: The binary value of the hex character
*
* DESCRIPTION: Perform ascii-to-hex translation
*
******************************************************************************/
static UINT8
UtHexCharToValue (
int HexChar,
UINT8 *OutBinary)
{
if (HexChar >= 0x30 && HexChar <= 0x39)
{
*OutBinary = (UINT8) (HexChar - 0x30);
return (1);
}
else if (HexChar >= 0x41 && HexChar <= 0x46)
{
*OutBinary = (UINT8) (HexChar - 0x37);
return (1);
}
else if (HexChar >= 0x61 && HexChar <= 0x66)
{
*OutBinary = (UINT8) (HexChar - 0x57);
return (1);
}
return (0);
}
static UINT8
AbHexByteToBinary (
char *HexString,
char *OutBinary)
{
UINT8 Local1;
UINT8 Local2;
if (!UtHexCharToValue (HexString[0], &Local1))
{
return (0);
}
if (!UtHexCharToValue (HexString[1], &Local2))
{
return (0);
}
*OutBinary = (UINT8) ((Local1 << 4) | Local2);
return (2);
}
/******************************************************************************
*
* FUNCTION: AbValidateHeader
@ -190,23 +123,24 @@ AcpiTbSumTable (
void *Buffer,
UINT32 Length)
{
const UINT8 *limit;
const UINT8 *rover;
UINT8 sum = 0;
const UINT8 *Limit;
const UINT8 *Rover;
UINT8 Sum = 0;
if (Buffer && Length)
{
/* Buffer and Length are valid */
limit = (UINT8 *) Buffer + Length;
Limit = (UINT8 *) Buffer + Length;
for (rover = Buffer; rover < limit; rover++)
for (Rover = Buffer; Rover < Limit; Rover++)
{
sum = (UINT8) (sum + *rover);
Sum = (UINT8) (Sum + *Rover);
}
}
return (sum);
return (Sum);
}
@ -233,10 +167,10 @@ AbPrintHeaderInfo (
printf ("Length : %8.8X\n", Header->Length);
printf ("Revision : %2.2X\n", Header->Revision);
printf ("Checksum : %2.2X\n", Header->Checksum);
printf ("OEM ID : %6.6s\n", Header->OemId);
printf ("OEM Table ID : %8.8s\n", Header->OemTableId);
printf ("OEM ID : %.6s\n", Header->OemId);
printf ("OEM Table ID : %.8s\n", Header->OemTableId);
printf ("OEM Revision : %8.8X\n", Header->OemRevision);
printf ("ASL Compiler ID : %4.4s\n", Header->AslCompilerId);
printf ("ASL Compiler ID : %.4s\n", Header->AslCompilerId);
printf ("Compiler Revision : %8.8X\n", Header->AslCompilerRevision);
printf ("\n");
}
@ -253,10 +187,10 @@ AbPrintHeadersInfo (
printf ("Length %8.8X : %8.8X\n", Header->Length, Header2->Length);
printf ("Revision %8.2X : %2.2X\n", Header->Revision, Header2->Revision);
printf ("Checksum %8.2X : %2.2X\n", Header->Checksum, Header2->Checksum);
printf ("OEM ID %8.6s : %6.6s\n", Header->OemId, Header2->OemId);
printf ("OEM Table ID %8.8s : %8.8s\n", Header->OemTableId, Header2->OemTableId);
printf ("OEM ID %8.6s : %.6s\n", Header->OemId, Header2->OemId);
printf ("OEM Table ID %8.8s : %.8s\n", Header->OemTableId, Header2->OemTableId);
printf ("OEM Revision %8.8X : %8.8X\n", Header->OemRevision, Header2->OemRevision);
printf ("ASL Compiler ID %8.4s : %4.4s\n", Header->AslCompilerId, Header2->AslCompilerId);
printf ("ASL Compiler ID %8.4s : %.4s\n", Header->AslCompilerId, Header2->AslCompilerId);
printf ("Compiler Revision %8.8X : %8.8X\n", Header->AslCompilerRevision, Header2->AslCompilerRevision);
printf ("\n");
}
@ -272,22 +206,25 @@ AbPrintHeadersInfo (
void
AbDisplayHeader (
char *File1Path)
char *FilePath)
{
UINT32 Actual;
FILE *File;
File1 = fopen (File1Path, "rb");
if (!File1)
File = fopen (FilePath, "rb");
if (!File)
{
printf ("Could not open file %s\n", File1Path);
printf ("Could not open file %s\n", FilePath);
return;
}
Actual = fread (&Header1, 1, sizeof (ACPI_TABLE_HEADER), File1);
Actual = fread (&Header1, 1, sizeof (ACPI_TABLE_HEADER), File);
fclose (File);
if (Actual != sizeof (ACPI_TABLE_HEADER))
{
printf ("File %s does not contain an ACPI table header\n", File1Path);
printf ("File %s does not contain a valid ACPI table header\n", FilePath);
return;
}
@ -310,30 +247,31 @@ AbDisplayHeader (
void
AbComputeChecksum (
char *File1Path)
char *FilePath)
{
UINT32 Actual;
ACPI_TABLE_HEADER *Table;
UINT8 Checksum;
FILE *File;
File1 = fopen (File1Path, "rb");
if (!File1)
File = fopen (FilePath, "rb");
if (!File)
{
printf ("Could not open file %s\n", File1Path);
printf ("Could not open file %s\n", FilePath);
return;
}
Actual = fread (&Header1, 1, sizeof (ACPI_TABLE_HEADER), File1);
Actual = fread (&Header1, 1, sizeof (ACPI_TABLE_HEADER), File);
if (Actual < sizeof (ACPI_TABLE_HEADER))
{
printf ("File %s does not contain an ACPI table header\n", File1Path);
return;
printf ("File %s does not contain a valid ACPI table header\n", FilePath);
goto Exit1;
}
if (!AbValidateHeader (&Header1))
{
return;
goto Exit1;
}
if (!Gbl_TerseMode)
@ -346,18 +284,18 @@ AbComputeChecksum (
Table = AcpiOsAllocate (Header1.Length);
if (!Table)
{
printf ("could not allocate\n");
return;
printf ("Could not allocate buffer for table\n");
goto Exit1;
}
/* Read the entire table, including header */
fseek (File1, 0, SEEK_SET);
Actual = fread (Table, 1, Header1.Length, File1);
fseek (File, 0, SEEK_SET);
Actual = fread (Table, 1, Header1.Length, File);
if (Actual != Header1.Length)
{
printf ("could not read table, length %u\n", Header1.Length);
return;
printf ("Could not read table, length %u\n", Header1.Length);
goto Exit2;
}
/* Compute the checksum for the table */
@ -369,32 +307,41 @@ AbComputeChecksum (
if (Header1.Checksum == Checksum)
{
printf ("Checksum ok in AML file, not updating\n");
return;
printf ("Checksum OK in AML file, not updating\n");
goto Exit2;
}
/* Open the target file for writing, to update checksum */
fclose (File1);
File1 = fopen (File1Path, "r+b");
if (!File1)
fclose (File);
File = fopen (FilePath, "r+b");
if (!File)
{
printf ("Could not open file %s for writing\n", File1Path);
return;
printf ("Could not open file %s for writing\n", FilePath);
goto Exit2;
}
/* Set the checksum, write the new header */
Header1.Checksum = Checksum;
Actual = fwrite (&Header1, 1, sizeof (ACPI_TABLE_HEADER), File1);
Actual = fwrite (&Header1, 1, sizeof (ACPI_TABLE_HEADER), File);
if (Actual != sizeof (ACPI_TABLE_HEADER))
{
printf ("Could not write updated table header\n");
return;
goto Exit2;
}
printf ("Wrote new checksum\n");
Exit2:
AcpiOsFree (Table);
Exit1:
if (File)
{
fclose (File);
}
return;
}
@ -419,6 +366,9 @@ AbCompareAmlFiles (
UINT8 Char2;
UINT8 Mismatches = 0;
BOOLEAN HeaderMismatch = FALSE;
FILE *File1;
FILE *File2;
int Status = -1;
File1 = fopen (File1Path, "rb");
@ -432,7 +382,7 @@ AbCompareAmlFiles (
if (!File2)
{
printf ("Could not open file %s\n", File2Path);
return (-1);
goto Exit1;
}
/* Read the ACPI header from each file */
@ -441,20 +391,20 @@ AbCompareAmlFiles (
if (Actual1 != sizeof (ACPI_TABLE_HEADER))
{
printf ("File %s does not contain an ACPI table header\n", File1Path);
return (-1);
goto Exit2;
}
Actual2 = fread (&Header2, 1, sizeof (ACPI_TABLE_HEADER), File2);
if (Actual2 != sizeof (ACPI_TABLE_HEADER))
{
printf ("File %s does not contain an ACPI table header\n", File2Path);
return (-1);
goto Exit2;
}
if ((!AbValidateHeader (&Header1)) ||
(!AbValidateHeader (&Header2)))
{
return (-1);
goto Exit2;
}
/* Table signatures must match */
@ -462,7 +412,7 @@ AbCompareAmlFiles (
if (*((UINT32 *) Header1.Signature) != *((UINT32 *) Header2.Signature))
{
printf ("Table signatures do not match\n");
return (-1);
goto Exit2;
}
if (!Gbl_TerseMode)
@ -494,7 +444,7 @@ AbCompareAmlFiles (
if (Mismatches > 100)
{
printf ("100 Mismatches: Too many mismatches\n");
return (-1);
goto Exit2;
}
}
@ -526,43 +476,14 @@ AbCompareAmlFiles (
}
printf ("%u Mismatches found\n", Mismatches);
return (0);
}
Status = 0;
Exit2:
fclose (File2);
/******************************************************************************
*
* FUNCTION: AbGetFileSize
*
* DESCRIPTION: Get the size of an open file
*
******************************************************************************/
static UINT32
AbGetFileSize (
FILE *File)
{
UINT32 FileSize;
long Offset;
Offset = ftell (File);
if (fseek (File, 0, SEEK_END))
{
return (0);
}
FileSize = (UINT32) ftell (File);
/* Restore file pointer */
if (fseek (File, Offset, SEEK_SET))
{
return (0);
}
return (FileSize);
Exit1:
fclose (File1);
return (Status);
}
@ -596,8 +517,8 @@ AbGetFile (
/* Need file size to allocate a buffer */
Size = AbGetFileSize (File);
if (!Size)
Size = CmGetFileSize (File);
if (Size == ACPI_UINT32_MAX)
{
printf ("Could not get file size (seek) for %s\n", Filename);
goto ErrorExit;
@ -647,6 +568,7 @@ AbDumpAmlFile (
char *FileBuffer;
FILE *FileOutHandle;
UINT32 FileSize = 0;
int Status = -1;
/* Get the entire AML file, validate header */
@ -664,12 +586,12 @@ AbDumpAmlFile (
if (!FileOutHandle)
{
printf ("Could not open file %s\n", File2Path);
return (-1);
goto Exit1;
}
if (!AbValidateHeader ((ACPI_TABLE_HEADER *) FileBuffer))
{
return (-1);
goto Exit2;
}
/* Convert binary AML to text, using common dump buffer routine */
@ -684,133 +606,18 @@ AbDumpAmlFile (
/* Summary for the output file */
FileSize = AbGetFileSize (FileOutHandle);
FileSize = CmGetFileSize (FileOutHandle);
printf ("Output file: %s contains %u (0x%X) bytes\n\n",
File2Path, FileSize, FileSize);
return (0);
}
Status = 0;
/******************************************************************************
*
* FUNCTION: AbExtractAmlFile
*
* DESCRIPTION: Extract a binary AML file from a text file (as produced by the
* DumpAmlFile procedure or the "acpidump" table utility.
*
******************************************************************************/
int
AbExtractAmlFile (
char *TableSig,
char *File1Path,
char *File2Path)
{
char *Table;
char Value;
UINT32 i;
FILE *FileHandle;
FILE *FileOutHandle;
UINT32 Count = 0;
int Scanned;
/* Open in/out files. input is in text mode, output is in binary mode */
FileHandle = fopen (File1Path, "rt");
if (!FileHandle)
{
printf ("Could not open file %s\n", File1Path);
return (-1);
}
FileOutHandle = fopen (File2Path, "w+b");
if (!FileOutHandle)
{
printf ("Could not open file %s\n", File2Path);
return (-1);
}
/* Force input table sig to uppercase */
AcpiUtStrupr (TableSig);
/* TBD: examine input for ASCII */
/* We have an ascii file, grab one line at a time */
while (fgets (Buffer, BUFFER_SIZE, FileHandle))
{
/* The 4-char ACPI signature appears at the beginning of a line */
if (ACPI_COMPARE_NAME (Buffer, TableSig))
{
printf ("Found table [%4.4s]\n", TableSig);
/*
* Eat all lines in the table, of the form:
* <offset>: <16 bytes of hex data, separated by spaces> <ASCII representation> <newline>
*
* Example:
*
* 02C0: 5F 53 42 5F 4C 4E 4B 44 00 12 13 04 0C FF FF 08 _SB_LNKD........
*
*/
while (fgets (Buffer, BUFFER_SIZE, FileHandle))
{
/* Get past the offset, terminated by a colon */
Table = strchr (Buffer, ':');
if (!Table)
{
/* No colon, all done */
goto Exit;
}
Table += 2; /* Eat the colon + space */
for (i = 0; i < 16; i++)
{
Scanned = AbHexByteToBinary (Table, &Value);
if (!Scanned)
{
goto Exit;
}
Table += 3; /* Go past this hex byte and space */
/* Write the converted (binary) byte */
if (fwrite (&Value, 1, 1, FileOutHandle) != 1)
{
printf ("Error writing byte %u to output file: %s\n",
Count, File2Path);
goto Exit;
}
Count++;
}
}
/* No more lines, EOF, all done */
goto Exit;
}
}
/* Searched entire file, no match to table signature */
printf ("Could not match table signature\n");
fclose (FileHandle);
return (-1);
Exit:
printf ("%u (0x%X) bytes written to %s\n", Count, Count, File2Path);
fclose (FileHandle);
Exit2:
fclose (FileOutHandle);
return (0);
Exit1:
free (FileBuffer);
return (Status);
}

View File

@ -54,7 +54,7 @@ AbDisplayUsage (
#define AB_UTILITY_NAME "ACPI Binary Table Dump Utility"
#define AB_SUPPORTED_OPTIONS "c:d:e:h:s:tv"
#define AB_SUPPORTED_OPTIONS "c:d:h:s:tv"
/******************************************************************************
@ -79,7 +79,6 @@ AbDisplayUsage (
ACPI_OPTION ("-c <File1><File2>", "Compare two binary AML files");
ACPI_OPTION ("-d <In><Out>", "Dump AML binary to text file");
ACPI_OPTION ("-e <Sig><In><Out>", "Extract binary AML table from AcpiDump file");
ACPI_OPTION ("-h <File>", "Display table header for binary AML file");
ACPI_OPTION ("-s <File>", "Update checksum for binary AML file");
ACPI_OPTION ("-t", "Terse mode");
@ -144,18 +143,6 @@ main (
Status = AbDumpAmlFile (AcpiGbl_Optarg, argv[AcpiGbl_Optind]);
break;
case 'e': /* Extract AML text file */
if (argc < 5)
{
AbDisplayUsage (3);
return (-1);
}
Status = AbExtractAmlFile (AcpiGbl_Optarg, argv[AcpiGbl_Optind],
argv[AcpiGbl_Optind+1]);
break;
case 'h': /* Display ACPI table header */
if (argc < 3)

View File

@ -75,12 +75,6 @@ AbCompareAmlFiles (
char *File1Path,
char *File2Path);
int
AbExtractAmlFile (
char *TableSig,
char *File1Path,
char *File2Path);
int
AbDumpAmlFile (
char *File1Path,

View File

@ -142,10 +142,6 @@ ApGetTableLength (
/*
* apfiles - File I/O utilities
*/
UINT32
ApGetFileSize (
FILE *File);
int
ApOpenOutputFile (
char *Pathname);

View File

@ -69,6 +69,7 @@ BOOLEAN
ApIsValidHeader (
ACPI_TABLE_HEADER *Table)
{
if (!ACPI_VALIDATE_RSDP_SIG (Table->Signature))
{
/* Make sure signature is all ASCII and a valid ACPI name */
@ -100,9 +101,9 @@ ApIsValidHeader (
*
* PARAMETERS: Table - Pointer to table to be validated
*
* RETURN: TRUE if the checksum appears to be valid. FALSE otherwise
* RETURN: TRUE if the checksum appears to be valid. FALSE otherwise.
*
* DESCRIPTION: Check for a valid ACPI table checksum
* DESCRIPTION: Check for a valid ACPI table checksum.
*
******************************************************************************/
@ -120,7 +121,6 @@ ApIsValidChecksum (
* Checksum for RSDP.
* Note: Other checksums are computed during the table dump.
*/
Rsdp = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table);
Status = AcpiTbValidateRsdp (Rsdp);
}
@ -131,7 +131,7 @@ ApIsValidChecksum (
if (ACPI_FAILURE (Status))
{
fprintf (stderr, "%4.4s: Warning: wrong checksum\n",
fprintf (stderr, "%4.4s: Warning: wrong checksum in table\n",
Table->Signature);
}
@ -147,7 +147,7 @@ ApIsValidChecksum (
*
* RETURN: Table length
*
* DESCRIPTION: Obtain table length according to table signature
* DESCRIPTION: Obtain table length according to table signature.
*
******************************************************************************/
@ -170,10 +170,10 @@ ApGetTableLength (
Rsdp = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table);
return (Rsdp->Length);
}
else
{
return (Table->Length);
}
/* Normal ACPI table */
return (Table->Length);
}
@ -219,7 +219,7 @@ ApDumpTableBuffer (
}
/*
* Dump the table with header for use with acpixtract utility
* Dump the table with header for use with acpixtract utility.
* Note: simplest to just always emit a 64-bit address. AcpiXtract
* utility can handle this.
*/
@ -254,6 +254,7 @@ ApDumpAllTables (
UINT32 Instance = 0;
ACPI_PHYSICAL_ADDRESS Address;
ACPI_STATUS Status;
int TableStatus;
UINT32 i;
@ -284,11 +285,13 @@ ApDumpAllTables (
}
}
if (ApDumpTableBuffer (Table, Instance, Address))
{
return (-1);
}
TableStatus = ApDumpTableBuffer (Table, Instance, Address);
free (Table);
if (TableStatus)
{
break;
}
}
/* Something seriously bad happened if the loop terminates here */
@ -368,6 +371,7 @@ ApDumpTableByName (
ACPI_TABLE_HEADER *Table;
ACPI_PHYSICAL_ADDRESS Address;
ACPI_STATUS Status;
int TableStatus;
if (strlen (Signature) != ACPI_NAME_SIZE)
@ -415,11 +419,13 @@ ApDumpTableByName (
return (-1);
}
if (ApDumpTableBuffer (Table, Instance, Address))
{
return (-1);
}
TableStatus = ApDumpTableBuffer (Table, Instance, Address);
free (Table);
if (TableStatus)
{
break;
}
}
/* Something seriously bad happened if the loop terminates here */
@ -446,7 +452,7 @@ ApDumpTableFromFile (
{
ACPI_TABLE_HEADER *Table;
UINT32 FileSize = 0;
int TableStatus;
int TableStatus = -1;
/* Get the entire ACPI table from the file */
@ -464,7 +470,7 @@ ApDumpTableFromFile (
fprintf (stderr,
"Table length (0x%X) is too large for input file (0x%X) %s\n",
Table->Length, FileSize, Pathname);
return (-1);
goto Exit;
}
if (Gbl_VerboseMode)
@ -475,6 +481,8 @@ ApDumpTableFromFile (
}
TableStatus = ApDumpTableBuffer (Table, 0, 0);
Exit:
free (Table);
return (TableStatus);
}

View File

@ -215,8 +215,8 @@ ApGetTableFromFile (
/* Need file size to allocate a buffer */
FileSize = ApGetFileSize (File);
if (!FileSize)
FileSize = CmGetFileSize (File);
if (FileSize == ACPI_UINT32_MAX)
{
fprintf (stderr,
"Could not get input file size: %s\n", Pathname);
@ -251,41 +251,3 @@ ApGetTableFromFile (
fclose (File);
return (Buffer);
}
/******************************************************************************
*
* FUNCTION: ApGetFileSize
*
* PARAMETERS: File - Open file descriptor
*
* RETURN: File size in bytes
*
* DESCRIPTION: Get the size of an open file
*
******************************************************************************/
UINT32
ApGetFileSize (
FILE *File)
{
UINT32 FileSize;
long Offset;
Offset = ftell (File);
if (fseek (File, 0, SEEK_END))
{
return (0);
}
/* Get size and restore file pointer */
FileSize = (UINT32) ftell (File);
if (fseek (File, Offset, SEEK_SET))
{
return (0);
}
return (FileSize);
}

View File

@ -358,7 +358,7 @@ main (
{
/* Summary for the output file */
FileSize = ApGetFileSize (Gbl_OutputFile);
FileSize = CmGetFileSize (Gbl_OutputFile);
fprintf (stderr, "Output file %s contains 0x%X (%u) bytes\n\n",
Gbl_OutputFilename, FileSize, FileSize);
}

View File

@ -63,8 +63,6 @@
#include <string.h>
#include <signal.h>
#pragma pack(push) /* Set default struct packing */
extern BOOLEAN AcpiGbl_IgnoreErrors;
extern UINT8 AcpiGbl_RegionFillValue;
extern UINT8 AcpiGbl_UseHwReducedFadt;
@ -198,7 +196,4 @@ AeGlobalEventHandler (
UINT32 EventNumber,
void *Context);
#pragma pack(pop) /* Restore original struct packing */
#endif /* _AECOMMON */

View File

@ -312,7 +312,7 @@ AeCommonNotifyHandler (
printf ("[AcpiExec] Handler %u: Received a %s Notify on [%4.4s] %p Value 0x%2.2X (%s)\n",
HandlerId, Type, AcpiUtGetNodeName (Device), Device, Value,
AcpiUtGetNotifyName (Value));
AcpiUtGetNotifyName (Value, ACPI_TYPE_ANY));
if (AcpiGbl_DebugFile)
{
AcpiOsPrintf ("[AcpiExec] Handler %u: Received a %s notify, Value 0x%2.2X\n",
@ -348,7 +348,7 @@ AeSystemNotifyHandler (
printf ("[AcpiExec] Global: Received a System Notify on [%4.4s] %p Value 0x%2.2X (%s)\n",
AcpiUtGetNodeName (Device), Device, Value,
AcpiUtGetNotifyName (Value));
AcpiUtGetNotifyName (Value, ACPI_TYPE_ANY));
if (AcpiGbl_DebugFile)
{
AcpiOsPrintf ("[AcpiExec] Global: Received a System Notify, Value 0x%2.2X\n", Value);
@ -381,7 +381,7 @@ AeDeviceNotifyHandler (
printf ("[AcpiExec] Global: Received a Device Notify on [%4.4s] %p Value 0x%2.2X (%s)\n",
AcpiUtGetNodeName (Device), Device, Value,
AcpiUtGetNotifyName (Value));
AcpiUtGetNotifyName (Value, ACPI_TYPE_ANY));
if (AcpiGbl_DebugFile)
{
AcpiOsPrintf ("[AcpiExec] Global: Received a Device Notify, Value 0x%2.2X\n", Value);

View File

@ -70,6 +70,7 @@
#define AH_DECODE_AML_OPCODE 5
#define AH_DISPLAY_DEVICE_IDS 6
#define AH_DECODE_EXCEPTION 7
#define AH_DECODE_ASL_AML 8
#define AH_MAX_ASL_LINE_LENGTH 70
#define AH_MAX_AML_LINE_LENGTH 100
@ -104,13 +105,6 @@ typedef struct ah_asl_keyword
} AH_ASL_KEYWORD;
typedef struct ah_device_id
{
char *Name;
char *Description;
} AH_DEVICE_ID;
extern const AH_AML_OPCODE AmlOpcodeInfo[];
extern const AH_ASL_OPERATOR AslOperatorInfo[];
@ -138,6 +132,10 @@ AhFindPredefinedNames (
char *Name);
void
AhFindAslAndAmlOperators (
char *Name);
UINT32
AhFindAslOperators (
char *Name);
@ -147,6 +145,6 @@ AhFindAslKeywords (
void
AhDisplayDeviceIds (
void);
char *Name);
#endif /* __ACPIHELP_H */

View File

@ -141,7 +141,7 @@ const AH_AML_OPCODE AmlOpcodeInfo[] =
"DefFatal := FatalOp FatalType FatalCode FatalArg"},
{0x5B33, 0x5B33, "0x5B33", "TimerOp", "TermObject", NULL, NULL,
"DefTimer := TimerOp"},
{0x5B80, 0x5B80, "0x5B80", "OpRegionOp", "TermObject", "NameString ByteData TermArg TermArg", NULL,
{0x5B80, 0x5B80, "0x5B80", "OperationRegionOp", "TermObject", "NameString ByteData TermArg TermArg", NULL,
"DefOpRegion := OpRegionOp NameString RegionSpace RegionOffset RegionLen"},
{0x5B81, 0x5B81, "0x5B81", "FieldOp", "TermObject", "NameString ByteData", "FieldList",
"DefField := FieldOp PkgLength NameString FieldFlags FieldList"},

View File

@ -48,41 +48,6 @@
#include "acpredef.h"
/* Device IDs defined in the ACPI specification */
static const AH_DEVICE_ID AhDeviceIds[] =
{
{"PNP0A05", "Generic Container Device"},
{"PNP0A06", "Generic Container Device"},
{"PNP0C08", "ACPI core hardware"},
{"PNP0C09", "Embedded Controller Device"},
{"PNP0C0A", "Control Method Battery"},
{"PNP0C0B", "Fan"},
{"PNP0C0C", "Power Button Device"},
{"PNP0C0D", "Lid Device"},
{"PNP0C0E", "Sleep Button Device"},
{"PNP0C0F", "PCI Interrupt Link Device"},
{"PNP0C80", "Memory Device"},
{"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/Alarm Device"},
{"ACPI000F", "User Presence Detection Device"},
{NULL, NULL}
};
#define AH_DISPLAY_EXCEPTION(Status, Name) \
printf ("%.4X: %s\n", Status, Name)
@ -589,7 +554,7 @@ AhDisplayAslKeyword (
/*******************************************************************************
*
* FUNCTION: AhFindAslOperators (entry point for ASL operator search)
* FUNCTION: AhFindAslAndAmlOperators
*
* PARAMETERS: Name - Name or prefix for an ASL operator.
* NULL means "find all"
@ -597,16 +562,46 @@ AhDisplayAslKeyword (
* RETURN: None
*
* DESCRIPTION: Find all ASL operators that match the input Name or name
* prefix.
* prefix. Also displays the AML information if only one entry
* matches.
*
******************************************************************************/
void
AhFindAslAndAmlOperators (
char *Name)
{
UINT32 MatchCount;
MatchCount = AhFindAslOperators (Name);
if (MatchCount == 1)
{
AhFindAmlOpcode (Name);
}
}
/*******************************************************************************
*
* FUNCTION: AhFindAslOperators (entry point for ASL operator search)
*
* PARAMETERS: Name - Name or prefix for an ASL operator.
* NULL means "find all"
*
* RETURN: Number of operators that matched the name prefix.
*
* DESCRIPTION: Find all ASL operators that match the input Name or name
* prefix.
*
******************************************************************************/
UINT32
AhFindAslOperators (
char *Name)
{
const AH_ASL_OPERATOR *Operator;
BOOLEAN Found = FALSE;
BOOLEAN MatchCount = 0;
AhStrupr (Name);
@ -618,7 +613,7 @@ AhFindAslOperators (
if (!Name)
{
AhDisplayAslOperator (Operator);
Found = TRUE;
MatchCount++;
continue;
}
@ -630,14 +625,16 @@ AhFindAslOperators (
if (strstr (Gbl_Buffer, Name) == Gbl_Buffer)
{
AhDisplayAslOperator (Operator);
Found = TRUE;
MatchCount++;
}
}
if (!Found)
if (!MatchCount)
{
printf ("%s, no matching ASL operators\n", Name);
}
return (MatchCount);
}
@ -805,26 +802,71 @@ AhPrintOneField (
*
* FUNCTION: AhDisplayDeviceIds
*
* PARAMETERS: None
* PARAMETERS: Name - Device Hardware ID string.
* NULL means "find all"
*
* RETURN: None
*
* DESCRIPTION: Display all PNP* and ACPI* device IDs defined in the ACPI spec.
* DESCRIPTION: Display PNP* and ACPI* device IDs.
*
******************************************************************************/
void
AhDisplayDeviceIds (
void)
char *Name)
{
const AH_DEVICE_ID *DeviceId = AhDeviceIds;
const AH_DEVICE_ID *Info;
UINT32 Length;
BOOLEAN Matched;
UINT32 i;
BOOLEAN Found = FALSE;
printf ("ACPI and PNP Device IDs defined in the ACPI specification:\n\n");
while (DeviceId->Name)
/* Null input name indicates "display all" */
if (!Name)
{
printf ("%8s %s\n", DeviceId->Name, DeviceId->Description);
DeviceId++;
printf ("ACPI and PNP Device/Hardware IDs:\n\n");
for (Info = AslDeviceIds; Info->Name; Info++)
{
printf ("%8s %s\n", Info->Name, Info->Description);
}
return;
}
Length = strlen (Name);
if (Length > 8)
{
printf ("%.8s: Hardware ID must be 8 characters maximum\n", Name);
return;
}
/* Find/display all names that match the input name prefix */
AhStrupr (Name);
for (Info = AslDeviceIds; Info->Name; Info++)
{
Matched = TRUE;
for (i = 0; i < Length; i++)
{
if (Info->Name[i] != Name[i])
{
Matched = FALSE;
break;
}
}
if (Matched)
{
Found = TRUE;
printf ("%8s %s\n", Info->Name, Info->Description);
}
}
if (!Found)
{
printf ("%s, Hardware ID not found\n", Name);
}
}

View File

@ -51,7 +51,7 @@ AhDisplayUsage (
void);
#define AH_UTILITY_NAME "ACPI Help Utility"
#define AH_SUPPORTED_OPTIONS "ehikmopsv"
#define AH_SUPPORTED_OPTIONS "aehikmopsv"
/******************************************************************************
@ -67,24 +67,29 @@ AhDisplayUsage (
void)
{
ACPI_USAGE_HEADER ("acpihelp <options> [NamePrefix | HexValue]");
ACPI_USAGE_HEADER ("acpihelp <options> [Name/Prefix | HexValue]");
ACPI_OPTION ("-h", "Display help");
ACPI_OPTION ("-v", "Display version information");
printf ("\nACPI Names and Symbols:\n");
ACPI_OPTION ("-k [NamePrefix]", "Find/Display ASL non-operator keyword(s)");
ACPI_OPTION ("-m [NamePrefix]", "Find/Display AML opcode name(s)");
ACPI_OPTION ("-p [NamePrefix]", "Find/Display ASL predefined method name(s)");
ACPI_OPTION ("-s [NamePrefix]", "Find/Display ASL operator name(s)");
printf ("\nAML (ACPI Machine Language) Names and Encodings:\n");
ACPI_OPTION ("-a [Name/Prefix]", "Find/Display both ASL operator and AML opcode name(s)");
ACPI_OPTION ("-m [Name/Prefix]", "Find/Display AML opcode name(s)");
printf ("\nASL (ACPI Source Language) Names and Symbols:\n");
ACPI_OPTION ("-k [Name/Prefix]", "Find/Display ASL non-operator keyword(s)");
ACPI_OPTION ("-p [Name/Prefix]", "Find/Display ASL predefined method name(s)");
ACPI_OPTION ("-s [Name/Prefix]", "Find/Display ASL operator name(s)");
printf ("\nOther ACPI Names:\n");
ACPI_OPTION ("-i [Name/Prefix]", "Find/Display ACPI/PNP Hardware ID(s)");
printf ("\nACPI Values:\n");
ACPI_OPTION ("-e [HexValue]", "Decode ACPICA exception code");
ACPI_OPTION ("-i", "Display known ACPI Device IDs (_HID)");
ACPI_OPTION ("-o [HexValue]", "Decode hex AML opcode");
printf ("\nNamePrefix/HexValue not specified means \"Display All\"\n");
printf ("\nDefault search with NamePrefix and no options:\n");
printf (" Find ASL operator names - if NamePrefix does not start with underscore\n");
printf ("\nName/Prefix or HexValue not specified means \"Display All\"\n");
printf ("\nDefault search with valid Name/Prefix and no options:\n");
printf (" Find ASL/AML operator names - if NamePrefix does not start with underscore\n");
printf (" Find ASL predefined method names - if NamePrefix starts with underscore\n");
}
@ -121,6 +126,11 @@ main (
while ((j = AcpiGetopt (argc, argv, AH_SUPPORTED_OPTIONS)) != EOF) switch (j)
{
case 'a':
DecodeType = AH_DECODE_ASL_AML;
break;
case 'e':
DecodeType = AH_DECODE_EXCEPTION;
@ -173,6 +183,11 @@ main (
switch (DecodeType)
{
case AH_DECODE_ASL_AML:
AhFindAslAndAmlOperators (Name);
break;
case AH_DECODE_AML:
AhFindAmlOpcode (Name);
@ -200,7 +215,7 @@ main (
case AH_DISPLAY_DEVICE_IDS:
AhDisplayDeviceIds ();
AhDisplayDeviceIds (Name);
break;
case AH_DECODE_EXCEPTION:
@ -222,7 +237,7 @@ main (
}
else
{
AhFindAslOperators (Name);
AhFindAslAndAmlOperators (Name);
}
break;
}

Some files were not shown because too many files have changed in this diff Show More