/******************************************************************************
*
* Name: aclocal.h - Internal data types used across the ACPI subsystem
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2016, 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.
*/
#ifndef __ACLOCAL_H__
#define __ACLOCAL_H__
/* acpisrc:struct_defs -- for acpisrc conversion */
#define ACPI_SERIALIZED 0xFF
typedef u32 acpi_mutex_handle;
#define ACPI_GLOBAL_LOCK (acpi_semaphore) (-1)
/* Total number of aml opcodes defined */
#define AML_NUM_OPCODES 0x82
/* Forward declarations */
struct acpi_walk_state;
struct acpi_obj_mutex;
union acpi_parse_object;
/*****************************************************************************
*
* Mutex typedefs and structs
*
****************************************************************************/
/*
* Predefined handles for the mutex objects used within the subsystem
* All mutex objects are automatically created by acpi_ut_mutex_initialize.
*
* The acquire/release ordering protocol is implied via this list. Mutexes
* with a lower value must be acquired before mutexes with a higher value.
*
* NOTE: any changes here must be reflected in the acpi_gbl_mutex_names
* table below also!
*/
#define ACPI_MTX_INTERPRETER 0 /* AML Interpreter, main lock */
#define ACPI_MTX_NAMESPACE 1 /* ACPI Namespace */
#define ACPI_MTX_TABLES 2 /* Data for ACPI tables */
#define ACPI_MTX_EVENTS 3 /* Data for ACPI events */
#define ACPI_MTX_CACHES 4 /* Internal caches, general purposes */
#define ACPI_MTX_MEMORY 5 /* Debug memory tracking lists */
#define ACPI_MAX_MUTEX 5
#define ACPI_NUM_MUTEX (ACPI_MAX_MUTEX+1)
/* Lock structure for reader/writer interfaces */
struct acpi_rw_lock {
acpi_mutex writer_mutex;
acpi_mutex reader_mutex;
u32 num_readers;
};
/*
* Predefined handles for spinlocks used within the subsystem.
* These spinlocks are created by acpi_ut_mutex_initialize
*/
#define ACPI_LOCK_GPES 0
#define ACPI_LOCK_HARDWARE 1
#define ACPI_MAX_LOCK 1
#define ACPI_NUM_LOCK (ACPI_MAX_LOCK+1)
/* This Thread ID means that the mutex is not in use (unlocked) */
#define ACPI_MUTEX_NOT_ACQUIRED ((acpi_thread_id) 0)
/* This Thread ID means an invalid thread ID */
#ifdef ACPI_OS_INVALID_THREAD_ID
#define ACPI_INVALID_THREAD_ID ACPI_OS_INVALID_THREAD_ID
#else
#define ACPI_INVALID_THREAD_ID ((acpi_thread_id) 0xFFFFFFFF)
#endif
/* Table for the global mutexes */
struct acpi_mutex_info {
acpi_mutex mutex;
u32 use_count;
acpi_thread_id thread_id;
};
/* Lock flag parameter for various interfaces */
#define ACPI_MTX_DO_NOT_LOCK 0
#define ACPI_MTX_LOCK 1
/* Field access granularities */
#define ACPI_FIELD_BYTE_GRANULARITY 1
#define ACPI_FIELD_WORD_GRANULARITY 2
#define ACPI_FIELD_DWORD_GRANULARITY 4
#define ACPI_FIELD_QWORD_GRANULARITY 8
#define ACPI_ENTRY_NOT_FOUND NULL
/*****************************************************************************
*
* Namespace typedefs and structs
*
****************************************************************************/
/* Operational modes of the AML interpreter/scanner */
typedef enum {
ACPI_IMODE_LOAD_PASS1 = 0x01,
ACPI_IMODE_LOAD_PASS2 = 0x02,
ACPI_IMODE_EXECUTE = 0x03
} acpi_interpreter_mode;
/*
* The Namespace Node describes a named object that appears in the AML.
* descriptor_type is used to differentiate between internal descriptors.
*
* The node is optimized for both 32-bit and 64-bit platforms:
* 20 bytes for the 32-bit case, 32 bytes for the 64-bit case.
*
* Note: The descriptor_type and Type fields must appear in the identical
* position in both the struct acpi_namespace_node and union acpi_operand_object
* structures.
*/
struct acpi_namespace_node {
union acpi_operand_object *object; /* Interpreter object */
u8 descriptor_type; /* Differentiate object descriptor types */
u8 type; /* ACPI Type associated with this name */
u8 flags; /* Miscellaneous flags */
acpi_owner_id owner_id; /* Node creator */
union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */
struct acpi_namespace_node *parent; /* Parent node */
struct acpi_namespace_node *child; /* First child */
struct acpi_namespace_node *peer; /* First peer */
/*
* The following fields are used by the ASL compiler and disassembler only
*/
#ifdef ACPI_LARGE_NAMESPACE_NODE
union acpi_parse_object *op;
void *method_locals;
void *method_args;
u32 value;
u32 length;
u8 arg_count;
#endif