/drivers/ddk/debug/dbglog.c |
---|
59,6 → 59,13 |
#pragma pack(pop) |
int get_fileinfo(const char *path,FILEINFO *info); |
int create_file(const char *path); |
int set_file_size(const char *path, unsigned size); |
int write_file(const char *path,const void *buff, |
unsigned offset,unsigned count,unsigned *writes); |
typedef struct |
{ |
char *path; |
/drivers/include/acpi/acbuffer.h |
---|
0,0 → 1,244 |
/****************************************************************************** |
* |
* Name: acbuffer.h - Support for buffers returned by ACPI predefined names |
* |
*****************************************************************************/ |
/* |
* Copyright (C) 2000 - 2015, 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 __ACBUFFER_H__ |
#define __ACBUFFER_H__ |
/* |
* Contains buffer structures for these predefined names: |
* _FDE, _GRT, _GTM, _PLD, _SRT |
*/ |
/* |
* Note: C bitfields are not used for this reason: |
* |
* "Bitfields are great and easy to read, but unfortunately the C language |
* does not specify the layout of bitfields in memory, which means they are |
* essentially useless for dealing with packed data in on-disk formats or |
* binary wire protocols." (Or ACPI tables and buffers.) "If you ask me, |
* this decision was a design error in C. Ritchie could have picked an order |
* and stuck with it." Norman Ramsey. |
* See http://stackoverflow.com/a/1053662/41661 |
*/ |
/* _FDE return value */ |
struct acpi_fde_info { |
u32 floppy0; |
u32 floppy1; |
u32 floppy2; |
u32 floppy3; |
u32 tape; |
}; |
/* |
* _GRT return value |
* _SRT input value |
*/ |
struct acpi_grt_info { |
u16 year; |
u8 month; |
u8 day; |
u8 hour; |
u8 minute; |
u8 second; |
u8 valid; |
u16 milliseconds; |
u16 timezone; |
u8 daylight; |
u8 reserved[3]; |
}; |
/* _GTM return value */ |
struct acpi_gtm_info { |
u32 pio_speed0; |
u32 dma_speed0; |
u32 pio_speed1; |
u32 dma_speed1; |
u32 flags; |
}; |
/* |
* Formatted _PLD return value. The minimum size is a package containing |
* one buffer. |
* Revision 1: Buffer is 16 bytes (128 bits) |
* Revision 2: Buffer is 20 bytes (160 bits) |
* |
* Note: This structure is returned from the acpi_decode_pld_buffer |
* interface. |
*/ |
struct acpi_pld_info { |
u8 revision; |
u8 ignore_color; |
u8 red; |
u8 green; |
u8 blue; |
u16 width; |
u16 height; |
u8 user_visible; |
u8 dock; |
u8 lid; |
u8 panel; |
u8 vertical_position; |
u8 horizontal_position; |
u8 shape; |
u8 group_orientation; |
u8 group_token; |
u8 group_position; |
u8 bay; |
u8 ejectable; |
u8 ospm_eject_required; |
u8 cabinet_number; |
u8 card_cage_number; |
u8 reference; |
u8 rotation; |
u8 order; |
u8 reserved; |
u16 vertical_offset; |
u16 horizontal_offset; |
}; |
/* |
* Macros to: |
* 1) Convert a _PLD buffer to internal struct acpi_pld_info format - ACPI_PLD_GET* |
* (Used by acpi_decode_pld_buffer) |
* 2) Construct a _PLD buffer - ACPI_PLD_SET* |
* (Intended for BIOS use only) |
*/ |
#define ACPI_PLD_REV1_BUFFER_SIZE 16 /* For Revision 1 of the buffer (From ACPI spec) */ |
#define ACPI_PLD_REV2_BUFFER_SIZE 20 /* For Revision 2 of the buffer (From ACPI spec) */ |
#define ACPI_PLD_BUFFER_SIZE 20 /* For Revision 2 of the buffer (From ACPI spec) */ |
/* First 32-bit dword, bits 0:32 */ |
#define ACPI_PLD_GET_REVISION(dword) ACPI_GET_BITS (dword, 0, ACPI_7BIT_MASK) |
#define ACPI_PLD_SET_REVISION(dword,value) ACPI_SET_BITS (dword, 0, ACPI_7BIT_MASK, value) /* Offset 0, Len 7 */ |
#define ACPI_PLD_GET_IGNORE_COLOR(dword) ACPI_GET_BITS (dword, 7, ACPI_1BIT_MASK) |
#define ACPI_PLD_SET_IGNORE_COLOR(dword,value) ACPI_SET_BITS (dword, 7, ACPI_1BIT_MASK, value) /* Offset 7, Len 1 */ |
#define ACPI_PLD_GET_RED(dword) ACPI_GET_BITS (dword, 8, ACPI_8BIT_MASK) |
#define ACPI_PLD_SET_RED(dword,value) ACPI_SET_BITS (dword, 8, ACPI_8BIT_MASK, value) /* Offset 8, Len 8 */ |
#define ACPI_PLD_GET_GREEN(dword) ACPI_GET_BITS (dword, 16, ACPI_8BIT_MASK) |
#define ACPI_PLD_SET_GREEN(dword,value) ACPI_SET_BITS (dword, 16, ACPI_8BIT_MASK, value) /* Offset 16, Len 8 */ |
#define ACPI_PLD_GET_BLUE(dword) ACPI_GET_BITS (dword, 24, ACPI_8BIT_MASK) |
#define ACPI_PLD_SET_BLUE(dword,value) ACPI_SET_BITS (dword, 24, ACPI_8BIT_MASK, value) /* Offset 24, Len 8 */ |
/* Second 32-bit dword, bits 33:63 */ |
#define ACPI_PLD_GET_WIDTH(dword) ACPI_GET_BITS (dword, 0, ACPI_16BIT_MASK) |
#define ACPI_PLD_SET_WIDTH(dword,value) ACPI_SET_BITS (dword, 0, ACPI_16BIT_MASK, value) /* Offset 32+0=32, Len 16 */ |
#define ACPI_PLD_GET_HEIGHT(dword) ACPI_GET_BITS (dword, 16, ACPI_16BIT_MASK) |
#define ACPI_PLD_SET_HEIGHT(dword,value) ACPI_SET_BITS (dword, 16, ACPI_16BIT_MASK, value) /* Offset 32+16=48, Len 16 */ |
/* Third 32-bit dword, bits 64:95 */ |
#define ACPI_PLD_GET_USER_VISIBLE(dword) ACPI_GET_BITS (dword, 0, ACPI_1BIT_MASK) |
#define ACPI_PLD_SET_USER_VISIBLE(dword,value) ACPI_SET_BITS (dword, 0, ACPI_1BIT_MASK, value) /* Offset 64+0=64, Len 1 */ |
#define ACPI_PLD_GET_DOCK(dword) ACPI_GET_BITS (dword, 1, ACPI_1BIT_MASK) |
#define ACPI_PLD_SET_DOCK(dword,value) ACPI_SET_BITS (dword, 1, ACPI_1BIT_MASK, value) /* Offset 64+1=65, Len 1 */ |
#define ACPI_PLD_GET_LID(dword) ACPI_GET_BITS (dword, 2, ACPI_1BIT_MASK) |
#define ACPI_PLD_SET_LID(dword,value) ACPI_SET_BITS (dword, 2, ACPI_1BIT_MASK, value) /* Offset 64+2=66, Len 1 */ |
#define ACPI_PLD_GET_PANEL(dword) ACPI_GET_BITS (dword, 3, ACPI_3BIT_MASK) |
#define ACPI_PLD_SET_PANEL(dword,value) ACPI_SET_BITS (dword, 3, ACPI_3BIT_MASK, value) /* Offset 64+3=67, Len 3 */ |
#define ACPI_PLD_GET_VERTICAL(dword) ACPI_GET_BITS (dword, 6, ACPI_2BIT_MASK) |
#define ACPI_PLD_SET_VERTICAL(dword,value) ACPI_SET_BITS (dword, 6, ACPI_2BIT_MASK, value) /* Offset 64+6=70, Len 2 */ |
#define ACPI_PLD_GET_HORIZONTAL(dword) ACPI_GET_BITS (dword, 8, ACPI_2BIT_MASK) |
#define ACPI_PLD_SET_HORIZONTAL(dword,value) ACPI_SET_BITS (dword, 8, ACPI_2BIT_MASK, value) /* Offset 64+8=72, Len 2 */ |
#define ACPI_PLD_GET_SHAPE(dword) ACPI_GET_BITS (dword, 10, ACPI_4BIT_MASK) |
#define ACPI_PLD_SET_SHAPE(dword,value) ACPI_SET_BITS (dword, 10, ACPI_4BIT_MASK, value) /* Offset 64+10=74, Len 4 */ |
#define ACPI_PLD_GET_ORIENTATION(dword) ACPI_GET_BITS (dword, 14, ACPI_1BIT_MASK) |
#define ACPI_PLD_SET_ORIENTATION(dword,value) ACPI_SET_BITS (dword, 14, ACPI_1BIT_MASK, value) /* Offset 64+14=78, Len 1 */ |
#define ACPI_PLD_GET_TOKEN(dword) ACPI_GET_BITS (dword, 15, ACPI_8BIT_MASK) |
#define ACPI_PLD_SET_TOKEN(dword,value) ACPI_SET_BITS (dword, 15, ACPI_8BIT_MASK, value) /* Offset 64+15=79, Len 8 */ |
#define ACPI_PLD_GET_POSITION(dword) ACPI_GET_BITS (dword, 23, ACPI_8BIT_MASK) |
#define ACPI_PLD_SET_POSITION(dword,value) ACPI_SET_BITS (dword, 23, ACPI_8BIT_MASK, value) /* Offset 64+23=87, Len 8 */ |
#define ACPI_PLD_GET_BAY(dword) ACPI_GET_BITS (dword, 31, ACPI_1BIT_MASK) |
#define ACPI_PLD_SET_BAY(dword,value) ACPI_SET_BITS (dword, 31, ACPI_1BIT_MASK, value) /* Offset 64+31=95, Len 1 */ |
/* Fourth 32-bit dword, bits 96:127 */ |
#define ACPI_PLD_GET_EJECTABLE(dword) ACPI_GET_BITS (dword, 0, ACPI_1BIT_MASK) |
#define ACPI_PLD_SET_EJECTABLE(dword,value) ACPI_SET_BITS (dword, 0, ACPI_1BIT_MASK, value) /* Offset 96+0=96, Len 1 */ |
#define ACPI_PLD_GET_OSPM_EJECT(dword) ACPI_GET_BITS (dword, 1, ACPI_1BIT_MASK) |
#define ACPI_PLD_SET_OSPM_EJECT(dword,value) ACPI_SET_BITS (dword, 1, ACPI_1BIT_MASK, value) /* Offset 96+1=97, Len 1 */ |
#define ACPI_PLD_GET_CABINET(dword) ACPI_GET_BITS (dword, 2, ACPI_8BIT_MASK) |
#define ACPI_PLD_SET_CABINET(dword,value) ACPI_SET_BITS (dword, 2, ACPI_8BIT_MASK, value) /* Offset 96+2=98, Len 8 */ |
#define ACPI_PLD_GET_CARD_CAGE(dword) ACPI_GET_BITS (dword, 10, ACPI_8BIT_MASK) |
#define ACPI_PLD_SET_CARD_CAGE(dword,value) ACPI_SET_BITS (dword, 10, ACPI_8BIT_MASK, value) /* Offset 96+10=106, Len 8 */ |
#define ACPI_PLD_GET_REFERENCE(dword) ACPI_GET_BITS (dword, 18, ACPI_1BIT_MASK) |
#define ACPI_PLD_SET_REFERENCE(dword,value) ACPI_SET_BITS (dword, 18, ACPI_1BIT_MASK, value) /* Offset 96+18=114, Len 1 */ |
#define ACPI_PLD_GET_ROTATION(dword) ACPI_GET_BITS (dword, 19, ACPI_4BIT_MASK) |
#define ACPI_PLD_SET_ROTATION(dword,value) ACPI_SET_BITS (dword, 19, ACPI_4BIT_MASK, value) /* Offset 96+19=115, Len 4 */ |
#define ACPI_PLD_GET_ORDER(dword) ACPI_GET_BITS (dword, 23, ACPI_5BIT_MASK) |
#define ACPI_PLD_SET_ORDER(dword,value) ACPI_SET_BITS (dword, 23, ACPI_5BIT_MASK, value) /* Offset 96+23=119, Len 5 */ |
/* Fifth 32-bit dword, bits 128:159 (Revision 2 of _PLD only) */ |
#define ACPI_PLD_GET_VERT_OFFSET(dword) ACPI_GET_BITS (dword, 0, ACPI_16BIT_MASK) |
#define ACPI_PLD_SET_VERT_OFFSET(dword,value) ACPI_SET_BITS (dword, 0, ACPI_16BIT_MASK, value) /* Offset 128+0=128, Len 16 */ |
#define ACPI_PLD_GET_HORIZ_OFFSET(dword) ACPI_GET_BITS (dword, 16, ACPI_16BIT_MASK) |
#define ACPI_PLD_SET_HORIZ_OFFSET(dword,value) ACPI_SET_BITS (dword, 16, ACPI_16BIT_MASK, value) /* Offset 128+16=144, Len 16 */ |
#endif /* ACBUFFER_H */ |
/drivers/include/acpi/acconfig.h |
---|
0,0 → 1,246 |
/****************************************************************************** |
* |
* Name: acconfig.h - Global configuration constants |
* |
*****************************************************************************/ |
/* |
* Copyright (C) 2000 - 2015, 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 _ACCONFIG_H |
#define _ACCONFIG_H |
/****************************************************************************** |
* |
* Configuration options |
* |
*****************************************************************************/ |
/* |
* ACPI_DEBUG_OUTPUT - This switch enables all the debug facilities of the |
* ACPI subsystem. This includes the DEBUG_PRINT output |
* statements. When disabled, all DEBUG_PRINT |
* statements are compiled out. |
* |
* ACPI_APPLICATION - Use this switch if the subsystem is going to be run |
* at the application level. |
* |
*/ |
/* |
* OS name, used for the _OS object. The _OS object is essentially obsolete, |
* but there is a large base of ASL/AML code in existing machines that check |
* for the string below. The use of this string usually guarantees that |
* the ASL will execute down the most tested code path. Also, there is some |
* code that will not execute the _OSI method unless _OS matches the string |
* below. Therefore, change this string at your own risk. |
*/ |
#define ACPI_OS_NAME "Microsoft Windows NT" |
/* Maximum objects in the various object caches */ |
#define ACPI_MAX_STATE_CACHE_DEPTH 96 /* State objects */ |
#define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */ |
#define ACPI_MAX_EXTPARSE_CACHE_DEPTH 96 /* Parse tree objects */ |
#define ACPI_MAX_OBJECT_CACHE_DEPTH 96 /* Interpreter operand objects */ |
#define ACPI_MAX_NAMESPACE_CACHE_DEPTH 96 /* Namespace objects */ |
/* |
* Should the subsystem abort the loading of an ACPI table if the |
* table checksum is incorrect? |
*/ |
#ifndef ACPI_CHECKSUM_ABORT |
#define ACPI_CHECKSUM_ABORT FALSE |
#endif |
/* |
* Generate a version of ACPICA that only supports "reduced hardware" |
* platforms (as defined in ACPI 5.0). Set to TRUE to generate a specialized |
* version of ACPICA that ONLY supports the ACPI 5.0 "reduced hardware" |
* model. In other words, no ACPI hardware is supported. |
* |
* If TRUE, this means no support for the following: |
* PM Event and Control registers |
* SCI interrupt (and handler) |
* Fixed Events |
* General Purpose Events (GPEs) |
* Global Lock |
* ACPI PM timer |
* FACS table (Waking vectors and Global Lock) |
*/ |
#ifndef ACPI_REDUCED_HARDWARE |
#define ACPI_REDUCED_HARDWARE FALSE |
#endif |
/****************************************************************************** |
* |
* Subsystem Constants |
* |
*****************************************************************************/ |
/* Version of ACPI supported */ |
#define ACPI_CA_SUPPORT_LEVEL 5 |
/* Maximum count for a semaphore object */ |
#define ACPI_MAX_SEMAPHORE_COUNT 256 |
/* Maximum object reference count (detects object deletion issues) */ |
#define ACPI_MAX_REFERENCE_COUNT 0x1000 |
/* Default page size for use in mapping memory for operation regions */ |
#define ACPI_DEFAULT_PAGE_SIZE 4096 /* Must be power of 2 */ |
/* owner_id tracking. 8 entries allows for 255 owner_ids */ |
#define ACPI_NUM_OWNERID_MASKS 8 |
/* Size of the root table array is increased by this increment */ |
#define ACPI_ROOT_TABLE_SIZE_INCREMENT 4 |
/* Maximum sleep allowed via Sleep() operator */ |
#define ACPI_MAX_SLEEP 2000 /* 2000 millisec == two seconds */ |
/* Address Range lists are per-space_id (Memory and I/O only) */ |
#define ACPI_ADDRESS_RANGE_MAX 2 |
/****************************************************************************** |
* |
* ACPI Specification constants (Do not change unless the specification changes) |
* |
*****************************************************************************/ |
/* Method info (in WALK_STATE), containing local variables and argumetns */ |
#define ACPI_METHOD_NUM_LOCALS 8 |
#define ACPI_METHOD_MAX_LOCAL 7 |
#define ACPI_METHOD_NUM_ARGS 7 |
#define ACPI_METHOD_MAX_ARG 6 |
/* |
* Operand Stack (in WALK_STATE), Must be large enough to contain METHOD_MAX_ARG |
*/ |
#define ACPI_OBJ_NUM_OPERANDS 8 |
#define ACPI_OBJ_MAX_OPERAND 7 |
/* Number of elements in the Result Stack frame, can be an arbitrary value */ |
#define ACPI_RESULTS_FRAME_OBJ_NUM 8 |
/* |
* Maximal number of elements the Result Stack can contain, |
* it may be an arbitray value not exceeding the types of |
* result_size and result_count (now u8). |
*/ |
#define ACPI_RESULTS_OBJ_NUM_MAX 255 |
/* Constants used in searching for the RSDP in low memory */ |
#define ACPI_EBDA_PTR_LOCATION 0x0000040E /* Physical Address */ |
#define ACPI_EBDA_PTR_LENGTH 2 |
#define ACPI_EBDA_WINDOW_SIZE 1024 |
#define ACPI_HI_RSDP_WINDOW_BASE 0x000E0000 /* Physical Address */ |
#define ACPI_HI_RSDP_WINDOW_SIZE 0x00020000 |
#define ACPI_RSDP_SCAN_STEP 16 |
/* Operation regions */ |
#define ACPI_USER_REGION_BEGIN 0x80 |
/* Maximum space_ids for Operation Regions */ |
#define ACPI_MAX_ADDRESS_SPACE 255 |
#define ACPI_NUM_DEFAULT_SPACES 4 |
/* Array sizes. Used for range checking also */ |
#define ACPI_MAX_MATCH_OPCODE 5 |
/* RSDP checksums */ |
#define ACPI_RSDP_CHECKSUM_LENGTH 20 |
#define ACPI_RSDP_XCHECKSUM_LENGTH 36 |
/* SMBus, GSBus and IPMI bidirectional buffer size */ |
#define ACPI_SMBUS_BUFFER_SIZE 34 |
#define ACPI_GSBUS_BUFFER_SIZE 34 |
#define ACPI_IPMI_BUFFER_SIZE 66 |
/* _sx_d and _sx_w control methods */ |
#define ACPI_NUM_sx_d_METHODS 4 |
#define ACPI_NUM_sx_w_METHODS 5 |
/****************************************************************************** |
* |
* Miscellaneous constants |
* |
*****************************************************************************/ |
/* UUID constants */ |
#define UUID_BUFFER_LENGTH 16 /* Length of UUID in memory */ |
#define UUID_STRING_LENGTH 36 /* Total length of a UUID string */ |
/* Positions for required hyphens (dashes) in UUID strings */ |
#define UUID_HYPHEN1_OFFSET 8 |
#define UUID_HYPHEN2_OFFSET 13 |
#define UUID_HYPHEN3_OFFSET 18 |
#define UUID_HYPHEN4_OFFSET 23 |
/****************************************************************************** |
* |
* ACPI AML Debugger |
* |
*****************************************************************************/ |
#define ACPI_DEBUGGER_MAX_ARGS ACPI_METHOD_NUM_ARGS + 4 /* Max command line arguments */ |
#define ACPI_DB_LINE_BUFFER_SIZE 512 |
#define ACPI_DEBUGGER_COMMAND_PROMPT '-' |
#define ACPI_DEBUGGER_EXECUTE_PROMPT '%' |
#endif /* _ACCONFIG_H */ |
/drivers/include/acpi/acexcep.h |
---|
0,0 → 1,386 |
/****************************************************************************** |
* |
* Name: acexcep.h - Exception codes returned by the ACPI subsystem |
* |
*****************************************************************************/ |
/* |
* Copyright (C) 2000 - 2015, 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 __ACEXCEP_H__ |
#define __ACEXCEP_H__ |
/* This module contains all possible exception codes for acpi_status */ |
/* |
* Exception code classes |
*/ |
#define AE_CODE_ENVIRONMENTAL 0x0000 /* General ACPICA environment */ |
#define AE_CODE_PROGRAMMER 0x1000 /* External ACPICA interface caller */ |
#define AE_CODE_ACPI_TABLES 0x2000 /* ACPI tables */ |
#define AE_CODE_AML 0x3000 /* From executing AML code */ |
#define AE_CODE_CONTROL 0x4000 /* Internal control codes */ |
#define AE_CODE_MAX 0x4000 |
#define AE_CODE_MASK 0xF000 |
/* |
* Macros to insert the exception code classes |
*/ |
#define EXCEP_ENV(code) ((acpi_status) (code | AE_CODE_ENVIRONMENTAL)) |
#define EXCEP_PGM(code) ((acpi_status) (code | AE_CODE_PROGRAMMER)) |
#define EXCEP_TBL(code) ((acpi_status) (code | AE_CODE_ACPI_TABLES)) |
#define EXCEP_AML(code) ((acpi_status) (code | AE_CODE_AML)) |
#define EXCEP_CTL(code) ((acpi_status) (code | AE_CODE_CONTROL)) |
/* |
* Exception info table. The "Description" field is used only by the |
* ACPICA help application (acpihelp). |
*/ |
struct acpi_exception_info { |
char *name; |
#ifdef ACPI_HELP_APP |
char *description; |
#endif |
}; |
#ifdef ACPI_HELP_APP |
#define EXCEP_TXT(name,description) {name, description} |
#else |
#define EXCEP_TXT(name,description) {name} |
#endif |
/* |
* Success is always zero, failure is non-zero |
*/ |
#define ACPI_SUCCESS(a) (!(a)) |
#define ACPI_FAILURE(a) (a) |
#define ACPI_SKIP(a) (a == AE_CTRL_SKIP) |
#define AE_OK (acpi_status) 0x0000 |
/* |
* Environmental exceptions |
*/ |
#define AE_ERROR EXCEP_ENV (0x0001) |
#define AE_NO_ACPI_TABLES EXCEP_ENV (0x0002) |
#define AE_NO_NAMESPACE EXCEP_ENV (0x0003) |
#define AE_NO_MEMORY EXCEP_ENV (0x0004) |
#define AE_NOT_FOUND EXCEP_ENV (0x0005) |
#define AE_NOT_EXIST EXCEP_ENV (0x0006) |
#define AE_ALREADY_EXISTS EXCEP_ENV (0x0007) |
#define AE_TYPE EXCEP_ENV (0x0008) |
#define AE_NULL_OBJECT EXCEP_ENV (0x0009) |
#define AE_NULL_ENTRY EXCEP_ENV (0x000A) |
#define AE_BUFFER_OVERFLOW EXCEP_ENV (0x000B) |
#define AE_STACK_OVERFLOW EXCEP_ENV (0x000C) |
#define AE_STACK_UNDERFLOW EXCEP_ENV (0x000D) |
#define AE_NOT_IMPLEMENTED EXCEP_ENV (0x000E) |
#define AE_SUPPORT EXCEP_ENV (0x000F) |
#define AE_LIMIT EXCEP_ENV (0x0010) |
#define AE_TIME EXCEP_ENV (0x0011) |
#define AE_ACQUIRE_DEADLOCK EXCEP_ENV (0x0012) |
#define AE_RELEASE_DEADLOCK EXCEP_ENV (0x0013) |
#define AE_NOT_ACQUIRED EXCEP_ENV (0x0014) |
#define AE_ALREADY_ACQUIRED EXCEP_ENV (0x0015) |
#define AE_NO_HARDWARE_RESPONSE EXCEP_ENV (0x0016) |
#define AE_NO_GLOBAL_LOCK EXCEP_ENV (0x0017) |
#define AE_ABORT_METHOD EXCEP_ENV (0x0018) |
#define AE_SAME_HANDLER EXCEP_ENV (0x0019) |
#define AE_NO_HANDLER EXCEP_ENV (0x001A) |
#define AE_OWNER_ID_LIMIT EXCEP_ENV (0x001B) |
#define AE_NOT_CONFIGURED EXCEP_ENV (0x001C) |
#define AE_ACCESS EXCEP_ENV (0x001D) |
#define AE_CODE_ENV_MAX 0x001D |
/* |
* Programmer exceptions |
*/ |
#define AE_BAD_PARAMETER EXCEP_PGM (0x0001) |
#define AE_BAD_CHARACTER EXCEP_PGM (0x0002) |
#define AE_BAD_PATHNAME EXCEP_PGM (0x0003) |
#define AE_BAD_DATA EXCEP_PGM (0x0004) |
#define AE_BAD_HEX_CONSTANT EXCEP_PGM (0x0005) |
#define AE_BAD_OCTAL_CONSTANT EXCEP_PGM (0x0006) |
#define AE_BAD_DECIMAL_CONSTANT EXCEP_PGM (0x0007) |
#define AE_MISSING_ARGUMENTS EXCEP_PGM (0x0008) |
#define AE_BAD_ADDRESS EXCEP_PGM (0x0009) |
#define AE_CODE_PGM_MAX 0x0009 |
/* |
* Acpi table exceptions |
*/ |
#define AE_BAD_SIGNATURE EXCEP_TBL (0x0001) |
#define AE_BAD_HEADER EXCEP_TBL (0x0002) |
#define AE_BAD_CHECKSUM EXCEP_TBL (0x0003) |
#define AE_BAD_VALUE EXCEP_TBL (0x0004) |
#define AE_INVALID_TABLE_LENGTH EXCEP_TBL (0x0005) |
#define AE_CODE_TBL_MAX 0x0005 |
/* |
* AML exceptions. These are caused by problems with |
* the actual AML byte stream |
*/ |
#define AE_AML_BAD_OPCODE EXCEP_AML (0x0001) |
#define AE_AML_NO_OPERAND EXCEP_AML (0x0002) |
#define AE_AML_OPERAND_TYPE EXCEP_AML (0x0003) |
#define AE_AML_OPERAND_VALUE EXCEP_AML (0x0004) |
#define AE_AML_UNINITIALIZED_LOCAL EXCEP_AML (0x0005) |
#define AE_AML_UNINITIALIZED_ARG EXCEP_AML (0x0006) |
#define AE_AML_UNINITIALIZED_ELEMENT EXCEP_AML (0x0007) |
#define AE_AML_NUMERIC_OVERFLOW EXCEP_AML (0x0008) |
#define AE_AML_REGION_LIMIT EXCEP_AML (0x0009) |
#define AE_AML_BUFFER_LIMIT EXCEP_AML (0x000A) |
#define AE_AML_PACKAGE_LIMIT EXCEP_AML (0x000B) |
#define AE_AML_DIVIDE_BY_ZERO EXCEP_AML (0x000C) |
#define AE_AML_BAD_NAME EXCEP_AML (0x000D) |
#define AE_AML_NAME_NOT_FOUND EXCEP_AML (0x000E) |
#define AE_AML_INTERNAL EXCEP_AML (0x000F) |
#define AE_AML_INVALID_SPACE_ID EXCEP_AML (0x0010) |
#define AE_AML_STRING_LIMIT EXCEP_AML (0x0011) |
#define AE_AML_NO_RETURN_VALUE EXCEP_AML (0x0012) |
#define AE_AML_METHOD_LIMIT EXCEP_AML (0x0013) |
#define AE_AML_NOT_OWNER EXCEP_AML (0x0014) |
#define AE_AML_MUTEX_ORDER EXCEP_AML (0x0015) |
#define AE_AML_MUTEX_NOT_ACQUIRED EXCEP_AML (0x0016) |
#define AE_AML_INVALID_RESOURCE_TYPE EXCEP_AML (0x0017) |
#define AE_AML_INVALID_INDEX EXCEP_AML (0x0018) |
#define AE_AML_REGISTER_LIMIT EXCEP_AML (0x0019) |
#define AE_AML_NO_WHILE EXCEP_AML (0x001A) |
#define AE_AML_ALIGNMENT EXCEP_AML (0x001B) |
#define AE_AML_NO_RESOURCE_END_TAG EXCEP_AML (0x001C) |
#define AE_AML_BAD_RESOURCE_VALUE EXCEP_AML (0x001D) |
#define AE_AML_CIRCULAR_REFERENCE EXCEP_AML (0x001E) |
#define AE_AML_BAD_RESOURCE_LENGTH EXCEP_AML (0x001F) |
#define AE_AML_ILLEGAL_ADDRESS EXCEP_AML (0x0020) |
#define AE_AML_INFINITE_LOOP EXCEP_AML (0x0021) |
#define AE_AML_UNINITIALIZED_NODE EXCEP_AML (0x0022) |
#define AE_AML_TARGET_TYPE EXCEP_AML (0x0023) |
#define AE_CODE_AML_MAX 0x0023 |
/* |
* Internal exceptions used for control |
*/ |
#define AE_CTRL_RETURN_VALUE EXCEP_CTL (0x0001) |
#define AE_CTRL_PENDING EXCEP_CTL (0x0002) |
#define AE_CTRL_TERMINATE EXCEP_CTL (0x0003) |
#define AE_CTRL_TRUE EXCEP_CTL (0x0004) |
#define AE_CTRL_FALSE EXCEP_CTL (0x0005) |
#define AE_CTRL_DEPTH EXCEP_CTL (0x0006) |
#define AE_CTRL_END EXCEP_CTL (0x0007) |
#define AE_CTRL_TRANSFER EXCEP_CTL (0x0008) |
#define AE_CTRL_BREAK EXCEP_CTL (0x0009) |
#define AE_CTRL_CONTINUE EXCEP_CTL (0x000A) |
#define AE_CTRL_SKIP EXCEP_CTL (0x000B) |
#define AE_CTRL_PARSE_CONTINUE EXCEP_CTL (0x000C) |
#define AE_CTRL_PARSE_PENDING EXCEP_CTL (0x000D) |
#define AE_CODE_CTRL_MAX 0x000D |
/* Exception strings for acpi_format_exception */ |
#ifdef ACPI_DEFINE_EXCEPTION_TABLE |
/* |
* String versions of the exception codes above |
* These strings must match the corresponding defines exactly |
*/ |
static const struct acpi_exception_info acpi_gbl_exception_names_env[] = { |
EXCEP_TXT("AE_OK", "No error"), |
EXCEP_TXT("AE_ERROR", "Unspecified error"), |
EXCEP_TXT("AE_NO_ACPI_TABLES", "ACPI tables could not be found"), |
EXCEP_TXT("AE_NO_NAMESPACE", "A namespace has not been loaded"), |
EXCEP_TXT("AE_NO_MEMORY", "Insufficient dynamic memory"), |
EXCEP_TXT("AE_NOT_FOUND", "A requested entity is not found"), |
EXCEP_TXT("AE_NOT_EXIST", "A required entity does not exist"), |
EXCEP_TXT("AE_ALREADY_EXISTS", "An entity already exists"), |
EXCEP_TXT("AE_TYPE", "The object type is incorrect"), |
EXCEP_TXT("AE_NULL_OBJECT", "A required object was missing"), |
EXCEP_TXT("AE_NULL_ENTRY", "The requested object does not exist"), |
EXCEP_TXT("AE_BUFFER_OVERFLOW", "The buffer provided is too small"), |
EXCEP_TXT("AE_STACK_OVERFLOW", "An internal stack overflowed"), |
EXCEP_TXT("AE_STACK_UNDERFLOW", "An internal stack underflowed"), |
EXCEP_TXT("AE_NOT_IMPLEMENTED", "The feature is not implemented"), |
EXCEP_TXT("AE_SUPPORT", "The feature is not supported"), |
EXCEP_TXT("AE_LIMIT", "A predefined limit was exceeded"), |
EXCEP_TXT("AE_TIME", "A time limit or timeout expired"), |
EXCEP_TXT("AE_ACQUIRE_DEADLOCK", |
"Internal error, attempt was made to acquire a mutex in improper order"), |
EXCEP_TXT("AE_RELEASE_DEADLOCK", |
"Internal error, attempt was made to release a mutex in improper order"), |
EXCEP_TXT("AE_NOT_ACQUIRED", |
"An attempt to release a mutex or Global Lock without a previous acquire"), |
EXCEP_TXT("AE_ALREADY_ACQUIRED", |
"Internal error, attempt was made to acquire a mutex twice"), |
EXCEP_TXT("AE_NO_HARDWARE_RESPONSE", |
"Hardware did not respond after an I/O operation"), |
EXCEP_TXT("AE_NO_GLOBAL_LOCK", "There is no FACS Global Lock"), |
EXCEP_TXT("AE_ABORT_METHOD", "A control method was aborted"), |
EXCEP_TXT("AE_SAME_HANDLER", |
"Attempt was made to install the same handler that is already installed"), |
EXCEP_TXT("AE_NO_HANDLER", |
"A handler for the operation is not installed"), |
EXCEP_TXT("AE_OWNER_ID_LIMIT", |
"There are no more Owner IDs available for ACPI tables or control methods"), |
EXCEP_TXT("AE_NOT_CONFIGURED", |
"The interface is not part of the current subsystem configuration"), |
EXCEP_TXT("AE_ACCESS", "Permission denied for the requested operation") |
}; |
static const struct acpi_exception_info acpi_gbl_exception_names_pgm[] = { |
EXCEP_TXT(NULL, NULL), |
EXCEP_TXT("AE_BAD_PARAMETER", "A parameter is out of range or invalid"), |
EXCEP_TXT("AE_BAD_CHARACTER", |
"An invalid character was found in a name"), |
EXCEP_TXT("AE_BAD_PATHNAME", |
"An invalid character was found in a pathname"), |
EXCEP_TXT("AE_BAD_DATA", |
"A package or buffer contained incorrect data"), |
EXCEP_TXT("AE_BAD_HEX_CONSTANT", "Invalid character in a Hex constant"), |
EXCEP_TXT("AE_BAD_OCTAL_CONSTANT", |
"Invalid character in an Octal constant"), |
EXCEP_TXT("AE_BAD_DECIMAL_CONSTANT", |
"Invalid character in a Decimal constant"), |
EXCEP_TXT("AE_MISSING_ARGUMENTS", |
"Too few arguments were passed to a control method"), |
EXCEP_TXT("AE_BAD_ADDRESS", "An illegal null I/O address") |
}; |
static const struct acpi_exception_info acpi_gbl_exception_names_tbl[] = { |
EXCEP_TXT(NULL, NULL), |
EXCEP_TXT("AE_BAD_SIGNATURE", "An ACPI table has an invalid signature"), |
EXCEP_TXT("AE_BAD_HEADER", "Invalid field in an ACPI table header"), |
EXCEP_TXT("AE_BAD_CHECKSUM", "An ACPI table checksum is not correct"), |
EXCEP_TXT("AE_BAD_VALUE", "An invalid value was found in a table"), |
EXCEP_TXT("AE_INVALID_TABLE_LENGTH", |
"The FADT or FACS has improper length") |
}; |
static const struct acpi_exception_info acpi_gbl_exception_names_aml[] = { |
EXCEP_TXT(NULL, NULL), |
EXCEP_TXT("AE_AML_BAD_OPCODE", "Invalid AML opcode encountered"), |
EXCEP_TXT("AE_AML_NO_OPERAND", "A required operand is missing"), |
EXCEP_TXT("AE_AML_OPERAND_TYPE", |
"An operand of an incorrect type was encountered"), |
EXCEP_TXT("AE_AML_OPERAND_VALUE", |
"The operand had an inappropriate or invalid value"), |
EXCEP_TXT("AE_AML_UNINITIALIZED_LOCAL", |
"Method tried to use an uninitialized local variable"), |
EXCEP_TXT("AE_AML_UNINITIALIZED_ARG", |
"Method tried to use an uninitialized argument"), |
EXCEP_TXT("AE_AML_UNINITIALIZED_ELEMENT", |
"Method tried to use an empty package element"), |
EXCEP_TXT("AE_AML_NUMERIC_OVERFLOW", |
"Overflow during BCD conversion or other"), |
EXCEP_TXT("AE_AML_REGION_LIMIT", |
"Tried to access beyond the end of an Operation Region"), |
EXCEP_TXT("AE_AML_BUFFER_LIMIT", |
"Tried to access beyond the end of a buffer"), |
EXCEP_TXT("AE_AML_PACKAGE_LIMIT", |
"Tried to access beyond the end of a package"), |
EXCEP_TXT("AE_AML_DIVIDE_BY_ZERO", |
"During execution of AML Divide operator"), |
EXCEP_TXT("AE_AML_BAD_NAME", |
"An ACPI name contains invalid character(s)"), |
EXCEP_TXT("AE_AML_NAME_NOT_FOUND", |
"Could not resolve a named reference"), |
EXCEP_TXT("AE_AML_INTERNAL", "An internal error within the interprete"), |
EXCEP_TXT("AE_AML_INVALID_SPACE_ID", |
"An Operation Region SpaceID is invalid"), |
EXCEP_TXT("AE_AML_STRING_LIMIT", |
"String is longer than 200 characters"), |
EXCEP_TXT("AE_AML_NO_RETURN_VALUE", |
"A method did not return a required value"), |
EXCEP_TXT("AE_AML_METHOD_LIMIT", |
"A control method reached the maximum reentrancy limit of 255"), |
EXCEP_TXT("AE_AML_NOT_OWNER", |
"A thread tried to release a mutex that it does not own"), |
EXCEP_TXT("AE_AML_MUTEX_ORDER", "Mutex SyncLevel release mismatch"), |
EXCEP_TXT("AE_AML_MUTEX_NOT_ACQUIRED", |
"Attempt to release a mutex that was not previously acquired"), |
EXCEP_TXT("AE_AML_INVALID_RESOURCE_TYPE", |
"Invalid resource type in resource list"), |
EXCEP_TXT("AE_AML_INVALID_INDEX", |
"Invalid Argx or Localx (x too large)"), |
EXCEP_TXT("AE_AML_REGISTER_LIMIT", |
"Bank value or Index value beyond range of register"), |
EXCEP_TXT("AE_AML_NO_WHILE", "Break or Continue without a While"), |
EXCEP_TXT("AE_AML_ALIGNMENT", |
"Non-aligned memory transfer on platform that does not support this"), |
EXCEP_TXT("AE_AML_NO_RESOURCE_END_TAG", |
"No End Tag in a resource list"), |
EXCEP_TXT("AE_AML_BAD_RESOURCE_VALUE", |
"Invalid value of a resource element"), |
EXCEP_TXT("AE_AML_CIRCULAR_REFERENCE", |
"Two references refer to each other"), |
EXCEP_TXT("AE_AML_BAD_RESOURCE_LENGTH", |
"The length of a Resource Descriptor in the AML is incorrect"), |
EXCEP_TXT("AE_AML_ILLEGAL_ADDRESS", |
"A memory, I/O, or PCI configuration address is invalid"), |
EXCEP_TXT("AE_AML_INFINITE_LOOP", |
"An apparent infinite AML While loop, method was aborted"), |
EXCEP_TXT("AE_AML_UNINITIALIZED_NODE", |
"A namespace node is uninitialized or unresolved"), |
EXCEP_TXT("AE_AML_TARGET_TYPE", |
"A target operand of an incorrect type was encountered") |
}; |
static const struct acpi_exception_info acpi_gbl_exception_names_ctrl[] = { |
EXCEP_TXT(NULL, NULL), |
EXCEP_TXT("AE_CTRL_RETURN_VALUE", "A Method returned a value"), |
EXCEP_TXT("AE_CTRL_PENDING", "Method is calling another method"), |
EXCEP_TXT("AE_CTRL_TERMINATE", "Terminate the executing method"), |
EXCEP_TXT("AE_CTRL_TRUE", "An If or While predicate result"), |
EXCEP_TXT("AE_CTRL_FALSE", "An If or While predicate result"), |
EXCEP_TXT("AE_CTRL_DEPTH", "Maximum search depth has been reached"), |
EXCEP_TXT("AE_CTRL_END", "An If or While predicate is false"), |
EXCEP_TXT("AE_CTRL_TRANSFER", "Transfer control to called method"), |
EXCEP_TXT("AE_CTRL_BREAK", "A Break has been executed"), |
EXCEP_TXT("AE_CTRL_CONTINUE", "A Continue has been executed"), |
EXCEP_TXT("AE_CTRL_SKIP", "Not currently used"), |
EXCEP_TXT("AE_CTRL_PARSE_CONTINUE", "Used to skip over bad opcodes"), |
EXCEP_TXT("AE_CTRL_PARSE_PENDING", "Used to implement AML While loops") |
}; |
#endif /* EXCEPTION_TABLE */ |
#endif /* __ACEXCEP_H__ */ |
/drivers/include/acpi/acnames.h |
---|
0,0 → 1,92 |
/****************************************************************************** |
* |
* Name: acnames.h - Global names and strings |
* |
*****************************************************************************/ |
/* |
* Copyright (C) 2000 - 2015, 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 __ACNAMES_H__ |
#define __ACNAMES_H__ |
/* Method names - these methods can appear anywhere in the namespace */ |
#define METHOD_NAME__ADR "_ADR" |
#define METHOD_NAME__AEI "_AEI" |
#define METHOD_NAME__BBN "_BBN" |
#define METHOD_NAME__CBA "_CBA" |
#define METHOD_NAME__CID "_CID" |
#define METHOD_NAME__CLS "_CLS" |
#define METHOD_NAME__CRS "_CRS" |
#define METHOD_NAME__DDN "_DDN" |
#define METHOD_NAME__HID "_HID" |
#define METHOD_NAME__INI "_INI" |
#define METHOD_NAME__PLD "_PLD" |
#define METHOD_NAME__DSD "_DSD" |
#define METHOD_NAME__PRS "_PRS" |
#define METHOD_NAME__PRT "_PRT" |
#define METHOD_NAME__PRW "_PRW" |
#define METHOD_NAME__PS0 "_PS0" |
#define METHOD_NAME__PS1 "_PS1" |
#define METHOD_NAME__PS2 "_PS2" |
#define METHOD_NAME__PS3 "_PS3" |
#define METHOD_NAME__REG "_REG" |
#define METHOD_NAME__SB_ "_SB_" |
#define METHOD_NAME__SEG "_SEG" |
#define METHOD_NAME__SRS "_SRS" |
#define METHOD_NAME__STA "_STA" |
#define METHOD_NAME__SUB "_SUB" |
#define METHOD_NAME__UID "_UID" |
/* Method names - these methods must appear at the namespace root */ |
#define METHOD_PATHNAME__PTS "\\_PTS" |
#define METHOD_PATHNAME__SST "\\_SI._SST" |
#define METHOD_PATHNAME__WAK "\\_WAK" |
/* Definitions of the predefined namespace names */ |
#define ACPI_UNKNOWN_NAME (u32) 0x3F3F3F3F /* Unknown name is "????" */ |
#define ACPI_ROOT_NAME (u32) 0x5F5F5F5C /* Root name is "\___" */ |
#define ACPI_PREFIX_MIXED (u32) 0x69706341 /* "Acpi" */ |
#define ACPI_PREFIX_LOWER (u32) 0x69706361 /* "acpi" */ |
#define ACPI_NS_ROOT_PATH "\\" |
#endif /* __ACNAMES_H__ */ |
/drivers/include/acpi/acoutput.h |
---|
0,0 → 1,487 |
/****************************************************************************** |
* |
* Name: acoutput.h -- debug output |
* |
*****************************************************************************/ |
/* |
* Copyright (C) 2000 - 2015, 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 __ACOUTPUT_H__ |
#define __ACOUTPUT_H__ |
/* |
* Debug levels and component IDs. These are used to control the |
* granularity of the output of the ACPI_DEBUG_PRINT macro -- on a |
* per-component basis and a per-exception-type basis. |
*/ |
/* Component IDs are used in the global "DebugLayer" */ |
#define ACPI_UTILITIES 0x00000001 |
#define ACPI_HARDWARE 0x00000002 |
#define ACPI_EVENTS 0x00000004 |
#define ACPI_TABLES 0x00000008 |
#define ACPI_NAMESPACE 0x00000010 |
#define ACPI_PARSER 0x00000020 |
#define ACPI_DISPATCHER 0x00000040 |
#define ACPI_EXECUTER 0x00000080 |
#define ACPI_RESOURCES 0x00000100 |
#define ACPI_CA_DEBUGGER 0x00000200 |
#define ACPI_OS_SERVICES 0x00000400 |
#define ACPI_CA_DISASSEMBLER 0x00000800 |
/* Component IDs for ACPI tools and utilities */ |
#define ACPI_COMPILER 0x00001000 |
#define ACPI_TOOLS 0x00002000 |
#define ACPI_EXAMPLE 0x00004000 |
#define ACPI_DRIVER 0x00008000 |
#define DT_COMPILER 0x00010000 |
#define ASL_PREPROCESSOR 0x00020000 |
#define ACPI_ALL_COMPONENTS 0x0001FFFF |
#define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS) |
/* Component IDs reserved for ACPI drivers */ |
#define ACPI_ALL_DRIVERS 0xFFFF0000 |
/* |
* Raw debug output levels, do not use these in the ACPI_DEBUG_PRINT macros |
*/ |
#define ACPI_LV_INIT 0x00000001 |
#define ACPI_LV_DEBUG_OBJECT 0x00000002 |
#define ACPI_LV_INFO 0x00000004 |
#define ACPI_LV_REPAIR 0x00000008 |
#define ACPI_LV_TRACE_POINT 0x00000010 |
#define ACPI_LV_ALL_EXCEPTIONS 0x0000001F |
/* Trace verbosity level 1 [Standard Trace Level] */ |
#define ACPI_LV_INIT_NAMES 0x00000020 |
#define ACPI_LV_PARSE 0x00000040 |
#define ACPI_LV_LOAD 0x00000080 |
#define ACPI_LV_DISPATCH 0x00000100 |
#define ACPI_LV_EXEC 0x00000200 |
#define ACPI_LV_NAMES 0x00000400 |
#define ACPI_LV_OPREGION 0x00000800 |
#define ACPI_LV_BFIELD 0x00001000 |
#define ACPI_LV_TABLES 0x00002000 |
#define ACPI_LV_VALUES 0x00004000 |
#define ACPI_LV_OBJECTS 0x00008000 |
#define ACPI_LV_RESOURCES 0x00010000 |
#define ACPI_LV_USER_REQUESTS 0x00020000 |
#define ACPI_LV_PACKAGE 0x00040000 |
#define ACPI_LV_VERBOSITY1 0x0007FF40 | ACPI_LV_ALL_EXCEPTIONS |
/* Trace verbosity level 2 [Function tracing and memory allocation] */ |
#define ACPI_LV_ALLOCATIONS 0x00100000 |
#define ACPI_LV_FUNCTIONS 0x00200000 |
#define ACPI_LV_OPTIMIZATIONS 0x00400000 |
#define ACPI_LV_VERBOSITY2 0x00700000 | ACPI_LV_VERBOSITY1 |
#define ACPI_LV_ALL ACPI_LV_VERBOSITY2 |
/* Trace verbosity level 3 [Threading, I/O, and Interrupts] */ |
#define ACPI_LV_MUTEX 0x01000000 |
#define ACPI_LV_THREADS 0x02000000 |
#define ACPI_LV_IO 0x04000000 |
#define ACPI_LV_INTERRUPTS 0x08000000 |
#define ACPI_LV_VERBOSITY3 0x0F000000 | ACPI_LV_VERBOSITY2 |
/* Exceptionally verbose output -- also used in the global "DebugLevel" */ |
#define ACPI_LV_AML_DISASSEMBLE 0x10000000 |
#define ACPI_LV_VERBOSE_INFO 0x20000000 |
#define ACPI_LV_FULL_TABLES 0x40000000 |
#define ACPI_LV_EVENTS 0x80000000 |
#define ACPI_LV_VERBOSE 0xF0000000 |
/* |
* Debug level macros that are used in the DEBUG_PRINT macros |
*/ |
#define ACPI_DEBUG_LEVEL(dl) (u32) dl,ACPI_DEBUG_PARAMETERS |
/* |
* Exception level -- used in the global "DebugLevel" |
* |
* Note: For errors, use the ACPI_ERROR or ACPI_EXCEPTION interfaces. |
* For warnings, use ACPI_WARNING. |
*/ |
#define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT) |
#define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT) |
#define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO) |
#define ACPI_DB_REPAIR ACPI_DEBUG_LEVEL (ACPI_LV_REPAIR) |
#define ACPI_DB_TRACE_POINT ACPI_DEBUG_LEVEL (ACPI_LV_TRACE_POINT) |
#define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS) |
/* Trace level -- also used in the global "DebugLevel" */ |
#define ACPI_DB_INIT_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES) |
#define ACPI_DB_THREADS ACPI_DEBUG_LEVEL (ACPI_LV_THREADS) |
#define ACPI_DB_PARSE ACPI_DEBUG_LEVEL (ACPI_LV_PARSE) |
#define ACPI_DB_DISPATCH ACPI_DEBUG_LEVEL (ACPI_LV_DISPATCH) |
#define ACPI_DB_LOAD ACPI_DEBUG_LEVEL (ACPI_LV_LOAD) |
#define ACPI_DB_EXEC ACPI_DEBUG_LEVEL (ACPI_LV_EXEC) |
#define ACPI_DB_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_NAMES) |
#define ACPI_DB_OPREGION ACPI_DEBUG_LEVEL (ACPI_LV_OPREGION) |
#define ACPI_DB_BFIELD ACPI_DEBUG_LEVEL (ACPI_LV_BFIELD) |
#define ACPI_DB_TABLES ACPI_DEBUG_LEVEL (ACPI_LV_TABLES) |
#define ACPI_DB_FUNCTIONS ACPI_DEBUG_LEVEL (ACPI_LV_FUNCTIONS) |
#define ACPI_DB_OPTIMIZATIONS ACPI_DEBUG_LEVEL (ACPI_LV_OPTIMIZATIONS) |
#define ACPI_DB_VALUES ACPI_DEBUG_LEVEL (ACPI_LV_VALUES) |
#define ACPI_DB_OBJECTS ACPI_DEBUG_LEVEL (ACPI_LV_OBJECTS) |
#define ACPI_DB_ALLOCATIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALLOCATIONS) |
#define ACPI_DB_RESOURCES ACPI_DEBUG_LEVEL (ACPI_LV_RESOURCES) |
#define ACPI_DB_IO ACPI_DEBUG_LEVEL (ACPI_LV_IO) |
#define ACPI_DB_INTERRUPTS ACPI_DEBUG_LEVEL (ACPI_LV_INTERRUPTS) |
#define ACPI_DB_USER_REQUESTS ACPI_DEBUG_LEVEL (ACPI_LV_USER_REQUESTS) |
#define ACPI_DB_PACKAGE ACPI_DEBUG_LEVEL (ACPI_LV_PACKAGE) |
#define ACPI_DB_MUTEX ACPI_DEBUG_LEVEL (ACPI_LV_MUTEX) |
#define ACPI_DB_EVENTS ACPI_DEBUG_LEVEL (ACPI_LV_EVENTS) |
#define ACPI_DB_ALL ACPI_DEBUG_LEVEL (ACPI_LV_ALL) |
/* Defaults for debug_level, debug and normal */ |
#define ACPI_DEBUG_DEFAULT (ACPI_LV_INFO | ACPI_LV_REPAIR) |
#define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT | ACPI_LV_REPAIR) |
#define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL) |
/* |
* Global trace flags |
*/ |
#define ACPI_TRACE_ENABLED ((u32) 4) |
#define ACPI_TRACE_ONESHOT ((u32) 2) |
#define ACPI_TRACE_OPCODE ((u32) 1) |
/* Defaults for trace debugging level/layer */ |
#define ACPI_TRACE_LEVEL_ALL ACPI_LV_ALL |
#define ACPI_TRACE_LAYER_ALL 0x000001FF |
#define ACPI_TRACE_LEVEL_DEFAULT ACPI_LV_TRACE_POINT |
#define ACPI_TRACE_LAYER_DEFAULT ACPI_EXECUTER |
#if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES) |
/* |
* The module name is used primarily for error and debug messages. |
* The __FILE__ macro is not very useful for this, because it |
* usually includes the entire pathname to the module making the |
* debug output difficult to read. |
*/ |
#define ACPI_MODULE_NAME(name) static const char ACPI_UNUSED_VAR _acpi_module_name[] = name; |
#else |
/* |
* For the no-debug and no-error-msg cases, we must at least define |
* a null module name. |
*/ |
#define ACPI_MODULE_NAME(name) |
#define _acpi_module_name "" |
#endif |
/* |
* Ascii error messages can be configured out |
*/ |
#ifndef ACPI_NO_ERROR_MESSAGES |
#define AE_INFO _acpi_module_name, __LINE__ |
/* |
* Error reporting. Callers module and line number are inserted by AE_INFO, |
* the plist contains a set of parens to allow variable-length lists. |
* These macros are used for both the debug and non-debug versions of the code. |
*/ |
#define ACPI_INFO(plist) acpi_info plist |
#define ACPI_WARNING(plist) acpi_warning plist |
#define ACPI_EXCEPTION(plist) acpi_exception plist |
#define ACPI_ERROR(plist) acpi_error plist |
#define ACPI_BIOS_WARNING(plist) acpi_bios_warning plist |
#define ACPI_BIOS_ERROR(plist) acpi_bios_error plist |
#define ACPI_DEBUG_OBJECT(obj,l,i) acpi_ex_do_debug_object(obj,l,i) |
#else |
/* No error messages */ |
#define ACPI_INFO(plist) |
#define ACPI_WARNING(plist) |
#define ACPI_EXCEPTION(plist) |
#define ACPI_ERROR(plist) |
#define ACPI_BIOS_WARNING(plist) |
#define ACPI_BIOS_ERROR(plist) |
#define ACPI_DEBUG_OBJECT(obj,l,i) |
#endif /* ACPI_NO_ERROR_MESSAGES */ |
/* |
* Debug macros that are conditionally compiled |
*/ |
#ifdef ACPI_DEBUG_OUTPUT |
/* |
* If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header, |
* define it now. This is the case where there the compiler does not support |
* a __func__ macro or equivalent. |
*/ |
#ifndef ACPI_GET_FUNCTION_NAME |
#define ACPI_GET_FUNCTION_NAME _acpi_function_name |
/* |
* The Name parameter should be the procedure name as a quoted string. |
* The function name is also used by the function exit macros below. |
* Note: (const char) is used to be compatible with the debug interfaces |
* and macros such as __func__. |
*/ |
#define ACPI_FUNCTION_NAME(name) static const char _acpi_function_name[] = #name; |
#else |
/* Compiler supports __func__ (or equivalent) -- Ignore this macro */ |
#define ACPI_FUNCTION_NAME(name) |
#endif /* ACPI_GET_FUNCTION_NAME */ |
/* |
* Common parameters used for debug output functions: |
* line number, function name, module(file) name, component ID |
*/ |
#define ACPI_DEBUG_PARAMETERS \ |
__LINE__, ACPI_GET_FUNCTION_NAME, _acpi_module_name, _COMPONENT |
/* Check if debug output is currently dynamically enabled */ |
#define ACPI_IS_DEBUG_ENABLED(level, component) \ |
((level & acpi_dbg_level) && (component & acpi_dbg_layer)) |
/* |
* Master debug print macros |
* Print message if and only if: |
* 1) Debug print for the current component is enabled |
* 2) Debug error level or trace level for the print statement is enabled |
* |
* November 2012: Moved the runtime check for whether to actually emit the |
* debug message outside of the print function itself. This improves overall |
* performance at a relatively small code cost. Implementation involves the |
* use of variadic macros supported by C99. |
* |
* Note: the ACPI_DO_WHILE0 macro is used to prevent some compilers from |
* complaining about these constructs. On other compilers the do...while |
* adds some extra code, so this feature is optional. |
*/ |
#ifdef ACPI_USE_DO_WHILE_0 |
#define ACPI_DO_WHILE0(a) do a while(0) |
#else |
#define ACPI_DO_WHILE0(a) a |
#endif |
/* DEBUG_PRINT functions */ |
#ifndef COMPILER_VA_MACRO |
#define ACPI_DEBUG_PRINT(plist) acpi_debug_print plist |
#define ACPI_DEBUG_PRINT_RAW(plist) acpi_debug_print_raw plist |
#else |
/* Helper macros for DEBUG_PRINT */ |
#define ACPI_DO_DEBUG_PRINT(function, level, line, filename, modulename, component, ...) \ |
ACPI_DO_WHILE0 ({ \ |
if (ACPI_IS_DEBUG_ENABLED (level, component)) \ |
{ \ |
function (level, line, filename, modulename, component, __VA_ARGS__); \ |
} \ |
}) |
#define ACPI_ACTUAL_DEBUG(level, line, filename, modulename, component, ...) \ |
ACPI_DO_DEBUG_PRINT (acpi_debug_print, level, line, \ |
filename, modulename, component, __VA_ARGS__) |
#define ACPI_ACTUAL_DEBUG_RAW(level, line, filename, modulename, component, ...) \ |
ACPI_DO_DEBUG_PRINT (acpi_debug_print_raw, level, line, \ |
filename, modulename, component, __VA_ARGS__) |
#define ACPI_DEBUG_PRINT(plist) ACPI_ACTUAL_DEBUG plist |
#define ACPI_DEBUG_PRINT_RAW(plist) ACPI_ACTUAL_DEBUG_RAW plist |
#endif |
/* |
* Function entry tracing |
* |
* The name of the function is emitted as a local variable that is |
* intended to be used by both the entry trace and the exit trace. |
*/ |
/* Helper macro */ |
#define ACPI_TRACE_ENTRY(name, function, type, param) \ |
ACPI_FUNCTION_NAME (name) \ |
function (ACPI_DEBUG_PARAMETERS, (type) (param)) |
/* The actual entry trace macros */ |
#define ACPI_FUNCTION_TRACE(name) \ |
ACPI_FUNCTION_NAME(name) \ |
acpi_ut_trace (ACPI_DEBUG_PARAMETERS) |
#define ACPI_FUNCTION_TRACE_PTR(name, pointer) \ |
ACPI_TRACE_ENTRY (name, acpi_ut_trace_ptr, void *, pointer) |
#define ACPI_FUNCTION_TRACE_U32(name, value) \ |
ACPI_TRACE_ENTRY (name, acpi_ut_trace_u32, u32, value) |
#define ACPI_FUNCTION_TRACE_STR(name, string) \ |
ACPI_TRACE_ENTRY (name, acpi_ut_trace_str, char *, string) |
#define ACPI_FUNCTION_ENTRY() \ |
acpi_ut_track_stack_ptr() |
/* |
* Function exit tracing |
* |
* These macros include a return statement. This is usually considered |
* bad form, but having a separate exit macro before the actual return |
* is very ugly and difficult to maintain. |
* |
* One of the FUNCTION_TRACE macros above must be used in conjunction |
* with these macros so that "_AcpiFunctionName" is defined. |
* |
* There are two versions of most of the return macros. The default version is |
* safer, since it avoids side-effects by guaranteeing that the argument will |
* not be evaluated twice. |
* |
* A less-safe version of the macros is provided for optional use if the |
* compiler uses excessive CPU stack (for example, this may happen in the |
* debug case if code optimzation is disabled.) |
*/ |
/* Exit trace helper macro */ |
#ifndef ACPI_SIMPLE_RETURN_MACROS |
#define ACPI_TRACE_EXIT(function, type, param) \ |
ACPI_DO_WHILE0 ({ \ |
register type _param = (type) (param); \ |
function (ACPI_DEBUG_PARAMETERS, _param); \ |
return (_param); \ |
}) |
#else /* Use original less-safe macros */ |
#define ACPI_TRACE_EXIT(function, type, param) \ |
ACPI_DO_WHILE0 ({ \ |
function (ACPI_DEBUG_PARAMETERS, (type) (param)); \ |
return (param); \ |
}) |
#endif /* ACPI_SIMPLE_RETURN_MACROS */ |
/* The actual exit macros */ |
#define return_VOID \ |
ACPI_DO_WHILE0 ({ \ |
acpi_ut_exit (ACPI_DEBUG_PARAMETERS); \ |
return; \ |
}) |
#define return_ACPI_STATUS(status) \ |
ACPI_TRACE_EXIT (acpi_ut_status_exit, acpi_status, status) |
#define return_PTR(pointer) \ |
ACPI_TRACE_EXIT (acpi_ut_ptr_exit, void *, pointer) |
#define return_VALUE(value) \ |
ACPI_TRACE_EXIT (acpi_ut_value_exit, u64, value) |
#define return_UINT32(value) \ |
ACPI_TRACE_EXIT (acpi_ut_value_exit, u32, value) |
#define return_UINT8(value) \ |
ACPI_TRACE_EXIT (acpi_ut_value_exit, u8, value) |
/* Conditional execution */ |
#define ACPI_DEBUG_EXEC(a) a |
#define ACPI_DEBUG_ONLY_MEMBERS(a) a; |
#define _VERBOSE_STRUCTURES |
/* Various object display routines for debug */ |
#define ACPI_DUMP_STACK_ENTRY(a) acpi_ex_dump_operand((a), 0) |
#define ACPI_DUMP_OPERANDS(a, b ,c) acpi_ex_dump_operands(a, b, c) |
#define ACPI_DUMP_ENTRY(a, b) acpi_ns_dump_entry (a, b) |
#define ACPI_DUMP_PATHNAME(a, b, c, d) acpi_ns_dump_pathname(a, b, c, d) |
#define ACPI_DUMP_BUFFER(a, b) acpi_ut_debug_dump_buffer((u8 *) a, b, DB_BYTE_DISPLAY, _COMPONENT) |
#define ACPI_TRACE_POINT(a, b, c, d) acpi_trace_point (a, b, c, d) |
#else /* ACPI_DEBUG_OUTPUT */ |
/* |
* This is the non-debug case -- make everything go away, |
* leaving no executable debug code! |
*/ |
#define ACPI_DEBUG_PRINT(pl) |
#define ACPI_DEBUG_PRINT_RAW(pl) |
#define ACPI_DEBUG_EXEC(a) |
#define ACPI_DEBUG_ONLY_MEMBERS(a) |
#define ACPI_FUNCTION_NAME(a) |
#define ACPI_FUNCTION_TRACE(a) |
#define ACPI_FUNCTION_TRACE_PTR(a, b) |
#define ACPI_FUNCTION_TRACE_U32(a, b) |
#define ACPI_FUNCTION_TRACE_STR(a, b) |
#define ACPI_FUNCTION_ENTRY() |
#define ACPI_DUMP_STACK_ENTRY(a) |
#define ACPI_DUMP_OPERANDS(a, b, c) |
#define ACPI_DUMP_ENTRY(a, b) |
#define ACPI_DUMP_PATHNAME(a, b, c, d) |
#define ACPI_DUMP_BUFFER(a, b) |
#define ACPI_IS_DEBUG_ENABLED(level, component) 0 |
#define ACPI_TRACE_POINT(a, b, c, d) |
/* Return macros must have a return statement at the minimum */ |
#define return_VOID return |
#define return_ACPI_STATUS(s) return(s) |
#define return_PTR(s) return(s) |
#define return_VALUE(s) return(s) |
#define return_UINT8(s) return(s) |
#define return_UINT32(s) return(s) |
#endif /* ACPI_DEBUG_OUTPUT */ |
#endif /* __ACOUTPUT_H__ */ |
/drivers/include/acpi/acpi.h |
---|
0,0 → 1,67 |
/****************************************************************************** |
* |
* Name: acpi.h - Master public include file used to interface to ACPICA |
* |
*****************************************************************************/ |
/* |
* Copyright (C) 2000 - 2015, 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 __ACPI_H__ |
#define __ACPI_H__ |
/* |
* Public include files for use by code that will interface to ACPICA. |
* |
* Information includes the ACPICA data types, names, exceptions, and |
* external interface prototypes. Also included are the definitions for |
* all ACPI tables (FADT, MADT, etc.) |
* |
* Note: The order of these include files is important. |
*/ |
#include <acpi/platform/acenv.h> /* Environment-specific items */ |
#include <acpi/acnames.h> /* Common ACPI names and strings */ |
#include <acpi/actypes.h> /* ACPICA data types and structures */ |
#include <acpi/acexcep.h> /* ACPICA exceptions */ |
#include <acpi/actbl.h> /* ACPI table definitions */ |
#include <acpi/acoutput.h> /* Error output and Debug macros */ |
#include <acpi/acrestyp.h> /* Resource Descriptor structs */ |
#include <acpi/acpiosxf.h> /* OSL interfaces (ACPICA-to-OS) */ |
#include <acpi/acpixf.h> /* ACPI core subsystem external interfaces */ |
#include <acpi/platform/acenvex.h> /* Extra environment-specific items */ |
#endif /* __ACPI_H__ */ |
/drivers/include/acpi/acpi_bus.h |
---|
0,0 → 1,639 |
/* |
* acpi_bus.h - ACPI Bus Driver ($Revision: 22 $) |
* |
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> |
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> |
* |
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
* |
* This program is free software; you can redistribute it and/or modify |
* it under the terms of the GNU General Public License as published by |
* the Free Software Foundation; either version 2 of the License, or (at |
* your option) any later version. |
* |
* This program is distributed in the hope that it will be useful, but |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* General Public License for more details. |
* |
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
*/ |
#ifndef __ACPI_BUS_H__ |
#define __ACPI_BUS_H__ |
#include <linux/device.h> |
#include <linux/property.h> |
/* TBD: Make dynamic */ |
#define ACPI_MAX_HANDLES 10 |
struct acpi_handle_list { |
u32 count; |
acpi_handle handles[ACPI_MAX_HANDLES]; |
}; |
/* acpi_utils.h */ |
acpi_status |
acpi_extract_package(union acpi_object *package, |
struct acpi_buffer *format, struct acpi_buffer *buffer); |
acpi_status |
acpi_evaluate_integer(acpi_handle handle, |
acpi_string pathname, |
struct acpi_object_list *arguments, unsigned long long *data); |
acpi_status |
acpi_evaluate_reference(acpi_handle handle, |
acpi_string pathname, |
struct acpi_object_list *arguments, |
struct acpi_handle_list *list); |
acpi_status |
acpi_evaluate_ost(acpi_handle handle, u32 source_event, u32 status_code, |
struct acpi_buffer *status_buf); |
acpi_status |
acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld); |
bool acpi_has_method(acpi_handle handle, char *name); |
acpi_status acpi_execute_simple_method(acpi_handle handle, char *method, |
u64 arg); |
acpi_status acpi_evaluate_ej0(acpi_handle handle); |
acpi_status acpi_evaluate_lck(acpi_handle handle, int lock); |
bool acpi_ata_match(acpi_handle handle); |
bool acpi_bay_match(acpi_handle handle); |
bool acpi_dock_match(acpi_handle handle); |
bool acpi_check_dsm(acpi_handle handle, const u8 *uuid, int rev, u64 funcs); |
union acpi_object *acpi_evaluate_dsm(acpi_handle handle, const u8 *uuid, |
int rev, int func, union acpi_object *argv4); |
static inline union acpi_object * |
acpi_evaluate_dsm_typed(acpi_handle handle, const u8 *uuid, int rev, int func, |
union acpi_object *argv4, acpi_object_type type) |
{ |
union acpi_object *obj; |
obj = acpi_evaluate_dsm(handle, uuid, rev, func, argv4); |
if (obj && obj->type != type) { |
ACPI_FREE(obj); |
obj = NULL; |
} |
return obj; |
} |
#define ACPI_INIT_DSM_ARGV4(cnt, eles) \ |
{ \ |
.package.type = ACPI_TYPE_PACKAGE, \ |
.package.count = (cnt), \ |
.package.elements = (eles) \ |
} |
#ifdef CONFIG_ACPI |
#define ACPI_BUS_FILE_ROOT "acpi" |
enum acpi_bus_device_type { |
ACPI_BUS_TYPE_DEVICE = 0, |
ACPI_BUS_TYPE_POWER, |
ACPI_BUS_TYPE_PROCESSOR, |
ACPI_BUS_TYPE_THERMAL, |
ACPI_BUS_TYPE_POWER_BUTTON, |
ACPI_BUS_TYPE_SLEEP_BUTTON, |
ACPI_BUS_DEVICE_TYPE_COUNT |
}; |
struct acpi_driver; |
struct acpi_device; |
/* |
* ACPI Scan Handler |
* ----------------- |
*/ |
struct acpi_hotplug_profile { |
struct kobject kobj; |
int (*scan_dependent)(struct acpi_device *adev); |
void (*notify_online)(struct acpi_device *adev); |
bool enabled:1; |
bool demand_offline:1; |
}; |
static inline struct acpi_hotplug_profile *to_acpi_hotplug_profile( |
struct kobject *kobj) |
{ |
return container_of(kobj, struct acpi_hotplug_profile, kobj); |
} |
struct acpi_scan_handler { |
const struct acpi_device_id *ids; |
struct list_head list_node; |
bool (*match)(const char *idstr, const struct acpi_device_id **matchid); |
int (*attach)(struct acpi_device *dev, const struct acpi_device_id *id); |
void (*detach)(struct acpi_device *dev); |
void (*bind)(struct device *phys_dev); |
void (*unbind)(struct device *phys_dev); |
struct acpi_hotplug_profile hotplug; |
}; |
/* |
* ACPI Hotplug Context |
* -------------------- |
*/ |
struct acpi_hotplug_context { |
struct acpi_device *self; |
int (*notify)(struct acpi_device *, u32); |
void (*uevent)(struct acpi_device *, u32); |
void (*fixup)(struct acpi_device *); |
}; |
/* |
* ACPI Driver |
* ----------- |
*/ |
typedef int (*acpi_op_add) (struct acpi_device * device); |
typedef int (*acpi_op_remove) (struct acpi_device * device); |
typedef void (*acpi_op_notify) (struct acpi_device * device, u32 event); |
struct acpi_device_ops { |
acpi_op_add add; |
acpi_op_remove remove; |
acpi_op_notify notify; |
}; |
#define ACPI_DRIVER_ALL_NOTIFY_EVENTS 0x1 /* system AND device events */ |
struct acpi_driver { |
char name[80]; |
char class[80]; |
const struct acpi_device_id *ids; /* Supported Hardware IDs */ |
unsigned int flags; |
struct acpi_device_ops ops; |
struct device_driver drv; |
struct module *owner; |
}; |
/* |
* ACPI Device |
* ----------- |
*/ |
/* Status (_STA) */ |
struct acpi_device_status { |
u32 present:1; |
u32 enabled:1; |
u32 show_in_ui:1; |
u32 functional:1; |
u32 battery_present:1; |
u32 reserved:27; |
}; |
/* Flags */ |
struct acpi_device_flags { |
u32 dynamic_status:1; |
u32 removable:1; |
u32 ejectable:1; |
u32 power_manageable:1; |
u32 match_driver:1; |
u32 initialized:1; |
u32 visited:1; |
u32 hotplug_notify:1; |
u32 is_dock_station:1; |
u32 of_compatible_ok:1; |
u32 coherent_dma:1; |
u32 cca_seen:1; |
u32 reserved:20; |
}; |
/* File System */ |
struct acpi_device_dir { |
struct proc_dir_entry *entry; |
}; |
#define acpi_device_dir(d) ((d)->dir.entry) |
/* Plug and Play */ |
typedef char acpi_bus_id[8]; |
typedef unsigned long acpi_bus_address; |
typedef char acpi_device_name[40]; |
typedef char acpi_device_class[20]; |
struct acpi_hardware_id { |
struct list_head list; |
const char *id; |
}; |
struct acpi_pnp_type { |
u32 hardware_id:1; |
u32 bus_address:1; |
u32 platform_id:1; |
u32 reserved:29; |
}; |
struct acpi_device_pnp { |
acpi_bus_id bus_id; /* Object name */ |
struct acpi_pnp_type type; /* ID type */ |
acpi_bus_address bus_address; /* _ADR */ |
char *unique_id; /* _UID */ |
struct list_head ids; /* _HID and _CIDs */ |
acpi_device_name device_name; /* Driver-determined */ |
acpi_device_class device_class; /* " */ |
union acpi_object *str_obj; /* unicode string for _STR method */ |
}; |
#define acpi_device_bid(d) ((d)->pnp.bus_id) |
#define acpi_device_adr(d) ((d)->pnp.bus_address) |
const char *acpi_device_hid(struct acpi_device *device); |
#define acpi_device_uid(d) ((d)->pnp.unique_id) |
#define acpi_device_name(d) ((d)->pnp.device_name) |
#define acpi_device_class(d) ((d)->pnp.device_class) |
/* Power Management */ |
struct acpi_device_power_flags { |
u32 explicit_get:1; /* _PSC present? */ |
u32 power_resources:1; /* Power resources */ |
u32 inrush_current:1; /* Serialize Dx->D0 */ |
u32 power_removed:1; /* Optimize Dx->D0 */ |
u32 ignore_parent:1; /* Power is independent of parent power state */ |
u32 dsw_present:1; /* _DSW present? */ |
u32 reserved:26; |
}; |
struct acpi_device_power_state { |
struct { |
u8 valid:1; |
u8 explicit_set:1; /* _PSx present? */ |
u8 reserved:6; |
} flags; |
int power; /* % Power (compared to D0) */ |
int latency; /* Dx->D0 time (microseconds) */ |
struct list_head resources; /* Power resources referenced */ |
}; |
struct acpi_device_power { |
int state; /* Current state */ |
struct acpi_device_power_flags flags; |
struct acpi_device_power_state states[ACPI_D_STATE_COUNT]; /* Power states (D0-D3Cold) */ |
}; |
/* Performance Management */ |
struct acpi_device_perf_flags { |
u8 reserved:8; |
}; |
struct acpi_device_perf_state { |
struct { |
u8 valid:1; |
u8 reserved:7; |
} flags; |
u8 power; /* % Power (compared to P0) */ |
u8 performance; /* % Performance ( " ) */ |
int latency; /* Px->P0 time (microseconds) */ |
}; |
struct acpi_device_perf { |
int state; |
struct acpi_device_perf_flags flags; |
int state_count; |
struct acpi_device_perf_state *states; |
}; |
/* Wakeup Management */ |
struct acpi_device_wakeup_flags { |
u8 valid:1; /* Can successfully enable wakeup? */ |
u8 run_wake:1; /* Run-Wake GPE devices */ |
u8 notifier_present:1; /* Wake-up notify handler has been installed */ |
u8 enabled:1; /* Enabled for wakeup */ |
}; |
struct acpi_device_wakeup_context { |
struct work_struct work; |
struct device *dev; |
}; |
struct acpi_device_wakeup { |
acpi_handle gpe_device; |
u64 gpe_number; |
u64 sleep_state; |
struct list_head resources; |
struct acpi_device_wakeup_flags flags; |
struct acpi_device_wakeup_context context; |
struct wakeup_source *ws; |
int prepare_count; |
}; |
struct acpi_device_physical_node { |
unsigned int node_id; |
struct list_head node; |
struct device *dev; |
bool put_online:1; |
}; |
/* ACPI Device Specific Data (_DSD) */ |
struct acpi_device_data { |
const union acpi_object *pointer; |
const union acpi_object *properties; |
const union acpi_object *of_compatible; |
struct list_head subnodes; |
}; |
struct acpi_gpio_mapping; |
/* Device */ |
struct acpi_device { |
int device_type; |
acpi_handle handle; /* no handle for fixed hardware */ |
struct fwnode_handle fwnode; |
struct acpi_device *parent; |
struct list_head children; |
struct list_head node; |
struct list_head wakeup_list; |
struct list_head del_list; |
struct acpi_device_status status; |
struct acpi_device_flags flags; |
struct acpi_device_pnp pnp; |
struct acpi_device_power power; |
struct acpi_device_wakeup wakeup; |
struct acpi_device_perf performance; |
struct acpi_device_dir dir; |
struct acpi_device_data data; |
struct acpi_scan_handler *handler; |
struct acpi_hotplug_context *hp; |
struct acpi_driver *driver; |
const struct acpi_gpio_mapping *driver_gpios; |
void *driver_data; |
struct device dev; |
unsigned int physical_node_count; |
unsigned int dep_unmet; |
struct list_head physical_node_list; |
struct mutex physical_node_lock; |
void (*remove)(struct acpi_device *); |
}; |
/* Non-device subnode */ |
struct acpi_data_node { |
const char *name; |
acpi_handle handle; |
struct fwnode_handle fwnode; |
struct acpi_device_data data; |
struct list_head sibling; |
struct kobject kobj; |
struct completion kobj_done; |
}; |
static inline bool is_acpi_node(struct fwnode_handle *fwnode) |
{ |
return fwnode && (fwnode->type == FWNODE_ACPI |
|| fwnode->type == FWNODE_ACPI_DATA); |
} |
static inline bool is_acpi_device_node(struct fwnode_handle *fwnode) |
{ |
return fwnode && fwnode->type == FWNODE_ACPI; |
} |
static inline struct acpi_device *to_acpi_device_node(struct fwnode_handle *fwnode) |
{ |
return is_acpi_device_node(fwnode) ? |
container_of(fwnode, struct acpi_device, fwnode) : NULL; |
} |
static inline bool is_acpi_data_node(struct fwnode_handle *fwnode) |
{ |
return fwnode && fwnode->type == FWNODE_ACPI_DATA; |
} |
static inline struct acpi_data_node *to_acpi_data_node(struct fwnode_handle *fwnode) |
{ |
return is_acpi_data_node(fwnode) ? |
container_of(fwnode, struct acpi_data_node, fwnode) : NULL; |
} |
static inline struct fwnode_handle *acpi_fwnode_handle(struct acpi_device *adev) |
{ |
return &adev->fwnode; |
} |
static inline void *acpi_driver_data(struct acpi_device *d) |
{ |
return d->driver_data; |
} |
#define to_acpi_device(d) container_of(d, struct acpi_device, dev) |
#define to_acpi_driver(d) container_of(d, struct acpi_driver, drv) |
static inline void acpi_set_device_status(struct acpi_device *adev, u32 sta) |
{ |
*((u32 *)&adev->status) = sta; |
} |
static inline void acpi_set_hp_context(struct acpi_device *adev, |
struct acpi_hotplug_context *hp) |
{ |
hp->self = adev; |
adev->hp = hp; |
} |
void acpi_initialize_hp_context(struct acpi_device *adev, |
struct acpi_hotplug_context *hp, |
int (*notify)(struct acpi_device *, u32), |
void (*uevent)(struct acpi_device *, u32)); |
/* acpi_device.dev.bus == &acpi_bus_type */ |
extern struct bus_type acpi_bus_type; |
/* |
* Events |
* ------ |
*/ |
struct acpi_bus_event { |
struct list_head node; |
acpi_device_class device_class; |
acpi_bus_id bus_id; |
u32 type; |
u32 data; |
}; |
extern struct kobject *acpi_kobj; |
extern int acpi_bus_generate_netlink_event(const char*, const char*, u8, int); |
void acpi_bus_private_data_handler(acpi_handle, void *); |
int acpi_bus_get_private_data(acpi_handle, void **); |
int acpi_bus_attach_private_data(acpi_handle, void *); |
void acpi_bus_detach_private_data(acpi_handle); |
extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32); |
/* |
* External Functions |
*/ |
int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device); |
struct acpi_device *acpi_bus_get_acpi_device(acpi_handle handle); |
void acpi_bus_put_acpi_device(struct acpi_device *adev); |
acpi_status acpi_bus_get_status_handle(acpi_handle handle, |
unsigned long long *sta); |
int acpi_bus_get_status(struct acpi_device *device); |
int acpi_bus_set_power(acpi_handle handle, int state); |
const char *acpi_power_state_string(int state); |
int acpi_device_get_power(struct acpi_device *device, int *state); |
int acpi_device_set_power(struct acpi_device *device, int state); |
int acpi_bus_init_power(struct acpi_device *device); |
int acpi_device_fix_up_power(struct acpi_device *device); |
int acpi_bus_update_power(acpi_handle handle, int *state_p); |
int acpi_device_update_power(struct acpi_device *device, int *state_p); |
bool acpi_bus_power_manageable(acpi_handle handle); |
#ifdef CONFIG_PM |
bool acpi_bus_can_wakeup(acpi_handle handle); |
#else |
static inline bool acpi_bus_can_wakeup(acpi_handle handle) { return false; } |
#endif |
void acpi_scan_lock_acquire(void); |
void acpi_scan_lock_release(void); |
void acpi_lock_hp_context(void); |
void acpi_unlock_hp_context(void); |
int acpi_scan_add_handler(struct acpi_scan_handler *handler); |
int acpi_bus_register_driver(struct acpi_driver *driver); |
void acpi_bus_unregister_driver(struct acpi_driver *driver); |
int acpi_bus_scan(acpi_handle handle); |
void acpi_bus_trim(struct acpi_device *start); |
acpi_status acpi_bus_get_ejd(acpi_handle handle, acpi_handle * ejd); |
int acpi_match_device_ids(struct acpi_device *device, |
const struct acpi_device_id *ids); |
int acpi_create_dir(struct acpi_device *); |
void acpi_remove_dir(struct acpi_device *); |
static inline bool acpi_device_enumerated(struct acpi_device *adev) |
{ |
return adev && adev->flags.initialized && adev->flags.visited; |
} |
/** |
* module_acpi_driver(acpi_driver) - Helper macro for registering an ACPI driver |
* @__acpi_driver: acpi_driver struct |
* |
* Helper macro for ACPI drivers which do not do anything special in module |
* init/exit. This eliminates a lot of boilerplate. Each module may only |
* use this macro once, and calling it replaces module_init() and module_exit() |
*/ |
#define module_acpi_driver(__acpi_driver) \ |
module_driver(__acpi_driver, acpi_bus_register_driver, \ |
acpi_bus_unregister_driver) |
/* |
* Bind physical devices with ACPI devices |
*/ |
struct acpi_bus_type { |
struct list_head list; |
const char *name; |
bool (*match)(struct device *dev); |
struct acpi_device * (*find_companion)(struct device *); |
void (*setup)(struct device *); |
void (*cleanup)(struct device *); |
}; |
int register_acpi_bus_type(struct acpi_bus_type *); |
int unregister_acpi_bus_type(struct acpi_bus_type *); |
int acpi_bind_one(struct device *dev, struct acpi_device *adev); |
int acpi_unbind_one(struct device *dev); |
struct acpi_pci_root { |
struct acpi_device * device; |
struct pci_bus *bus; |
u16 segment; |
struct resource secondary; /* downstream bus range */ |
u32 osc_support_set; /* _OSC state of support bits */ |
u32 osc_control_set; /* _OSC state of control bits */ |
phys_addr_t mcfg_addr; |
}; |
/* helper */ |
bool acpi_dma_supported(struct acpi_device *adev); |
enum dev_dma_attr acpi_get_dma_attr(struct acpi_device *adev); |
struct acpi_device *acpi_find_child_device(struct acpi_device *parent, |
u64 address, bool check_children); |
int acpi_is_root_bridge(acpi_handle); |
struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle); |
int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state); |
int acpi_disable_wakeup_device_power(struct acpi_device *dev); |
#ifdef CONFIG_PM |
acpi_status acpi_add_pm_notifier(struct acpi_device *adev, struct device *dev, |
void (*work_func)(struct work_struct *work)); |
acpi_status acpi_remove_pm_notifier(struct acpi_device *adev); |
int acpi_pm_device_sleep_state(struct device *, int *, int); |
int acpi_pm_device_run_wake(struct device *, bool); |
#else |
static inline acpi_status acpi_add_pm_notifier(struct acpi_device *adev, |
struct device *dev, |
void (*work_func)(struct work_struct *work)) |
{ |
return AE_SUPPORT; |
} |
static inline acpi_status acpi_remove_pm_notifier(struct acpi_device *adev) |
{ |
return AE_SUPPORT; |
} |
static inline int acpi_pm_device_sleep_state(struct device *d, int *p, int m) |
{ |
if (p) |
*p = ACPI_STATE_D0; |
return (m >= ACPI_STATE_D0 && m <= ACPI_STATE_D3_COLD) ? |
m : ACPI_STATE_D0; |
} |
static inline int acpi_pm_device_run_wake(struct device *dev, bool enable) |
{ |
return -ENODEV; |
} |
#endif |
#ifdef CONFIG_PM_SLEEP |
int acpi_pm_device_sleep_wake(struct device *, bool); |
#else |
static inline int acpi_pm_device_sleep_wake(struct device *dev, bool enable) |
{ |
return -ENODEV; |
} |
#endif |
#ifdef CONFIG_ACPI_SLEEP |
u32 acpi_target_system_state(void); |
#else |
static inline u32 acpi_target_system_state(void) { return ACPI_STATE_S0; } |
#endif |
static inline bool acpi_device_power_manageable(struct acpi_device *adev) |
{ |
return adev->flags.power_manageable; |
} |
static inline bool acpi_device_can_wakeup(struct acpi_device *adev) |
{ |
return adev->wakeup.flags.valid; |
} |
static inline bool acpi_device_can_poweroff(struct acpi_device *adev) |
{ |
return adev->power.states[ACPI_STATE_D3_COLD].flags.valid; |
} |
#else /* CONFIG_ACPI */ |
static inline int register_acpi_bus_type(void *bus) { return 0; } |
static inline int unregister_acpi_bus_type(void *bus) { return 0; } |
#endif /* CONFIG_ACPI */ |
#endif /*__ACPI_BUS_H__*/ |
/drivers/include/acpi/acpi_drivers.h |
---|
0,0 → 1,123 |
/* |
* acpi_drivers.h ($Revision: 31 $) |
* |
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> |
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> |
* |
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
* |
* This program is free software; you can redistribute it and/or modify |
* it under the terms of the GNU General Public License as published by |
* the Free Software Foundation; either version 2 of the License, or (at |
* your option) any later version. |
* |
* This program is distributed in the hope that it will be useful, but |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
* General Public License for more details. |
* |
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
*/ |
#ifndef __ACPI_DRIVERS_H__ |
#define __ACPI_DRIVERS_H__ |
#define ACPI_MAX_STRING 80 |
/* |
* Please update drivers/acpi/debug.c and Documentation/acpi/debug.txt |
* if you add to this list. |
*/ |
#define ACPI_BUS_COMPONENT 0x00010000 |
#define ACPI_AC_COMPONENT 0x00020000 |
#define ACPI_BATTERY_COMPONENT 0x00040000 |
#define ACPI_BUTTON_COMPONENT 0x00080000 |
#define ACPI_SBS_COMPONENT 0x00100000 |
#define ACPI_FAN_COMPONENT 0x00200000 |
#define ACPI_PCI_COMPONENT 0x00400000 |
#define ACPI_POWER_COMPONENT 0x00800000 |
#define ACPI_CONTAINER_COMPONENT 0x01000000 |
#define ACPI_SYSTEM_COMPONENT 0x02000000 |
#define ACPI_THERMAL_COMPONENT 0x04000000 |
#define ACPI_MEMORY_DEVICE_COMPONENT 0x08000000 |
#define ACPI_VIDEO_COMPONENT 0x10000000 |
#define ACPI_PROCESSOR_COMPONENT 0x20000000 |
/* |
* _HID definitions |
* HIDs must conform to ACPI spec(6.1.4) |
* Linux specific HIDs do not apply to this and begin with LNX: |
*/ |
#define ACPI_POWER_HID "LNXPOWER" |
#define ACPI_PROCESSOR_OBJECT_HID "LNXCPU" |
#define ACPI_SYSTEM_HID "LNXSYSTM" |
#define ACPI_THERMAL_HID "LNXTHERM" |
#define ACPI_BUTTON_HID_POWERF "LNXPWRBN" |
#define ACPI_BUTTON_HID_SLEEPF "LNXSLPBN" |
#define ACPI_VIDEO_HID "LNXVIDEO" |
#define ACPI_BAY_HID "LNXIOBAY" |
#define ACPI_DOCK_HID "LNXDOCK" |
/* Quirk for broken IBM BIOSes */ |
#define ACPI_SMBUS_IBM_HID "SMBUSIBM" |
/* |
* For fixed hardware buttons, we fabricate acpi_devices with HID |
* ACPI_BUTTON_HID_POWERF or ACPI_BUTTON_HID_SLEEPF. Fixed hardware |
* signals only an event; it doesn't supply a notification value. |
* To allow drivers to treat notifications from fixed hardware the |
* same as those from real devices, we turn the events into this |
* notification value. |
*/ |
#define ACPI_FIXED_HARDWARE_EVENT 0x100 |
/* -------------------------------------------------------------------------- |
PCI |
-------------------------------------------------------------------------- */ |
/* ACPI PCI Interrupt Link (pci_link.c) */ |
int acpi_irq_penalty_init(void); |
int acpi_pci_link_allocate_irq(acpi_handle handle, int index, int *triggering, |
int *polarity, char **name); |
int acpi_pci_link_free_irq(acpi_handle handle); |
/* ACPI PCI Device Binding (pci_bind.c) */ |
struct pci_bus; |
struct pci_dev *acpi_get_pci_dev(acpi_handle); |
/* Arch-defined function to add a bus to the system */ |
struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root); |
#ifdef CONFIG_X86 |
void pci_acpi_crs_quirks(void); |
#else |
static inline void pci_acpi_crs_quirks(void) { } |
#endif |
/* -------------------------------------------------------------------------- |
Processor |
-------------------------------------------------------------------------- */ |
#define ACPI_PROCESSOR_LIMIT_NONE 0x00 |
#define ACPI_PROCESSOR_LIMIT_INCREMENT 0x01 |
#define ACPI_PROCESSOR_LIMIT_DECREMENT 0x02 |
/*-------------------------------------------------------------------------- |
Dock Station |
-------------------------------------------------------------------------- */ |
#ifdef CONFIG_ACPI_DOCK |
extern int is_dock_device(struct acpi_device *adev); |
#else |
static inline int is_dock_device(struct acpi_device *adev) |
{ |
return 0; |
} |
#endif /* CONFIG_ACPI_DOCK */ |
#endif /*__ACPI_DRIVERS_H__*/ |
/drivers/include/acpi/acpi_io.h |
---|
0,0 → 1,16 |
#ifndef _ACPI_IO_H_ |
#define _ACPI_IO_H_ |
#include <linux/io.h> |
#include <asm/acpi.h> |
void acpi_os_map_iomem(acpi_physical_address phys, acpi_size size); |
void acpi_os_unmap_iomem(void __iomem *virt, acpi_size size); |
void *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size); |
int acpi_os_map_generic_address(struct acpi_generic_address *addr); |
void acpi_os_unmap_generic_address(struct acpi_generic_address *addr); |
#endif |
/drivers/include/acpi/acpi_numa.h |
---|
0,0 → 1,20 |
#ifndef __ACPI_NUMA_H |
#define __ACPI_NUMA_H |
#ifdef CONFIG_ACPI_NUMA |
#include <linux/kernel.h> |
/* Proximity bitmap length */ |
#if MAX_NUMNODES > 256 |
#define MAX_PXM_DOMAINS MAX_NUMNODES |
#else |
#define MAX_PXM_DOMAINS (256) /* Old pxm spec is defined 8 bit */ |
#endif |
extern int pxm_to_node(int); |
extern int node_to_pxm(int); |
extern int acpi_map_pxm_to_node(int); |
extern unsigned char acpi_srat_revision; |
#endif /* CONFIG_ACPI_NUMA */ |
#endif /* __ACP_NUMA_H */ |
/drivers/include/acpi/acpiosxf.h |
---|
0,0 → 1,440 |
/****************************************************************************** |
* |
* Name: acpiosxf.h - All interfaces to the OS Services Layer (OSL). These |
* interfaces must be implemented by OSL to interface the |
* ACPI components to the host operating system. |
* |
*****************************************************************************/ |
/* |
* Copyright (C) 2000 - 2015, 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 __ACPIOSXF_H__ |
#define __ACPIOSXF_H__ |
#include <acpi/platform/acenv.h> |
#include <acpi/actypes.h> |
/* Types for acpi_os_execute */ |
typedef enum { |
OSL_GLOBAL_LOCK_HANDLER, |
OSL_NOTIFY_HANDLER, |
OSL_GPE_HANDLER, |
OSL_DEBUGGER_MAIN_THREAD, |
OSL_DEBUGGER_EXEC_THREAD, |
OSL_EC_POLL_HANDLER, |
OSL_EC_BURST_HANDLER |
} acpi_execute_type; |
#define ACPI_NO_UNIT_LIMIT ((u32) -1) |
#define ACPI_MUTEX_SEM 1 |
/* Functions for acpi_os_signal */ |
#define ACPI_SIGNAL_FATAL 0 |
#define ACPI_SIGNAL_BREAKPOINT 1 |
struct acpi_signal_fatal_info { |
u32 type; |
u32 code; |
u32 argument; |
}; |
/* |
* OSL Initialization and shutdown primitives |
*/ |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize |
acpi_status acpi_os_initialize(void); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate |
acpi_status acpi_os_terminate(void); |
#endif |
/* |
* ACPI Table interfaces |
*/ |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_root_pointer |
acpi_physical_address acpi_os_get_root_pointer(void); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_predefined_override |
acpi_status |
acpi_os_predefined_override(const struct acpi_predefined_names *init_val, |
char **new_val); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_table_override |
acpi_status |
acpi_os_table_override(struct acpi_table_header *existing_table, |
struct acpi_table_header **new_table); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_physical_table_override |
acpi_status |
acpi_os_physical_table_override(struct acpi_table_header *existing_table, |
acpi_physical_address * new_address, |
u32 *new_table_length); |
#endif |
/* |
* Spinlock primitives |
*/ |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_lock |
acpi_status acpi_os_create_lock(acpi_spinlock * out_handle); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_delete_lock |
void acpi_os_delete_lock(acpi_spinlock handle); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_lock |
acpi_cpu_flags acpi_os_acquire_lock(acpi_spinlock handle); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_release_lock |
void acpi_os_release_lock(acpi_spinlock handle, acpi_cpu_flags flags); |
#endif |
/* |
* Semaphore primitives |
*/ |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_semaphore |
acpi_status |
acpi_os_create_semaphore(u32 max_units, |
u32 initial_units, acpi_semaphore * out_handle); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_delete_semaphore |
acpi_status acpi_os_delete_semaphore(acpi_semaphore handle); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_wait_semaphore |
acpi_status |
acpi_os_wait_semaphore(acpi_semaphore handle, u32 units, u16 timeout); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_signal_semaphore |
acpi_status acpi_os_signal_semaphore(acpi_semaphore handle, u32 units); |
#endif |
/* |
* Mutex primitives. May be configured to use semaphores instead via |
* ACPI_MUTEX_TYPE (see platform/acenv.h) |
*/ |
#if (ACPI_MUTEX_TYPE != ACPI_BINARY_SEMAPHORE) |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_mutex |
acpi_status acpi_os_create_mutex(acpi_mutex * out_handle); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_delete_mutex |
void acpi_os_delete_mutex(acpi_mutex handle); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_mutex |
acpi_status acpi_os_acquire_mutex(acpi_mutex handle, u16 timeout); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_release_mutex |
void acpi_os_release_mutex(acpi_mutex handle); |
#endif |
#endif |
/* |
* Memory allocation and mapping |
*/ |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate |
void *acpi_os_allocate(acpi_size size); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate_zeroed |
void *acpi_os_allocate_zeroed(acpi_size size); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_free |
void acpi_os_free(void *memory); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_map_memory |
void *acpi_os_map_memory(acpi_physical_address where, acpi_size length); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_unmap_memory |
void acpi_os_unmap_memory(void *logical_address, acpi_size size); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_physical_address |
acpi_status |
acpi_os_get_physical_address(void *logical_address, |
acpi_physical_address * physical_address); |
#endif |
/* |
* Memory/Object Cache |
*/ |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_cache |
acpi_status |
acpi_os_create_cache(char *cache_name, |
u16 object_size, |
u16 max_depth, acpi_cache_t ** return_cache); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_delete_cache |
acpi_status acpi_os_delete_cache(acpi_cache_t * cache); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_purge_cache |
acpi_status acpi_os_purge_cache(acpi_cache_t * cache); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_object |
void *acpi_os_acquire_object(acpi_cache_t * cache); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_release_object |
acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object); |
#endif |
/* |
* Interrupt handlers |
*/ |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_install_interrupt_handler |
acpi_status |
acpi_os_install_interrupt_handler(u32 interrupt_number, |
acpi_osd_handler service_routine, |
void *context); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_remove_interrupt_handler |
acpi_status |
acpi_os_remove_interrupt_handler(u32 interrupt_number, |
acpi_osd_handler service_routine); |
#endif |
/* |
* Threads and Scheduling |
*/ |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_thread_id |
acpi_thread_id acpi_os_get_thread_id(void); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_execute |
acpi_status |
acpi_os_execute(acpi_execute_type type, |
acpi_osd_exec_callback function, void *context); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_wait_events_complete |
void acpi_os_wait_events_complete(void); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_sleep |
void acpi_os_sleep(u64 milliseconds); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_stall |
void acpi_os_stall(u32 microseconds); |
#endif |
/* |
* Platform and hardware-independent I/O interfaces |
*/ |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_read_port |
acpi_status acpi_os_read_port(acpi_io_address address, u32 *value, u32 width); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_write_port |
acpi_status acpi_os_write_port(acpi_io_address address, u32 value, u32 width); |
#endif |
/* |
* Platform and hardware-independent physical memory interfaces |
*/ |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_read_memory |
acpi_status |
acpi_os_read_memory(acpi_physical_address address, u64 *value, u32 width); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_write_memory |
acpi_status |
acpi_os_write_memory(acpi_physical_address address, u64 value, u32 width); |
#endif |
/* |
* Platform and hardware-independent PCI configuration space access |
* Note: Can't use "Register" as a parameter, changed to "Reg" -- |
* certain compilers complain. |
*/ |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_read_pci_configuration |
acpi_status |
acpi_os_read_pci_configuration(struct acpi_pci_id *pci_id, |
u32 reg, u64 *value, u32 width); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_write_pci_configuration |
acpi_status |
acpi_os_write_pci_configuration(struct acpi_pci_id *pci_id, |
u32 reg, u64 value, u32 width); |
#endif |
/* |
* Miscellaneous |
*/ |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_readable |
u8 acpi_os_readable(void *pointer, acpi_size length); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_writable |
u8 acpi_os_writable(void *pointer, acpi_size length); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_timer |
u64 acpi_os_get_timer(void); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_signal |
acpi_status acpi_os_signal(u32 function, void *info); |
#endif |
/* |
* Debug print routines |
*/ |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_printf |
void ACPI_INTERNAL_VAR_XFACE acpi_os_printf(const char *format, ...); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_vprintf |
void acpi_os_vprintf(const char *format, va_list args); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_redirect_output |
void acpi_os_redirect_output(void *destination); |
#endif |
/* |
* Debug input |
*/ |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_line |
acpi_status acpi_os_get_line(char *buffer, u32 buffer_length, u32 *bytes_read); |
#endif |
/* |
* Obtain ACPI table(s) |
*/ |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_name |
acpi_status |
acpi_os_get_table_by_name(char *signature, |
u32 instance, |
struct acpi_table_header **table, |
acpi_physical_address * address); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_index |
acpi_status |
acpi_os_get_table_by_index(u32 index, |
struct acpi_table_header **table, |
u32 *instance, acpi_physical_address * address); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_address |
acpi_status |
acpi_os_get_table_by_address(acpi_physical_address address, |
struct acpi_table_header **table); |
#endif |
/* |
* Directory manipulation |
*/ |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_open_directory |
void *acpi_os_open_directory(char *pathname, |
char *wildcard_spec, char requested_file_type); |
#endif |
/* requeste_file_type values */ |
#define REQUEST_FILE_ONLY 0 |
#define REQUEST_DIR_ONLY 1 |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_next_filename |
char *acpi_os_get_next_filename(void *dir_handle); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_close_directory |
void acpi_os_close_directory(void *dir_handle); |
#endif |
/* |
* File I/O and related support |
*/ |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_open_file |
ACPI_FILE acpi_os_open_file(const char *path, u8 modes); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_close_file |
void acpi_os_close_file(ACPI_FILE file); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_read_file |
int |
acpi_os_read_file(ACPI_FILE file, |
void *buffer, acpi_size size, acpi_size count); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_write_file |
int |
acpi_os_write_file(ACPI_FILE file, |
void *buffer, acpi_size size, acpi_size count); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_file_offset |
long acpi_os_get_file_offset(ACPI_FILE file); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_set_file_offset |
acpi_status acpi_os_set_file_offset(ACPI_FILE file, long offset, u8 from); |
#endif |
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_trace_point |
void |
acpi_os_trace_point(acpi_trace_event_type type, |
u8 begin, u8 *aml, char *pathname); |
#endif |
#endif /* __ACPIOSXF_H__ */ |
/drivers/include/acpi/acpixf.h |
---|
0,0 → 1,934 |
/****************************************************************************** |
* |
* Name: acpixf.h - External interfaces to the ACPI subsystem |
* |
*****************************************************************************/ |
/* |
* Copyright (C) 2000 - 2015, 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 __ACXFACE_H__ |
#define __ACXFACE_H__ |
/* Current ACPICA subsystem version in YYYYMMDD format */ |
#define ACPI_CA_VERSION 0x20150930 |
#include <acpi/acconfig.h> |
#include <acpi/actypes.h> |
#include <acpi/actbl.h> |
#include <acpi/acbuffer.h> |
/***************************************************************************** |
* |
* Macros used for ACPICA globals and configuration |
* |
****************************************************************************/ |
/* |
* Ensure that global variables are defined and initialized only once. |
* |
* The use of these macros allows for a single list of globals (here) |
* in order to simplify maintenance of the code. |
*/ |
#ifdef DEFINE_ACPI_GLOBALS |
#define ACPI_GLOBAL(type,name) \ |
extern type name; \ |
type name |
#define ACPI_INIT_GLOBAL(type,name,value) \ |
type name=value |
#else |
#ifndef ACPI_GLOBAL |
#define ACPI_GLOBAL(type,name) \ |
extern type name |
#endif |
#ifndef ACPI_INIT_GLOBAL |
#define ACPI_INIT_GLOBAL(type,name,value) \ |
extern type name |
#endif |
#endif |
/* |
* These macros configure the various ACPICA interfaces. They are |
* useful for generating stub inline functions for features that are |
* configured out of the current kernel or ACPICA application. |
*/ |
#ifndef ACPI_EXTERNAL_RETURN_STATUS |
#define ACPI_EXTERNAL_RETURN_STATUS(prototype) \ |
prototype; |
#endif |
#ifndef ACPI_EXTERNAL_RETURN_OK |
#define ACPI_EXTERNAL_RETURN_OK(prototype) \ |
prototype; |
#endif |
#ifndef ACPI_EXTERNAL_RETURN_VOID |
#define ACPI_EXTERNAL_RETURN_VOID(prototype) \ |
prototype; |
#endif |
#ifndef ACPI_EXTERNAL_RETURN_UINT32 |
#define ACPI_EXTERNAL_RETURN_UINT32(prototype) \ |
prototype; |
#endif |
#ifndef ACPI_EXTERNAL_RETURN_PTR |
#define ACPI_EXTERNAL_RETURN_PTR(prototype) \ |
prototype; |
#endif |
/***************************************************************************** |
* |
* Public globals and runtime configuration options |
* |
****************************************************************************/ |
/* |
* Enable "slack mode" of the AML interpreter? Default is FALSE, and the |
* interpreter strictly follows the ACPI specification. Setting to TRUE |
* allows the interpreter to ignore certain errors and/or bad AML constructs. |
* |
* Currently, these features are enabled by this flag: |
* |
* 1) Allow "implicit return" of last value in a control method |
* 2) Allow access beyond the end of an operation region |
* 3) Allow access to uninitialized locals/args (auto-init to integer 0) |
* 4) Allow ANY object type to be a source operand for the Store() operator |
* 5) Allow unresolved references (invalid target name) in package objects |
* 6) Enable warning messages for behavior that is not ACPI spec compliant |
*/ |
ACPI_INIT_GLOBAL(u8, acpi_gbl_enable_interpreter_slack, FALSE); |
/* |
* Automatically serialize all methods that create named objects? Default |
* is TRUE, meaning that all non_serialized methods are scanned once at |
* table load time to determine those that create named objects. Methods |
* that create named objects are marked Serialized in order to prevent |
* possible run-time problems if they are entered by more than one thread. |
*/ |
ACPI_INIT_GLOBAL(u8, acpi_gbl_auto_serialize_methods, TRUE); |
/* |
* Create the predefined _OSI method in the namespace? Default is TRUE |
* because ACPICA is fully compatible with other ACPI implementations. |
* Changing this will revert ACPICA (and machine ASL) to pre-OSI behavior. |
*/ |
ACPI_INIT_GLOBAL(u8, acpi_gbl_create_osi_method, TRUE); |
/* |
* Optionally use default values for the ACPI register widths. Set this to |
* TRUE to use the defaults, if an FADT contains incorrect widths/lengths. |
*/ |
ACPI_INIT_GLOBAL(u8, acpi_gbl_use_default_register_widths, TRUE); |
/* |
* Whether or not to verify the table checksum before installation. Set |
* this to TRUE to verify the table checksum before install it to the table |
* manager. Note that enabling this option causes errors to happen in some |
* OSPMs during early initialization stages. Default behavior is to do such |
* verification. |
*/ |
ACPI_INIT_GLOBAL(u8, acpi_gbl_verify_table_checksum, TRUE); |
/* |
* Optionally enable output from the AML Debug Object. |
*/ |
ACPI_INIT_GLOBAL(u8, acpi_gbl_enable_aml_debug_object, FALSE); |
/* |
* Optionally copy the entire DSDT to local memory (instead of simply |
* mapping it.) There are some BIOSs that corrupt or replace the original |
* DSDT, creating the need for this option. Default is FALSE, do not copy |
* the DSDT. |
*/ |
ACPI_INIT_GLOBAL(u8, acpi_gbl_copy_dsdt_locally, FALSE); |
/* |
* Optionally ignore an XSDT if present and use the RSDT instead. |
* Although the ACPI specification requires that an XSDT be used instead |
* of the RSDT, the XSDT has been found to be corrupt or ill-formed on |
* some machines. Default behavior is to use the XSDT if present. |
*/ |
ACPI_INIT_GLOBAL(u8, acpi_gbl_do_not_use_xsdt, FALSE); |
/* |
* Optionally use 32-bit FADT addresses if and when there is a conflict |
* (address mismatch) between the 32-bit and 64-bit versions of the |
* address. Although ACPICA adheres to the ACPI specification which |
* requires the use of the corresponding 64-bit address if it is non-zero, |
* some machines have been found to have a corrupted non-zero 64-bit |
* address. Default is FALSE, do not favor the 32-bit addresses. |
*/ |
ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_fadt_addresses, FALSE); |
/* |
* Optionally use 32-bit FACS table addresses. |
* It is reported that some platforms fail to resume from system suspending |
* if 64-bit FACS table address is selected: |
* https://bugzilla.kernel.org/show_bug.cgi?id=74021 |
* Default is TRUE, favor the 32-bit addresses. |
*/ |
ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_facs_addresses, TRUE); |
/* |
* Optionally truncate I/O addresses to 16 bits. Provides compatibility |
* with other ACPI implementations. NOTE: During ACPICA initialization, |
* this value is set to TRUE if any Windows OSI strings have been |
* requested by the BIOS. |
*/ |
ACPI_INIT_GLOBAL(u8, acpi_gbl_truncate_io_addresses, FALSE); |
/* |
* Disable runtime checking and repair of values returned by control methods. |
* Use only if the repair is causing a problem on a particular machine. |
*/ |
ACPI_INIT_GLOBAL(u8, acpi_gbl_disable_auto_repair, FALSE); |
/* |
* Optionally do not install any SSDTs from the RSDT/XSDT during initialization. |
* This can be useful for debugging ACPI problems on some machines. |
*/ |
ACPI_INIT_GLOBAL(u8, acpi_gbl_disable_ssdt_table_install, FALSE); |
/* |
* Optionally enable runtime namespace override. |
*/ |
ACPI_INIT_GLOBAL(u8, acpi_gbl_runtime_namespace_override, TRUE); |
/* |
* We keep track of the latest version of Windows that has been requested by |
* the BIOS. ACPI 5.0. |
*/ |
ACPI_INIT_GLOBAL(u8, acpi_gbl_osi_data, 0); |
/* |
* ACPI 5.0 introduces the concept of a "reduced hardware platform", meaning |
* that the ACPI hardware is no longer required. A flag in the FADT indicates |
* a reduced HW machine, and that flag is duplicated here for convenience. |
*/ |
ACPI_INIT_GLOBAL(u8, acpi_gbl_reduced_hardware, FALSE); |
/* |
* This mechanism is used to trace a specified AML method. The method is |
* traced each time it is executed. |
*/ |
ACPI_INIT_GLOBAL(u32, acpi_gbl_trace_flags, 0); |
ACPI_INIT_GLOBAL(const char *, acpi_gbl_trace_method_name, NULL); |
ACPI_INIT_GLOBAL(u32, acpi_gbl_trace_dbg_level, ACPI_TRACE_LEVEL_DEFAULT); |
ACPI_INIT_GLOBAL(u32, acpi_gbl_trace_dbg_layer, ACPI_TRACE_LAYER_DEFAULT); |
/* |
* Runtime configuration of debug output control masks. We want the debug |
* switches statically initialized so they are already set when the debugger |
* is entered. |
*/ |
ACPI_INIT_GLOBAL(u32, acpi_dbg_level, ACPI_DEBUG_DEFAULT); |
ACPI_INIT_GLOBAL(u32, acpi_dbg_layer, 0); |
/* |
* Other miscellaneous globals |
*/ |
ACPI_GLOBAL(struct acpi_table_fadt, acpi_gbl_FADT); |
ACPI_GLOBAL(u32, acpi_current_gpe_count); |
ACPI_GLOBAL(u8, acpi_gbl_system_awake_and_running); |
/***************************************************************************** |
* |
* ACPICA public interface configuration. |
* |
* Interfaces that are configured out of the ACPICA build are replaced |
* by inlined stubs by default. |
* |
****************************************************************************/ |
/* |
* Hardware-reduced prototypes (default: Not hardware reduced). |
* |
* All ACPICA hardware-related interfaces that use these macros will be |
* configured out of the ACPICA build if the ACPI_REDUCED_HARDWARE flag |
* is set to TRUE. |
* |
* Note: This static build option for reduced hardware is intended to |
* reduce ACPICA code size if desired or necessary. However, even if this |
* option is not specified, the runtime behavior of ACPICA is dependent |
* on the actual FADT reduced hardware flag (HW_REDUCED_ACPI). If set, |
* the flag will enable similar behavior -- ACPICA will not attempt |
* to access any ACPI-relate hardware (SCI, GPEs, Fixed Events, etc.) |
*/ |
#if (!ACPI_REDUCED_HARDWARE) |
#define ACPI_HW_DEPENDENT_RETURN_STATUS(prototype) \ |
ACPI_EXTERNAL_RETURN_STATUS(prototype) |
#define ACPI_HW_DEPENDENT_RETURN_OK(prototype) \ |
ACPI_EXTERNAL_RETURN_OK(prototype) |
#define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \ |
ACPI_EXTERNAL_RETURN_VOID(prototype) |
#else |
#define ACPI_HW_DEPENDENT_RETURN_STATUS(prototype) \ |
static ACPI_INLINE prototype {return(AE_NOT_CONFIGURED);} |
#define ACPI_HW_DEPENDENT_RETURN_OK(prototype) \ |
static ACPI_INLINE prototype {return(AE_OK);} |
#define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \ |
static ACPI_INLINE prototype {return;} |
#endif /* !ACPI_REDUCED_HARDWARE */ |
/* |
* Error message prototypes (default: error messages enabled). |
* |
* All interfaces related to error and warning messages |
* will be configured out of the ACPICA build if the |
* ACPI_NO_ERROR_MESSAGE flag is defined. |
*/ |
#ifndef ACPI_NO_ERROR_MESSAGES |
#define ACPI_MSG_DEPENDENT_RETURN_VOID(prototype) \ |
prototype; |
#else |
#define ACPI_MSG_DEPENDENT_RETURN_VOID(prototype) \ |
static ACPI_INLINE prototype {return;} |
#endif /* ACPI_NO_ERROR_MESSAGES */ |
/* |
* Debugging output prototypes (default: no debug output). |
* |
* All interfaces related to debug output messages |
* will be configured out of the ACPICA build unless the |
* ACPI_DEBUG_OUTPUT flag is defined. |
*/ |
#ifdef ACPI_DEBUG_OUTPUT |
#define ACPI_DBG_DEPENDENT_RETURN_VOID(prototype) \ |
prototype; |
#else |
#define ACPI_DBG_DEPENDENT_RETURN_VOID(prototype) \ |
static ACPI_INLINE prototype {return;} |
#endif /* ACPI_DEBUG_OUTPUT */ |
/* |
* Application prototypes |
* |
* All interfaces used by application will be configured |
* out of the ACPICA build unless the ACPI_APPLICATION |
* flag is defined. |
*/ |
#ifdef ACPI_APPLICATION |
#define ACPI_APP_DEPENDENT_RETURN_VOID(prototype) \ |
prototype; |
#else |
#define ACPI_APP_DEPENDENT_RETURN_VOID(prototype) \ |
static ACPI_INLINE prototype {return;} |
#endif /* ACPI_APPLICATION */ |
/***************************************************************************** |
* |
* ACPICA public interface prototypes |
* |
****************************************************************************/ |
/* |
* Initialization |
*/ |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init |
acpi_initialize_tables(struct acpi_table_desc |
*initial_storage, |
u32 initial_table_count, |
u8 allow_resize)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_initialize_subsystem(void)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_enable_subsystem(u32 flags)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init |
acpi_initialize_objects(u32 flags)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_terminate(void)) |
/* |
* Miscellaneous global interfaces |
*/ |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable(void)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_disable(void)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_subsystem_status(void)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_get_system_info(struct acpi_buffer |
*ret_buffer)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_get_statistics(struct acpi_statistics *stats)) |
ACPI_EXTERNAL_RETURN_PTR(const char |
*acpi_format_exception(acpi_status exception)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_purge_cached_objects(void)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_install_interface(acpi_string interface_name)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_remove_interface(acpi_string interface_name)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_update_interfaces(u8 action)) |
ACPI_EXTERNAL_RETURN_UINT32(u32 |
acpi_check_address_range(acpi_adr_space_type |
space_id, |
acpi_physical_address |
address, acpi_size length, |
u8 warn)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_decode_pld_buffer(u8 *in_buffer, |
acpi_size length, |
struct acpi_pld_info |
**return_buffer)) |
/* |
* ACPI table load/unload interfaces |
*/ |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init |
acpi_install_table(acpi_physical_address address, |
u8 physical)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_load_table(struct acpi_table_header *table)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_unload_parent_table(acpi_handle object)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_load_tables(void)) |
/* |
* ACPI table manipulation interfaces |
*/ |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_reallocate_root_table(void)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init |
acpi_find_root_pointer(acpi_physical_address * |
rsdp_address)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_get_table_header(acpi_string signature, |
u32 instance, |
struct acpi_table_header |
*out_table_header)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_get_table(acpi_string signature, u32 instance, |
struct acpi_table_header |
**out_table)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_get_table_by_index(u32 table_index, |
struct acpi_table_header |
**out_table)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_install_table_handler(acpi_table_handler |
handler, void *context)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_remove_table_handler(acpi_table_handler |
handler)) |
/* |
* Namespace and name interfaces |
*/ |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_walk_namespace(acpi_object_type type, |
acpi_handle start_object, |
u32 max_depth, |
acpi_walk_callback |
descending_callback, |
acpi_walk_callback |
ascending_callback, |
void *context, |
void **return_value)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_get_devices(const char *HID, |
acpi_walk_callback user_function, |
void *context, |
void **return_value)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_get_name(acpi_handle object, u32 name_type, |
struct acpi_buffer *ret_path_ptr)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_get_handle(acpi_handle parent, |
acpi_string pathname, |
acpi_handle * ret_handle)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_attach_data(acpi_handle object, |
acpi_object_handler handler, |
void *data)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_detach_data(acpi_handle object, |
acpi_object_handler handler)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_get_data(acpi_handle object, |
acpi_object_handler handler, |
void **data)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_debug_trace(const char *name, u32 debug_level, |
u32 debug_layer, u32 flags)) |
/* |
* Object manipulation and enumeration |
*/ |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_evaluate_object(acpi_handle object, |
acpi_string pathname, |
struct acpi_object_list |
*parameter_objects, |
struct acpi_buffer |
*return_object_buffer)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_evaluate_object_typed(acpi_handle object, |
acpi_string pathname, |
struct acpi_object_list |
*external_params, |
struct acpi_buffer |
*return_buffer, |
acpi_object_type |
return_type)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_get_object_info(acpi_handle object, |
struct acpi_device_info |
**return_buffer)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_install_method(u8 *buffer)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_get_next_object(acpi_object_type type, |
acpi_handle parent, |
acpi_handle child, |
acpi_handle * out_handle)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_get_type(acpi_handle object, |
acpi_object_type * out_type)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_get_parent(acpi_handle object, |
acpi_handle * out_handle)) |
/* |
* Handler interfaces |
*/ |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_install_initialization_handler |
(acpi_init_handler handler, u32 function)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
acpi_install_sci_handler(acpi_sci_handler |
address, |
void *context)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
acpi_remove_sci_handler(acpi_sci_handler |
address)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
acpi_install_global_event_handler |
(acpi_gbl_event_handler handler, |
void *context)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
acpi_install_fixed_event_handler(u32 |
acpi_event, |
acpi_event_handler |
handler, |
void |
*context)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
acpi_remove_fixed_event_handler(u32 acpi_event, |
acpi_event_handler |
handler)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
acpi_install_gpe_handler(acpi_handle |
gpe_device, |
u32 gpe_number, |
u32 type, |
acpi_gpe_handler |
address, |
void *context)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
acpi_install_gpe_raw_handler(acpi_handle |
gpe_device, |
u32 gpe_number, |
u32 type, |
acpi_gpe_handler |
address, |
void *context)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
acpi_remove_gpe_handler(acpi_handle gpe_device, |
u32 gpe_number, |
acpi_gpe_handler |
address)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_install_notify_handler(acpi_handle device, |
u32 handler_type, |
acpi_notify_handler |
handler, |
void *context)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_remove_notify_handler(acpi_handle device, |
u32 handler_type, |
acpi_notify_handler |
handler)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_install_address_space_handler(acpi_handle |
device, |
acpi_adr_space_type |
space_id, |
acpi_adr_space_handler |
handler, |
acpi_adr_space_setup |
setup, |
void *context)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_remove_address_space_handler(acpi_handle |
device, |
acpi_adr_space_type |
space_id, |
acpi_adr_space_handler |
handler)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_install_exception_handler |
(acpi_exception_handler handler)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_install_interface_handler |
(acpi_interface_handler handler)) |
/* |
* Global Lock interfaces |
*/ |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
acpi_acquire_global_lock(u16 timeout, |
u32 *handle)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
acpi_release_global_lock(u32 handle)) |
/* |
* Interfaces to AML mutex objects |
*/ |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_acquire_mutex(acpi_handle handle, |
acpi_string pathname, |
u16 timeout)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_release_mutex(acpi_handle handle, |
acpi_string pathname)) |
/* |
* Fixed Event interfaces |
*/ |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
acpi_enable_event(u32 event, u32 flags)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
acpi_disable_event(u32 event, u32 flags)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_clear_event(u32 event)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
acpi_get_event_status(u32 event, |
acpi_event_status |
*event_status)) |
/* |
* General Purpose Event (GPE) Interfaces |
*/ |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_update_all_gpes(void)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
acpi_enable_gpe(acpi_handle gpe_device, |
u32 gpe_number)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
acpi_disable_gpe(acpi_handle gpe_device, |
u32 gpe_number)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
acpi_clear_gpe(acpi_handle gpe_device, |
u32 gpe_number)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
acpi_set_gpe(acpi_handle gpe_device, |
u32 gpe_number, u8 action)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
acpi_finish_gpe(acpi_handle gpe_device, |
u32 gpe_number)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
acpi_mark_gpe_for_wake(acpi_handle gpe_device, |
u32 gpe_number)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
acpi_setup_gpe_for_wake(acpi_handle |
parent_device, |
acpi_handle gpe_device, |
u32 gpe_number)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
acpi_set_gpe_wake_mask(acpi_handle gpe_device, |
u32 gpe_number, |
u8 action)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
acpi_get_gpe_status(acpi_handle gpe_device, |
u32 gpe_number, |
acpi_event_status |
*event_status)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_disable_all_gpes(void)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable_all_runtime_gpes(void)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable_all_wakeup_gpes(void)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
acpi_get_gpe_device(u32 gpe_index, |
acpi_handle * gpe_device)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
acpi_install_gpe_block(acpi_handle gpe_device, |
struct |
acpi_generic_address |
*gpe_block_address, |
u32 register_count, |
u32 interrupt_number)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
acpi_remove_gpe_block(acpi_handle gpe_device)) |
/* |
* Resource interfaces |
*/ |
typedef |
acpi_status(*acpi_walk_resource_callback) (struct acpi_resource * resource, |
void *context); |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_get_vendor_resource(acpi_handle device, |
char *name, |
struct acpi_vendor_uuid |
*uuid, |
struct acpi_buffer |
*ret_buffer)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_get_current_resources(acpi_handle device, |
struct acpi_buffer |
*ret_buffer)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_get_possible_resources(acpi_handle device, |
struct acpi_buffer |
*ret_buffer)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_get_event_resources(acpi_handle device_handle, |
struct acpi_buffer |
*ret_buffer)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_walk_resource_buffer(struct acpi_buffer |
*buffer, |
acpi_walk_resource_callback |
user_function, |
void *context)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_walk_resources(acpi_handle device, char *name, |
acpi_walk_resource_callback |
user_function, void *context)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_set_current_resources(acpi_handle device, |
struct acpi_buffer |
*in_buffer)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_get_irq_routing_table(acpi_handle device, |
struct acpi_buffer |
*ret_buffer)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_resource_to_address64(struct acpi_resource |
*resource, |
struct |
acpi_resource_address64 |
*out)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_buffer_to_resource(u8 *aml_buffer, |
u16 aml_buffer_length, |
struct acpi_resource |
**resource_ptr)) |
/* |
* Hardware (ACPI device) interfaces |
*/ |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_reset(void)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_read(u64 *value, |
struct acpi_generic_address *reg)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_write(u64 value, |
struct acpi_generic_address *reg)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
acpi_read_bit_register(u32 register_id, |
u32 *return_value)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
acpi_write_bit_register(u32 register_id, |
u32 value)) |
/* |
* Sleep/Wake interfaces |
*/ |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_get_sleep_type_data(u8 sleep_state, |
u8 *slp_typ_a, |
u8 *slp_typ_b)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_enter_sleep_state_prep(u8 sleep_state)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_enter_sleep_state(u8 sleep_state)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enter_sleep_state_s4bios(void)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_leave_sleep_state_prep(u8 sleep_state)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_leave_sleep_state(u8 sleep_state)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
acpi_set_firmware_waking_vectors |
(acpi_physical_address physical_address, |
acpi_physical_address physical_address64)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
acpi_set_firmware_waking_vector(u32 |
physical_address)) |
#if ACPI_MACHINE_WIDTH == 64 |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
acpi_set_firmware_waking_vector64(u64 |
physical_address)) |
#endif |
/* |
* ACPI Timer interfaces |
*/ |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
acpi_get_timer_resolution(u32 *resolution)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_get_timer(u32 *ticks)) |
ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status |
acpi_get_timer_duration(u32 start_ticks, |
u32 end_ticks, |
u32 *time_elapsed)) |
/* |
* Error/Warning output |
*/ |
ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3) |
void ACPI_INTERNAL_VAR_XFACE |
acpi_error(const char *module_name, |
u32 line_number, |
const char *format, ...)) |
ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(4) |
void ACPI_INTERNAL_VAR_XFACE |
acpi_exception(const char *module_name, |
u32 line_number, |
acpi_status status, |
const char *format, ...)) |
ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3) |
void ACPI_INTERNAL_VAR_XFACE |
acpi_warning(const char *module_name, |
u32 line_number, |
const char *format, ...)) |
ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3) |
void ACPI_INTERNAL_VAR_XFACE |
acpi_info(const char *module_name, |
u32 line_number, |
const char *format, ...)) |
ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3) |
void ACPI_INTERNAL_VAR_XFACE |
acpi_bios_error(const char *module_name, |
u32 line_number, |
const char *format, ...)) |
ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3) |
void ACPI_INTERNAL_VAR_XFACE |
acpi_bios_warning(const char *module_name, |
u32 line_number, |
const char *format, ...)) |
/* |
* Debug output |
*/ |
ACPI_DBG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(6) |
void ACPI_INTERNAL_VAR_XFACE |
acpi_debug_print(u32 requested_debug_level, |
u32 line_number, |
const char *function_name, |
const char *module_name, |
u32 component_id, |
const char *format, ...)) |
ACPI_DBG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(6) |
void ACPI_INTERNAL_VAR_XFACE |
acpi_debug_print_raw(u32 requested_debug_level, |
u32 line_number, |
const char *function_name, |
const char *module_name, |
u32 component_id, |
const char *format, ...)) |
ACPI_DBG_DEPENDENT_RETURN_VOID(void |
acpi_trace_point(acpi_trace_event_type type, |
u8 begin, |
u8 *aml, char *pathname)) |
ACPI_APP_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(1) |
void ACPI_INTERNAL_VAR_XFACE |
acpi_log_error(const char *format, ...)) |
acpi_status acpi_initialize_debugger(void); |
void acpi_terminate_debugger(void); |
/* |
* Divergences |
*/ |
ACPI_GLOBAL(u8, acpi_gbl_permanent_mmap); |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_get_table_with_size(acpi_string signature, |
u32 instance, |
struct acpi_table_header |
**out_table, |
acpi_size *tbl_size)) |
ACPI_EXTERNAL_RETURN_STATUS(acpi_status |
acpi_get_data_full(acpi_handle object, |
acpi_object_handler handler, |
void **data, |
void (*callback)(void *))) |
void acpi_set_debugger_thread_id(acpi_thread_id thread_id); |
#endif /* __ACXFACE_H__ */ |
/drivers/include/acpi/acrestyp.h |
---|
0,0 → 1,621 |
/****************************************************************************** |
* |
* Name: acrestyp.h - Defines, types, and structures for resource descriptors |
* |
*****************************************************************************/ |
/* |
* Copyright (C) 2000 - 2015, 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 __ACRESTYP_H__ |
#define __ACRESTYP_H__ |
/* |
* Definitions for Resource Attributes |
*/ |
typedef u16 acpi_rs_length; /* Resource Length field is fixed at 16 bits */ |
typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (Length+3) = (64K-1)+3 */ |
/* |
* Memory Attributes |
*/ |
#define ACPI_READ_ONLY_MEMORY (u8) 0x00 |
#define ACPI_READ_WRITE_MEMORY (u8) 0x01 |
#define ACPI_NON_CACHEABLE_MEMORY (u8) 0x00 |
#define ACPI_CACHABLE_MEMORY (u8) 0x01 |
#define ACPI_WRITE_COMBINING_MEMORY (u8) 0x02 |
#define ACPI_PREFETCHABLE_MEMORY (u8) 0x03 |
/*! [Begin] no source code translation */ |
/* |
* IO Attributes |
* The ISA IO ranges are: n000-n0FFh, n400-n4FFh, n800-n8FFh, nC00-nCFFh. |
* The non-ISA IO ranges are: n100-n3FFh, n500-n7FFh, n900-nBFFh, nCD0-nFFFh. |
*/ |
/*! [End] no source code translation !*/ |
#define ACPI_NON_ISA_ONLY_RANGES (u8) 0x01 |
#define ACPI_ISA_ONLY_RANGES (u8) 0x02 |
#define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES) |
/* Type of translation - 1=Sparse, 0=Dense */ |
#define ACPI_SPARSE_TRANSLATION (u8) 0x01 |
/* |
* IO Port Descriptor Decode |
*/ |
#define ACPI_DECODE_10 (u8) 0x00 /* 10-bit IO address decode */ |
#define ACPI_DECODE_16 (u8) 0x01 /* 16-bit IO address decode */ |
/* |
* Interrupt attributes - used in multiple descriptors |
*/ |
/* Triggering */ |
#define ACPI_LEVEL_SENSITIVE (u8) 0x00 |
#define ACPI_EDGE_SENSITIVE (u8) 0x01 |
/* Polarity */ |
#define ACPI_ACTIVE_HIGH (u8) 0x00 |
#define ACPI_ACTIVE_LOW (u8) 0x01 |
#define ACPI_ACTIVE_BOTH (u8) 0x02 |
/* Sharing */ |
#define ACPI_EXCLUSIVE (u8) 0x00 |
#define ACPI_SHARED (u8) 0x01 |
/* Wake */ |
#define ACPI_NOT_WAKE_CAPABLE (u8) 0x00 |
#define ACPI_WAKE_CAPABLE (u8) 0x01 |
/* |
* DMA Attributes |
*/ |
#define ACPI_COMPATIBILITY (u8) 0x00 |
#define ACPI_TYPE_A (u8) 0x01 |
#define ACPI_TYPE_B (u8) 0x02 |
#define ACPI_TYPE_F (u8) 0x03 |
#define ACPI_NOT_BUS_MASTER (u8) 0x00 |
#define ACPI_BUS_MASTER (u8) 0x01 |
#define ACPI_TRANSFER_8 (u8) 0x00 |
#define ACPI_TRANSFER_8_16 (u8) 0x01 |
#define ACPI_TRANSFER_16 (u8) 0x02 |
/* |
* Start Dependent Functions Priority definitions |
*/ |
#define ACPI_GOOD_CONFIGURATION (u8) 0x00 |
#define ACPI_ACCEPTABLE_CONFIGURATION (u8) 0x01 |
#define ACPI_SUB_OPTIMAL_CONFIGURATION (u8) 0x02 |
/* |
* 16, 32 and 64-bit Address Descriptor resource types |
*/ |
#define ACPI_MEMORY_RANGE (u8) 0x00 |
#define ACPI_IO_RANGE (u8) 0x01 |
#define ACPI_BUS_NUMBER_RANGE (u8) 0x02 |
#define ACPI_ADDRESS_NOT_FIXED (u8) 0x00 |
#define ACPI_ADDRESS_FIXED (u8) 0x01 |
#define ACPI_POS_DECODE (u8) 0x00 |
#define ACPI_SUB_DECODE (u8) 0x01 |
/* Producer/Consumer */ |
#define ACPI_PRODUCER (u8) 0x00 |
#define ACPI_CONSUMER (u8) 0x01 |
/* |
* If possible, pack the following structures to byte alignment |
*/ |
#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED |
#pragma pack(1) |
#endif |
/* UUID data structures for use in vendor-defined resource descriptors */ |
struct acpi_uuid { |
u8 data[ACPI_UUID_LENGTH]; |
}; |
struct acpi_vendor_uuid { |
u8 subtype; |
u8 data[ACPI_UUID_LENGTH]; |
}; |
/* |
* Structures used to describe device resources |
*/ |
struct acpi_resource_irq { |
u8 descriptor_length; |
u8 triggering; |
u8 polarity; |
u8 sharable; |
u8 wake_capable; |
u8 interrupt_count; |
u8 interrupts[1]; |
}; |
struct acpi_resource_dma { |
u8 type; |
u8 bus_master; |
u8 transfer; |
u8 channel_count; |
u8 channels[1]; |
}; |
struct acpi_resource_start_dependent { |
u8 descriptor_length; |
u8 compatibility_priority; |
u8 performance_robustness; |
}; |
/* |
* The END_DEPENDENT_FUNCTIONS_RESOURCE struct is not |
* needed because it has no fields |
*/ |
struct acpi_resource_io { |
u8 io_decode; |
u8 alignment; |
u8 address_length; |
u16 minimum; |
u16 maximum; |
}; |
struct acpi_resource_fixed_io { |
u16 address; |
u8 address_length; |
}; |
struct acpi_resource_fixed_dma { |
u16 request_lines; |
u16 channels; |
u8 width; |
}; |
/* Values for Width field above */ |
#define ACPI_DMA_WIDTH8 0 |
#define ACPI_DMA_WIDTH16 1 |
#define ACPI_DMA_WIDTH32 2 |
#define ACPI_DMA_WIDTH64 3 |
#define ACPI_DMA_WIDTH128 4 |
#define ACPI_DMA_WIDTH256 5 |
struct acpi_resource_vendor { |
u16 byte_length; |
u8 byte_data[1]; |
}; |
/* Vendor resource with UUID info (introduced in ACPI 3.0) */ |
struct acpi_resource_vendor_typed { |
u16 byte_length; |
u8 uuid_subtype; |
u8 uuid[ACPI_UUID_LENGTH]; |
u8 byte_data[1]; |
}; |
struct acpi_resource_end_tag { |
u8 checksum; |
}; |
struct acpi_resource_memory24 { |
u8 write_protect; |
u16 minimum; |
u16 maximum; |
u16 alignment; |
u16 address_length; |
}; |
struct acpi_resource_memory32 { |
u8 write_protect; |
u32 minimum; |
u32 maximum; |
u32 alignment; |
u32 address_length; |
}; |
struct acpi_resource_fixed_memory32 { |
u8 write_protect; |
u32 address; |
u32 address_length; |
}; |
struct acpi_memory_attribute { |
u8 write_protect; |
u8 caching; |
u8 range_type; |
u8 translation; |
}; |
struct acpi_io_attribute { |
u8 range_type; |
u8 translation; |
u8 translation_type; |
u8 reserved1; |
}; |
union acpi_resource_attribute { |
struct acpi_memory_attribute mem; |
struct acpi_io_attribute io; |
/* Used for the *word_space macros */ |
u8 type_specific; |
}; |
struct acpi_resource_source { |
u8 index; |
u16 string_length; |
char *string_ptr; |
}; |
/* Fields common to all address descriptors, 16/32/64 bit */ |
#define ACPI_RESOURCE_ADDRESS_COMMON \ |
u8 resource_type; \ |
u8 producer_consumer; \ |
u8 decode; \ |
u8 min_address_fixed; \ |
u8 max_address_fixed; \ |
union acpi_resource_attribute info; |
struct acpi_address16_attribute { |
u16 granularity; |
u16 minimum; |
u16 maximum; |
u16 translation_offset; |
u16 address_length; |
}; |
struct acpi_address32_attribute { |
u32 granularity; |
u32 minimum; |
u32 maximum; |
u32 translation_offset; |
u32 address_length; |
}; |
struct acpi_address64_attribute { |
u64 granularity; |
u64 minimum; |
u64 maximum; |
u64 translation_offset; |
u64 address_length; |
}; |
struct acpi_resource_address { |
ACPI_RESOURCE_ADDRESS_COMMON}; |
struct acpi_resource_address16 { |
ACPI_RESOURCE_ADDRESS_COMMON struct acpi_address16_attribute address; |
struct acpi_resource_source resource_source; |
}; |
struct acpi_resource_address32 { |
ACPI_RESOURCE_ADDRESS_COMMON struct acpi_address32_attribute address; |
struct acpi_resource_source resource_source; |
}; |
struct acpi_resource_address64 { |
ACPI_RESOURCE_ADDRESS_COMMON struct acpi_address64_attribute address; |
struct acpi_resource_source resource_source; |
}; |
struct acpi_resource_extended_address64 { |
ACPI_RESOURCE_ADDRESS_COMMON u8 revision_ID; |
struct acpi_address64_attribute address; |
u64 type_specific; |
}; |
struct acpi_resource_extended_irq { |
u8 producer_consumer; |
u8 triggering; |
u8 polarity; |
u8 sharable; |
u8 wake_capable; |
u8 interrupt_count; |
struct acpi_resource_source resource_source; |
u32 interrupts[1]; |
}; |
struct acpi_resource_generic_register { |
u8 space_id; |
u8 bit_width; |
u8 bit_offset; |
u8 access_size; |
u64 address; |
}; |
struct acpi_resource_gpio { |
u8 revision_id; |
u8 connection_type; |
u8 producer_consumer; /* For values, see Producer/Consumer above */ |
u8 pin_config; |
u8 sharable; /* For values, see Interrupt Attributes above */ |
u8 wake_capable; /* For values, see Interrupt Attributes above */ |
u8 io_restriction; |
u8 triggering; /* For values, see Interrupt Attributes above */ |
u8 polarity; /* For values, see Interrupt Attributes above */ |
u16 drive_strength; |
u16 debounce_timeout; |
u16 pin_table_length; |
u16 vendor_length; |
struct acpi_resource_source resource_source; |
u16 *pin_table; |
u8 *vendor_data; |
}; |
/* Values for GPIO connection_type field above */ |
#define ACPI_RESOURCE_GPIO_TYPE_INT 0 |
#define ACPI_RESOURCE_GPIO_TYPE_IO 1 |
/* Values for pin_config field above */ |
#define ACPI_PIN_CONFIG_DEFAULT 0 |
#define ACPI_PIN_CONFIG_PULLUP 1 |
#define ACPI_PIN_CONFIG_PULLDOWN 2 |
#define ACPI_PIN_CONFIG_NOPULL 3 |
/* Values for io_restriction field above */ |
#define ACPI_IO_RESTRICT_NONE 0 |
#define ACPI_IO_RESTRICT_INPUT 1 |
#define ACPI_IO_RESTRICT_OUTPUT 2 |
#define ACPI_IO_RESTRICT_NONE_PRESERVE 3 |
/* Common structure for I2C, SPI, and UART serial descriptors */ |
#define ACPI_RESOURCE_SERIAL_COMMON \ |
u8 revision_id; \ |
u8 type; \ |
u8 producer_consumer; /* For values, see Producer/Consumer above */\ |
u8 slave_mode; \ |
u8 type_revision_id; \ |
u16 type_data_length; \ |
u16 vendor_length; \ |
struct acpi_resource_source resource_source; \ |
u8 *vendor_data; |
struct acpi_resource_common_serialbus { |
ACPI_RESOURCE_SERIAL_COMMON}; |
/* Values for the Type field above */ |
#define ACPI_RESOURCE_SERIAL_TYPE_I2C 1 |
#define ACPI_RESOURCE_SERIAL_TYPE_SPI 2 |
#define ACPI_RESOURCE_SERIAL_TYPE_UART 3 |
/* Values for slave_mode field above */ |
#define ACPI_CONTROLLER_INITIATED 0 |
#define ACPI_DEVICE_INITIATED 1 |
struct acpi_resource_i2c_serialbus { |
ACPI_RESOURCE_SERIAL_COMMON u8 access_mode; |
u16 slave_address; |
u32 connection_speed; |
}; |
/* Values for access_mode field above */ |
#define ACPI_I2C_7BIT_MODE 0 |
#define ACPI_I2C_10BIT_MODE 1 |
struct acpi_resource_spi_serialbus { |
ACPI_RESOURCE_SERIAL_COMMON u8 wire_mode; |
u8 device_polarity; |
u8 data_bit_length; |
u8 clock_phase; |
u8 clock_polarity; |
u16 device_selection; |
u32 connection_speed; |
}; |
/* Values for wire_mode field above */ |
#define ACPI_SPI_4WIRE_MODE 0 |
#define ACPI_SPI_3WIRE_MODE 1 |
/* Values for device_polarity field above */ |
#define ACPI_SPI_ACTIVE_LOW 0 |
#define ACPI_SPI_ACTIVE_HIGH 1 |
/* Values for clock_phase field above */ |
#define ACPI_SPI_FIRST_PHASE 0 |
#define ACPI_SPI_SECOND_PHASE 1 |
/* Values for clock_polarity field above */ |
#define ACPI_SPI_START_LOW 0 |
#define ACPI_SPI_START_HIGH 1 |
struct acpi_resource_uart_serialbus { |
ACPI_RESOURCE_SERIAL_COMMON u8 endian; |
u8 data_bits; |
u8 stop_bits; |
u8 flow_control; |
u8 parity; |
u8 lines_enabled; |
u16 rx_fifo_size; |
u16 tx_fifo_size; |
u32 default_baud_rate; |
}; |
/* Values for Endian field above */ |
#define ACPI_UART_LITTLE_ENDIAN 0 |
#define ACPI_UART_BIG_ENDIAN 1 |
/* Values for data_bits field above */ |
#define ACPI_UART_5_DATA_BITS 0 |
#define ACPI_UART_6_DATA_BITS 1 |
#define ACPI_UART_7_DATA_BITS 2 |
#define ACPI_UART_8_DATA_BITS 3 |
#define ACPI_UART_9_DATA_BITS 4 |
/* Values for stop_bits field above */ |
#define ACPI_UART_NO_STOP_BITS 0 |
#define ACPI_UART_1_STOP_BIT 1 |
#define ACPI_UART_1P5_STOP_BITS 2 |
#define ACPI_UART_2_STOP_BITS 3 |
/* Values for flow_control field above */ |
#define ACPI_UART_FLOW_CONTROL_NONE 0 |
#define ACPI_UART_FLOW_CONTROL_HW 1 |
#define ACPI_UART_FLOW_CONTROL_XON_XOFF 2 |
/* Values for Parity field above */ |
#define ACPI_UART_PARITY_NONE 0 |
#define ACPI_UART_PARITY_EVEN 1 |
#define ACPI_UART_PARITY_ODD 2 |
#define ACPI_UART_PARITY_MARK 3 |
#define ACPI_UART_PARITY_SPACE 4 |
/* Values for lines_enabled bitfield above */ |
#define ACPI_UART_CARRIER_DETECT (1<<2) |
#define ACPI_UART_RING_INDICATOR (1<<3) |
#define ACPI_UART_DATA_SET_READY (1<<4) |
#define ACPI_UART_DATA_TERMINAL_READY (1<<5) |
#define ACPI_UART_CLEAR_TO_SEND (1<<6) |
#define ACPI_UART_REQUEST_TO_SEND (1<<7) |
/* ACPI_RESOURCE_TYPEs */ |
#define ACPI_RESOURCE_TYPE_IRQ 0 |
#define ACPI_RESOURCE_TYPE_DMA 1 |
#define ACPI_RESOURCE_TYPE_START_DEPENDENT 2 |
#define ACPI_RESOURCE_TYPE_END_DEPENDENT 3 |
#define ACPI_RESOURCE_TYPE_IO 4 |
#define ACPI_RESOURCE_TYPE_FIXED_IO 5 |
#define ACPI_RESOURCE_TYPE_VENDOR 6 |
#define ACPI_RESOURCE_TYPE_END_TAG 7 |
#define ACPI_RESOURCE_TYPE_MEMORY24 8 |
#define ACPI_RESOURCE_TYPE_MEMORY32 9 |
#define ACPI_RESOURCE_TYPE_FIXED_MEMORY32 10 |
#define ACPI_RESOURCE_TYPE_ADDRESS16 11 |
#define ACPI_RESOURCE_TYPE_ADDRESS32 12 |
#define ACPI_RESOURCE_TYPE_ADDRESS64 13 |
#define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */ |
#define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15 |
#define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16 |
#define ACPI_RESOURCE_TYPE_GPIO 17 /* ACPI 5.0 */ |
#define ACPI_RESOURCE_TYPE_FIXED_DMA 18 /* ACPI 5.0 */ |
#define ACPI_RESOURCE_TYPE_SERIAL_BUS 19 /* ACPI 5.0 */ |
#define ACPI_RESOURCE_TYPE_MAX 19 |
/* Master union for resource descriptors */ |
union acpi_resource_data { |
struct acpi_resource_irq irq; |
struct acpi_resource_dma dma; |
struct acpi_resource_start_dependent start_dpf; |
struct acpi_resource_io io; |
struct acpi_resource_fixed_io fixed_io; |
struct acpi_resource_fixed_dma fixed_dma; |
struct acpi_resource_vendor vendor; |
struct acpi_resource_vendor_typed vendor_typed; |
struct acpi_resource_end_tag end_tag; |
struct acpi_resource_memory24 memory24; |
struct acpi_resource_memory32 memory32; |
struct acpi_resource_fixed_memory32 fixed_memory32; |
struct acpi_resource_address16 address16; |
struct acpi_resource_address32 address32; |
struct acpi_resource_address64 address64; |
struct acpi_resource_extended_address64 ext_address64; |
struct acpi_resource_extended_irq extended_irq; |
struct acpi_resource_generic_register generic_reg; |
struct acpi_resource_gpio gpio; |
struct acpi_resource_i2c_serialbus i2c_serial_bus; |
struct acpi_resource_spi_serialbus spi_serial_bus; |
struct acpi_resource_uart_serialbus uart_serial_bus; |
struct acpi_resource_common_serialbus common_serial_bus; |
/* Common fields */ |
struct acpi_resource_address address; /* Common 16/32/64 address fields */ |
}; |
/* Common resource header */ |
struct acpi_resource { |
u32 type; |
u32 length; |
union acpi_resource_data data; |
}; |
/* restore default alignment */ |
#pragma pack() |
#define ACPI_RS_SIZE_NO_DATA 8 /* Id + Length fields */ |
#define ACPI_RS_SIZE_MIN (u32) ACPI_ROUND_UP_TO_NATIVE_WORD (12) |
#define ACPI_RS_SIZE(type) (u32) (ACPI_RS_SIZE_NO_DATA + sizeof (type)) |
/* Macro for walking resource templates with multiple descriptors */ |
#define ACPI_NEXT_RESOURCE(res) \ |
ACPI_ADD_PTR (struct acpi_resource, (res), (res)->length) |
struct acpi_pci_routing_table { |
u32 length; |
u32 pin; |
u64 address; /* here for 64-bit alignment */ |
u32 source_index; |
char source[4]; /* pad to 64 bits so sizeof() works in all cases */ |
}; |
#endif /* __ACRESTYP_H__ */ |
/drivers/include/acpi/actbl.h |
---|
0,0 → 1,416 |
/****************************************************************************** |
* |
* Name: actbl.h - Basic ACPI Table Definitions |
* |
*****************************************************************************/ |
/* |
* Copyright (C) 2000 - 2015, 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 __ACTBL_H__ |
#define __ACTBL_H__ |
/******************************************************************************* |
* |
* Fundamental ACPI tables |
* |
* This file contains definitions for the ACPI tables that are directly consumed |
* by ACPICA. All other tables are consumed by the OS-dependent ACPI-related |
* device drivers and other OS support code. |
* |
* The RSDP and FACS do not use the common ACPI table header. All other ACPI |
* tables use the header. |
* |
******************************************************************************/ |
/* |
* Values for description table header signatures for tables defined in this |
* file. Useful because they make it more difficult to inadvertently type in |
* the wrong signature. |
*/ |
#define ACPI_SIG_DSDT "DSDT" /* Differentiated System Description Table */ |
#define ACPI_SIG_FADT "FACP" /* Fixed ACPI Description Table */ |
#define ACPI_SIG_FACS "FACS" /* Firmware ACPI Control Structure */ |
#define ACPI_SIG_OSDT "OSDT" /* Override System Description Table */ |
#define ACPI_SIG_PSDT "PSDT" /* Persistent System Description Table */ |
#define ACPI_SIG_RSDP "RSD PTR " /* Root System Description Pointer */ |
#define ACPI_SIG_RSDT "RSDT" /* Root System Description Table */ |
#define ACPI_SIG_XSDT "XSDT" /* Extended System Description Table */ |
#define ACPI_SIG_SSDT "SSDT" /* Secondary System Description Table */ |
#define ACPI_RSDP_NAME "RSDP" /* Short name for RSDP, not signature */ |
/* |
* All tables and structures must be byte-packed to match the ACPI |
* specification, since the tables are provided by the system BIOS |
*/ |
#pragma pack(1) |
/* |
* Note: C bitfields are not used for this reason: |
* |
* "Bitfields are great and easy to read, but unfortunately the C language |
* does not specify the layout of bitfields in memory, which means they are |
* essentially useless for dealing with packed data in on-disk formats or |
* binary wire protocols." (Or ACPI tables and buffers.) "If you ask me, |
* this decision was a design error in C. Ritchie could have picked an order |
* and stuck with it." Norman Ramsey. |
* See http://stackoverflow.com/a/1053662/41661 |
*/ |
/******************************************************************************* |
* |
* Master ACPI Table Header. This common header is used by all ACPI tables |
* except the RSDP and FACS. |
* |
******************************************************************************/ |
struct acpi_table_header { |
char signature[ACPI_NAME_SIZE]; /* ASCII table signature */ |
u32 length; /* Length of table in bytes, including this header */ |
u8 revision; /* ACPI Specification minor version number */ |
u8 checksum; /* To make sum of entire table == 0 */ |
char oem_id[ACPI_OEM_ID_SIZE]; /* ASCII OEM identification */ |
char oem_table_id[ACPI_OEM_TABLE_ID_SIZE]; /* ASCII OEM table identification */ |
u32 oem_revision; /* OEM revision number */ |
char asl_compiler_id[ACPI_NAME_SIZE]; /* ASCII ASL compiler vendor ID */ |
u32 asl_compiler_revision; /* ASL compiler version */ |
}; |
/******************************************************************************* |
* |
* GAS - Generic Address Structure (ACPI 2.0+) |
* |
* Note: Since this structure is used in the ACPI tables, it is byte aligned. |
* If misaligned access is not supported by the hardware, accesses to the |
* 64-bit Address field must be performed with care. |
* |
******************************************************************************/ |
struct acpi_generic_address { |
u8 space_id; /* Address space where struct or register exists */ |
u8 bit_width; /* Size in bits of given register */ |
u8 bit_offset; /* Bit offset within the register */ |
u8 access_width; /* Minimum Access size (ACPI 3.0) */ |
u64 address; /* 64-bit address of struct or register */ |
}; |
/******************************************************************************* |
* |
* RSDP - Root System Description Pointer (Signature is "RSD PTR ") |
* Version 2 |
* |
******************************************************************************/ |
struct acpi_table_rsdp { |
char signature[8]; /* ACPI signature, contains "RSD PTR " */ |
u8 checksum; /* ACPI 1.0 checksum */ |
char oem_id[ACPI_OEM_ID_SIZE]; /* OEM identification */ |
u8 revision; /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */ |
u32 rsdt_physical_address; /* 32-bit physical address of the RSDT */ |
u32 length; /* Table length in bytes, including header (ACPI 2.0+) */ |
u64 xsdt_physical_address; /* 64-bit physical address of the XSDT (ACPI 2.0+) */ |
u8 extended_checksum; /* Checksum of entire table (ACPI 2.0+) */ |
u8 reserved[3]; /* Reserved, must be zero */ |
}; |
/* Standalone struct for the ACPI 1.0 RSDP */ |
struct acpi_rsdp_common { |
char signature[8]; |
u8 checksum; |
char oem_id[ACPI_OEM_ID_SIZE]; |
u8 revision; |
u32 rsdt_physical_address; |
}; |
/* Standalone struct for the extended part of the RSDP (ACPI 2.0+) */ |
struct acpi_rsdp_extension { |
u32 length; |
u64 xsdt_physical_address; |
u8 extended_checksum; |
u8 reserved[3]; |
}; |
/******************************************************************************* |
* |
* RSDT/XSDT - Root System Description Tables |
* Version 1 (both) |
* |
******************************************************************************/ |
struct acpi_table_rsdt { |
struct acpi_table_header header; /* Common ACPI table header */ |
u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */ |
}; |
struct acpi_table_xsdt { |
struct acpi_table_header header; /* Common ACPI table header */ |
u64 table_offset_entry[1]; /* Array of pointers to ACPI tables */ |
}; |
#define ACPI_RSDT_ENTRY_SIZE (sizeof (u32)) |
#define ACPI_XSDT_ENTRY_SIZE (sizeof (u64)) |
/******************************************************************************* |
* |
* FACS - Firmware ACPI Control Structure (FACS) |
* |
******************************************************************************/ |
struct acpi_table_facs { |
char signature[4]; /* ASCII table signature */ |
u32 length; /* Length of structure, in bytes */ |
u32 hardware_signature; /* Hardware configuration signature */ |
u32 firmware_waking_vector; /* 32-bit physical address of the Firmware Waking Vector */ |
u32 global_lock; /* Global Lock for shared hardware resources */ |
u32 flags; |
u64 xfirmware_waking_vector; /* 64-bit version of the Firmware Waking Vector (ACPI 2.0+) */ |
u8 version; /* Version of this table (ACPI 2.0+) */ |
u8 reserved[3]; /* Reserved, must be zero */ |
u32 ospm_flags; /* Flags to be set by OSPM (ACPI 4.0) */ |
u8 reserved1[24]; /* Reserved, must be zero */ |
}; |
/* Masks for global_lock flag field above */ |
#define ACPI_GLOCK_PENDING (1) /* 00: Pending global lock ownership */ |
#define ACPI_GLOCK_OWNED (1<<1) /* 01: Global lock is owned */ |
/* Masks for Flags field above */ |
#define ACPI_FACS_S4_BIOS_PRESENT (1) /* 00: S4BIOS support is present */ |
#define ACPI_FACS_64BIT_WAKE (1<<1) /* 01: 64-bit wake vector supported (ACPI 4.0) */ |
/* Masks for ospm_flags field above */ |
#define ACPI_FACS_64BIT_ENVIRONMENT (1) /* 00: 64-bit wake environment is required (ACPI 4.0) */ |
/******************************************************************************* |
* |
* FADT - Fixed ACPI Description Table (Signature "FACP") |
* Version 4 |
* |
******************************************************************************/ |
/* Fields common to all versions of the FADT */ |
struct acpi_table_fadt { |
struct acpi_table_header header; /* Common ACPI table header */ |
u32 facs; /* 32-bit physical address of FACS */ |
u32 dsdt; /* 32-bit physical address of DSDT */ |
u8 model; /* System Interrupt Model (ACPI 1.0) - not used in ACPI 2.0+ */ |
u8 preferred_profile; /* Conveys preferred power management profile to OSPM. */ |
u16 sci_interrupt; /* System vector of SCI interrupt */ |
u32 smi_command; /* 32-bit Port address of SMI command port */ |
u8 acpi_enable; /* Value to write to SMI_CMD to enable ACPI */ |
u8 acpi_disable; /* Value to write to SMI_CMD to disable ACPI */ |
u8 s4_bios_request; /* Value to write to SMI_CMD to enter S4BIOS state */ |
u8 pstate_control; /* Processor performance state control */ |
u32 pm1a_event_block; /* 32-bit port address of Power Mgt 1a Event Reg Blk */ |
u32 pm1b_event_block; /* 32-bit port address of Power Mgt 1b Event Reg Blk */ |
u32 pm1a_control_block; /* 32-bit port address of Power Mgt 1a Control Reg Blk */ |
u32 pm1b_control_block; /* 32-bit port address of Power Mgt 1b Control Reg Blk */ |
u32 pm2_control_block; /* 32-bit port address of Power Mgt 2 Control Reg Blk */ |
u32 pm_timer_block; /* 32-bit port address of Power Mgt Timer Ctrl Reg Blk */ |
u32 gpe0_block; /* 32-bit port address of General Purpose Event 0 Reg Blk */ |
u32 gpe1_block; /* 32-bit port address of General Purpose Event 1 Reg Blk */ |
u8 pm1_event_length; /* Byte Length of ports at pm1x_event_block */ |
u8 pm1_control_length; /* Byte Length of ports at pm1x_control_block */ |
u8 pm2_control_length; /* Byte Length of ports at pm2_control_block */ |
u8 pm_timer_length; /* Byte Length of ports at pm_timer_block */ |
u8 gpe0_block_length; /* Byte Length of ports at gpe0_block */ |
u8 gpe1_block_length; /* Byte Length of ports at gpe1_block */ |
u8 gpe1_base; /* Offset in GPE number space where GPE1 events start */ |
u8 cst_control; /* Support for the _CST object and C-States change notification */ |
u16 c2_latency; /* Worst case HW latency to enter/exit C2 state */ |
u16 c3_latency; /* Worst case HW latency to enter/exit C3 state */ |
u16 flush_size; /* Processor memory cache line width, in bytes */ |
u16 flush_stride; /* Number of flush strides that need to be read */ |
u8 duty_offset; /* Processor duty cycle index in processor P_CNT reg */ |
u8 duty_width; /* Processor duty cycle value bit width in P_CNT register */ |
u8 day_alarm; /* Index to day-of-month alarm in RTC CMOS RAM */ |
u8 month_alarm; /* Index to month-of-year alarm in RTC CMOS RAM */ |
u8 century; /* Index to century in RTC CMOS RAM */ |
u16 boot_flags; /* IA-PC Boot Architecture Flags (see below for individual flags) */ |
u8 reserved; /* Reserved, must be zero */ |
u32 flags; /* Miscellaneous flag bits (see below for individual flags) */ |
struct acpi_generic_address reset_register; /* 64-bit address of the Reset register */ |
u8 reset_value; /* Value to write to the reset_register port to reset the system */ |
u16 arm_boot_flags; /* ARM-Specific Boot Flags (see below for individual flags) (ACPI 5.1) */ |
u8 minor_revision; /* FADT Minor Revision (ACPI 5.1) */ |
u64 Xfacs; /* 64-bit physical address of FACS */ |
u64 Xdsdt; /* 64-bit physical address of DSDT */ |
struct acpi_generic_address xpm1a_event_block; /* 64-bit Extended Power Mgt 1a Event Reg Blk address */ |
struct acpi_generic_address xpm1b_event_block; /* 64-bit Extended Power Mgt 1b Event Reg Blk address */ |
struct acpi_generic_address xpm1a_control_block; /* 64-bit Extended Power Mgt 1a Control Reg Blk address */ |
struct acpi_generic_address xpm1b_control_block; /* 64-bit Extended Power Mgt 1b Control Reg Blk address */ |
struct acpi_generic_address xpm2_control_block; /* 64-bit Extended Power Mgt 2 Control Reg Blk address */ |
struct acpi_generic_address xpm_timer_block; /* 64-bit Extended Power Mgt Timer Ctrl Reg Blk address */ |
struct acpi_generic_address xgpe0_block; /* 64-bit Extended General Purpose Event 0 Reg Blk address */ |
struct acpi_generic_address xgpe1_block; /* 64-bit Extended General Purpose Event 1 Reg Blk address */ |
struct acpi_generic_address sleep_control; /* 64-bit Sleep Control register (ACPI 5.0) */ |
struct acpi_generic_address sleep_status; /* 64-bit Sleep Status register (ACPI 5.0) */ |
u64 hypervisor_id; /* Hypervisor Vendor ID (ACPI 6.0) */ |
}; |
/* Masks for FADT IA-PC Boot Architecture Flags (boot_flags) [Vx]=Introduced in this FADT revision */ |
#define ACPI_FADT_LEGACY_DEVICES (1) /* 00: [V2] System has LPC or ISA bus devices */ |
#define ACPI_FADT_8042 (1<<1) /* 01: [V3] System has an 8042 controller on port 60/64 */ |
#define ACPI_FADT_NO_VGA (1<<2) /* 02: [V4] It is not safe to probe for VGA hardware */ |
#define ACPI_FADT_NO_MSI (1<<3) /* 03: [V4] Message Signaled Interrupts (MSI) must not be enabled */ |
#define ACPI_FADT_NO_ASPM (1<<4) /* 04: [V4] PCIe ASPM control must not be enabled */ |
#define ACPI_FADT_NO_CMOS_RTC (1<<5) /* 05: [V5] No CMOS real-time clock present */ |
#define FADT2_REVISION_ID 3 |
/* Masks for FADT ARM Boot Architecture Flags (arm_boot_flags) ACPI 5.1 */ |
#define ACPI_FADT_PSCI_COMPLIANT (1) /* 00: [V5+] PSCI 0.2+ is implemented */ |
#define ACPI_FADT_PSCI_USE_HVC (1<<1) /* 01: [V5+] HVC must be used instead of SMC as the PSCI conduit */ |
/* Masks for FADT flags */ |
#define ACPI_FADT_WBINVD (1) /* 00: [V1] The WBINVD instruction works properly */ |
#define ACPI_FADT_WBINVD_FLUSH (1<<1) /* 01: [V1] WBINVD flushes but does not invalidate caches */ |
#define ACPI_FADT_C1_SUPPORTED (1<<2) /* 02: [V1] All processors support C1 state */ |
#define ACPI_FADT_C2_MP_SUPPORTED (1<<3) /* 03: [V1] C2 state works on MP system */ |
#define ACPI_FADT_POWER_BUTTON (1<<4) /* 04: [V1] Power button is handled as a control method device */ |
#define ACPI_FADT_SLEEP_BUTTON (1<<5) /* 05: [V1] Sleep button is handled as a control method device */ |
#define ACPI_FADT_FIXED_RTC (1<<6) /* 06: [V1] RTC wakeup status is not in fixed register space */ |
#define ACPI_FADT_S4_RTC_WAKE (1<<7) /* 07: [V1] RTC alarm can wake system from S4 */ |
#define ACPI_FADT_32BIT_TIMER (1<<8) /* 08: [V1] ACPI timer width is 32-bit (0=24-bit) */ |
#define ACPI_FADT_DOCKING_SUPPORTED (1<<9) /* 09: [V1] Docking supported */ |
#define ACPI_FADT_RESET_REGISTER (1<<10) /* 10: [V2] System reset via the FADT RESET_REG supported */ |
#define ACPI_FADT_SEALED_CASE (1<<11) /* 11: [V3] No internal expansion capabilities and case is sealed */ |
#define ACPI_FADT_HEADLESS (1<<12) /* 12: [V3] No local video capabilities or local input devices */ |
#define ACPI_FADT_SLEEP_TYPE (1<<13) /* 13: [V3] Must execute native instruction after writing SLP_TYPx register */ |
#define ACPI_FADT_PCI_EXPRESS_WAKE (1<<14) /* 14: [V4] System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */ |
#define ACPI_FADT_PLATFORM_CLOCK (1<<15) /* 15: [V4] OSPM should use platform-provided timer (ACPI 3.0) */ |
#define ACPI_FADT_S4_RTC_VALID (1<<16) /* 16: [V4] Contents of RTC_STS valid after S4 wake (ACPI 3.0) */ |
#define ACPI_FADT_REMOTE_POWER_ON (1<<17) /* 17: [V4] System is compatible with remote power on (ACPI 3.0) */ |
#define ACPI_FADT_APIC_CLUSTER (1<<18) /* 18: [V4] All local APICs must use cluster model (ACPI 3.0) */ |
#define ACPI_FADT_APIC_PHYSICAL (1<<19) /* 19: [V4] All local xAPICs must use physical dest mode (ACPI 3.0) */ |
#define ACPI_FADT_HW_REDUCED (1<<20) /* 20: [V5] ACPI hardware is not implemented (ACPI 5.0) */ |
#define ACPI_FADT_LOW_POWER_S0 (1<<21) /* 21: [V5] S0 power savings are equal or better than S3 (ACPI 5.0) */ |
/* Values for preferred_profile (Preferred Power Management Profiles) */ |
enum acpi_preferred_pm_profiles { |
PM_UNSPECIFIED = 0, |
PM_DESKTOP = 1, |
PM_MOBILE = 2, |
PM_WORKSTATION = 3, |
PM_ENTERPRISE_SERVER = 4, |
PM_SOHO_SERVER = 5, |
PM_APPLIANCE_PC = 6, |
PM_PERFORMANCE_SERVER = 7, |
PM_TABLET = 8 |
}; |
/* Values for sleep_status and sleep_control registers (V5+ FADT) */ |
#define ACPI_X_WAKE_STATUS 0x80 |
#define ACPI_X_SLEEP_TYPE_MASK 0x1C |
#define ACPI_X_SLEEP_TYPE_POSITION 0x02 |
#define ACPI_X_SLEEP_ENABLE 0x20 |
/* Reset to default packing */ |
#pragma pack() |
/* |
* Internal table-related structures |
*/ |
union acpi_name_union { |
u32 integer; |
char ascii[4]; |
}; |
/* Internal ACPI Table Descriptor. One per ACPI table. */ |
struct acpi_table_desc { |
acpi_physical_address address; |
struct acpi_table_header *pointer; |
u32 length; /* Length fixed at 32 bits (fixed in table header) */ |
union acpi_name_union signature; |
acpi_owner_id owner_id; |
u8 flags; |
}; |
/* Masks for Flags field above */ |
#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) |
/* |
* Get the remaining ACPI tables |
*/ |
#include <acpi/actbl1.h> |
#include <acpi/actbl2.h> |
#include <acpi/actbl3.h> |
/* Macros used to generate offsets to specific table fields */ |
#define ACPI_FADT_OFFSET(f) (u16) ACPI_OFFSET (struct acpi_table_fadt, f) |
/* |
* Sizes of the various flavors of FADT. We need to look closely |
* at the FADT length because the version number essentially tells |
* us nothing because of many BIOS bugs where the version does not |
* match the expected length. In other words, the length of the |
* FADT is the bottom line as to what the version really is. |
* |
* For reference, the values below are as follows: |
* FADT V1 size: 0x074 |
* FADT V2 size: 0x084 |
* FADT V3 size: 0x0F4 |
* FADT V4 size: 0x0F4 |
* FADT V5 size: 0x10C |
* FADT V6 size: 0x114 |
*/ |
#define ACPI_FADT_V1_SIZE (u32) (ACPI_FADT_OFFSET (flags) + 4) |
#define ACPI_FADT_V2_SIZE (u32) (ACPI_FADT_OFFSET (minor_revision) + 1) |
#define ACPI_FADT_V3_SIZE (u32) (ACPI_FADT_OFFSET (sleep_control)) |
#define ACPI_FADT_V5_SIZE (u32) (ACPI_FADT_OFFSET (hypervisor_id)) |
#define ACPI_FADT_V6_SIZE (u32) (sizeof (struct acpi_table_fadt)) |
#endif /* __ACTBL_H__ */ |
/drivers/include/acpi/actbl1.h |
---|
0,0 → 1,1211 |
/****************************************************************************** |
* |
* Name: actbl1.h - Additional ACPI table definitions |
* |
*****************************************************************************/ |
/* |
* Copyright (C) 2000 - 2015, 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 __ACTBL1_H__ |
#define __ACTBL1_H__ |
/******************************************************************************* |
* |
* Additional ACPI Tables (1) |
* |
* These tables are not consumed directly by the ACPICA subsystem, but are |
* included here to support device drivers and the AML disassembler. |
* |
* The tables in this file are fully defined within the ACPI specification. |
* |
******************************************************************************/ |
/* |
* Values for description table header signatures for tables defined in this |
* file. Useful because they make it more difficult to inadvertently type in |
* the wrong signature. |
*/ |
#define ACPI_SIG_BERT "BERT" /* Boot Error Record Table */ |
#define ACPI_SIG_CPEP "CPEP" /* Corrected Platform Error Polling table */ |
#define ACPI_SIG_ECDT "ECDT" /* Embedded Controller Boot Resources Table */ |
#define ACPI_SIG_EINJ "EINJ" /* Error Injection table */ |
#define ACPI_SIG_ERST "ERST" /* Error Record Serialization Table */ |
#define ACPI_SIG_HEST "HEST" /* Hardware Error Source Table */ |
#define ACPI_SIG_MADT "APIC" /* Multiple APIC Description Table */ |
#define ACPI_SIG_MSCT "MSCT" /* Maximum System Characteristics Table */ |
#define ACPI_SIG_SBST "SBST" /* Smart Battery Specification Table */ |
#define ACPI_SIG_SLIT "SLIT" /* System Locality Distance Information Table */ |
#define ACPI_SIG_SRAT "SRAT" /* System Resource Affinity Table */ |
#define ACPI_SIG_NFIT "NFIT" /* NVDIMM Firmware Interface Table */ |
/* |
* All tables must be byte-packed to match the ACPI specification, since |
* the tables are provided by the system BIOS. |
*/ |
#pragma pack(1) |
/* |
* Note: C bitfields are not used for this reason: |
* |
* "Bitfields are great and easy to read, but unfortunately the C language |
* does not specify the layout of bitfields in memory, which means they are |
* essentially useless for dealing with packed data in on-disk formats or |
* binary wire protocols." (Or ACPI tables and buffers.) "If you ask me, |
* this decision was a design error in C. Ritchie could have picked an order |
* and stuck with it." Norman Ramsey. |
* See http://stackoverflow.com/a/1053662/41661 |
*/ |
/******************************************************************************* |
* |
* Common subtable headers |
* |
******************************************************************************/ |
/* Generic subtable header (used in MADT, SRAT, etc.) */ |
struct acpi_subtable_header { |
u8 type; |
u8 length; |
}; |
/* Subtable header for WHEA tables (EINJ, ERST, WDAT) */ |
struct acpi_whea_header { |
u8 action; |
u8 instruction; |
u8 flags; |
u8 reserved; |
struct acpi_generic_address register_region; |
u64 value; /* Value used with Read/Write register */ |
u64 mask; /* Bitmask required for this register instruction */ |
}; |
/******************************************************************************* |
* |
* BERT - Boot Error Record Table (ACPI 4.0) |
* Version 1 |
* |
******************************************************************************/ |
struct acpi_table_bert { |
struct acpi_table_header header; /* Common ACPI table header */ |
u32 region_length; /* Length of the boot error region */ |
u64 address; /* Physical address of the error region */ |
}; |
/* Boot Error Region (not a subtable, pointed to by Address field above) */ |
struct acpi_bert_region { |
u32 block_status; /* Type of error information */ |
u32 raw_data_offset; /* Offset to raw error data */ |
u32 raw_data_length; /* Length of raw error data */ |
u32 data_length; /* Length of generic error data */ |
u32 error_severity; /* Severity code */ |
}; |
/* Values for block_status flags above */ |
#define ACPI_BERT_UNCORRECTABLE (1) |
#define ACPI_BERT_CORRECTABLE (1<<1) |
#define ACPI_BERT_MULTIPLE_UNCORRECTABLE (1<<2) |
#define ACPI_BERT_MULTIPLE_CORRECTABLE (1<<3) |
#define ACPI_BERT_ERROR_ENTRY_COUNT (0xFF<<4) /* 8 bits, error count */ |
/* Values for error_severity above */ |
enum acpi_bert_error_severity { |
ACPI_BERT_ERROR_CORRECTABLE = 0, |
ACPI_BERT_ERROR_FATAL = 1, |
ACPI_BERT_ERROR_CORRECTED = 2, |
ACPI_BERT_ERROR_NONE = 3, |
ACPI_BERT_ERROR_RESERVED = 4 /* 4 and greater are reserved */ |
}; |
/* |
* Note: The generic error data that follows the error_severity field above |
* uses the struct acpi_hest_generic_data defined under the HEST table below |
*/ |
/******************************************************************************* |
* |
* CPEP - Corrected Platform Error Polling table (ACPI 4.0) |
* Version 1 |
* |
******************************************************************************/ |
struct acpi_table_cpep { |
struct acpi_table_header header; /* Common ACPI table header */ |
u64 reserved; |
}; |
/* Subtable */ |
struct acpi_cpep_polling { |
struct acpi_subtable_header header; |
u8 id; /* Processor ID */ |
u8 eid; /* Processor EID */ |
u32 interval; /* Polling interval (msec) */ |
}; |
/******************************************************************************* |
* |
* ECDT - Embedded Controller Boot Resources Table |
* Version 1 |
* |
******************************************************************************/ |
struct acpi_table_ecdt { |
struct acpi_table_header header; /* Common ACPI table header */ |
struct acpi_generic_address control; /* Address of EC command/status register */ |
struct acpi_generic_address data; /* Address of EC data register */ |
u32 uid; /* Unique ID - must be same as the EC _UID method */ |
u8 gpe; /* The GPE for the EC */ |
u8 id[1]; /* Full namepath of the EC in the ACPI namespace */ |
}; |
/******************************************************************************* |
* |
* EINJ - Error Injection Table (ACPI 4.0) |
* Version 1 |
* |
******************************************************************************/ |
struct acpi_table_einj { |
struct acpi_table_header header; /* Common ACPI table header */ |
u32 header_length; |
u8 flags; |
u8 reserved[3]; |
u32 entries; |
}; |
/* EINJ Injection Instruction Entries (actions) */ |
struct acpi_einj_entry { |
struct acpi_whea_header whea_header; /* Common header for WHEA tables */ |
}; |
/* Masks for Flags field above */ |
#define ACPI_EINJ_PRESERVE (1) |
/* Values for Action field above */ |
enum acpi_einj_actions { |
ACPI_EINJ_BEGIN_OPERATION = 0, |
ACPI_EINJ_GET_TRIGGER_TABLE = 1, |
ACPI_EINJ_SET_ERROR_TYPE = 2, |
ACPI_EINJ_GET_ERROR_TYPE = 3, |
ACPI_EINJ_END_OPERATION = 4, |
ACPI_EINJ_EXECUTE_OPERATION = 5, |
ACPI_EINJ_CHECK_BUSY_STATUS = 6, |
ACPI_EINJ_GET_COMMAND_STATUS = 7, |
ACPI_EINJ_SET_ERROR_TYPE_WITH_ADDRESS = 8, |
ACPI_EINJ_ACTION_RESERVED = 9, /* 9 and greater are reserved */ |
ACPI_EINJ_TRIGGER_ERROR = 0xFF /* Except for this value */ |
}; |
/* Values for Instruction field above */ |
enum acpi_einj_instructions { |
ACPI_EINJ_READ_REGISTER = 0, |
ACPI_EINJ_READ_REGISTER_VALUE = 1, |
ACPI_EINJ_WRITE_REGISTER = 2, |
ACPI_EINJ_WRITE_REGISTER_VALUE = 3, |
ACPI_EINJ_NOOP = 4, |
ACPI_EINJ_FLUSH_CACHELINE = 5, |
ACPI_EINJ_INSTRUCTION_RESERVED = 6 /* 6 and greater are reserved */ |
}; |
struct acpi_einj_error_type_with_addr { |
u32 error_type; |
u32 vendor_struct_offset; |
u32 flags; |
u32 apic_id; |
u64 address; |
u64 range; |
u32 pcie_id; |
}; |
struct acpi_einj_vendor { |
u32 length; |
u32 pcie_id; |
u16 vendor_id; |
u16 device_id; |
u8 revision_id; |
u8 reserved[3]; |
}; |
/* EINJ Trigger Error Action Table */ |
struct acpi_einj_trigger { |
u32 header_size; |
u32 revision; |
u32 table_size; |
u32 entry_count; |
}; |
/* Command status return values */ |
enum acpi_einj_command_status { |
ACPI_EINJ_SUCCESS = 0, |
ACPI_EINJ_FAILURE = 1, |
ACPI_EINJ_INVALID_ACCESS = 2, |
ACPI_EINJ_STATUS_RESERVED = 3 /* 3 and greater are reserved */ |
}; |
/* Error types returned from ACPI_EINJ_GET_ERROR_TYPE (bitfield) */ |
#define ACPI_EINJ_PROCESSOR_CORRECTABLE (1) |
#define ACPI_EINJ_PROCESSOR_UNCORRECTABLE (1<<1) |
#define ACPI_EINJ_PROCESSOR_FATAL (1<<2) |
#define ACPI_EINJ_MEMORY_CORRECTABLE (1<<3) |
#define ACPI_EINJ_MEMORY_UNCORRECTABLE (1<<4) |
#define ACPI_EINJ_MEMORY_FATAL (1<<5) |
#define ACPI_EINJ_PCIX_CORRECTABLE (1<<6) |
#define ACPI_EINJ_PCIX_UNCORRECTABLE (1<<7) |
#define ACPI_EINJ_PCIX_FATAL (1<<8) |
#define ACPI_EINJ_PLATFORM_CORRECTABLE (1<<9) |
#define ACPI_EINJ_PLATFORM_UNCORRECTABLE (1<<10) |
#define ACPI_EINJ_PLATFORM_FATAL (1<<11) |
#define ACPI_EINJ_VENDOR_DEFINED (1<<31) |
/******************************************************************************* |
* |
* ERST - Error Record Serialization Table (ACPI 4.0) |
* Version 1 |
* |
******************************************************************************/ |
struct acpi_table_erst { |
struct acpi_table_header header; /* Common ACPI table header */ |
u32 header_length; |
u32 reserved; |
u32 entries; |
}; |
/* ERST Serialization Entries (actions) */ |
struct acpi_erst_entry { |
struct acpi_whea_header whea_header; /* Common header for WHEA tables */ |
}; |
/* Masks for Flags field above */ |
#define ACPI_ERST_PRESERVE (1) |
/* Values for Action field above */ |
enum acpi_erst_actions { |
ACPI_ERST_BEGIN_WRITE = 0, |
ACPI_ERST_BEGIN_READ = 1, |
ACPI_ERST_BEGIN_CLEAR = 2, |
ACPI_ERST_END = 3, |
ACPI_ERST_SET_RECORD_OFFSET = 4, |
ACPI_ERST_EXECUTE_OPERATION = 5, |
ACPI_ERST_CHECK_BUSY_STATUS = 6, |
ACPI_ERST_GET_COMMAND_STATUS = 7, |
ACPI_ERST_GET_RECORD_ID = 8, |
ACPI_ERST_SET_RECORD_ID = 9, |
ACPI_ERST_GET_RECORD_COUNT = 10, |
ACPI_ERST_BEGIN_DUMMY_WRIITE = 11, |
ACPI_ERST_NOT_USED = 12, |
ACPI_ERST_GET_ERROR_RANGE = 13, |
ACPI_ERST_GET_ERROR_LENGTH = 14, |
ACPI_ERST_GET_ERROR_ATTRIBUTES = 15, |
ACPI_ERST_ACTION_RESERVED = 16 /* 16 and greater are reserved */ |
}; |
/* Values for Instruction field above */ |
enum acpi_erst_instructions { |
ACPI_ERST_READ_REGISTER = 0, |
ACPI_ERST_READ_REGISTER_VALUE = 1, |
ACPI_ERST_WRITE_REGISTER = 2, |
ACPI_ERST_WRITE_REGISTER_VALUE = 3, |
ACPI_ERST_NOOP = 4, |
ACPI_ERST_LOAD_VAR1 = 5, |
ACPI_ERST_LOAD_VAR2 = 6, |
ACPI_ERST_STORE_VAR1 = 7, |
ACPI_ERST_ADD = 8, |
ACPI_ERST_SUBTRACT = 9, |
ACPI_ERST_ADD_VALUE = 10, |
ACPI_ERST_SUBTRACT_VALUE = 11, |
ACPI_ERST_STALL = 12, |
ACPI_ERST_STALL_WHILE_TRUE = 13, |
ACPI_ERST_SKIP_NEXT_IF_TRUE = 14, |
ACPI_ERST_GOTO = 15, |
ACPI_ERST_SET_SRC_ADDRESS_BASE = 16, |
ACPI_ERST_SET_DST_ADDRESS_BASE = 17, |
ACPI_ERST_MOVE_DATA = 18, |
ACPI_ERST_INSTRUCTION_RESERVED = 19 /* 19 and greater are reserved */ |
}; |
/* Command status return values */ |
enum acpi_erst_command_status { |
ACPI_ERST_SUCESS = 0, |
ACPI_ERST_NO_SPACE = 1, |
ACPI_ERST_NOT_AVAILABLE = 2, |
ACPI_ERST_FAILURE = 3, |
ACPI_ERST_RECORD_EMPTY = 4, |
ACPI_ERST_NOT_FOUND = 5, |
ACPI_ERST_STATUS_RESERVED = 6 /* 6 and greater are reserved */ |
}; |
/* Error Record Serialization Information */ |
struct acpi_erst_info { |
u16 signature; /* Should be "ER" */ |
u8 data[48]; |
}; |
/******************************************************************************* |
* |
* HEST - Hardware Error Source Table (ACPI 4.0) |
* Version 1 |
* |
******************************************************************************/ |
struct acpi_table_hest { |
struct acpi_table_header header; /* Common ACPI table header */ |
u32 error_source_count; |
}; |
/* HEST subtable header */ |
struct acpi_hest_header { |
u16 type; |
u16 source_id; |
}; |
/* Values for Type field above for subtables */ |
enum acpi_hest_types { |
ACPI_HEST_TYPE_IA32_CHECK = 0, |
ACPI_HEST_TYPE_IA32_CORRECTED_CHECK = 1, |
ACPI_HEST_TYPE_IA32_NMI = 2, |
ACPI_HEST_TYPE_NOT_USED3 = 3, |
ACPI_HEST_TYPE_NOT_USED4 = 4, |
ACPI_HEST_TYPE_NOT_USED5 = 5, |
ACPI_HEST_TYPE_AER_ROOT_PORT = 6, |
ACPI_HEST_TYPE_AER_ENDPOINT = 7, |
ACPI_HEST_TYPE_AER_BRIDGE = 8, |
ACPI_HEST_TYPE_GENERIC_ERROR = 9, |
ACPI_HEST_TYPE_RESERVED = 10 /* 10 and greater are reserved */ |
}; |
/* |
* HEST substructures contained in subtables |
*/ |
/* |
* IA32 Error Bank(s) - Follows the struct acpi_hest_ia_machine_check and |
* struct acpi_hest_ia_corrected structures. |
*/ |
struct acpi_hest_ia_error_bank { |
u8 bank_number; |
u8 clear_status_on_init; |
u8 status_format; |
u8 reserved; |
u32 control_register; |
u64 control_data; |
u32 status_register; |
u32 address_register; |
u32 misc_register; |
}; |
/* Common HEST sub-structure for PCI/AER structures below (6,7,8) */ |
struct acpi_hest_aer_common { |
u16 reserved1; |
u8 flags; |
u8 enabled; |
u32 records_to_preallocate; |
u32 max_sections_per_record; |
u32 bus; /* Bus and Segment numbers */ |
u16 device; |
u16 function; |
u16 device_control; |
u16 reserved2; |
u32 uncorrectable_mask; |
u32 uncorrectable_severity; |
u32 correctable_mask; |
u32 advanced_capabilities; |
}; |
/* Masks for HEST Flags fields */ |
#define ACPI_HEST_FIRMWARE_FIRST (1) |
#define ACPI_HEST_GLOBAL (1<<1) |
/* |
* Macros to access the bus/segment numbers in Bus field above: |
* Bus number is encoded in bits 7:0 |
* Segment number is encoded in bits 23:8 |
*/ |
#define ACPI_HEST_BUS(bus) ((bus) & 0xFF) |
#define ACPI_HEST_SEGMENT(bus) (((bus) >> 8) & 0xFFFF) |
/* Hardware Error Notification */ |
struct acpi_hest_notify { |
u8 type; |
u8 length; |
u16 config_write_enable; |
u32 poll_interval; |
u32 vector; |
u32 polling_threshold_value; |
u32 polling_threshold_window; |
u32 error_threshold_value; |
u32 error_threshold_window; |
}; |
/* Values for Notify Type field above */ |
enum acpi_hest_notify_types { |
ACPI_HEST_NOTIFY_POLLED = 0, |
ACPI_HEST_NOTIFY_EXTERNAL = 1, |
ACPI_HEST_NOTIFY_LOCAL = 2, |
ACPI_HEST_NOTIFY_SCI = 3, |
ACPI_HEST_NOTIFY_NMI = 4, |
ACPI_HEST_NOTIFY_CMCI = 5, /* ACPI 5.0 */ |
ACPI_HEST_NOTIFY_MCE = 6, /* ACPI 5.0 */ |
ACPI_HEST_NOTIFY_RESERVED = 7 /* 7 and greater are reserved */ |
}; |
/* Values for config_write_enable bitfield above */ |
#define ACPI_HEST_TYPE (1) |
#define ACPI_HEST_POLL_INTERVAL (1<<1) |
#define ACPI_HEST_POLL_THRESHOLD_VALUE (1<<2) |
#define ACPI_HEST_POLL_THRESHOLD_WINDOW (1<<3) |
#define ACPI_HEST_ERR_THRESHOLD_VALUE (1<<4) |
#define ACPI_HEST_ERR_THRESHOLD_WINDOW (1<<5) |
/* |
* HEST subtables |
*/ |
/* 0: IA32 Machine Check Exception */ |
struct acpi_hest_ia_machine_check { |
struct acpi_hest_header header; |
u16 reserved1; |
u8 flags; |
u8 enabled; |
u32 records_to_preallocate; |
u32 max_sections_per_record; |
u64 global_capability_data; |
u64 global_control_data; |
u8 num_hardware_banks; |
u8 reserved3[7]; |
}; |
/* 1: IA32 Corrected Machine Check */ |
struct acpi_hest_ia_corrected { |
struct acpi_hest_header header; |
u16 reserved1; |
u8 flags; |
u8 enabled; |
u32 records_to_preallocate; |
u32 max_sections_per_record; |
struct acpi_hest_notify notify; |
u8 num_hardware_banks; |
u8 reserved2[3]; |
}; |
/* 2: IA32 Non-Maskable Interrupt */ |
struct acpi_hest_ia_nmi { |
struct acpi_hest_header header; |
u32 reserved; |
u32 records_to_preallocate; |
u32 max_sections_per_record; |
u32 max_raw_data_length; |
}; |
/* 3,4,5: Not used */ |
/* 6: PCI Express Root Port AER */ |
struct acpi_hest_aer_root { |
struct acpi_hest_header header; |
struct acpi_hest_aer_common aer; |
u32 root_error_command; |
}; |
/* 7: PCI Express AER (AER Endpoint) */ |
struct acpi_hest_aer { |
struct acpi_hest_header header; |
struct acpi_hest_aer_common aer; |
}; |
/* 8: PCI Express/PCI-X Bridge AER */ |
struct acpi_hest_aer_bridge { |
struct acpi_hest_header header; |
struct acpi_hest_aer_common aer; |
u32 uncorrectable_mask2; |
u32 uncorrectable_severity2; |
u32 advanced_capabilities2; |
}; |
/* 9: Generic Hardware Error Source */ |
struct acpi_hest_generic { |
struct acpi_hest_header header; |
u16 related_source_id; |
u8 reserved; |
u8 enabled; |
u32 records_to_preallocate; |
u32 max_sections_per_record; |
u32 max_raw_data_length; |
struct acpi_generic_address error_status_address; |
struct acpi_hest_notify notify; |
u32 error_block_length; |
}; |
/* Generic Error Status block */ |
struct acpi_hest_generic_status { |
u32 block_status; |
u32 raw_data_offset; |
u32 raw_data_length; |
u32 data_length; |
u32 error_severity; |
}; |
/* Values for block_status flags above */ |
#define ACPI_HEST_UNCORRECTABLE (1) |
#define ACPI_HEST_CORRECTABLE (1<<1) |
#define ACPI_HEST_MULTIPLE_UNCORRECTABLE (1<<2) |
#define ACPI_HEST_MULTIPLE_CORRECTABLE (1<<3) |
#define ACPI_HEST_ERROR_ENTRY_COUNT (0xFF<<4) /* 8 bits, error count */ |
/* Generic Error Data entry */ |
struct acpi_hest_generic_data { |
u8 section_type[16]; |
u32 error_severity; |
u16 revision; |
u8 validation_bits; |
u8 flags; |
u32 error_data_length; |
u8 fru_id[16]; |
u8 fru_text[20]; |
}; |
/******************************************************************************* |
* |
* MADT - Multiple APIC Description Table |
* Version 3 |
* |
******************************************************************************/ |
struct acpi_table_madt { |
struct acpi_table_header header; /* Common ACPI table header */ |
u32 address; /* Physical address of local APIC */ |
u32 flags; |
}; |
/* Masks for Flags field above */ |
#define ACPI_MADT_PCAT_COMPAT (1) /* 00: System also has dual 8259s */ |
/* Values for PCATCompat flag */ |
#define ACPI_MADT_DUAL_PIC 0 |
#define ACPI_MADT_MULTIPLE_APIC 1 |
/* Values for MADT subtable type in struct acpi_subtable_header */ |
enum acpi_madt_type { |
ACPI_MADT_TYPE_LOCAL_APIC = 0, |
ACPI_MADT_TYPE_IO_APIC = 1, |
ACPI_MADT_TYPE_INTERRUPT_OVERRIDE = 2, |
ACPI_MADT_TYPE_NMI_SOURCE = 3, |
ACPI_MADT_TYPE_LOCAL_APIC_NMI = 4, |
ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE = 5, |
ACPI_MADT_TYPE_IO_SAPIC = 6, |
ACPI_MADT_TYPE_LOCAL_SAPIC = 7, |
ACPI_MADT_TYPE_INTERRUPT_SOURCE = 8, |
ACPI_MADT_TYPE_LOCAL_X2APIC = 9, |
ACPI_MADT_TYPE_LOCAL_X2APIC_NMI = 10, |
ACPI_MADT_TYPE_GENERIC_INTERRUPT = 11, |
ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR = 12, |
ACPI_MADT_TYPE_GENERIC_MSI_FRAME = 13, |
ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR = 14, |
ACPI_MADT_TYPE_GENERIC_TRANSLATOR = 15, |
ACPI_MADT_TYPE_RESERVED = 16 /* 16 and greater are reserved */ |
}; |
/* |
* MADT Subtables, correspond to Type in struct acpi_subtable_header |
*/ |
/* 0: Processor Local APIC */ |
struct acpi_madt_local_apic { |
struct acpi_subtable_header header; |
u8 processor_id; /* ACPI processor id */ |
u8 id; /* Processor's local APIC id */ |
u32 lapic_flags; |
}; |
/* 1: IO APIC */ |
struct acpi_madt_io_apic { |
struct acpi_subtable_header header; |
u8 id; /* I/O APIC ID */ |
u8 reserved; /* reserved - must be zero */ |
u32 address; /* APIC physical address */ |
u32 global_irq_base; /* Global system interrupt where INTI lines start */ |
}; |
/* 2: Interrupt Override */ |
struct acpi_madt_interrupt_override { |
struct acpi_subtable_header header; |
u8 bus; /* 0 - ISA */ |
u8 source_irq; /* Interrupt source (IRQ) */ |
u32 global_irq; /* Global system interrupt */ |
u16 inti_flags; |
}; |
/* 3: NMI Source */ |
struct acpi_madt_nmi_source { |
struct acpi_subtable_header header; |
u16 inti_flags; |
u32 global_irq; /* Global system interrupt */ |
}; |
/* 4: Local APIC NMI */ |
struct acpi_madt_local_apic_nmi { |
struct acpi_subtable_header header; |
u8 processor_id; /* ACPI processor id */ |
u16 inti_flags; |
u8 lint; /* LINTn to which NMI is connected */ |
}; |
/* 5: Address Override */ |
struct acpi_madt_local_apic_override { |
struct acpi_subtable_header header; |
u16 reserved; /* Reserved, must be zero */ |
u64 address; /* APIC physical address */ |
}; |
/* 6: I/O Sapic */ |
struct acpi_madt_io_sapic { |
struct acpi_subtable_header header; |
u8 id; /* I/O SAPIC ID */ |
u8 reserved; /* Reserved, must be zero */ |
u32 global_irq_base; /* Global interrupt for SAPIC start */ |
u64 address; /* SAPIC physical address */ |
}; |
/* 7: Local Sapic */ |
struct acpi_madt_local_sapic { |
struct acpi_subtable_header header; |
u8 processor_id; /* ACPI processor id */ |
u8 id; /* SAPIC ID */ |
u8 eid; /* SAPIC EID */ |
u8 reserved[3]; /* Reserved, must be zero */ |
u32 lapic_flags; |
u32 uid; /* Numeric UID - ACPI 3.0 */ |
char uid_string[1]; /* String UID - ACPI 3.0 */ |
}; |
/* 8: Platform Interrupt Source */ |
struct acpi_madt_interrupt_source { |
struct acpi_subtable_header header; |
u16 inti_flags; |
u8 type; /* 1=PMI, 2=INIT, 3=corrected */ |
u8 id; /* Processor ID */ |
u8 eid; /* Processor EID */ |
u8 io_sapic_vector; /* Vector value for PMI interrupts */ |
u32 global_irq; /* Global system interrupt */ |
u32 flags; /* Interrupt Source Flags */ |
}; |
/* Masks for Flags field above */ |
#define ACPI_MADT_CPEI_OVERRIDE (1) |
/* 9: Processor Local X2APIC (ACPI 4.0) */ |
struct acpi_madt_local_x2apic { |
struct acpi_subtable_header header; |
u16 reserved; /* reserved - must be zero */ |
u32 local_apic_id; /* Processor x2APIC ID */ |
u32 lapic_flags; |
u32 uid; /* ACPI processor UID */ |
}; |
/* 10: Local X2APIC NMI (ACPI 4.0) */ |
struct acpi_madt_local_x2apic_nmi { |
struct acpi_subtable_header header; |
u16 inti_flags; |
u32 uid; /* ACPI processor UID */ |
u8 lint; /* LINTn to which NMI is connected */ |
u8 reserved[3]; /* reserved - must be zero */ |
}; |
/* 11: Generic Interrupt (ACPI 5.0 + ACPI 6.0 changes) */ |
struct acpi_madt_generic_interrupt { |
struct acpi_subtable_header header; |
u16 reserved; /* reserved - must be zero */ |
u32 cpu_interface_number; |
u32 uid; |
u32 flags; |
u32 parking_version; |
u32 performance_interrupt; |
u64 parked_address; |
u64 base_address; |
u64 gicv_base_address; |
u64 gich_base_address; |
u32 vgic_interrupt; |
u64 gicr_base_address; |
u64 arm_mpidr; |
u8 efficiency_class; |
u8 reserved2[3]; |
}; |
/* Masks for Flags field above */ |
/* ACPI_MADT_ENABLED (1) Processor is usable if set */ |
#define ACPI_MADT_PERFORMANCE_IRQ_MODE (1<<1) /* 01: Performance Interrupt Mode */ |
#define ACPI_MADT_VGIC_IRQ_MODE (1<<2) /* 02: VGIC Maintenance Interrupt mode */ |
/* 12: Generic Distributor (ACPI 5.0 + ACPI 6.0 changes) */ |
struct acpi_madt_generic_distributor { |
struct acpi_subtable_header header; |
u16 reserved; /* reserved - must be zero */ |
u32 gic_id; |
u64 base_address; |
u32 global_irq_base; |
u8 version; |
u8 reserved2[3]; /* reserved - must be zero */ |
}; |
/* Values for Version field above */ |
enum acpi_madt_gic_version { |
ACPI_MADT_GIC_VERSION_NONE = 0, |
ACPI_MADT_GIC_VERSION_V1 = 1, |
ACPI_MADT_GIC_VERSION_V2 = 2, |
ACPI_MADT_GIC_VERSION_V3 = 3, |
ACPI_MADT_GIC_VERSION_V4 = 4, |
ACPI_MADT_GIC_VERSION_RESERVED = 5 /* 5 and greater are reserved */ |
}; |
/* 13: Generic MSI Frame (ACPI 5.1) */ |
struct acpi_madt_generic_msi_frame { |
struct acpi_subtable_header header; |
u16 reserved; /* reserved - must be zero */ |
u32 msi_frame_id; |
u64 base_address; |
u32 flags; |
u16 spi_count; |
u16 spi_base; |
}; |
/* Masks for Flags field above */ |
#define ACPI_MADT_OVERRIDE_SPI_VALUES (1) |
/* 14: Generic Redistributor (ACPI 5.1) */ |
struct acpi_madt_generic_redistributor { |
struct acpi_subtable_header header; |
u16 reserved; /* reserved - must be zero */ |
u64 base_address; |
u32 length; |
}; |
/* 15: Generic Translator (ACPI 6.0) */ |
struct acpi_madt_generic_translator { |
struct acpi_subtable_header header; |
u16 reserved; /* reserved - must be zero */ |
u32 translation_id; |
u64 base_address; |
u32 reserved2; |
}; |
/* |
* Common flags fields for MADT subtables |
*/ |
/* MADT Local APIC flags */ |
#define ACPI_MADT_ENABLED (1) /* 00: Processor is usable if set */ |
/* MADT MPS INTI flags (inti_flags) */ |
#define ACPI_MADT_POLARITY_MASK (3) /* 00-01: Polarity of APIC I/O input signals */ |
#define ACPI_MADT_TRIGGER_MASK (3<<2) /* 02-03: Trigger mode of APIC input signals */ |
/* Values for MPS INTI flags */ |
#define ACPI_MADT_POLARITY_CONFORMS 0 |
#define ACPI_MADT_POLARITY_ACTIVE_HIGH 1 |
#define ACPI_MADT_POLARITY_RESERVED 2 |
#define ACPI_MADT_POLARITY_ACTIVE_LOW 3 |
#define ACPI_MADT_TRIGGER_CONFORMS (0) |
#define ACPI_MADT_TRIGGER_EDGE (1<<2) |
#define ACPI_MADT_TRIGGER_RESERVED (2<<2) |
#define ACPI_MADT_TRIGGER_LEVEL (3<<2) |
/******************************************************************************* |
* |
* MSCT - Maximum System Characteristics Table (ACPI 4.0) |
* Version 1 |
* |
******************************************************************************/ |
struct acpi_table_msct { |
struct acpi_table_header header; /* Common ACPI table header */ |
u32 proximity_offset; /* Location of proximity info struct(s) */ |
u32 max_proximity_domains; /* Max number of proximity domains */ |
u32 max_clock_domains; /* Max number of clock domains */ |
u64 max_address; /* Max physical address in system */ |
}; |
/* subtable - Maximum Proximity Domain Information. Version 1 */ |
struct acpi_msct_proximity { |
u8 revision; |
u8 length; |
u32 range_start; /* Start of domain range */ |
u32 range_end; /* End of domain range */ |
u32 processor_capacity; |
u64 memory_capacity; /* In bytes */ |
}; |
/******************************************************************************* |
* |
* NFIT - NVDIMM Interface Table (ACPI 6.0) |
* Version 1 |
* |
******************************************************************************/ |
struct acpi_table_nfit { |
struct acpi_table_header header; /* Common ACPI table header */ |
u32 reserved; /* Reserved, must be zero */ |
}; |
/* Subtable header for NFIT */ |
struct acpi_nfit_header { |
u16 type; |
u16 length; |
}; |
/* Values for subtable type in struct acpi_nfit_header */ |
enum acpi_nfit_type { |
ACPI_NFIT_TYPE_SYSTEM_ADDRESS = 0, |
ACPI_NFIT_TYPE_MEMORY_MAP = 1, |
ACPI_NFIT_TYPE_INTERLEAVE = 2, |
ACPI_NFIT_TYPE_SMBIOS = 3, |
ACPI_NFIT_TYPE_CONTROL_REGION = 4, |
ACPI_NFIT_TYPE_DATA_REGION = 5, |
ACPI_NFIT_TYPE_FLUSH_ADDRESS = 6, |
ACPI_NFIT_TYPE_RESERVED = 7 /* 7 and greater are reserved */ |
}; |
/* |
* NFIT Subtables |
*/ |
/* 0: System Physical Address Range Structure */ |
struct acpi_nfit_system_address { |
struct acpi_nfit_header header; |
u16 range_index; |
u16 flags; |
u32 reserved; /* Reseved, must be zero */ |
u32 proximity_domain; |
u8 range_guid[16]; |
u64 address; |
u64 length; |
u64 memory_mapping; |
}; |
/* Flags */ |
#define ACPI_NFIT_ADD_ONLINE_ONLY (1) /* 00: Add/Online Operation Only */ |
#define ACPI_NFIT_PROXIMITY_VALID (1<<1) /* 01: Proximity Domain Valid */ |
/* Range Type GUIDs appear in the include/acuuid.h file */ |
/* 1: Memory Device to System Address Range Map Structure */ |
struct acpi_nfit_memory_map { |
struct acpi_nfit_header header; |
u32 device_handle; |
u16 physical_id; |
u16 region_id; |
u16 range_index; |
u16 region_index; |
u64 region_size; |
u64 region_offset; |
u64 address; |
u16 interleave_index; |
u16 interleave_ways; |
u16 flags; |
u16 reserved; /* Reserved, must be zero */ |
}; |
/* Flags */ |
#define ACPI_NFIT_MEM_SAVE_FAILED (1) /* 00: Last SAVE to Memory Device failed */ |
#define ACPI_NFIT_MEM_RESTORE_FAILED (1<<1) /* 01: Last RESTORE from Memory Device failed */ |
#define ACPI_NFIT_MEM_FLUSH_FAILED (1<<2) /* 02: Platform flush failed */ |
#define ACPI_NFIT_MEM_NOT_ARMED (1<<3) /* 03: Memory Device is not armed */ |
#define ACPI_NFIT_MEM_HEALTH_OBSERVED (1<<4) /* 04: Memory Device observed SMART/health events */ |
#define ACPI_NFIT_MEM_HEALTH_ENABLED (1<<5) /* 05: SMART/health events enabled */ |
/* 2: Interleave Structure */ |
struct acpi_nfit_interleave { |
struct acpi_nfit_header header; |
u16 interleave_index; |
u16 reserved; /* Reserved, must be zero */ |
u32 line_count; |
u32 line_size; |
u32 line_offset[1]; /* Variable length */ |
}; |
/* 3: SMBIOS Management Information Structure */ |
struct acpi_nfit_smbios { |
struct acpi_nfit_header header; |
u32 reserved; /* Reserved, must be zero */ |
u8 data[1]; /* Variable length */ |
}; |
/* 4: NVDIMM Control Region Structure */ |
struct acpi_nfit_control_region { |
struct acpi_nfit_header header; |
u16 region_index; |
u16 vendor_id; |
u16 device_id; |
u16 revision_id; |
u16 subsystem_vendor_id; |
u16 subsystem_device_id; |
u16 subsystem_revision_id; |
u8 reserved[6]; /* Reserved, must be zero */ |
u32 serial_number; |
u16 code; |
u16 windows; |
u64 window_size; |
u64 command_offset; |
u64 command_size; |
u64 status_offset; |
u64 status_size; |
u16 flags; |
u8 reserved1[6]; /* Reserved, must be zero */ |
}; |
/* Flags */ |
#define ACPI_NFIT_CONTROL_BUFFERED (1) /* Block Data Windows implementation is buffered */ |
/* 5: NVDIMM Block Data Window Region Structure */ |
struct acpi_nfit_data_region { |
struct acpi_nfit_header header; |
u16 region_index; |
u16 windows; |
u64 offset; |
u64 size; |
u64 capacity; |
u64 start_address; |
}; |
/* 6: Flush Hint Address Structure */ |
struct acpi_nfit_flush_address { |
struct acpi_nfit_header header; |
u32 device_handle; |
u16 hint_count; |
u8 reserved[6]; /* Reserved, must be zero */ |
u64 hint_address[1]; /* Variable length */ |
}; |
/******************************************************************************* |
* |
* SBST - Smart Battery Specification Table |
* Version 1 |
* |
******************************************************************************/ |
struct acpi_table_sbst { |
struct acpi_table_header header; /* Common ACPI table header */ |
u32 warning_level; |
u32 low_level; |
u32 critical_level; |
}; |
/******************************************************************************* |
* |
* SLIT - System Locality Distance Information Table |
* Version 1 |
* |
******************************************************************************/ |
struct acpi_table_slit { |
struct acpi_table_header header; /* Common ACPI table header */ |
u64 locality_count; |
u8 entry[1]; /* Real size = localities^2 */ |
}; |
/******************************************************************************* |
* |
* SRAT - System Resource Affinity Table |
* Version 3 |
* |
******************************************************************************/ |
struct acpi_table_srat { |
struct acpi_table_header header; /* Common ACPI table header */ |
u32 table_revision; /* Must be value '1' */ |
u64 reserved; /* Reserved, must be zero */ |
}; |
/* Values for subtable type in struct acpi_subtable_header */ |
enum acpi_srat_type { |
ACPI_SRAT_TYPE_CPU_AFFINITY = 0, |
ACPI_SRAT_TYPE_MEMORY_AFFINITY = 1, |
ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY = 2, |
ACPI_SRAT_TYPE_GICC_AFFINITY = 3, |
ACPI_SRAT_TYPE_RESERVED = 4 /* 4 and greater are reserved */ |
}; |
/* |
* SRAT Subtables, correspond to Type in struct acpi_subtable_header |
*/ |
/* 0: Processor Local APIC/SAPIC Affinity */ |
struct acpi_srat_cpu_affinity { |
struct acpi_subtable_header header; |
u8 proximity_domain_lo; |
u8 apic_id; |
u32 flags; |
u8 local_sapic_eid; |
u8 proximity_domain_hi[3]; |
u32 clock_domain; |
}; |
/* Flags */ |
#define ACPI_SRAT_CPU_USE_AFFINITY (1) /* 00: Use affinity structure */ |
/* 1: Memory Affinity */ |
struct acpi_srat_mem_affinity { |
struct acpi_subtable_header header; |
u32 proximity_domain; |
u16 reserved; /* Reserved, must be zero */ |
u64 base_address; |
u64 length; |
u32 reserved1; |
u32 flags; |
u64 reserved2; /* Reserved, must be zero */ |
}; |
/* Flags */ |
#define ACPI_SRAT_MEM_ENABLED (1) /* 00: Use affinity structure */ |
#define ACPI_SRAT_MEM_HOT_PLUGGABLE (1<<1) /* 01: Memory region is hot pluggable */ |
#define ACPI_SRAT_MEM_NON_VOLATILE (1<<2) /* 02: Memory region is non-volatile */ |
/* 2: Processor Local X2_APIC Affinity (ACPI 4.0) */ |
struct acpi_srat_x2apic_cpu_affinity { |
struct acpi_subtable_header header; |
u16 reserved; /* Reserved, must be zero */ |
u32 proximity_domain; |
u32 apic_id; |
u32 flags; |
u32 clock_domain; |
u32 reserved2; |
}; |
/* Flags for struct acpi_srat_cpu_affinity and struct acpi_srat_x2apic_cpu_affinity */ |
#define ACPI_SRAT_CPU_ENABLED (1) /* 00: Use affinity structure */ |
/* 3: GICC Affinity (ACPI 5.1) */ |
struct acpi_srat_gicc_affinity { |
struct acpi_subtable_header header; |
u32 proximity_domain; |
u32 acpi_processor_uid; |
u32 flags; |
u32 clock_domain; |
}; |
/* Flags for struct acpi_srat_gicc_affinity */ |
#define ACPI_SRAT_GICC_ENABLED (1) /* 00: Use affinity structure */ |
/* Reset to default packing */ |
#pragma pack() |
#endif /* __ACTBL1_H__ */ |
/drivers/include/acpi/actbl2.h |
---|
0,0 → 1,1467 |
/****************************************************************************** |
* |
* Name: actbl2.h - ACPI Table Definitions (tables not in ACPI spec) |
* |
*****************************************************************************/ |
/* |
* Copyright (C) 2000 - 2015, 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 __ACTBL2_H__ |
#define __ACTBL2_H__ |
/******************************************************************************* |
* |
* Additional ACPI Tables (2) |
* |
* These tables are not consumed directly by the ACPICA subsystem, but are |
* included here to support device drivers and the AML disassembler. |
* |
* Generally, the tables in this file are defined by third-party specifications, |
* and are not defined directly by the ACPI specification itself. |
* |
******************************************************************************/ |
/* |
* Values for description table header signatures for tables defined in this |
* file. Useful because they make it more difficult to inadvertently type in |
* the wrong signature. |
*/ |
#define ACPI_SIG_ASF "ASF!" /* Alert Standard Format table */ |
#define ACPI_SIG_BOOT "BOOT" /* Simple Boot Flag Table */ |
#define ACPI_SIG_CSRT "CSRT" /* Core System Resource Table */ |
#define ACPI_SIG_DBG2 "DBG2" /* Debug Port table type 2 */ |
#define ACPI_SIG_DBGP "DBGP" /* Debug Port table */ |
#define ACPI_SIG_DMAR "DMAR" /* DMA Remapping table */ |
#define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */ |
#define ACPI_SIG_IBFT "IBFT" /* iSCSI Boot Firmware Table */ |
#define ACPI_SIG_IORT "IORT" /* IO Remapping Table */ |
#define ACPI_SIG_IVRS "IVRS" /* I/O Virtualization Reporting Structure */ |
#define ACPI_SIG_LPIT "LPIT" /* Low Power Idle Table */ |
#define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */ |
#define ACPI_SIG_MCHI "MCHI" /* Management Controller Host Interface table */ |
#define ACPI_SIG_MSDM "MSDM" /* Microsoft Data Management Table */ |
#define ACPI_SIG_MTMR "MTMR" /* MID Timer table */ |
#define ACPI_SIG_SLIC "SLIC" /* Software Licensing Description Table */ |
#define ACPI_SIG_SPCR "SPCR" /* Serial Port Console Redirection table */ |
#define ACPI_SIG_SPMI "SPMI" /* Server Platform Management Interface table */ |
#define ACPI_SIG_TCPA "TCPA" /* Trusted Computing Platform Alliance table */ |
#define ACPI_SIG_TPM2 "TPM2" /* Trusted Platform Module 2.0 H/W interface table */ |
#define ACPI_SIG_UEFI "UEFI" /* Uefi Boot Optimization Table */ |
#define ACPI_SIG_VRTC "VRTC" /* Virtual Real Time Clock Table */ |
#define ACPI_SIG_WAET "WAET" /* Windows ACPI Emulated devices Table */ |
#define ACPI_SIG_WDAT "WDAT" /* Watchdog Action Table */ |
#define ACPI_SIG_WDDT "WDDT" /* Watchdog Timer Description Table */ |
#define ACPI_SIG_WDRT "WDRT" /* Watchdog Resource Table */ |
#ifdef ACPI_UNDEFINED_TABLES |
/* |
* These tables have been seen in the field, but no definition has been found |
*/ |
#define ACPI_SIG_ATKG "ATKG" |
#define ACPI_SIG_GSCI "GSCI" /* GMCH SCI table */ |
#define ACPI_SIG_IEIT "IEIT" |
#endif |
/* |
* All tables must be byte-packed to match the ACPI specification, since |
* the tables are provided by the system BIOS. |
*/ |
#pragma pack(1) |
/* |
* Note: C bitfields are not used for this reason: |
* |
* "Bitfields are great and easy to read, but unfortunately the C language |
* does not specify the layout of bitfields in memory, which means they are |
* essentially useless for dealing with packed data in on-disk formats or |
* binary wire protocols." (Or ACPI tables and buffers.) "If you ask me, |
* this decision was a design error in C. Ritchie could have picked an order |
* and stuck with it." Norman Ramsey. |
* See http://stackoverflow.com/a/1053662/41661 |
*/ |
/******************************************************************************* |
* |
* ASF - Alert Standard Format table (Signature "ASF!") |
* Revision 0x10 |
* |
* Conforms to the Alert Standard Format Specification V2.0, 23 April 2003 |
* |
******************************************************************************/ |
struct acpi_table_asf { |
struct acpi_table_header header; /* Common ACPI table header */ |
}; |
/* ASF subtable header */ |
struct acpi_asf_header { |
u8 type; |
u8 reserved; |
u16 length; |
}; |
/* Values for Type field above */ |
enum acpi_asf_type { |
ACPI_ASF_TYPE_INFO = 0, |
ACPI_ASF_TYPE_ALERT = 1, |
ACPI_ASF_TYPE_CONTROL = 2, |
ACPI_ASF_TYPE_BOOT = 3, |
ACPI_ASF_TYPE_ADDRESS = 4, |
ACPI_ASF_TYPE_RESERVED = 5 |
}; |
/* |
* ASF subtables |
*/ |
/* 0: ASF Information */ |
struct acpi_asf_info { |
struct acpi_asf_header header; |
u8 min_reset_value; |
u8 min_poll_interval; |
u16 system_id; |
u32 mfg_id; |
u8 flags; |
u8 reserved2[3]; |
}; |
/* Masks for Flags field above */ |
#define ACPI_ASF_SMBUS_PROTOCOLS (1) |
/* 1: ASF Alerts */ |
struct acpi_asf_alert { |
struct acpi_asf_header header; |
u8 assert_mask; |
u8 deassert_mask; |
u8 alerts; |
u8 data_length; |
}; |
struct acpi_asf_alert_data { |
u8 address; |
u8 command; |
u8 mask; |
u8 value; |
u8 sensor_type; |
u8 type; |
u8 offset; |
u8 source_type; |
u8 severity; |
u8 sensor_number; |
u8 entity; |
u8 instance; |
}; |
/* 2: ASF Remote Control */ |
struct acpi_asf_remote { |
struct acpi_asf_header header; |
u8 controls; |
u8 data_length; |
u16 reserved2; |
}; |
struct acpi_asf_control_data { |
u8 function; |
u8 address; |
u8 command; |
u8 value; |
}; |
/* 3: ASF RMCP Boot Options */ |
struct acpi_asf_rmcp { |
struct acpi_asf_header header; |
u8 capabilities[7]; |
u8 completion_code; |
u32 enterprise_id; |
u8 command; |
u16 parameter; |
u16 boot_options; |
u16 oem_parameters; |
}; |
/* 4: ASF Address */ |
struct acpi_asf_address { |
struct acpi_asf_header header; |
u8 eprom_address; |
u8 devices; |
}; |
/******************************************************************************* |
* |
* BOOT - Simple Boot Flag Table |
* Version 1 |
* |
* Conforms to the "Simple Boot Flag Specification", Version 2.1 |
* |
******************************************************************************/ |
struct acpi_table_boot { |
struct acpi_table_header header; /* Common ACPI table header */ |
u8 cmos_index; /* Index in CMOS RAM for the boot register */ |
u8 reserved[3]; |
}; |
/******************************************************************************* |
* |
* CSRT - Core System Resource Table |
* Version 0 |
* |
* Conforms to the "Core System Resource Table (CSRT)", November 14, 2011 |
* |
******************************************************************************/ |
struct acpi_table_csrt { |
struct acpi_table_header header; /* Common ACPI table header */ |
}; |
/* Resource Group subtable */ |
struct acpi_csrt_group { |
u32 length; |
u32 vendor_id; |
u32 subvendor_id; |
u16 device_id; |
u16 subdevice_id; |
u16 revision; |
u16 reserved; |
u32 shared_info_length; |
/* Shared data immediately follows (Length = shared_info_length) */ |
}; |
/* Shared Info subtable */ |
struct acpi_csrt_shared_info { |
u16 major_version; |
u16 minor_version; |
u32 mmio_base_low; |
u32 mmio_base_high; |
u32 gsi_interrupt; |
u8 interrupt_polarity; |
u8 interrupt_mode; |
u8 num_channels; |
u8 dma_address_width; |
u16 base_request_line; |
u16 num_handshake_signals; |
u32 max_block_size; |
/* Resource descriptors immediately follow (Length = Group length - shared_info_length) */ |
}; |
/* Resource Descriptor subtable */ |
struct acpi_csrt_descriptor { |
u32 length; |
u16 type; |
u16 subtype; |
u32 uid; |
/* Resource-specific information immediately follows */ |
}; |
/* Resource Types */ |
#define ACPI_CSRT_TYPE_INTERRUPT 0x0001 |
#define ACPI_CSRT_TYPE_TIMER 0x0002 |
#define ACPI_CSRT_TYPE_DMA 0x0003 |
/* Resource Subtypes */ |
#define ACPI_CSRT_XRUPT_LINE 0x0000 |
#define ACPI_CSRT_XRUPT_CONTROLLER 0x0001 |
#define ACPI_CSRT_TIMER 0x0000 |
#define ACPI_CSRT_DMA_CHANNEL 0x0000 |
#define ACPI_CSRT_DMA_CONTROLLER 0x0001 |
/******************************************************************************* |
* |
* DBG2 - Debug Port Table 2 |
* Version 0 (Both main table and subtables) |
* |
* Conforms to "Microsoft Debug Port Table 2 (DBG2)", May 22 2012. |
* |
******************************************************************************/ |
struct acpi_table_dbg2 { |
struct acpi_table_header header; /* Common ACPI table header */ |
u32 info_offset; |
u32 info_count; |
}; |
struct acpi_dbg2_header { |
u32 info_offset; |
u32 info_count; |
}; |
/* Debug Device Information Subtable */ |
struct acpi_dbg2_device { |
u8 revision; |
u16 length; |
u8 register_count; /* Number of base_address registers */ |
u16 namepath_length; |
u16 namepath_offset; |
u16 oem_data_length; |
u16 oem_data_offset; |
u16 port_type; |
u16 port_subtype; |
u16 reserved; |
u16 base_address_offset; |
u16 address_size_offset; |
/* |
* Data that follows: |
* base_address (required) - Each in 12-byte Generic Address Structure format. |
* address_size (required) - Array of u32 sizes corresponding to each base_address register. |
* Namepath (required) - Null terminated string. Single dot if not supported. |
* oem_data (optional) - Length is oem_data_length. |
*/ |
}; |
/* Types for port_type field above */ |
#define ACPI_DBG2_SERIAL_PORT 0x8000 |
#define ACPI_DBG2_1394_PORT 0x8001 |
#define ACPI_DBG2_USB_PORT 0x8002 |
#define ACPI_DBG2_NET_PORT 0x8003 |
/* Subtypes for port_subtype field above */ |
#define ACPI_DBG2_16550_COMPATIBLE 0x0000 |
#define ACPI_DBG2_16550_SUBSET 0x0001 |
#define ACPI_DBG2_1394_STANDARD 0x0000 |
#define ACPI_DBG2_USB_XHCI 0x0000 |
#define ACPI_DBG2_USB_EHCI 0x0001 |
/******************************************************************************* |
* |
* DBGP - Debug Port table |
* Version 1 |
* |
* Conforms to the "Debug Port Specification", Version 1.00, 2/9/2000 |
* |
******************************************************************************/ |
struct acpi_table_dbgp { |
struct acpi_table_header header; /* Common ACPI table header */ |
u8 type; /* 0=full 16550, 1=subset of 16550 */ |
u8 reserved[3]; |
struct acpi_generic_address debug_port; |
}; |
/******************************************************************************* |
* |
* DMAR - DMA Remapping table |
* Version 1 |
* |
* Conforms to "Intel Virtualization Technology for Directed I/O", |
* Version 2.2, Sept. 2013 |
* |
******************************************************************************/ |
struct acpi_table_dmar { |
struct acpi_table_header header; /* Common ACPI table header */ |
u8 width; /* Host Address Width */ |
u8 flags; |
u8 reserved[10]; |
}; |
/* Masks for Flags field above */ |
#define ACPI_DMAR_INTR_REMAP (1) |
/* DMAR subtable header */ |
struct acpi_dmar_header { |
u16 type; |
u16 length; |
}; |
/* Values for subtable type in struct acpi_dmar_header */ |
enum acpi_dmar_type { |
ACPI_DMAR_TYPE_HARDWARE_UNIT = 0, |
ACPI_DMAR_TYPE_RESERVED_MEMORY = 1, |
ACPI_DMAR_TYPE_ROOT_ATS = 2, |
ACPI_DMAR_TYPE_HARDWARE_AFFINITY = 3, |
ACPI_DMAR_TYPE_NAMESPACE = 4, |
ACPI_DMAR_TYPE_RESERVED = 5 /* 5 and greater are reserved */ |
}; |
/* DMAR Device Scope structure */ |
struct acpi_dmar_device_scope { |
u8 entry_type; |
u8 length; |
u16 reserved; |
u8 enumeration_id; |
u8 bus; |
}; |
/* Values for entry_type in struct acpi_dmar_device_scope - device types */ |
enum acpi_dmar_scope_type { |
ACPI_DMAR_SCOPE_TYPE_NOT_USED = 0, |
ACPI_DMAR_SCOPE_TYPE_ENDPOINT = 1, |
ACPI_DMAR_SCOPE_TYPE_BRIDGE = 2, |
ACPI_DMAR_SCOPE_TYPE_IOAPIC = 3, |
ACPI_DMAR_SCOPE_TYPE_HPET = 4, |
ACPI_DMAR_SCOPE_TYPE_NAMESPACE = 5, |
ACPI_DMAR_SCOPE_TYPE_RESERVED = 6 /* 6 and greater are reserved */ |
}; |
struct acpi_dmar_pci_path { |
u8 device; |
u8 function; |
}; |
/* |
* DMAR Subtables, correspond to Type in struct acpi_dmar_header |
*/ |
/* 0: Hardware Unit Definition */ |
struct acpi_dmar_hardware_unit { |
struct acpi_dmar_header header; |
u8 flags; |
u8 reserved; |
u16 segment; |
u64 address; /* Register Base Address */ |
}; |
/* Masks for Flags field above */ |
#define ACPI_DMAR_INCLUDE_ALL (1) |
/* 1: Reserved Memory Defininition */ |
struct acpi_dmar_reserved_memory { |
struct acpi_dmar_header header; |
u16 reserved; |
u16 segment; |
u64 base_address; /* 4K aligned base address */ |
u64 end_address; /* 4K aligned limit address */ |
}; |
/* Masks for Flags field above */ |
#define ACPI_DMAR_ALLOW_ALL (1) |
/* 2: Root Port ATS Capability Reporting Structure */ |
struct acpi_dmar_atsr { |
struct acpi_dmar_header header; |
u8 flags; |
u8 reserved; |
u16 segment; |
}; |
/* Masks for Flags field above */ |
#define ACPI_DMAR_ALL_PORTS (1) |
/* 3: Remapping Hardware Static Affinity Structure */ |
struct acpi_dmar_rhsa { |
struct acpi_dmar_header header; |
u32 reserved; |
u64 base_address; |
u32 proximity_domain; |
}; |
/* 4: ACPI Namespace Device Declaration Structure */ |
struct acpi_dmar_andd { |
struct acpi_dmar_header header; |
u8 reserved[3]; |
u8 device_number; |
char device_name[1]; |
}; |
/******************************************************************************* |
* |
* HPET - High Precision Event Timer table |
* Version 1 |
* |
* Conforms to "IA-PC HPET (High Precision Event Timers) Specification", |
* Version 1.0a, October 2004 |
* |
******************************************************************************/ |
struct acpi_table_hpet { |
struct acpi_table_header header; /* Common ACPI table header */ |
u32 id; /* Hardware ID of event timer block */ |
struct acpi_generic_address address; /* Address of event timer block */ |
u8 sequence; /* HPET sequence number */ |
u16 minimum_tick; /* Main counter min tick, periodic mode */ |
u8 flags; |
}; |
/* Masks for Flags field above */ |
#define ACPI_HPET_PAGE_PROTECT_MASK (3) |
/* Values for Page Protect flags */ |
enum acpi_hpet_page_protect { |
ACPI_HPET_NO_PAGE_PROTECT = 0, |
ACPI_HPET_PAGE_PROTECT4 = 1, |
ACPI_HPET_PAGE_PROTECT64 = 2 |
}; |
/******************************************************************************* |
* |
* IBFT - Boot Firmware Table |
* Version 1 |
* |
* Conforms to "iSCSI Boot Firmware Table (iBFT) as Defined in ACPI 3.0b |
* Specification", Version 1.01, March 1, 2007 |
* |
* Note: It appears that this table is not intended to appear in the RSDT/XSDT. |
* Therefore, it is not currently supported by the disassembler. |
* |
******************************************************************************/ |
struct acpi_table_ibft { |
struct acpi_table_header header; /* Common ACPI table header */ |
u8 reserved[12]; |
}; |
/* IBFT common subtable header */ |
struct acpi_ibft_header { |
u8 type; |
u8 version; |
u16 length; |
u8 index; |
u8 flags; |
}; |
/* Values for Type field above */ |
enum acpi_ibft_type { |
ACPI_IBFT_TYPE_NOT_USED = 0, |
ACPI_IBFT_TYPE_CONTROL = 1, |
ACPI_IBFT_TYPE_INITIATOR = 2, |
ACPI_IBFT_TYPE_NIC = 3, |
ACPI_IBFT_TYPE_TARGET = 4, |
ACPI_IBFT_TYPE_EXTENSIONS = 5, |
ACPI_IBFT_TYPE_RESERVED = 6 /* 6 and greater are reserved */ |
}; |
/* IBFT subtables */ |
struct acpi_ibft_control { |
struct acpi_ibft_header header; |
u16 extensions; |
u16 initiator_offset; |
u16 nic0_offset; |
u16 target0_offset; |
u16 nic1_offset; |
u16 target1_offset; |
}; |
struct acpi_ibft_initiator { |
struct acpi_ibft_header header; |
u8 sns_server[16]; |
u8 slp_server[16]; |
u8 primary_server[16]; |
u8 secondary_server[16]; |
u16 name_length; |
u16 name_offset; |
}; |
struct acpi_ibft_nic { |
struct acpi_ibft_header header; |
u8 ip_address[16]; |
u8 subnet_mask_prefix; |
u8 origin; |
u8 gateway[16]; |
u8 primary_dns[16]; |
u8 secondary_dns[16]; |
u8 dhcp[16]; |
u16 vlan; |
u8 mac_address[6]; |
u16 pci_address; |
u16 name_length; |
u16 name_offset; |
}; |
struct acpi_ibft_target { |
struct acpi_ibft_header header; |
u8 target_ip_address[16]; |
u16 target_ip_socket; |
u8 target_boot_lun[8]; |
u8 chap_type; |
u8 nic_association; |
u16 target_name_length; |
u16 target_name_offset; |
u16 chap_name_length; |
u16 chap_name_offset; |
u16 chap_secret_length; |
u16 chap_secret_offset; |
u16 reverse_chap_name_length; |
u16 reverse_chap_name_offset; |
u16 reverse_chap_secret_length; |
u16 reverse_chap_secret_offset; |
}; |
/******************************************************************************* |
* |
* IORT - IO Remapping Table |
* |
* Conforms to "IO Remapping Table System Software on ARM Platforms", |
* Document number: ARM DEN 0049A, 2015 |
* |
******************************************************************************/ |
struct acpi_table_iort { |
struct acpi_table_header header; |
u32 node_count; |
u32 node_offset; |
u32 reserved; |
}; |
/* |
* IORT subtables |
*/ |
struct acpi_iort_node { |
u8 type; |
u16 length; |
u8 revision; |
u32 reserved; |
u32 mapping_count; |
u32 mapping_offset; |
char node_data[1]; |
}; |
/* Values for subtable Type above */ |
enum acpi_iort_node_type { |
ACPI_IORT_NODE_ITS_GROUP = 0x00, |
ACPI_IORT_NODE_NAMED_COMPONENT = 0x01, |
ACPI_IORT_NODE_PCI_ROOT_COMPLEX = 0x02, |
ACPI_IORT_NODE_SMMU = 0x03 |
}; |
struct acpi_iort_id_mapping { |
u32 input_base; /* Lowest value in input range */ |
u32 id_count; /* Number of IDs */ |
u32 output_base; /* Lowest value in output range */ |
u32 output_reference; /* A reference to the output node */ |
u32 flags; |
}; |
/* Masks for Flags field above for IORT subtable */ |
#define ACPI_IORT_ID_SINGLE_MAPPING (1) |
struct acpi_iort_memory_access { |
u32 cache_coherency; |
u8 hints; |
u16 reserved; |
u8 memory_flags; |
}; |
/* Values for cache_coherency field above */ |
#define ACPI_IORT_NODE_COHERENT 0x00000001 /* The device node is fully coherent */ |
#define ACPI_IORT_NODE_NOT_COHERENT 0x00000000 /* The device node is not coherent */ |
/* Masks for Hints field above */ |
#define ACPI_IORT_HT_TRANSIENT (1) |
#define ACPI_IORT_HT_WRITE (1<<1) |
#define ACPI_IORT_HT_READ (1<<2) |
#define ACPI_IORT_HT_OVERRIDE (1<<3) |
/* Masks for memory_flags field above */ |
#define ACPI_IORT_MF_COHERENCY (1) |
#define ACPI_IORT_MF_ATTRIBUTES (1<<1) |
/* |
* IORT node specific subtables |
*/ |
struct acpi_iort_its_group { |
u32 its_count; |
u32 identifiers[1]; /* GIC ITS identifier arrary */ |
}; |
struct acpi_iort_named_component { |
u32 node_flags; |
u64 memory_properties; /* Memory access properties */ |
u8 memory_address_limit; /* Memory address size limit */ |
char device_name[1]; /* Path of namespace object */ |
}; |
struct acpi_iort_root_complex { |
u64 memory_properties; /* Memory access properties */ |
u32 ats_attribute; |
u32 pci_segment_number; |
}; |
/* Values for ats_attribute field above */ |
#define ACPI_IORT_ATS_SUPPORTED 0x00000001 /* The root complex supports ATS */ |
#define ACPI_IORT_ATS_UNSUPPORTED 0x00000000 /* The root complex doesn't support ATS */ |
struct acpi_iort_smmu { |
u64 base_address; /* SMMU base address */ |
u64 span; /* Length of memory range */ |
u32 model; |
u32 flags; |
u32 global_interrupt_offset; |
u32 context_interrupt_count; |
u32 context_interrupt_offset; |
u32 pmu_interrupt_count; |
u32 pmu_interrupt_offset; |
u64 interrupts[1]; /* Interrupt array */ |
}; |
/* Values for Model field above */ |
#define ACPI_IORT_SMMU_V1 0x00000000 /* Generic SMMUv1 */ |
#define ACPI_IORT_SMMU_V2 0x00000001 /* Generic SMMUv2 */ |
#define ACPI_IORT_SMMU_CORELINK_MMU400 0x00000002 /* ARM Corelink MMU-400 */ |
#define ACPI_IORT_SMMU_CORELINK_MMU500 0x00000003 /* ARM Corelink MMU-500 */ |
/* Masks for Flags field above */ |
#define ACPI_IORT_SMMU_DVM_SUPPORTED (1) |
#define ACPI_IORT_SMMU_COHERENT_WALK (1<<1) |
/******************************************************************************* |
* |
* IVRS - I/O Virtualization Reporting Structure |
* Version 1 |
* |
* Conforms to "AMD I/O Virtualization Technology (IOMMU) Specification", |
* Revision 1.26, February 2009. |
* |
******************************************************************************/ |
struct acpi_table_ivrs { |
struct acpi_table_header header; /* Common ACPI table header */ |
u32 info; /* Common virtualization info */ |
u64 reserved; |
}; |
/* Values for Info field above */ |
#define ACPI_IVRS_PHYSICAL_SIZE 0x00007F00 /* 7 bits, physical address size */ |
#define ACPI_IVRS_VIRTUAL_SIZE 0x003F8000 /* 7 bits, virtual address size */ |
#define ACPI_IVRS_ATS_RESERVED 0x00400000 /* ATS address translation range reserved */ |
/* IVRS subtable header */ |
struct acpi_ivrs_header { |
u8 type; /* Subtable type */ |
u8 flags; |
u16 length; /* Subtable length */ |
u16 device_id; /* ID of IOMMU */ |
}; |
/* Values for subtable Type above */ |
enum acpi_ivrs_type { |
ACPI_IVRS_TYPE_HARDWARE = 0x10, |
ACPI_IVRS_TYPE_MEMORY1 = 0x20, |
ACPI_IVRS_TYPE_MEMORY2 = 0x21, |
ACPI_IVRS_TYPE_MEMORY3 = 0x22 |
}; |
/* Masks for Flags field above for IVHD subtable */ |
#define ACPI_IVHD_TT_ENABLE (1) |
#define ACPI_IVHD_PASS_PW (1<<1) |
#define ACPI_IVHD_RES_PASS_PW (1<<2) |
#define ACPI_IVHD_ISOC (1<<3) |
#define ACPI_IVHD_IOTLB (1<<4) |
/* Masks for Flags field above for IVMD subtable */ |
#define ACPI_IVMD_UNITY (1) |
#define ACPI_IVMD_READ (1<<1) |
#define ACPI_IVMD_WRITE (1<<2) |
#define ACPI_IVMD_EXCLUSION_RANGE (1<<3) |
/* |
* IVRS subtables, correspond to Type in struct acpi_ivrs_header |
*/ |
/* 0x10: I/O Virtualization Hardware Definition Block (IVHD) */ |
struct acpi_ivrs_hardware { |
struct acpi_ivrs_header header; |
u16 capability_offset; /* Offset for IOMMU control fields */ |
u64 base_address; /* IOMMU control registers */ |
u16 pci_segment_group; |
u16 info; /* MSI number and unit ID */ |
u32 reserved; |
}; |
/* Masks for Info field above */ |
#define ACPI_IVHD_MSI_NUMBER_MASK 0x001F /* 5 bits, MSI message number */ |
#define ACPI_IVHD_UNIT_ID_MASK 0x1F00 /* 5 bits, unit_ID */ |
/* |
* Device Entries for IVHD subtable, appear after struct acpi_ivrs_hardware structure. |
* Upper two bits of the Type field are the (encoded) length of the structure. |
* Currently, only 4 and 8 byte entries are defined. 16 and 32 byte entries |
* are reserved for future use but not defined. |
*/ |
struct acpi_ivrs_de_header { |
u8 type; |
u16 id; |
u8 data_setting; |
}; |
/* Length of device entry is in the top two bits of Type field above */ |
#define ACPI_IVHD_ENTRY_LENGTH 0xC0 |
/* Values for device entry Type field above */ |
enum acpi_ivrs_device_entry_type { |
/* 4-byte device entries, all use struct acpi_ivrs_device4 */ |
ACPI_IVRS_TYPE_PAD4 = 0, |
ACPI_IVRS_TYPE_ALL = 1, |
ACPI_IVRS_TYPE_SELECT = 2, |
ACPI_IVRS_TYPE_START = 3, |
ACPI_IVRS_TYPE_END = 4, |
/* 8-byte device entries */ |
ACPI_IVRS_TYPE_PAD8 = 64, |
ACPI_IVRS_TYPE_NOT_USED = 65, |
ACPI_IVRS_TYPE_ALIAS_SELECT = 66, /* Uses struct acpi_ivrs_device8a */ |
ACPI_IVRS_TYPE_ALIAS_START = 67, /* Uses struct acpi_ivrs_device8a */ |
ACPI_IVRS_TYPE_EXT_SELECT = 70, /* Uses struct acpi_ivrs_device8b */ |
ACPI_IVRS_TYPE_EXT_START = 71, /* Uses struct acpi_ivrs_device8b */ |
ACPI_IVRS_TYPE_SPECIAL = 72 /* Uses struct acpi_ivrs_device8c */ |
}; |
/* Values for Data field above */ |
#define ACPI_IVHD_INIT_PASS (1) |
#define ACPI_IVHD_EINT_PASS (1<<1) |
#define ACPI_IVHD_NMI_PASS (1<<2) |
#define ACPI_IVHD_SYSTEM_MGMT (3<<4) |
#define ACPI_IVHD_LINT0_PASS (1<<6) |
#define ACPI_IVHD_LINT1_PASS (1<<7) |
/* Types 0-4: 4-byte device entry */ |
struct acpi_ivrs_device4 { |
struct acpi_ivrs_de_header header; |
}; |
/* Types 66-67: 8-byte device entry */ |
struct acpi_ivrs_device8a { |
struct acpi_ivrs_de_header header; |
u8 reserved1; |
u16 used_id; |
u8 reserved2; |
}; |
/* Types 70-71: 8-byte device entry */ |
struct acpi_ivrs_device8b { |
struct acpi_ivrs_de_header header; |
u32 extended_data; |
}; |
/* Values for extended_data above */ |
#define ACPI_IVHD_ATS_DISABLED (1<<31) |
/* Type 72: 8-byte device entry */ |
struct acpi_ivrs_device8c { |
struct acpi_ivrs_de_header header; |
u8 handle; |
u16 used_id; |
u8 variety; |
}; |
/* Values for Variety field above */ |
#define ACPI_IVHD_IOAPIC 1 |
#define ACPI_IVHD_HPET 2 |
/* 0x20, 0x21, 0x22: I/O Virtualization Memory Definition Block (IVMD) */ |
struct acpi_ivrs_memory { |
struct acpi_ivrs_header header; |
u16 aux_data; |
u64 reserved; |
u64 start_address; |
u64 memory_length; |
}; |
/******************************************************************************* |
* |
* LPIT - Low Power Idle Table |
* |
* Conforms to "ACPI Low Power Idle Table (LPIT)" July 2014. |
* |
******************************************************************************/ |
struct acpi_table_lpit { |
struct acpi_table_header header; /* Common ACPI table header */ |
}; |
/* LPIT subtable header */ |
struct acpi_lpit_header { |
u32 type; /* Subtable type */ |
u32 length; /* Subtable length */ |
u16 unique_id; |
u16 reserved; |
u32 flags; |
}; |
/* Values for subtable Type above */ |
enum acpi_lpit_type { |
ACPI_LPIT_TYPE_NATIVE_CSTATE = 0x00, |
ACPI_LPIT_TYPE_RESERVED = 0x01 /* 1 and above are reserved */ |
}; |
/* Masks for Flags field above */ |
#define ACPI_LPIT_STATE_DISABLED (1) |
#define ACPI_LPIT_NO_COUNTER (1<<1) |
/* |
* LPIT subtables, correspond to Type in struct acpi_lpit_header |
*/ |
/* 0x00: Native C-state instruction based LPI structure */ |
struct acpi_lpit_native { |
struct acpi_lpit_header header; |
struct acpi_generic_address entry_trigger; |
u32 residency; |
u32 latency; |
struct acpi_generic_address residency_counter; |
u64 counter_frequency; |
}; |
/******************************************************************************* |
* |
* MCFG - PCI Memory Mapped Configuration table and subtable |
* Version 1 |
* |
* Conforms to "PCI Firmware Specification", Revision 3.0, June 20, 2005 |
* |
******************************************************************************/ |
struct acpi_table_mcfg { |
struct acpi_table_header header; /* Common ACPI table header */ |
u8 reserved[8]; |
}; |
/* Subtable */ |
struct acpi_mcfg_allocation { |
u64 address; /* Base address, processor-relative */ |
u16 pci_segment; /* PCI segment group number */ |
u8 start_bus_number; /* Starting PCI Bus number */ |
u8 end_bus_number; /* Final PCI Bus number */ |
u32 reserved; |
}; |
/******************************************************************************* |
* |
* MCHI - Management Controller Host Interface Table |
* Version 1 |
* |
* Conforms to "Management Component Transport Protocol (MCTP) Host |
* Interface Specification", Revision 1.0.0a, October 13, 2009 |
* |
******************************************************************************/ |
struct acpi_table_mchi { |
struct acpi_table_header header; /* Common ACPI table header */ |
u8 interface_type; |
u8 protocol; |
u64 protocol_data; |
u8 interrupt_type; |
u8 gpe; |
u8 pci_device_flag; |
u32 global_interrupt; |
struct acpi_generic_address control_register; |
u8 pci_segment; |
u8 pci_bus; |
u8 pci_device; |
u8 pci_function; |
}; |
/******************************************************************************* |
* |
* MSDM - Microsoft Data Management table |
* |
* Conforms to "Microsoft Software Licensing Tables (SLIC and MSDM)", |
* November 29, 2011. Copyright 2011 Microsoft |
* |
******************************************************************************/ |
/* Basic MSDM table is only the common ACPI header */ |
struct acpi_table_msdm { |
struct acpi_table_header header; /* Common ACPI table header */ |
}; |
/******************************************************************************* |
* |
* MTMR - MID Timer Table |
* Version 1 |
* |
* Conforms to "Simple Firmware Interface Specification", |
* Draft 0.8.2, Oct 19, 2010 |
* NOTE: The ACPI MTMR is equivalent to the SFI MTMR table. |
* |
******************************************************************************/ |
struct acpi_table_mtmr { |
struct acpi_table_header header; /* Common ACPI table header */ |
}; |
/* MTMR entry */ |
struct acpi_mtmr_entry { |
struct acpi_generic_address physical_address; |
u32 frequency; |
u32 irq; |
}; |
/******************************************************************************* |
* |
* SLIC - Software Licensing Description Table |
* |
* Conforms to "Microsoft Software Licensing Tables (SLIC and MSDM)", |
* November 29, 2011. Copyright 2011 Microsoft |
* |
******************************************************************************/ |
/* Basic SLIC table is only the common ACPI header */ |
struct acpi_table_slic { |
struct acpi_table_header header; /* Common ACPI table header */ |
}; |
/******************************************************************************* |
* |
* SPCR - Serial Port Console Redirection table |
* Version 1 |
* |
* Conforms to "Serial Port Console Redirection Table", |
* Version 1.00, January 11, 2002 |
* |
******************************************************************************/ |
struct acpi_table_spcr { |
struct acpi_table_header header; /* Common ACPI table header */ |
u8 interface_type; /* 0=full 16550, 1=subset of 16550 */ |
u8 reserved[3]; |
struct acpi_generic_address serial_port; |
u8 interrupt_type; |
u8 pc_interrupt; |
u32 interrupt; |
u8 baud_rate; |
u8 parity; |
u8 stop_bits; |
u8 flow_control; |
u8 terminal_type; |
u8 reserved1; |
u16 pci_device_id; |
u16 pci_vendor_id; |
u8 pci_bus; |
u8 pci_device; |
u8 pci_function; |
u32 pci_flags; |
u8 pci_segment; |
u32 reserved2; |
}; |
/* Masks for pci_flags field above */ |
#define ACPI_SPCR_DO_NOT_DISABLE (1) |
/******************************************************************************* |
* |
* SPMI - Server Platform Management Interface table |
* Version 5 |
* |
* Conforms to "Intelligent Platform Management Interface Specification |
* Second Generation v2.0", Document Revision 1.0, February 12, 2004 with |
* June 12, 2009 markup. |
* |
******************************************************************************/ |
struct acpi_table_spmi { |
struct acpi_table_header header; /* Common ACPI table header */ |
u8 interface_type; |
u8 reserved; /* Must be 1 */ |
u16 spec_revision; /* Version of IPMI */ |
u8 interrupt_type; |
u8 gpe_number; /* GPE assigned */ |
u8 reserved1; |
u8 pci_device_flag; |
u32 interrupt; |
struct acpi_generic_address ipmi_register; |
u8 pci_segment; |
u8 pci_bus; |
u8 pci_device; |
u8 pci_function; |
u8 reserved2; |
}; |
/* Values for interface_type above */ |
enum acpi_spmi_interface_types { |
ACPI_SPMI_NOT_USED = 0, |
ACPI_SPMI_KEYBOARD = 1, |
ACPI_SPMI_SMI = 2, |
ACPI_SPMI_BLOCK_TRANSFER = 3, |
ACPI_SPMI_SMBUS = 4, |
ACPI_SPMI_RESERVED = 5 /* 5 and above are reserved */ |
}; |
/******************************************************************************* |
* |
* TCPA - Trusted Computing Platform Alliance table |
* Version 2 |
* |
* Conforms to "TCG ACPI Specification, Family 1.2 and 2.0", |
* December 19, 2014 |
* |
* NOTE: There are two versions of the table with the same signature -- |
* the client version and the server version. The common platform_class |
* field is used to differentiate the two types of tables. |
* |
******************************************************************************/ |
struct acpi_table_tcpa_hdr { |
struct acpi_table_header header; /* Common ACPI table header */ |
u16 platform_class; |
}; |
/* |
* Values for platform_class above. |
* This is how the client and server subtables are differentiated |
*/ |
#define ACPI_TCPA_CLIENT_TABLE 0 |
#define ACPI_TCPA_SERVER_TABLE 1 |
struct acpi_table_tcpa_client { |
u32 minimum_log_length; /* Minimum length for the event log area */ |
u64 log_address; /* Address of the event log area */ |
}; |
struct acpi_table_tcpa_server { |
u16 reserved; |
u64 minimum_log_length; /* Minimum length for the event log area */ |
u64 log_address; /* Address of the event log area */ |
u16 spec_revision; |
u8 device_flags; |
u8 interrupt_flags; |
u8 gpe_number; |
u8 reserved2[3]; |
u32 global_interrupt; |
struct acpi_generic_address address; |
u32 reserved3; |
struct acpi_generic_address config_address; |
u8 group; |
u8 bus; /* PCI Bus/Segment/Function numbers */ |
u8 device; |
u8 function; |
}; |
/* Values for device_flags above */ |
#define ACPI_TCPA_PCI_DEVICE (1) |
#define ACPI_TCPA_BUS_PNP (1<<1) |
#define ACPI_TCPA_ADDRESS_VALID (1<<2) |
/* Values for interrupt_flags above */ |
#define ACPI_TCPA_INTERRUPT_MODE (1) |
#define ACPI_TCPA_INTERRUPT_POLARITY (1<<1) |
#define ACPI_TCPA_SCI_VIA_GPE (1<<2) |
#define ACPI_TCPA_GLOBAL_INTERRUPT (1<<3) |
/******************************************************************************* |
* |
* TPM2 - Trusted Platform Module (TPM) 2.0 Hardware Interface Table |
* Version 4 |
* |
* Conforms to "TCG ACPI Specification, Family 1.2 and 2.0", |
* December 19, 2014 |
* |
******************************************************************************/ |
struct acpi_table_tpm2 { |
struct acpi_table_header header; /* Common ACPI table header */ |
u16 platform_class; |
u16 reserved; |
u64 control_address; |
u32 start_method; |
/* Platform-specific data follows */ |
}; |
/* Values for start_method above */ |
#define ACPI_TPM2_NOT_ALLOWED 0 |
#define ACPI_TPM2_START_METHOD 2 |
#define ACPI_TPM2_MEMORY_MAPPED 6 |
#define ACPI_TPM2_COMMAND_BUFFER 7 |
#define ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD 8 |
/******************************************************************************* |
* |
* UEFI - UEFI Boot optimization Table |
* Version 1 |
* |
* Conforms to "Unified Extensible Firmware Interface Specification", |
* Version 2.3, May 8, 2009 |
* |
******************************************************************************/ |
struct acpi_table_uefi { |
struct acpi_table_header header; /* Common ACPI table header */ |
u8 identifier[16]; /* UUID identifier */ |
u16 data_offset; /* Offset of remaining data in table */ |
}; |
/******************************************************************************* |
* |
* VRTC - Virtual Real Time Clock Table |
* Version 1 |
* |
* Conforms to "Simple Firmware Interface Specification", |
* Draft 0.8.2, Oct 19, 2010 |
* NOTE: The ACPI VRTC is equivalent to The SFI MRTC table. |
* |
******************************************************************************/ |
struct acpi_table_vrtc { |
struct acpi_table_header header; /* Common ACPI table header */ |
}; |
/* VRTC entry */ |
struct acpi_vrtc_entry { |
struct acpi_generic_address physical_address; |
u32 irq; |
}; |
/******************************************************************************* |
* |
* WAET - Windows ACPI Emulated devices Table |
* Version 1 |
* |
* Conforms to "Windows ACPI Emulated Devices Table", version 1.0, April 6, 2009 |
* |
******************************************************************************/ |
struct acpi_table_waet { |
struct acpi_table_header header; /* Common ACPI table header */ |
u32 flags; |
}; |
/* Masks for Flags field above */ |
#define ACPI_WAET_RTC_NO_ACK (1) /* RTC requires no int acknowledge */ |
#define ACPI_WAET_TIMER_ONE_READ (1<<1) /* PM timer requires only one read */ |
/******************************************************************************* |
* |
* WDAT - Watchdog Action Table |
* Version 1 |
* |
* Conforms to "Hardware Watchdog Timers Design Specification", |
* Copyright 2006 Microsoft Corporation. |
* |
******************************************************************************/ |
struct acpi_table_wdat { |
struct acpi_table_header header; /* Common ACPI table header */ |
u32 header_length; /* Watchdog Header Length */ |
u16 pci_segment; /* PCI Segment number */ |
u8 pci_bus; /* PCI Bus number */ |
u8 pci_device; /* PCI Device number */ |
u8 pci_function; /* PCI Function number */ |
u8 reserved[3]; |
u32 timer_period; /* Period of one timer count (msec) */ |
u32 max_count; /* Maximum counter value supported */ |
u32 min_count; /* Minimum counter value */ |
u8 flags; |
u8 reserved2[3]; |
u32 entries; /* Number of watchdog entries that follow */ |
}; |
/* Masks for Flags field above */ |
#define ACPI_WDAT_ENABLED (1) |
#define ACPI_WDAT_STOPPED 0x80 |
/* WDAT Instruction Entries (actions) */ |
struct acpi_wdat_entry { |
u8 action; |
u8 instruction; |
u16 reserved; |
struct acpi_generic_address register_region; |
u32 value; /* Value used with Read/Write register */ |
u32 mask; /* Bitmask required for this register instruction */ |
}; |
/* Values for Action field above */ |
enum acpi_wdat_actions { |
ACPI_WDAT_RESET = 1, |
ACPI_WDAT_GET_CURRENT_COUNTDOWN = 4, |
ACPI_WDAT_GET_COUNTDOWN = 5, |
ACPI_WDAT_SET_COUNTDOWN = 6, |
ACPI_WDAT_GET_RUNNING_STATE = 8, |
ACPI_WDAT_SET_RUNNING_STATE = 9, |
ACPI_WDAT_GET_STOPPED_STATE = 10, |
ACPI_WDAT_SET_STOPPED_STATE = 11, |
ACPI_WDAT_GET_REBOOT = 16, |
ACPI_WDAT_SET_REBOOT = 17, |
ACPI_WDAT_GET_SHUTDOWN = 18, |
ACPI_WDAT_SET_SHUTDOWN = 19, |
ACPI_WDAT_GET_STATUS = 32, |
ACPI_WDAT_SET_STATUS = 33, |
ACPI_WDAT_ACTION_RESERVED = 34 /* 34 and greater are reserved */ |
}; |
/* Values for Instruction field above */ |
enum acpi_wdat_instructions { |
ACPI_WDAT_READ_VALUE = 0, |
ACPI_WDAT_READ_COUNTDOWN = 1, |
ACPI_WDAT_WRITE_VALUE = 2, |
ACPI_WDAT_WRITE_COUNTDOWN = 3, |
ACPI_WDAT_INSTRUCTION_RESERVED = 4, /* 4 and greater are reserved */ |
ACPI_WDAT_PRESERVE_REGISTER = 0x80 /* Except for this value */ |
}; |
/******************************************************************************* |
* |
* WDDT - Watchdog Descriptor Table |
* Version 1 |
* |
* Conforms to "Using the Intel ICH Family Watchdog Timer (WDT)", |
* Version 001, September 2002 |
* |
******************************************************************************/ |
struct acpi_table_wddt { |
struct acpi_table_header header; /* Common ACPI table header */ |
u16 spec_version; |
u16 table_version; |
u16 pci_vendor_id; |
struct acpi_generic_address address; |
u16 max_count; /* Maximum counter value supported */ |
u16 min_count; /* Minimum counter value supported */ |
u16 period; |
u16 status; |
u16 capability; |
}; |
/* Flags for Status field above */ |
#define ACPI_WDDT_AVAILABLE (1) |
#define ACPI_WDDT_ACTIVE (1<<1) |
#define ACPI_WDDT_TCO_OS_OWNED (1<<2) |
#define ACPI_WDDT_USER_RESET (1<<11) |
#define ACPI_WDDT_WDT_RESET (1<<12) |
#define ACPI_WDDT_POWER_FAIL (1<<13) |
#define ACPI_WDDT_UNKNOWN_RESET (1<<14) |
/* Flags for Capability field above */ |
#define ACPI_WDDT_AUTO_RESET (1) |
#define ACPI_WDDT_ALERT_SUPPORT (1<<1) |
/******************************************************************************* |
* |
* WDRT - Watchdog Resource Table |
* Version 1 |
* |
* Conforms to "Watchdog Timer Hardware Requirements for Windows Server 2003", |
* Version 1.01, August 28, 2006 |
* |
******************************************************************************/ |
struct acpi_table_wdrt { |
struct acpi_table_header header; /* Common ACPI table header */ |
struct acpi_generic_address control_register; |
struct acpi_generic_address count_register; |
u16 pci_device_id; |
u16 pci_vendor_id; |
u8 pci_bus; /* PCI Bus number */ |
u8 pci_device; /* PCI Device number */ |
u8 pci_function; /* PCI Function number */ |
u8 pci_segment; /* PCI Segment number */ |
u16 max_count; /* Maximum counter value supported */ |
u8 units; |
}; |
/* Reset to default packing */ |
#pragma pack() |
#endif /* __ACTBL2_H__ */ |
/drivers/include/acpi/actypes.h |
---|
0,0 → 1,1301 |
/****************************************************************************** |
* |
* Name: actypes.h - Common data types for the entire ACPI subsystem |
* |
*****************************************************************************/ |
/* |
* Copyright (C) 2000 - 2015, 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 __ACTYPES_H__ |
#define __ACTYPES_H__ |
/* acpisrc:struct_defs -- for acpisrc conversion */ |
/* |
* ACPI_MACHINE_WIDTH must be specified in an OS- or compiler-dependent header |
* and must be either 32 or 64. 16-bit ACPICA is no longer supported, as of |
* 12/2006. |
*/ |
#ifndef ACPI_MACHINE_WIDTH |
#error ACPI_MACHINE_WIDTH not defined |
#endif |
/* |
* Data type ranges |
* Note: These macros are designed to be compiler independent as well as |
* working around problems that some 32-bit compilers have with 64-bit |
* constants. |
*/ |
#define ACPI_UINT8_MAX (u8) (~((u8) 0)) /* 0xFF */ |
#define ACPI_UINT16_MAX (u16)(~((u16) 0)) /* 0xFFFF */ |
#define ACPI_UINT32_MAX (u32)(~((u32) 0)) /* 0xFFFFFFFF */ |
#define ACPI_UINT64_MAX (u64)(~((u64) 0)) /* 0xFFFFFFFFFFFFFFFF */ |
#define ACPI_ASCII_MAX 0x7F |
/* |
* Architecture-specific ACPICA Subsystem Data Types |
* |
* The goal of these types is to provide source code portability across |
* 16-bit, 32-bit, and 64-bit targets. |
* |
* 1) The following types are of fixed size for all targets (16/32/64): |
* |
* u8 Logical boolean |
* |
* u8 8-bit (1 byte) unsigned value |
* u16 16-bit (2 byte) unsigned value |
* u32 32-bit (4 byte) unsigned value |
* u64 64-bit (8 byte) unsigned value |
* |
* s16 16-bit (2 byte) signed value |
* s32 32-bit (4 byte) signed value |
* s64 64-bit (8 byte) signed value |
* |
* COMPILER_DEPENDENT_UINT64/s64 - These types are defined in the |
* compiler-dependent header(s) and were introduced because there is no common |
* 64-bit integer type across the various compilation models, as shown in |
* the table below. |
* |
* Datatype LP64 ILP64 LLP64 ILP32 LP32 16bit |
* char 8 8 8 8 8 8 |
* short 16 16 16 16 16 16 |
* _int32 32 |
* int 32 64 32 32 16 16 |
* long 64 64 32 32 32 32 |
* long long 64 64 |
* pointer 64 64 64 32 32 32 |
* |
* Note: ILP64 and LP32 are currently not supported. |
* |
* |
* 2) These types represent the native word size of the target mode of the |
* processor, and may be 16-bit, 32-bit, or 64-bit as required. They are |
* usually used for memory allocation, efficient loop counters, and array |
* indexes. The types are similar to the size_t type in the C library and are |
* required because there is no C type that consistently represents the native |
* data width. acpi_size is needed because there is no guarantee that a |
* kernel-level C library is present. |
* |
* acpi_size 16/32/64-bit unsigned value |
* acpi_native_int 16/32/64-bit signed value |
*/ |
/******************************************************************************* |
* |
* Common types for all compilers, all targets |
* |
******************************************************************************/ |
#ifndef ACPI_USE_SYSTEM_INTTYPES |
typedef unsigned char u8; |
typedef unsigned short u16; |
typedef short s16; |
typedef COMPILER_DEPENDENT_UINT64 u64; |
typedef COMPILER_DEPENDENT_INT64 s64; |
#endif /* ACPI_USE_SYSTEM_INTTYPES */ |
/* |
* Value returned by acpi_os_get_thread_id. There is no standard "thread_id" |
* across operating systems or even the various UNIX systems. Since ACPICA |
* only needs the thread ID as a unique thread identifier, we use a u64 |
* as the only common data type - it will accommodate any type of pointer or |
* any type of integer. It is up to the host-dependent OSL to cast the |
* native thread ID type to a u64 (in acpi_os_get_thread_id). |
*/ |
#define acpi_thread_id u64 |
/******************************************************************************* |
* |
* Types specific to 64-bit targets |
* |
******************************************************************************/ |
#if ACPI_MACHINE_WIDTH == 64 |
#ifndef ACPI_USE_SYSTEM_INTTYPES |
typedef unsigned int u32; |
typedef int s32; |
#endif /* ACPI_USE_SYSTEM_INTTYPES */ |
typedef s64 acpi_native_int; |
typedef u64 acpi_size; |
typedef u64 acpi_io_address; |
typedef u64 acpi_physical_address; |
#define ACPI_MAX_PTR ACPI_UINT64_MAX |
#define ACPI_SIZE_MAX ACPI_UINT64_MAX |
#define ACPI_USE_NATIVE_DIVIDE /* Has native 64-bit integer support */ |
/* |
* In the case of the Itanium Processor Family (IPF), the hardware does not |
* support misaligned memory transfers. Set the MISALIGNMENT_NOT_SUPPORTED flag |
* to indicate that special precautions must be taken to avoid alignment faults. |
* (IA64 or ia64 is currently used by existing compilers to indicate IPF.) |
* |
* Note: EM64T and other X86-64 processors support misaligned transfers, |
* so there is no need to define this flag. |
*/ |
#if defined (__IA64__) || defined (__ia64__) |
#define ACPI_MISALIGNMENT_NOT_SUPPORTED |
#endif |
/******************************************************************************* |
* |
* Types specific to 32-bit targets |
* |
******************************************************************************/ |
#elif ACPI_MACHINE_WIDTH == 32 |
#ifndef ACPI_USE_SYSTEM_INTTYPES |
typedef unsigned int u32; |
typedef int s32; |
#endif /* ACPI_USE_SYSTEM_INTTYPES */ |
typedef s32 acpi_native_int; |
typedef u32 acpi_size; |
#ifdef ACPI_32BIT_PHYSICAL_ADDRESS |
/* |
* OSPMs can define this to shrink the size of the structures for 32-bit |
* none PAE environment. ASL compiler may always define this to generate |
* 32-bit OSPM compliant tables. |
*/ |
typedef u32 acpi_io_address; |
typedef u32 acpi_physical_address; |
#else /* ACPI_32BIT_PHYSICAL_ADDRESS */ |
/* |
* It is reported that, after some calculations, the physical addresses can |
* wrap over the 32-bit boundary on 32-bit PAE environment. |
* https://bugzilla.kernel.org/show_bug.cgi?id=87971 |
*/ |
typedef u64 acpi_io_address; |
typedef u64 acpi_physical_address; |
#endif /* ACPI_32BIT_PHYSICAL_ADDRESS */ |
#define ACPI_MAX_PTR ACPI_UINT32_MAX |
#define ACPI_SIZE_MAX ACPI_UINT32_MAX |
#else |
/* ACPI_MACHINE_WIDTH must be either 64 or 32 */ |
#error unknown ACPI_MACHINE_WIDTH |
#endif |
/******************************************************************************* |
* |
* OS-dependent types |
* |
* If the defaults below are not appropriate for the host system, they can |
* be defined in the OS-specific header, and this will take precedence. |
* |
******************************************************************************/ |
/* Flags for acpi_os_acquire_lock/acpi_os_release_lock */ |
#ifndef acpi_cpu_flags |
#define acpi_cpu_flags acpi_size |
#endif |
/* Object returned from acpi_os_create_cache */ |
#ifndef acpi_cache_t |
#ifdef ACPI_USE_LOCAL_CACHE |
#define acpi_cache_t struct acpi_memory_list |
#else |
#define acpi_cache_t void * |
#endif |
#endif |
/* |
* Synchronization objects - Mutexes, Semaphores, and spin_locks |
*/ |
#if (ACPI_MUTEX_TYPE == ACPI_BINARY_SEMAPHORE) |
/* |
* These macros are used if the host OS does not support a mutex object. |
* Map the OSL Mutex interfaces to binary semaphores. |
*/ |
#define acpi_mutex acpi_semaphore |
#define acpi_os_create_mutex(out_handle) acpi_os_create_semaphore (1, 1, out_handle) |
#define acpi_os_delete_mutex(handle) (void) acpi_os_delete_semaphore (handle) |
#define acpi_os_acquire_mutex(handle,time) acpi_os_wait_semaphore (handle, 1, time) |
#define acpi_os_release_mutex(handle) (void) acpi_os_signal_semaphore (handle, 1) |
#endif |
/* Configurable types for synchronization objects */ |
#ifndef acpi_spinlock |
#define acpi_spinlock void * |
#endif |
#ifndef acpi_semaphore |
#define acpi_semaphore void * |
#endif |
#ifndef acpi_mutex |
#define acpi_mutex void * |
#endif |
/******************************************************************************* |
* |
* Compiler-dependent types |
* |
* If the defaults below are not appropriate for the host compiler, they can |
* be defined in the compiler-specific header, and this will take precedence. |
* |
******************************************************************************/ |
/* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */ |
#ifndef acpi_uintptr_t |
#define acpi_uintptr_t void * |
#endif |
/* |
* ACPI_PRINTF_LIKE is used to tag functions as "printf-like" because |
* some compilers can catch printf format string problems |
*/ |
#ifndef ACPI_PRINTF_LIKE |
#define ACPI_PRINTF_LIKE(c) |
#endif |
/* |
* Some compilers complain about unused variables. Sometimes we don't want to |
* use all the variables (for example, _acpi_module_name). This allows us |
* to tell the compiler in a per-variable manner that a variable |
* is unused |
*/ |
#ifndef ACPI_UNUSED_VAR |
#define ACPI_UNUSED_VAR |
#endif |
/* |
* All ACPICA external functions that are available to the rest of the kernel |
* are tagged with thes macros which can be defined as appropriate for the host. |
* |
* Notes: |
* ACPI_EXPORT_SYMBOL_INIT is used for initialization and termination |
* interfaces that may need special processing. |
* ACPI_EXPORT_SYMBOL is used for all other public external functions. |
*/ |
#ifndef ACPI_EXPORT_SYMBOL_INIT |
#define ACPI_EXPORT_SYMBOL_INIT(symbol) |
#endif |
#ifndef ACPI_EXPORT_SYMBOL |
#define ACPI_EXPORT_SYMBOL(symbol) |
#endif |
/* |
* Compiler/Clibrary-dependent debug initialization. Used for ACPICA |
* utilities only. |
*/ |
#ifndef ACPI_DEBUG_INITIALIZE |
#define ACPI_DEBUG_INITIALIZE() |
#endif |
/******************************************************************************* |
* |
* Configuration |
* |
******************************************************************************/ |
#ifdef ACPI_NO_MEM_ALLOCATIONS |
#define ACPI_ALLOCATE(a) NULL |
#define ACPI_ALLOCATE_ZEROED(a) NULL |
#define ACPI_FREE(a) |
#define ACPI_MEM_TRACKING(a) |
#else /* ACPI_NO_MEM_ALLOCATIONS */ |
#ifdef ACPI_DBG_TRACK_ALLOCATIONS |
/* |
* Memory allocation tracking (used by acpi_exec to detect memory leaks) |
*/ |
#define ACPI_MEM_PARAMETERS _COMPONENT, _acpi_module_name, __LINE__ |
#define ACPI_ALLOCATE(a) acpi_ut_allocate_and_track ((acpi_size) (a), ACPI_MEM_PARAMETERS) |
#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed_and_track ((acpi_size) (a), ACPI_MEM_PARAMETERS) |
#define ACPI_FREE(a) acpi_ut_free_and_track (a, ACPI_MEM_PARAMETERS) |
#define ACPI_MEM_TRACKING(a) a |
#else |
/* |
* Normal memory allocation directly via the OS services layer |
*/ |
#define ACPI_ALLOCATE(a) acpi_os_allocate ((acpi_size) (a)) |
#define ACPI_ALLOCATE_ZEROED(a) acpi_os_allocate_zeroed ((acpi_size) (a)) |
#define ACPI_FREE(a) acpi_os_free (a) |
#define ACPI_MEM_TRACKING(a) |
#endif /* ACPI_DBG_TRACK_ALLOCATIONS */ |
#endif /* ACPI_NO_MEM_ALLOCATIONS */ |
/****************************************************************************** |
* |
* ACPI Specification constants (Do not change unless the specification changes) |
* |
*****************************************************************************/ |
/* Number of distinct FADT-based GPE register blocks (GPE0 and GPE1) */ |
#define ACPI_MAX_GPE_BLOCKS 2 |
/* Default ACPI register widths */ |
#define ACPI_GPE_REGISTER_WIDTH 8 |
#define ACPI_PM1_REGISTER_WIDTH 16 |
#define ACPI_PM2_REGISTER_WIDTH 8 |
#define ACPI_PM_TIMER_WIDTH 32 |
#define ACPI_RESET_REGISTER_WIDTH 8 |
/* Names within the namespace are 4 bytes long */ |
#define ACPI_NAME_SIZE 4 |
#define ACPI_PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */ |
#define ACPI_PATH_SEPARATOR '.' |
/* Sizes for ACPI table headers */ |
#define ACPI_OEM_ID_SIZE 6 |
#define ACPI_OEM_TABLE_ID_SIZE 8 |
/* ACPI/PNP hardware IDs */ |
#define PCI_ROOT_HID_STRING "PNP0A03" |
#define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08" |
/* PM Timer ticks per second (HZ) */ |
#define ACPI_PM_TIMER_FREQUENCY 3579545 |
/******************************************************************************* |
* |
* Independent types |
* |
******************************************************************************/ |
/* Logical defines and NULL */ |
#ifdef FALSE |
#undef FALSE |
#endif |
#define FALSE (1 == 0) |
#ifdef TRUE |
#undef TRUE |
#endif |
#define TRUE (1 == 1) |
#ifndef NULL |
#define NULL (void *) 0 |
#endif |
/* |
* Miscellaneous types |
*/ |
typedef u32 acpi_status; /* All ACPI Exceptions */ |
typedef u32 acpi_name; /* 4-byte ACPI name */ |
typedef char *acpi_string; /* Null terminated ASCII string */ |
typedef void *acpi_handle; /* Actually a ptr to a NS Node */ |
/* Time constants for timer calculations */ |
#define ACPI_MSEC_PER_SEC 1000L |
#define ACPI_USEC_PER_MSEC 1000L |
#define ACPI_USEC_PER_SEC 1000000L |
#define ACPI_100NSEC_PER_USEC 10L |
#define ACPI_100NSEC_PER_MSEC 10000L |
#define ACPI_100NSEC_PER_SEC 10000000L |
#define ACPI_NSEC_PER_USEC 1000L |
#define ACPI_NSEC_PER_MSEC 1000000L |
#define ACPI_NSEC_PER_SEC 1000000000L |
/* Owner IDs are used to track namespace nodes for selective deletion */ |
typedef u8 acpi_owner_id; |
#define ACPI_OWNER_ID_MAX 0xFF |
#define ACPI_INTEGER_BIT_SIZE 64 |
#define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */ |
#define ACPI_MAX64_DECIMAL_DIGITS 20 |
#define ACPI_MAX32_DECIMAL_DIGITS 10 |
#define ACPI_MAX16_DECIMAL_DIGITS 5 |
#define ACPI_MAX8_DECIMAL_DIGITS 3 |
/* |
* Constants with special meanings |
*/ |
#define ACPI_ROOT_OBJECT ACPI_ADD_PTR (acpi_handle, NULL, ACPI_MAX_PTR) |
#define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */ |
#define ACPI_DO_NOT_WAIT 0 |
/* |
* Obsolete: Acpi integer width. In ACPI version 1 (1996), integers are 32 bits. |
* In ACPI version 2 (2000) and later, integers are 64 bits. Note that this |
* pertains to the ACPI integer type only, not to other integers used in the |
* implementation of the ACPICA subsystem. |
* |
* 01/2010: This type is obsolete and has been removed from the entire ACPICA |
* code base. It remains here for compatibility with device drivers that use |
* the type. However, it will be removed in the future. |
*/ |
typedef u64 acpi_integer; |
#define ACPI_INTEGER_MAX ACPI_UINT64_MAX |
/******************************************************************************* |
* |
* Commonly used macros |
* |
******************************************************************************/ |
/* Data manipulation */ |
#define ACPI_LOBYTE(integer) ((u8) (u16)(integer)) |
#define ACPI_HIBYTE(integer) ((u8) (((u16)(integer)) >> 8)) |
#define ACPI_LOWORD(integer) ((u16) (u32)(integer)) |
#define ACPI_HIWORD(integer) ((u16)(((u32)(integer)) >> 16)) |
#define ACPI_LODWORD(integer64) ((u32) (u64)(integer64)) |
#define ACPI_HIDWORD(integer64) ((u32)(((u64)(integer64)) >> 32)) |
#define ACPI_SET_BIT(target,bit) ((target) |= (bit)) |
#define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit)) |
#define ACPI_MIN(a,b) (((a)<(b))?(a):(b)) |
#define ACPI_MAX(a,b) (((a)>(b))?(a):(b)) |
/* Size calculation */ |
#define ACPI_ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0])) |
/* Pointer manipulation */ |
#define ACPI_CAST_PTR(t, p) ((t *) (acpi_uintptr_t) (p)) |
#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **) (acpi_uintptr_t) (p)) |
#define ACPI_ADD_PTR(t, a, b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (u8, (a)) + (acpi_size)(b))) |
#define ACPI_SUB_PTR(t, a, b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (u8, (a)) - (acpi_size)(b))) |
#define ACPI_PTR_DIFF(a, b) (acpi_size) (ACPI_CAST_PTR (u8, (a)) - ACPI_CAST_PTR (u8, (b))) |
/* Pointer/Integer type conversions */ |
#define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void, (void *) NULL,(acpi_size) i) |
#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p, (void *) NULL) |
#define ACPI_OFFSET(d, f) ACPI_PTR_DIFF (&(((d *) 0)->f), (void *) NULL) |
#define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i) |
#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) |
/* Optimizations for 4-character (32-bit) acpi_name manipulation */ |
#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED |
#define ACPI_COMPARE_NAME(a,b) (*ACPI_CAST_PTR (u32, (a)) == *ACPI_CAST_PTR (u32, (b))) |
#define ACPI_MOVE_NAME(dest,src) (*ACPI_CAST_PTR (u32, (dest)) = *ACPI_CAST_PTR (u32, (src))) |
#else |
#define ACPI_COMPARE_NAME(a,b) (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE)) |
#define ACPI_MOVE_NAME(dest,src) (strncpy (ACPI_CAST_PTR (char, (dest)), ACPI_CAST_PTR (char, (src)), ACPI_NAME_SIZE)) |
#endif |
/* Support for the special RSDP signature (8 characters) */ |
#define ACPI_VALIDATE_RSDP_SIG(a) (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, 8)) |
#define ACPI_MAKE_RSDP_SIG(dest) (memcpy (ACPI_CAST_PTR (char, (dest)), ACPI_SIG_RSDP, 8)) |
/******************************************************************************* |
* |
* Miscellaneous constants |
* |
******************************************************************************/ |
/* |
* Initialization sequence |
*/ |
#define ACPI_FULL_INITIALIZATION 0x00 |
#define ACPI_NO_ADDRESS_SPACE_INIT 0x01 |
#define ACPI_NO_HARDWARE_INIT 0x02 |
#define ACPI_NO_EVENT_INIT 0x04 |
#define ACPI_NO_HANDLER_INIT 0x08 |
#define ACPI_NO_ACPI_ENABLE 0x10 |
#define ACPI_NO_DEVICE_INIT 0x20 |
#define ACPI_NO_OBJECT_INIT 0x40 |
#define ACPI_NO_FACS_INIT 0x80 |
/* |
* Initialization state |
*/ |
#define ACPI_SUBSYSTEM_INITIALIZE 0x01 |
#define ACPI_INITIALIZED_OK 0x02 |
/* |
* Power state values |
*/ |
#define ACPI_STATE_UNKNOWN (u8) 0xFF |
#define ACPI_STATE_S0 (u8) 0 |
#define ACPI_STATE_S1 (u8) 1 |
#define ACPI_STATE_S2 (u8) 2 |
#define ACPI_STATE_S3 (u8) 3 |
#define ACPI_STATE_S4 (u8) 4 |
#define ACPI_STATE_S5 (u8) 5 |
#define ACPI_S_STATES_MAX ACPI_STATE_S5 |
#define ACPI_S_STATE_COUNT 6 |
#define ACPI_STATE_D0 (u8) 0 |
#define ACPI_STATE_D1 (u8) 1 |
#define ACPI_STATE_D2 (u8) 2 |
#define ACPI_STATE_D3_HOT (u8) 3 |
#define ACPI_STATE_D3 (u8) 4 |
#define ACPI_STATE_D3_COLD ACPI_STATE_D3 |
#define ACPI_D_STATES_MAX ACPI_STATE_D3 |
#define ACPI_D_STATE_COUNT 5 |
#define ACPI_STATE_C0 (u8) 0 |
#define ACPI_STATE_C1 (u8) 1 |
#define ACPI_STATE_C2 (u8) 2 |
#define ACPI_STATE_C3 (u8) 3 |
#define ACPI_C_STATES_MAX ACPI_STATE_C3 |
#define ACPI_C_STATE_COUNT 4 |
/* |
* Sleep type invalid value |
*/ |
#define ACPI_SLEEP_TYPE_MAX 0x7 |
#define ACPI_SLEEP_TYPE_INVALID 0xFF |
/* |
* Standard notify values |
*/ |
#define ACPI_NOTIFY_BUS_CHECK (u8) 0x00 |
#define ACPI_NOTIFY_DEVICE_CHECK (u8) 0x01 |
#define ACPI_NOTIFY_DEVICE_WAKE (u8) 0x02 |
#define ACPI_NOTIFY_EJECT_REQUEST (u8) 0x03 |
#define ACPI_NOTIFY_DEVICE_CHECK_LIGHT (u8) 0x04 |
#define ACPI_NOTIFY_FREQUENCY_MISMATCH (u8) 0x05 |
#define ACPI_NOTIFY_BUS_MODE_MISMATCH (u8) 0x06 |
#define ACPI_NOTIFY_POWER_FAULT (u8) 0x07 |
#define ACPI_NOTIFY_CAPABILITIES_CHECK (u8) 0x08 |
#define ACPI_NOTIFY_DEVICE_PLD_CHECK (u8) 0x09 |
#define ACPI_NOTIFY_RESERVED (u8) 0x0A |
#define ACPI_NOTIFY_LOCALITY_UPDATE (u8) 0x0B |
#define ACPI_NOTIFY_SHUTDOWN_REQUEST (u8) 0x0C |
#define ACPI_NOTIFY_AFFINITY_UPDATE (u8) 0x0D |
#define ACPI_NOTIFY_MAX 0x0D |
/* |
* Types associated with ACPI names and objects. The first group of |
* values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition |
* of the ACPI object_type() operator (See the ACPI Spec). Therefore, |
* only add to the first group if the spec changes. |
* |
* NOTE: Types must be kept in sync with the global acpi_ns_properties |
* and acpi_ns_type_names arrays. |
*/ |
typedef u32 acpi_object_type; |
#define ACPI_TYPE_ANY 0x00 |
#define ACPI_TYPE_INTEGER 0x01 /* Byte/Word/Dword/Zero/One/Ones */ |
#define ACPI_TYPE_STRING 0x02 |
#define ACPI_TYPE_BUFFER 0x03 |
#define ACPI_TYPE_PACKAGE 0x04 /* byte_const, multiple data_term/Constant/super_name */ |
#define ACPI_TYPE_FIELD_UNIT 0x05 |
#define ACPI_TYPE_DEVICE 0x06 /* Name, multiple Node */ |
#define ACPI_TYPE_EVENT 0x07 |
#define ACPI_TYPE_METHOD 0x08 /* Name, byte_const, multiple Code */ |
#define ACPI_TYPE_MUTEX 0x09 |
#define ACPI_TYPE_REGION 0x0A |
#define ACPI_TYPE_POWER 0x0B /* Name,byte_const,word_const,multi Node */ |
#define ACPI_TYPE_PROCESSOR 0x0C /* Name,byte_const,Dword_const,byte_const,multi nm_o */ |
#define ACPI_TYPE_THERMAL 0x0D /* Name, multiple Node */ |
#define ACPI_TYPE_BUFFER_FIELD 0x0E |
#define ACPI_TYPE_DDB_HANDLE 0x0F |
#define ACPI_TYPE_DEBUG_OBJECT 0x10 |
#define ACPI_TYPE_EXTERNAL_MAX 0x10 |
#define ACPI_NUM_TYPES (ACPI_TYPE_EXTERNAL_MAX + 1) |
/* |
* These are object types that do not map directly to the ACPI |
* object_type() operator. They are used for various internal purposes only. |
* If new predefined ACPI_TYPEs are added (via the ACPI specification), these |
* internal types must move upwards. (There is code that depends on these |
* values being contiguous with the external types above.) |
*/ |
#define ACPI_TYPE_LOCAL_REGION_FIELD 0x11 |
#define ACPI_TYPE_LOCAL_BANK_FIELD 0x12 |
#define ACPI_TYPE_LOCAL_INDEX_FIELD 0x13 |
#define ACPI_TYPE_LOCAL_REFERENCE 0x14 /* Arg#, Local#, Name, Debug, ref_of, Index */ |
#define ACPI_TYPE_LOCAL_ALIAS 0x15 |
#define ACPI_TYPE_LOCAL_METHOD_ALIAS 0x16 |
#define ACPI_TYPE_LOCAL_NOTIFY 0x17 |
#define ACPI_TYPE_LOCAL_ADDRESS_HANDLER 0x18 |
#define ACPI_TYPE_LOCAL_RESOURCE 0x19 |
#define ACPI_TYPE_LOCAL_RESOURCE_FIELD 0x1A |
#define ACPI_TYPE_LOCAL_SCOPE 0x1B /* 1 Name, multiple object_list Nodes */ |
#define ACPI_TYPE_NS_NODE_MAX 0x1B /* Last typecode used within a NS Node */ |
#define ACPI_TOTAL_TYPES (ACPI_TYPE_NS_NODE_MAX + 1) |
/* |
* These are special object types that never appear in |
* a Namespace node, only in an object of union acpi_operand_object |
*/ |
#define ACPI_TYPE_LOCAL_EXTRA 0x1C |
#define ACPI_TYPE_LOCAL_DATA 0x1D |
#define ACPI_TYPE_LOCAL_MAX 0x1D |
/* All types above here are invalid */ |
#define ACPI_TYPE_INVALID 0x1E |
#define ACPI_TYPE_NOT_FOUND 0xFF |
#define ACPI_NUM_NS_TYPES (ACPI_TYPE_INVALID + 1) |
/* |
* All I/O |
*/ |
#define ACPI_READ 0 |
#define ACPI_WRITE 1 |
#define ACPI_IO_MASK 1 |
/* |
* Event Types: Fixed & General Purpose |
*/ |
typedef u32 acpi_event_type; |
/* |
* Fixed events |
*/ |
#define ACPI_EVENT_PMTIMER 0 |
#define ACPI_EVENT_GLOBAL 1 |
#define ACPI_EVENT_POWER_BUTTON 2 |
#define ACPI_EVENT_SLEEP_BUTTON 3 |
#define ACPI_EVENT_RTC 4 |
#define ACPI_EVENT_MAX 4 |
#define ACPI_NUM_FIXED_EVENTS ACPI_EVENT_MAX + 1 |
/* |
* Event status - Per event |
* ------------- |
* The encoding of acpi_event_status is illustrated below. |
* Note that a set bit (1) indicates the property is TRUE |
* (e.g. if bit 0 is set then the event is enabled). |
* +-------------+-+-+-+-+-+ |
* | Bits 31:5 |4|3|2|1|0| |
* +-------------+-+-+-+-+-+ |
* | | | | | | |
* | | | | | +- Enabled? |
* | | | | +--- Enabled for wake? |
* | | | +----- Status bit set? |
* | | +------- Enable bit set? |
* | +--------- Has a handler? |
* +--------------- <Reserved> |
*/ |
typedef u32 acpi_event_status; |
#define ACPI_EVENT_FLAG_DISABLED (acpi_event_status) 0x00 |
#define ACPI_EVENT_FLAG_ENABLED (acpi_event_status) 0x01 |
#define ACPI_EVENT_FLAG_WAKE_ENABLED (acpi_event_status) 0x02 |
#define ACPI_EVENT_FLAG_STATUS_SET (acpi_event_status) 0x04 |
#define ACPI_EVENT_FLAG_ENABLE_SET (acpi_event_status) 0x08 |
#define ACPI_EVENT_FLAG_HAS_HANDLER (acpi_event_status) 0x10 |
#define ACPI_EVENT_FLAG_SET ACPI_EVENT_FLAG_STATUS_SET |
/* Actions for acpi_set_gpe, acpi_gpe_wakeup, acpi_hw_low_set_gpe */ |
#define ACPI_GPE_ENABLE 0 |
#define ACPI_GPE_DISABLE 1 |
#define ACPI_GPE_CONDITIONAL_ENABLE 2 |
/* |
* GPE info flags - Per GPE |
* +-------+-+-+---+ |
* | 7:5 |4|3|2:0| |
* +-------+-+-+---+ |
* | | | | |
* | | | +-- Type of dispatch:to method, handler, notify, or none |
* | | +----- Interrupt type: edge or level triggered |
* | +------- Is a Wake GPE |
* +------------ <Reserved> |
*/ |
#define ACPI_GPE_DISPATCH_NONE (u8) 0x00 |
#define ACPI_GPE_DISPATCH_METHOD (u8) 0x01 |
#define ACPI_GPE_DISPATCH_HANDLER (u8) 0x02 |
#define ACPI_GPE_DISPATCH_NOTIFY (u8) 0x03 |
#define ACPI_GPE_DISPATCH_RAW_HANDLER (u8) 0x04 |
#define ACPI_GPE_DISPATCH_MASK (u8) 0x07 |
#define ACPI_GPE_DISPATCH_TYPE(flags) ((u8) ((flags) & ACPI_GPE_DISPATCH_MASK)) |
#define ACPI_GPE_LEVEL_TRIGGERED (u8) 0x08 |
#define ACPI_GPE_EDGE_TRIGGERED (u8) 0x00 |
#define ACPI_GPE_XRUPT_TYPE_MASK (u8) 0x08 |
#define ACPI_GPE_CAN_WAKE (u8) 0x10 |
/* |
* Flags for GPE and Lock interfaces |
*/ |
#define ACPI_NOT_ISR 0x1 |
#define ACPI_ISR 0x0 |
/* Notify types */ |
#define ACPI_SYSTEM_NOTIFY 0x1 |
#define ACPI_DEVICE_NOTIFY 0x2 |
#define ACPI_ALL_NOTIFY (ACPI_SYSTEM_NOTIFY | ACPI_DEVICE_NOTIFY) |
#define ACPI_MAX_NOTIFY_HANDLER_TYPE 0x3 |
#define ACPI_NUM_NOTIFY_TYPES 2 |
#define ACPI_MAX_SYS_NOTIFY 0x7F |
#define ACPI_MAX_DEVICE_SPECIFIC_NOTIFY 0xBF |
#define ACPI_SYSTEM_HANDLER_LIST 0 /* Used as index, must be SYSTEM_NOTIFY -1 */ |
#define ACPI_DEVICE_HANDLER_LIST 1 /* Used as index, must be DEVICE_NOTIFY -1 */ |
/* Address Space (Operation Region) Types */ |
typedef u8 acpi_adr_space_type; |
#define ACPI_ADR_SPACE_SYSTEM_MEMORY (acpi_adr_space_type) 0 |
#define ACPI_ADR_SPACE_SYSTEM_IO (acpi_adr_space_type) 1 |
#define ACPI_ADR_SPACE_PCI_CONFIG (acpi_adr_space_type) 2 |
#define ACPI_ADR_SPACE_EC (acpi_adr_space_type) 3 |
#define ACPI_ADR_SPACE_SMBUS (acpi_adr_space_type) 4 |
#define ACPI_ADR_SPACE_CMOS (acpi_adr_space_type) 5 |
#define ACPI_ADR_SPACE_PCI_BAR_TARGET (acpi_adr_space_type) 6 |
#define ACPI_ADR_SPACE_IPMI (acpi_adr_space_type) 7 |
#define ACPI_ADR_SPACE_GPIO (acpi_adr_space_type) 8 |
#define ACPI_ADR_SPACE_GSBUS (acpi_adr_space_type) 9 |
#define ACPI_ADR_SPACE_PLATFORM_COMM (acpi_adr_space_type) 10 |
#define ACPI_NUM_PREDEFINED_REGIONS 11 |
/* |
* Special Address Spaces |
* |
* Note: A Data Table region is a special type of operation region |
* that has its own AML opcode. However, internally, the AML |
* interpreter simply creates an operation region with an an address |
* space type of ACPI_ADR_SPACE_DATA_TABLE. |
*/ |
#define ACPI_ADR_SPACE_DATA_TABLE (acpi_adr_space_type) 0x7E /* Internal to ACPICA only */ |
#define ACPI_ADR_SPACE_FIXED_HARDWARE (acpi_adr_space_type) 0x7F |
/* Values for _REG connection code */ |
#define ACPI_REG_DISCONNECT 0 |
#define ACPI_REG_CONNECT 1 |
/* |
* bit_register IDs |
* |
* These values are intended to be used by the hardware interfaces |
* and are mapped to individual bitfields defined within the ACPI |
* registers. See the acpi_gbl_bit_register_info global table in utglobal.c |
* for this mapping. |
*/ |
/* PM1 Status register */ |
#define ACPI_BITREG_TIMER_STATUS 0x00 |
#define ACPI_BITREG_BUS_MASTER_STATUS 0x01 |
#define ACPI_BITREG_GLOBAL_LOCK_STATUS 0x02 |
#define ACPI_BITREG_POWER_BUTTON_STATUS 0x03 |
#define ACPI_BITREG_SLEEP_BUTTON_STATUS 0x04 |
#define ACPI_BITREG_RT_CLOCK_STATUS 0x05 |
#define ACPI_BITREG_WAKE_STATUS 0x06 |
#define ACPI_BITREG_PCIEXP_WAKE_STATUS 0x07 |
/* PM1 Enable register */ |
#define ACPI_BITREG_TIMER_ENABLE 0x08 |
#define ACPI_BITREG_GLOBAL_LOCK_ENABLE 0x09 |
#define ACPI_BITREG_POWER_BUTTON_ENABLE 0x0A |
#define ACPI_BITREG_SLEEP_BUTTON_ENABLE 0x0B |
#define ACPI_BITREG_RT_CLOCK_ENABLE 0x0C |
#define ACPI_BITREG_PCIEXP_WAKE_DISABLE 0x0D |
/* PM1 Control register */ |
#define ACPI_BITREG_SCI_ENABLE 0x0E |
#define ACPI_BITREG_BUS_MASTER_RLD 0x0F |
#define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x10 |
#define ACPI_BITREG_SLEEP_TYPE 0x11 |
#define ACPI_BITREG_SLEEP_ENABLE 0x12 |
/* PM2 Control register */ |
#define ACPI_BITREG_ARB_DISABLE 0x13 |
#define ACPI_BITREG_MAX 0x13 |
#define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1 |
/* Status register values. A 1 clears a status bit. 0 = no effect */ |
#define ACPI_CLEAR_STATUS 1 |
/* Enable and Control register values */ |
#define ACPI_ENABLE_EVENT 1 |
#define ACPI_DISABLE_EVENT 0 |
/* Sleep function dispatch */ |
typedef acpi_status(*acpi_sleep_function) (u8 sleep_state); |
struct acpi_sleep_functions { |
acpi_sleep_function legacy_function; |
acpi_sleep_function extended_function; |
}; |
/* |
* External ACPI object definition |
*/ |
/* |
* Note: Type == ACPI_TYPE_ANY (0) is used to indicate a NULL package element |
* or an unresolved named reference. |
*/ |
union acpi_object { |
acpi_object_type type; /* See definition of acpi_ns_type for values */ |
struct { |
acpi_object_type type; /* ACPI_TYPE_INTEGER */ |
u64 value; /* The actual number */ |
} integer; |
struct { |
acpi_object_type type; /* ACPI_TYPE_STRING */ |
u32 length; /* # of bytes in string, excluding trailing null */ |
char *pointer; /* points to the string value */ |
} string; |
struct { |
acpi_object_type type; /* ACPI_TYPE_BUFFER */ |
u32 length; /* # of bytes in buffer */ |
u8 *pointer; /* points to the buffer */ |
} buffer; |
struct { |
acpi_object_type type; /* ACPI_TYPE_PACKAGE */ |
u32 count; /* # of elements in package */ |
union acpi_object *elements; /* Pointer to an array of ACPI_OBJECTs */ |
} package; |
struct { |
acpi_object_type type; /* ACPI_TYPE_LOCAL_REFERENCE */ |
acpi_object_type actual_type; /* Type associated with the Handle */ |
acpi_handle handle; /* object reference */ |
} reference; |
struct { |
acpi_object_type type; /* ACPI_TYPE_PROCESSOR */ |
u32 proc_id; |
acpi_io_address pblk_address; |
u32 pblk_length; |
} processor; |
struct { |
acpi_object_type type; /* ACPI_TYPE_POWER */ |
u32 system_level; |
u32 resource_order; |
} power_resource; |
}; |
/* |
* List of objects, used as a parameter list for control method evaluation |
*/ |
struct acpi_object_list { |
u32 count; |
union acpi_object *pointer; |
}; |
/* |
* Miscellaneous common Data Structures used by the interfaces |
*/ |
#define ACPI_NO_BUFFER 0 |
#ifdef ACPI_NO_MEM_ALLOCATIONS |
#define ACPI_ALLOCATE_BUFFER (acpi_size) (0) |
#define ACPI_ALLOCATE_LOCAL_BUFFER (acpi_size) (0) |
#else /* ACPI_NO_MEM_ALLOCATIONS */ |
#define ACPI_ALLOCATE_BUFFER (acpi_size) (-1) /* Let ACPICA allocate buffer */ |
#define ACPI_ALLOCATE_LOCAL_BUFFER (acpi_size) (-2) /* For internal use only (enables tracking) */ |
#endif /* ACPI_NO_MEM_ALLOCATIONS */ |
struct acpi_buffer { |
acpi_size length; /* Length in bytes of the buffer */ |
void *pointer; /* pointer to buffer */ |
}; |
/* |
* name_type for acpi_get_name |
*/ |
#define ACPI_FULL_PATHNAME 0 |
#define ACPI_SINGLE_NAME 1 |
#define ACPI_FULL_PATHNAME_NO_TRAILING 2 |
#define ACPI_NAME_TYPE_MAX 2 |
/* |
* Predefined Namespace items |
*/ |
struct acpi_predefined_names { |
char *name; |
u8 type; |
char *val; |
}; |
/* |
* Structure and flags for acpi_get_system_info |
*/ |
#define ACPI_SYS_MODE_UNKNOWN 0x0000 |
#define ACPI_SYS_MODE_ACPI 0x0001 |
#define ACPI_SYS_MODE_LEGACY 0x0002 |
#define ACPI_SYS_MODES_MASK 0x0003 |
/* |
* System info returned by acpi_get_system_info() |
*/ |
struct acpi_system_info { |
u32 acpi_ca_version; |
u32 flags; |
u32 timer_resolution; |
u32 reserved1; |
u32 reserved2; |
u32 debug_level; |
u32 debug_layer; |
}; |
/* |
* System statistics returned by acpi_get_statistics() |
*/ |
struct acpi_statistics { |
u32 sci_count; |
u32 gpe_count; |
u32 fixed_event_count[ACPI_NUM_FIXED_EVENTS]; |
u32 method_count; |
}; |
/* Table Event Types */ |
#define ACPI_TABLE_EVENT_LOAD 0x0 |
#define ACPI_TABLE_EVENT_UNLOAD 0x1 |
#define ACPI_NUM_TABLE_EVENTS 2 |
/* |
* Types specific to the OS service interfaces |
*/ |
typedef u32 |
(ACPI_SYSTEM_XFACE * acpi_osd_handler) (void *context); |
typedef void |
(ACPI_SYSTEM_XFACE * acpi_osd_exec_callback) (void *context); |
/* |
* Various handlers and callback procedures |
*/ |
typedef |
u32 (*acpi_sci_handler) (void *context); |
typedef |
void (*acpi_gbl_event_handler) (u32 event_type, |
acpi_handle device, |
u32 event_number, void *context); |
#define ACPI_EVENT_TYPE_GPE 0 |
#define ACPI_EVENT_TYPE_FIXED 1 |
typedef |
u32(*acpi_event_handler) (void *context); |
typedef |
u32 (*acpi_gpe_handler) (acpi_handle gpe_device, u32 gpe_number, void *context); |
typedef |
void (*acpi_notify_handler) (acpi_handle device, u32 value, void *context); |
typedef |
void (*acpi_object_handler) (acpi_handle object, void *data); |
typedef acpi_status(*acpi_init_handler) (acpi_handle object, u32 function); |
#define ACPI_INIT_DEVICE_INI 1 |
typedef |
acpi_status(*acpi_exception_handler) (acpi_status aml_status, |
acpi_name name, |
u16 opcode, |
u32 aml_offset, void *context); |
/* Table Event handler (Load, load_table, etc.) and types */ |
typedef |
acpi_status(*acpi_table_handler) (u32 event, void *table, void *context); |
#define ACPI_TABLE_LOAD 0x0 |
#define ACPI_TABLE_UNLOAD 0x1 |
#define ACPI_NUM_TABLE_EVENTS 2 |
/* Address Spaces (For Operation Regions) */ |
typedef |
acpi_status(*acpi_adr_space_handler) (u32 function, |
acpi_physical_address address, |
u32 bit_width, |
u64 *value, |
void *handler_context, |
void *region_context); |
#define ACPI_DEFAULT_HANDLER NULL |
/* Special Context data for generic_serial_bus/general_purpose_io (ACPI 5.0) */ |
struct acpi_connection_info { |
u8 *connection; |
u16 length; |
u8 access_length; |
}; |
typedef |
acpi_status(*acpi_adr_space_setup) (acpi_handle region_handle, |
u32 function, |
void *handler_context, |
void **region_context); |
#define ACPI_REGION_ACTIVATE 0 |
#define ACPI_REGION_DEACTIVATE 1 |
typedef |
acpi_status(*acpi_walk_callback) (acpi_handle object, |
u32 nesting_level, |
void *context, void **return_value); |
typedef |
u32 (*acpi_interface_handler) (acpi_string interface_name, u32 supported); |
/* Interrupt handler return values */ |
#define ACPI_INTERRUPT_NOT_HANDLED 0x00 |
#define ACPI_INTERRUPT_HANDLED 0x01 |
/* GPE handler return values */ |
#define ACPI_REENABLE_GPE 0x80 |
/* Length of 32-bit EISAID values when converted back to a string */ |
#define ACPI_EISAID_STRING_SIZE 8 /* Includes null terminator */ |
/* Length of UUID (string) values */ |
#define ACPI_UUID_LENGTH 16 |
/* Length of 3-byte PCI class code values when converted back to a string */ |
#define ACPI_PCICLS_STRING_SIZE 7 /* Includes null terminator */ |
/* Structures used for device/processor HID, UID, CID, and SUB */ |
struct acpi_pnp_device_id { |
u32 length; /* Length of string + null */ |
char *string; |
}; |
struct acpi_pnp_device_id_list { |
u32 count; /* Number of IDs in Ids array */ |
u32 list_size; /* Size of list, including ID strings */ |
struct acpi_pnp_device_id ids[1]; /* ID array */ |
}; |
/* |
* Structure returned from acpi_get_object_info. |
* Optimized for both 32- and 64-bit builds |
*/ |
struct acpi_device_info { |
u32 info_size; /* Size of info, including ID strings */ |
u32 name; /* ACPI object Name */ |
acpi_object_type type; /* ACPI object Type */ |
u8 param_count; /* If a method, required parameter count */ |
u16 valid; /* Indicates which optional fields are valid */ |
u8 flags; /* Miscellaneous info */ |
u8 highest_dstates[4]; /* _sx_d values: 0xFF indicates not valid */ |
u8 lowest_dstates[5]; /* _sx_w values: 0xFF indicates not valid */ |
u32 current_status; /* _STA value */ |
u64 address; /* _ADR value */ |
struct acpi_pnp_device_id hardware_id; /* _HID value */ |
struct acpi_pnp_device_id unique_id; /* _UID value */ |
struct acpi_pnp_device_id subsystem_id; /* _SUB value */ |
struct acpi_pnp_device_id class_code; /* _CLS value */ |
struct acpi_pnp_device_id_list compatible_id_list; /* _CID list <must be last> */ |
}; |
/* Values for Flags field above (acpi_get_object_info) */ |
#define ACPI_PCI_ROOT_BRIDGE 0x01 |
/* Flags for Valid field above (acpi_get_object_info) */ |
#define ACPI_VALID_STA 0x0001 |
#define ACPI_VALID_ADR 0x0002 |
#define ACPI_VALID_HID 0x0004 |
#define ACPI_VALID_UID 0x0008 |
#define ACPI_VALID_SUB 0x0010 |
#define ACPI_VALID_CID 0x0020 |
#define ACPI_VALID_CLS 0x0040 |
#define ACPI_VALID_SXDS 0x0100 |
#define ACPI_VALID_SXWS 0x0200 |
/* Flags for _STA return value (current_status above) */ |
#define ACPI_STA_DEVICE_PRESENT 0x01 |
#define ACPI_STA_DEVICE_ENABLED 0x02 |
#define ACPI_STA_DEVICE_UI 0x04 |
#define ACPI_STA_DEVICE_FUNCTIONING 0x08 |
#define ACPI_STA_DEVICE_OK 0x08 /* Synonym */ |
#define ACPI_STA_BATTERY_PRESENT 0x10 |
/* Context structs for address space handlers */ |
struct acpi_pci_id { |
u16 segment; |
u16 bus; |
u16 device; |
u16 function; |
}; |
struct acpi_mem_space_context { |
u32 length; |
acpi_physical_address address; |
acpi_physical_address mapped_physical_address; |
u8 *mapped_logical_address; |
acpi_size mapped_length; |
}; |
/* |
* struct acpi_memory_list is used only if the ACPICA local cache is enabled |
*/ |
struct acpi_memory_list { |
char *list_name; |
void *list_head; |
u16 object_size; |
u16 max_depth; |
u16 current_depth; |
#ifdef ACPI_DBG_TRACK_ALLOCATIONS |
/* Statistics for debug memory tracking only */ |
u32 total_allocated; |
u32 total_freed; |
u32 max_occupied; |
u32 total_size; |
u32 current_total_size; |
u32 requests; |
u32 hits; |
#endif |
}; |
/* Definitions of trace event types */ |
typedef enum { |
ACPI_TRACE_AML_METHOD, |
ACPI_TRACE_AML_OPCODE, |
ACPI_TRACE_AML_REGION |
} acpi_trace_event_type; |
/* Definitions of _OSI support */ |
#define ACPI_VENDOR_STRINGS 0x01 |
#define ACPI_FEATURE_STRINGS 0x02 |
#define ACPI_ENABLE_INTERFACES 0x00 |
#define ACPI_DISABLE_INTERFACES 0x04 |
#define ACPI_DISABLE_ALL_VENDOR_STRINGS (ACPI_DISABLE_INTERFACES | ACPI_VENDOR_STRINGS) |
#define ACPI_DISABLE_ALL_FEATURE_STRINGS (ACPI_DISABLE_INTERFACES | ACPI_FEATURE_STRINGS) |
#define ACPI_DISABLE_ALL_STRINGS (ACPI_DISABLE_INTERFACES | ACPI_VENDOR_STRINGS | ACPI_FEATURE_STRINGS) |
#define ACPI_ENABLE_ALL_VENDOR_STRINGS (ACPI_ENABLE_INTERFACES | ACPI_VENDOR_STRINGS) |
#define ACPI_ENABLE_ALL_FEATURE_STRINGS (ACPI_ENABLE_INTERFACES | ACPI_FEATURE_STRINGS) |
#define ACPI_ENABLE_ALL_STRINGS (ACPI_ENABLE_INTERFACES | ACPI_VENDOR_STRINGS | ACPI_FEATURE_STRINGS) |
#define ACPI_OSI_WIN_2000 0x01 |
#define ACPI_OSI_WIN_XP 0x02 |
#define ACPI_OSI_WIN_XP_SP1 0x03 |
#define ACPI_OSI_WINSRV_2003 0x04 |
#define ACPI_OSI_WIN_XP_SP2 0x05 |
#define ACPI_OSI_WINSRV_2003_SP1 0x06 |
#define ACPI_OSI_WIN_VISTA 0x07 |
#define ACPI_OSI_WINSRV_2008 0x08 |
#define ACPI_OSI_WIN_VISTA_SP1 0x09 |
#define ACPI_OSI_WIN_VISTA_SP2 0x0A |
#define ACPI_OSI_WIN_7 0x0B |
#define ACPI_OSI_WIN_8 0x0C |
#define ACPI_OSI_WIN_10 0x0D |
/* Definitions of file IO */ |
#define ACPI_FILE_READING 0x01 |
#define ACPI_FILE_WRITING 0x02 |
#define ACPI_FILE_BINARY 0x04 |
#define ACPI_FILE_BEGIN 0x01 |
#define ACPI_FILE_END 0x02 |
/* Definitions of getopt */ |
#define ACPI_OPT_END -1 |
#endif /* __ACTYPES_H__ */ |
/drivers/include/acpi/pdc_intel.h |
---|
0,0 → 1,35 |
/* _PDC bit definition for Intel processors */ |
#ifndef __PDC_INTEL_H__ |
#define __PDC_INTEL_H__ |
#define ACPI_PDC_P_FFH (0x0001) |
#define ACPI_PDC_C_C1_HALT (0x0002) |
#define ACPI_PDC_T_FFH (0x0004) |
#define ACPI_PDC_SMP_C1PT (0x0008) |
#define ACPI_PDC_SMP_C2C3 (0x0010) |
#define ACPI_PDC_SMP_P_SWCOORD (0x0020) |
#define ACPI_PDC_SMP_C_SWCOORD (0x0040) |
#define ACPI_PDC_SMP_T_SWCOORD (0x0080) |
#define ACPI_PDC_C_C1_FFH (0x0100) |
#define ACPI_PDC_C_C2C3_FFH (0x0200) |
#define ACPI_PDC_SMP_P_HWCOORD (0x0800) |
#define ACPI_PDC_EST_CAPABILITY_SMP (ACPI_PDC_SMP_C1PT | \ |
ACPI_PDC_C_C1_HALT | \ |
ACPI_PDC_P_FFH) |
#define ACPI_PDC_EST_CAPABILITY_SWSMP (ACPI_PDC_SMP_C1PT | \ |
ACPI_PDC_C_C1_HALT | \ |
ACPI_PDC_SMP_P_SWCOORD | \ |
ACPI_PDC_SMP_P_HWCOORD | \ |
ACPI_PDC_P_FFH) |
#define ACPI_PDC_C_CAPABILITY_SMP (ACPI_PDC_SMP_C2C3 | \ |
ACPI_PDC_SMP_C1PT | \ |
ACPI_PDC_C_C1_HALT | \ |
ACPI_PDC_C_C1_FFH | \ |
ACPI_PDC_C_C2C3_FFH) |
#endif /* __PDC_INTEL_H__ */ |
/drivers/include/acpi/platform/acenv.h |
---|
0,0 → 1,402 |
/****************************************************************************** |
* |
* Name: acenv.h - Host and compiler configuration |
* |
*****************************************************************************/ |
/* |
* Copyright (C) 2000 - 2015, 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 __ACENV_H__ |
#define __ACENV_H__ |
/* |
* Environment configuration. The purpose of this file is to interface ACPICA |
* to the local environment. This includes compiler-specific, OS-specific, |
* and machine-specific configuration. |
*/ |
/* Types for ACPI_MUTEX_TYPE */ |
#define ACPI_BINARY_SEMAPHORE 0 |
#define ACPI_OSL_MUTEX 1 |
/* Types for DEBUGGER_THREADING */ |
#define DEBUGGER_SINGLE_THREADED 0 |
#define DEBUGGER_MULTI_THREADED 1 |
/****************************************************************************** |
* |
* Configuration for ACPI tools and utilities |
* |
*****************************************************************************/ |
/* iASL configuration */ |
#ifdef ACPI_ASL_COMPILER |
#define ACPI_APPLICATION |
#define ACPI_DEBUG_OUTPUT |
#define ACPI_CONSTANT_EVAL_ONLY |
#define ACPI_LARGE_NAMESPACE_NODE |
#define ACPI_DATA_TABLE_DISASSEMBLY |
#define ACPI_SINGLE_THREADED |
#define ACPI_32BIT_PHYSICAL_ADDRESS |
#define ACPI_DISASSEMBLER 1 |
#endif |
/* acpi_exec configuration. Multithreaded with full AML debugger */ |
#ifdef ACPI_EXEC_APP |
#define ACPI_APPLICATION |
#define ACPI_FULL_DEBUG |
#define ACPI_MUTEX_DEBUG |
#define ACPI_DBG_TRACK_ALLOCATIONS |
#endif |
/* |
* acpi_bin/acpi_dump/acpi_help/acpi_names/acpi_src/acpi_xtract/Example |
* configuration. All single threaded. |
*/ |
#if (defined ACPI_BIN_APP) || \ |
(defined ACPI_DUMP_APP) || \ |
(defined ACPI_HELP_APP) || \ |
(defined ACPI_NAMES_APP) || \ |
(defined ACPI_SRC_APP) || \ |
(defined ACPI_XTRACT_APP) || \ |
(defined ACPI_EXAMPLE_APP) |
#define ACPI_APPLICATION |
#define ACPI_SINGLE_THREADED |
#endif |
/* acpi_help configuration. Error messages disabled. */ |
#ifdef ACPI_HELP_APP |
#define ACPI_NO_ERROR_MESSAGES |
#endif |
/* acpi_names configuration. Debug output enabled. */ |
#ifdef ACPI_NAMES_APP |
#define ACPI_DEBUG_OUTPUT |
#endif |
/* acpi_exec/acpi_names/Example configuration. Native RSDP used. */ |
#if (defined ACPI_EXEC_APP) || \ |
(defined ACPI_EXAMPLE_APP) || \ |
(defined ACPI_NAMES_APP) |
#define ACPI_USE_NATIVE_RSDP_POINTER |
#endif |
/* acpi_dump configuration. Native mapping used if provided by the host */ |
#ifdef ACPI_DUMP_APP |
#define ACPI_USE_NATIVE_MEMORY_MAPPING |
#define USE_NATIVE_ALLOCATE_ZEROED |
#endif |
/* acpi_names/Example configuration. Hardware disabled */ |
#if (defined ACPI_EXAMPLE_APP) || \ |
(defined ACPI_NAMES_APP) |
#define ACPI_REDUCED_HARDWARE 1 |
#endif |
/* Linkable ACPICA library */ |
#ifdef ACPI_LIBRARY |
#define ACPI_USE_LOCAL_CACHE |
#define ACPI_FULL_DEBUG |
#endif |
/* Common for all ACPICA applications */ |
#ifdef ACPI_APPLICATION |
#define ACPI_USE_SYSTEM_CLIBRARY |
#define ACPI_USE_LOCAL_CACHE |
#endif |
/* Common debug/disassembler support */ |
#ifdef ACPI_FULL_DEBUG |
#define ACPI_DEBUG_OUTPUT |
#define ACPI_DEBUGGER 1 |
#define ACPI_DISASSEMBLER 1 |
#endif |
/*! [Begin] no source code translation */ |
/****************************************************************************** |
* |
* Host configuration files. The compiler configuration files are included |
* by the host files. |
* |
*****************************************************************************/ |
#if defined(_LINUX) || defined(__linux__) |
#include <acpi/platform/aclinux.h> |
#elif defined(_APPLE) || defined(__APPLE__) |
#include "acmacosx.h" |
#elif defined(__DragonFly__) |
#include "acdragonfly.h" |
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) |
#include "acfreebsd.h" |
#elif defined(__NetBSD__) |
#include "acnetbsd.h" |
#elif defined(__sun) |
#include "acsolaris.h" |
#elif defined(MODESTO) |
#include "acmodesto.h" |
#elif defined(NETWARE) |
#include "acnetware.h" |
#elif defined(_CYGWIN) |
#include "accygwin.h" |
#elif defined(WIN32) |
#include "acwin.h" |
#elif defined(WIN64) |
#include "acwin64.h" |
#elif defined(_WRS_LIB_BUILD) |
#include "acvxworks.h" |
#elif defined(__OS2__) |
#include "acos2.h" |
#elif defined(_AED_EFI) |
#include "acefi.h" |
#elif defined(_GNU_EFI) |
#include "acefi.h" |
#elif defined(__HAIKU__) |
#include "achaiku.h" |
#else |
/* Unknown environment */ |
#error Unknown target environment |
#endif |
/*! [End] no source code translation !*/ |
/****************************************************************************** |
* |
* Setup defaults for the required symbols that were not defined in one of |
* the host/compiler files above. |
* |
*****************************************************************************/ |
/* 64-bit data types */ |
#ifndef COMPILER_DEPENDENT_INT64 |
#define COMPILER_DEPENDENT_INT64 long long |
#endif |
#ifndef COMPILER_DEPENDENT_UINT64 |
#define COMPILER_DEPENDENT_UINT64 unsigned long long |
#endif |
/* Type of mutex supported by host. Default is binary semaphores. */ |
#ifndef ACPI_MUTEX_TYPE |
#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE |
#endif |
/* Global Lock acquire/release */ |
#ifndef ACPI_ACQUIRE_GLOBAL_LOCK |
#define ACPI_ACQUIRE_GLOBAL_LOCK(Glptr, acquired) acquired = 1 |
#endif |
#ifndef ACPI_RELEASE_GLOBAL_LOCK |
#define ACPI_RELEASE_GLOBAL_LOCK(Glptr, pending) pending = 0 |
#endif |
/* Flush CPU cache - used when going to sleep. Wbinvd or similar. */ |
#ifndef ACPI_FLUSH_CPU_CACHE |
#define ACPI_FLUSH_CPU_CACHE() |
#endif |
/* "inline" keywords - configurable since inline is not standardized */ |
#ifndef ACPI_INLINE |
#define ACPI_INLINE |
#endif |
/* |
* Configurable calling conventions: |
* |
* ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads) |
* ACPI_EXTERNAL_XFACE - External ACPI interfaces |
* ACPI_INTERNAL_XFACE - Internal ACPI interfaces |
* ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces |
*/ |
#ifndef ACPI_SYSTEM_XFACE |
#define ACPI_SYSTEM_XFACE |
#endif |
#ifndef ACPI_EXTERNAL_XFACE |
#define ACPI_EXTERNAL_XFACE |
#endif |
#ifndef ACPI_INTERNAL_XFACE |
#define ACPI_INTERNAL_XFACE |
#endif |
#ifndef ACPI_INTERNAL_VAR_XFACE |
#define ACPI_INTERNAL_VAR_XFACE |
#endif |
/* |
* Debugger threading model |
* Use single threaded if the entire subsystem is contained in an application |
* Use multiple threaded when the subsystem is running in the kernel. |
* |
* By default the model is single threaded if ACPI_APPLICATION is set, |
* multi-threaded if ACPI_APPLICATION is not set. |
*/ |
#ifndef DEBUGGER_THREADING |
#if !defined (ACPI_APPLICATION) || defined (ACPI_EXEC_APP) |
#define DEBUGGER_THREADING DEBUGGER_MULTI_THREADED |
#else |
#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED |
#endif |
#endif /* !DEBUGGER_THREADING */ |
/****************************************************************************** |
* |
* C library configuration |
* |
*****************************************************************************/ |
/* |
* ACPI_USE_SYSTEM_CLIBRARY - Define this if linking to an actual C library. |
* Otherwise, local versions of string/memory functions will be used. |
* ACPI_USE_STANDARD_HEADERS - Define this if linking to a C library and |
* the standard header files may be used. |
* |
* The ACPICA subsystem only uses low level C library functions that do not |
* call operating system services and may therefore be inlined in the code. |
* |
* It may be necessary to tailor these include files to the target |
* generation environment. |
*/ |
#ifdef ACPI_USE_SYSTEM_CLIBRARY |
/* Use the standard C library headers. We want to keep these to a minimum. */ |
#ifdef ACPI_USE_STANDARD_HEADERS |
/* Use the standard headers from the standard locations */ |
#include <stdarg.h> |
#include <stdlib.h> |
#include <string.h> |
#include <ctype.h> |
#endif /* ACPI_USE_STANDARD_HEADERS */ |
/* We will be linking to the standard Clib functions */ |
#else |
/****************************************************************************** |
* |
* Not using native C library, use local implementations |
* |
*****************************************************************************/ |
/* |
* Use local definitions of C library macros and functions. These function |
* implementations may not be as efficient as an inline or assembly code |
* implementation provided by a native C library, but they are functionally |
* equivalent. |
*/ |
#ifndef va_arg |
#ifndef _VALIST |
#define _VALIST |
typedef char *va_list; |
#endif /* _VALIST */ |
/* Storage alignment properties */ |
#define _AUPBND (sizeof (acpi_native_int) - 1) |
#define _ADNBND (sizeof (acpi_native_int) - 1) |
/* Variable argument list macro definitions */ |
#define _bnd(X, bnd) (((sizeof (X)) + (bnd)) & (~(bnd))) |
#define va_arg(ap, T) (*(T *)(((ap) += (_bnd (T, _AUPBND))) - (_bnd (T,_ADNBND)))) |
#define va_end(ap) (ap = (va_list) NULL) |
#define va_start(ap, A) (void) ((ap) = (((char *) &(A)) + (_bnd (A,_AUPBND)))) |
#endif /* va_arg */ |
/* Use the local (ACPICA) definitions of the clib functions */ |
#endif /* ACPI_USE_SYSTEM_CLIBRARY */ |
#ifndef ACPI_FILE |
#ifdef ACPI_APPLICATION |
#include <stdio.h> |
#define ACPI_FILE FILE * |
#define ACPI_FILE_OUT stdout |
#define ACPI_FILE_ERR stderr |
#else |
#define ACPI_FILE void * |
#define ACPI_FILE_OUT NULL |
#define ACPI_FILE_ERR NULL |
#endif /* ACPI_APPLICATION */ |
#endif /* ACPI_FILE */ |
#endif /* __ACENV_H__ */ |
/drivers/include/acpi/platform/acenvex.h |
---|
0,0 → 1,75 |
/****************************************************************************** |
* |
* Name: acenvex.h - Extra host and compiler configuration |
* |
*****************************************************************************/ |
/* |
* Copyright (C) 2000 - 2015, 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 __ACENVEX_H__ |
#define __ACENVEX_H__ |
/*! [Begin] no source code translation */ |
/****************************************************************************** |
* |
* Extra host configuration files. All ACPICA headers are included before |
* including these files. |
* |
*****************************************************************************/ |
#if defined(_LINUX) || defined(__linux__) |
#include <acpi/platform/aclinuxex.h> |
#elif defined(WIN32) |
#include "acwinex.h" |
#elif defined(_AED_EFI) |
#include "acefiex.h" |
#elif defined(_GNU_EFI) |
#include "acefiex.h" |
#elif defined(__DragonFly__) |
#include "acdragonflyex.h" |
#endif |
/*! [End] no source code translation !*/ |
#endif /* __ACENVEX_H__ */ |
/drivers/include/acpi/platform/acgcc.h |
---|
0,0 → 1,82 |
/****************************************************************************** |
* |
* Name: acgcc.h - GCC specific defines, etc. |
* |
*****************************************************************************/ |
/* |
* Copyright (C) 2000 - 2015, 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 __ACGCC_H__ |
#define __ACGCC_H__ |
#define ACPI_INLINE __inline__ |
/* Function name is used for debug output. Non-ANSI, compiler-dependent */ |
#define ACPI_GET_FUNCTION_NAME __func__ |
/* |
* This macro is used to tag functions as "printf-like" because |
* some compilers (like GCC) can catch printf format string problems. |
*/ |
#define ACPI_PRINTF_LIKE(c) __attribute__ ((__format__ (__printf__, c, c+1))) |
/* |
* Some compilers complain about unused variables. Sometimes we don't want to |
* use all the variables (for example, _acpi_module_name). This allows us |
* to tell the compiler warning in a per-variable manner that a variable |
* is unused. |
*/ |
#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 |
/* GCC supports __VA_ARGS__ in macros */ |
#define COMPILER_VA_MACRO 1 |
#endif /* __ACGCC_H__ */ |
/drivers/include/acpi/platform/aclinux.h |
---|
0,0 → 1,206 |
/****************************************************************************** |
* |
* Name: aclinux.h - OS specific defines, etc. for Linux |
* |
*****************************************************************************/ |
/* |
* Copyright (C) 2000 - 2015, 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 __ACLINUX_H__ |
#define __ACLINUX_H__ |
#ifdef __KERNEL__ |
/* ACPICA external files should not include ACPICA headers directly. */ |
#if !defined(BUILDING_ACPICA) && !defined(_LINUX_ACPI_H) |
#error "Please don't include <acpi/acpi.h> directly, include <linux/acpi.h> instead." |
#endif |
#endif |
/* Common (in-kernel/user-space) ACPICA configuration */ |
#define ACPI_USE_SYSTEM_CLIBRARY |
#define ACPI_USE_DO_WHILE_0 |
#ifdef __KERNEL__ |
#define ACPI_USE_SYSTEM_INTTYPES |
/* Kernel specific ACPICA configuration */ |
#ifdef CONFIG_ACPI_REDUCED_HARDWARE_ONLY |
#define ACPI_REDUCED_HARDWARE 1 |
#endif |
#ifdef CONFIG_ACPI_DEBUGGER |
#define ACPI_DEBUGGER |
#endif |
#include <linux/string.h> |
#include <linux/kernel.h> |
#include <linux/ctype.h> |
#include <linux/sched.h> |
#include <linux/atomic.h> |
#include <linux/math64.h> |
#include <linux/slab.h> |
#include <linux/spinlock_types.h> |
#ifdef EXPORT_ACPI_INTERFACES |
#include <linux/export.h> |
#endif |
#ifdef CONFIG_ACPI |
#include <asm/acenv.h> |
#endif |
#ifndef CONFIG_ACPI |
/* External globals for __KERNEL__, stubs is needed */ |
#define ACPI_GLOBAL(t,a) |
#define ACPI_INIT_GLOBAL(t,a,b) |
/* Generating stubs for configurable ACPICA macros */ |
#define ACPI_NO_MEM_ALLOCATIONS |
/* Generating stubs for configurable ACPICA functions */ |
#define ACPI_NO_ERROR_MESSAGES |
#undef ACPI_DEBUG_OUTPUT |
/* External interface for __KERNEL__, stub is needed */ |
#define ACPI_EXTERNAL_RETURN_STATUS(prototype) \ |
static ACPI_INLINE prototype {return(AE_NOT_CONFIGURED);} |
#define ACPI_EXTERNAL_RETURN_OK(prototype) \ |
static ACPI_INLINE prototype {return(AE_OK);} |
#define ACPI_EXTERNAL_RETURN_VOID(prototype) \ |
static ACPI_INLINE prototype {return;} |
#define ACPI_EXTERNAL_RETURN_UINT32(prototype) \ |
static ACPI_INLINE prototype {return(0);} |
#define ACPI_EXTERNAL_RETURN_PTR(prototype) \ |
static ACPI_INLINE prototype {return(NULL);} |
#endif /* CONFIG_ACPI */ |
/* Host-dependent types and defines for in-kernel ACPICA */ |
#define ACPI_MACHINE_WIDTH BITS_PER_LONG |
#define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol); |
#define strtoul simple_strtoul |
#define acpi_cache_t struct kmem_cache |
#define acpi_spinlock spinlock_t * |
#define acpi_cpu_flags unsigned long |
/* Use native linux version of acpi_os_allocate_zeroed */ |
#define USE_NATIVE_ALLOCATE_ZEROED |
/* |
* Overrides for in-kernel ACPICA |
*/ |
#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize |
#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate |
#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate |
#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate_zeroed |
#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_free |
#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_object |
#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_thread_id |
#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_lock |
/* |
* OSL interfaces used by debugger/disassembler |
*/ |
#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_readable |
#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_writable |
/* |
* OSL interfaces used by utilities |
*/ |
#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_redirect_output |
#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_name |
#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_index |
#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_address |
#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_open_directory |
#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_next_filename |
#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_close_directory |
#else /* !__KERNEL__ */ |
#include <stdarg.h> |
#include <string.h> |
#include <stdlib.h> |
#include <ctype.h> |
#include <unistd.h> |
/* Define/disable kernel-specific declarators */ |
#ifndef __init |
#define __init |
#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__) || defined(__PPC64__) |
#define ACPI_MACHINE_WIDTH 64 |
#define COMPILER_DEPENDENT_INT64 long |
#define COMPILER_DEPENDENT_UINT64 unsigned long |
#else |
#define ACPI_MACHINE_WIDTH 32 |
#define COMPILER_DEPENDENT_INT64 long long |
#define COMPILER_DEPENDENT_UINT64 unsigned long long |
#define ACPI_USE_NATIVE_DIVIDE |
#endif |
#ifndef __cdecl |
#define __cdecl |
#endif |
#endif /* __KERNEL__ */ |
/* Linux uses GCC */ |
#include <acpi/platform/acgcc.h> |
#endif /* __ACLINUX_H__ */ |
/drivers/include/acpi/platform/aclinuxex.h |
---|
0,0 → 1,133 |
/****************************************************************************** |
* |
* Name: aclinuxex.h - Extra OS specific defines, etc. for Linux |
* |
*****************************************************************************/ |
/* |
* Copyright (C) 2000 - 2015, 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 __ACLINUXEX_H__ |
#define __ACLINUXEX_H__ |
#ifdef __KERNEL__ |
#ifndef ACPI_USE_NATIVE_DIVIDE |
#ifndef ACPI_DIV_64_BY_32 |
#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \ |
do { \ |
u64 (__n) = ((u64) n_hi) << 32 | (n_lo); \ |
(r32) = do_div ((__n), (d32)); \ |
(q32) = (u32) (__n); \ |
} while (0) |
#endif |
#ifndef ACPI_SHIFT_RIGHT_64 |
#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \ |
do { \ |
(n_lo) >>= 1; \ |
(n_lo) |= (((n_hi) & 1) << 31); \ |
(n_hi) >>= 1; \ |
} while (0) |
#endif |
#endif |
/* |
* Overrides for in-kernel ACPICA |
*/ |
acpi_status __init acpi_os_initialize(void); |
acpi_status acpi_os_terminate(void); |
/* |
* The irqs_disabled() check is for resume from RAM. |
* Interrupts are off during resume, just like they are for boot. |
* However, boot has (system_state != SYSTEM_RUNNING) |
* to quiet __might_sleep() in kmalloc() and resume does not. |
*/ |
static inline void *acpi_os_allocate(acpi_size size) |
{ |
return kmalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL); |
} |
static inline void *acpi_os_allocate_zeroed(acpi_size size) |
{ |
return kzalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL); |
} |
static inline void acpi_os_free(void *memory) |
{ |
kfree(memory); |
} |
static inline acpi_thread_id acpi_os_get_thread_id(void) |
{ |
return (acpi_thread_id) (unsigned long)current; |
} |
/* |
* When lockdep is enabled, the spin_lock_init() macro stringifies it's |
* argument and uses that as a name for the lock in debugging. |
* By executing spin_lock_init() in a macro the key changes from "lock" for |
* all locks to the name of the argument of acpi_os_create_lock(), which |
* prevents lockdep from reporting false positives for ACPICA locks. |
*/ |
#define acpi_os_create_lock(__handle) \ |
({ \ |
spinlock_t *lock = ACPI_ALLOCATE(sizeof(*lock)); \ |
if (lock) { \ |
*(__handle) = lock; \ |
spin_lock_init(*(__handle)); \ |
} \ |
lock ? AE_OK : AE_NO_MEMORY; \ |
}) |
static inline u8 acpi_os_readable(void *pointer, acpi_size length) |
{ |
return TRUE; |
} |
/* |
* OSL interfaces added by Linux |
*/ |
void early_acpi_os_unmap_memory(void __iomem * virt, acpi_size size); |
#endif /* __KERNEL__ */ |
#endif /* __ACLINUXEX_H__ */ |
/drivers/include/asm/acenv.h |
---|
0,0 → 1,45 |
/* |
* X86 specific ACPICA environments and implementation |
* |
* Copyright (C) 2014, Intel Corporation |
* Author: Lv Zheng <lv.zheng@intel.com> |
* |
* This program is free software; you can redistribute it and/or modify |
* it under the terms of the GNU General Public License version 2 as |
* published by the Free Software Foundation. |
*/ |
#ifndef _ASM_X86_ACENV_H |
#define _ASM_X86_ACENV_H |
#include <asm/special_insns.h> |
/* Asm macros */ |
#define ACPI_FLUSH_CPU_CACHE() wbinvd() |
int __acpi_acquire_global_lock(unsigned int *lock); |
int __acpi_release_global_lock(unsigned int *lock); |
#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \ |
((Acq) = __acpi_acquire_global_lock(&facs->global_lock)) |
#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \ |
((Acq) = __acpi_release_global_lock(&facs->global_lock)) |
/* |
* Math helper asm macros |
*/ |
#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \ |
asm("divl %2;" \ |
: "=a"(q32), "=d"(r32) \ |
: "r"(d32), \ |
"0"(n_lo), "1"(n_hi)) |
#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \ |
asm("shrl $1,%2 ;" \ |
"rcrl $1,%3;" \ |
: "=r"(n_hi), "=r"(n_lo) \ |
: "0"(n_hi), "1"(n_lo)) |
#endif /* _ASM_X86_ACENV_H */ |
/drivers/include/asm/acpi.h |
---|
0,0 → 1,170 |
#ifndef _ASM_X86_ACPI_H |
#define _ASM_X86_ACPI_H |
/* |
* Copyright (C) 2001 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> |
* Copyright (C) 2001 Patrick Mochel <mochel@osdl.org> |
* |
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
* |
* This program is free software; you can redistribute it and/or modify |
* it under the terms of the GNU General Public License as published by |
* the Free Software Foundation; either version 2 of the License, or |
* (at your option) any later version. |
* |
* This program is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* GNU General Public License for more details. |
* |
* You should have received a copy of the GNU General Public License |
* along with this program; if not, write to the Free Software |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* |
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
*/ |
#include <acpi/pdc_intel.h> |
#include <asm/numa.h> |
#include <asm/fixmap.h> |
#include <asm/processor.h> |
#ifdef CONFIG_ACPI_APEI |
# include <asm/pgtable_types.h> |
#endif |
#ifdef CONFIG_ACPI |
extern int acpi_lapic; |
extern int acpi_ioapic; |
extern int acpi_noirq; |
extern int acpi_strict; |
extern int acpi_disabled; |
extern int acpi_pci_disabled; |
extern int acpi_skip_timer_override; |
extern int acpi_use_timer_override; |
extern int acpi_fix_pin2_polarity; |
extern int acpi_disable_cmcff; |
extern u8 acpi_sci_flags; |
extern int acpi_sci_override_gsi; |
void acpi_pic_sci_set_trigger(unsigned int, u16); |
extern int (*__acpi_register_gsi)(struct device *dev, u32 gsi, |
int trigger, int polarity); |
extern void (*__acpi_unregister_gsi)(u32 gsi); |
static inline void disable_acpi(void) |
{ |
acpi_disabled = 1; |
acpi_pci_disabled = 1; |
acpi_noirq = 1; |
} |
extern int acpi_gsi_to_irq(u32 gsi, unsigned int *irq); |
static inline void acpi_noirq_set(void) { acpi_noirq = 1; } |
static inline void acpi_disable_pci(void) |
{ |
acpi_pci_disabled = 1; |
acpi_noirq_set(); |
} |
/* Low-level suspend routine. */ |
extern int (*acpi_suspend_lowlevel)(void); |
/* Physical address to resume after wakeup */ |
#define acpi_wakeup_address ((unsigned long)(real_mode_header->wakeup_start)) |
/* |
* Check if the CPU can handle C2 and deeper |
*/ |
static inline unsigned int acpi_processor_cstate_check(unsigned int max_cstate) |
{ |
/* |
* Early models (<=5) of AMD Opterons are not supposed to go into |
* C2 state. |
* |
* Steppings 0x0A and later are good |
*/ |
if (boot_cpu_data.x86 == 0x0F && |
boot_cpu_data.x86_vendor == X86_VENDOR_AMD && |
boot_cpu_data.x86_model <= 0x05 && |
boot_cpu_data.x86_mask < 0x0A) |
return 1; |
else if (amd_e400_c1e_detected) |
return 1; |
else |
return max_cstate; |
} |
static inline bool arch_has_acpi_pdc(void) |
{ |
struct cpuinfo_x86 *c = &cpu_data(0); |
return (c->x86_vendor == X86_VENDOR_INTEL || |
c->x86_vendor == X86_VENDOR_CENTAUR); |
} |
static inline void arch_acpi_set_pdc_bits(u32 *buf) |
{ |
struct cpuinfo_x86 *c = &cpu_data(0); |
buf[2] |= ACPI_PDC_C_CAPABILITY_SMP; |
if (cpu_has(c, X86_FEATURE_EST)) |
buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP; |
if (cpu_has(c, X86_FEATURE_ACPI)) |
buf[2] |= ACPI_PDC_T_FFH; |
/* |
* If mwait/monitor is unsupported, C2/C3_FFH will be disabled |
*/ |
if (!cpu_has(c, X86_FEATURE_MWAIT)) |
buf[2] &= ~(ACPI_PDC_C_C2C3_FFH); |
} |
static inline bool acpi_has_cpu_in_madt(void) |
{ |
return !!acpi_lapic; |
} |
#else /* !CONFIG_ACPI */ |
#define acpi_lapic 0 |
#define acpi_ioapic 0 |
#define acpi_disable_cmcff 0 |
static inline void acpi_noirq_set(void) { } |
static inline void acpi_disable_pci(void) { } |
static inline void disable_acpi(void) { } |
#endif /* !CONFIG_ACPI */ |
#define ARCH_HAS_POWER_INIT 1 |
#ifdef CONFIG_ACPI_NUMA |
extern int acpi_numa; |
extern int x86_acpi_numa_init(void); |
#endif /* CONFIG_ACPI_NUMA */ |
#define acpi_unlazy_tlb(x) leave_mm(x) |
#ifdef CONFIG_ACPI_APEI |
static inline pgprot_t arch_apei_get_mem_attribute(phys_addr_t addr) |
{ |
/* |
* We currently have no way to look up the EFI memory map |
* attributes for a region in a consistent way, because the |
* memmap is discarded after efi_free_boot_services(). So if |
* you call efi_mem_attributes() during boot and at runtime, |
* you could theoretically see different attributes. |
* |
* Since we are yet to see any x86 platforms that require |
* anything other than PAGE_KERNEL (some arm64 platforms |
* require the equivalent of PAGE_KERNEL_NOCACHE), return that |
* until we know differently. |
*/ |
return PAGE_KERNEL; |
} |
#endif |
#endif /* _ASM_X86_ACPI_H */ |
/drivers/include/asm/apicdef.h |
---|
0,0 → 1,445 |
#ifndef _ASM_X86_APICDEF_H |
#define _ASM_X86_APICDEF_H |
/* |
* Constants for various Intel APICs. (local APIC, IOAPIC, etc.) |
* |
* Alan Cox <Alan.Cox@linux.org>, 1995. |
* Ingo Molnar <mingo@redhat.com>, 1999, 2000 |
*/ |
#define IO_APIC_DEFAULT_PHYS_BASE 0xfec00000 |
#define APIC_DEFAULT_PHYS_BASE 0xfee00000 |
/* |
* This is the IO-APIC register space as specified |
* by Intel docs: |
*/ |
#define IO_APIC_SLOT_SIZE 1024 |
#define APIC_ID 0x20 |
#define APIC_LVR 0x30 |
#define APIC_LVR_MASK 0xFF00FF |
#define APIC_LVR_DIRECTED_EOI (1 << 24) |
#define GET_APIC_VERSION(x) ((x) & 0xFFu) |
#define GET_APIC_MAXLVT(x) (((x) >> 16) & 0xFFu) |
#ifdef CONFIG_X86_32 |
# define APIC_INTEGRATED(x) ((x) & 0xF0u) |
#else |
# define APIC_INTEGRATED(x) (1) |
#endif |
#define APIC_XAPIC(x) ((x) >= 0x14) |
#define APIC_EXT_SPACE(x) ((x) & 0x80000000) |
#define APIC_TASKPRI 0x80 |
#define APIC_TPRI_MASK 0xFFu |
#define APIC_ARBPRI 0x90 |
#define APIC_ARBPRI_MASK 0xFFu |
#define APIC_PROCPRI 0xA0 |
#define APIC_EOI 0xB0 |
#define APIC_EOI_ACK 0x0 /* Docs say 0 for future compat. */ |
#define APIC_RRR 0xC0 |
#define APIC_LDR 0xD0 |
#define APIC_LDR_MASK (0xFFu << 24) |
#define GET_APIC_LOGICAL_ID(x) (((x) >> 24) & 0xFFu) |
#define SET_APIC_LOGICAL_ID(x) (((x) << 24)) |
#define APIC_ALL_CPUS 0xFFu |
#define APIC_DFR 0xE0 |
#define APIC_DFR_CLUSTER 0x0FFFFFFFul |
#define APIC_DFR_FLAT 0xFFFFFFFFul |
#define APIC_SPIV 0xF0 |
#define APIC_SPIV_DIRECTED_EOI (1 << 12) |
#define APIC_SPIV_FOCUS_DISABLED (1 << 9) |
#define APIC_SPIV_APIC_ENABLED (1 << 8) |
#define APIC_ISR 0x100 |
#define APIC_ISR_NR 0x8 /* Number of 32 bit ISR registers. */ |
#define APIC_TMR 0x180 |
#define APIC_IRR 0x200 |
#define APIC_ESR 0x280 |
#define APIC_ESR_SEND_CS 0x00001 |
#define APIC_ESR_RECV_CS 0x00002 |
#define APIC_ESR_SEND_ACC 0x00004 |
#define APIC_ESR_RECV_ACC 0x00008 |
#define APIC_ESR_SENDILL 0x00020 |
#define APIC_ESR_RECVILL 0x00040 |
#define APIC_ESR_ILLREGA 0x00080 |
#define APIC_LVTCMCI 0x2f0 |
#define APIC_ICR 0x300 |
#define APIC_DEST_SELF 0x40000 |
#define APIC_DEST_ALLINC 0x80000 |
#define APIC_DEST_ALLBUT 0xC0000 |
#define APIC_ICR_RR_MASK 0x30000 |
#define APIC_ICR_RR_INVALID 0x00000 |
#define APIC_ICR_RR_INPROG 0x10000 |
#define APIC_ICR_RR_VALID 0x20000 |
#define APIC_INT_LEVELTRIG 0x08000 |
#define APIC_INT_ASSERT 0x04000 |
#define APIC_ICR_BUSY 0x01000 |
#define APIC_DEST_LOGICAL 0x00800 |
#define APIC_DEST_PHYSICAL 0x00000 |
#define APIC_DM_FIXED 0x00000 |
#define APIC_DM_FIXED_MASK 0x00700 |
#define APIC_DM_LOWEST 0x00100 |
#define APIC_DM_SMI 0x00200 |
#define APIC_DM_REMRD 0x00300 |
#define APIC_DM_NMI 0x00400 |
#define APIC_DM_INIT 0x00500 |
#define APIC_DM_STARTUP 0x00600 |
#define APIC_DM_EXTINT 0x00700 |
#define APIC_VECTOR_MASK 0x000FF |
#define APIC_ICR2 0x310 |
#define GET_APIC_DEST_FIELD(x) (((x) >> 24) & 0xFF) |
#define SET_APIC_DEST_FIELD(x) ((x) << 24) |
#define APIC_LVTT 0x320 |
#define APIC_LVTTHMR 0x330 |
#define APIC_LVTPC 0x340 |
#define APIC_LVT0 0x350 |
#define APIC_LVT_TIMER_BASE_MASK (0x3 << 18) |
#define GET_APIC_TIMER_BASE(x) (((x) >> 18) & 0x3) |
#define SET_APIC_TIMER_BASE(x) (((x) << 18)) |
#define APIC_TIMER_BASE_CLKIN 0x0 |
#define APIC_TIMER_BASE_TMBASE 0x1 |
#define APIC_TIMER_BASE_DIV 0x2 |
#define APIC_LVT_TIMER_ONESHOT (0 << 17) |
#define APIC_LVT_TIMER_PERIODIC (1 << 17) |
#define APIC_LVT_TIMER_TSCDEADLINE (2 << 17) |
#define APIC_LVT_MASKED (1 << 16) |
#define APIC_LVT_LEVEL_TRIGGER (1 << 15) |
#define APIC_LVT_REMOTE_IRR (1 << 14) |
#define APIC_INPUT_POLARITY (1 << 13) |
#define APIC_SEND_PENDING (1 << 12) |
#define APIC_MODE_MASK 0x700 |
#define GET_APIC_DELIVERY_MODE(x) (((x) >> 8) & 0x7) |
#define SET_APIC_DELIVERY_MODE(x, y) (((x) & ~0x700) | ((y) << 8)) |
#define APIC_MODE_FIXED 0x0 |
#define APIC_MODE_NMI 0x4 |
#define APIC_MODE_EXTINT 0x7 |
#define APIC_LVT1 0x360 |
#define APIC_LVTERR 0x370 |
#define APIC_TMICT 0x380 |
#define APIC_TMCCT 0x390 |
#define APIC_TDCR 0x3E0 |
#define APIC_SELF_IPI 0x3F0 |
#define APIC_TDR_DIV_TMBASE (1 << 2) |
#define APIC_TDR_DIV_1 0xB |
#define APIC_TDR_DIV_2 0x0 |
#define APIC_TDR_DIV_4 0x1 |
#define APIC_TDR_DIV_8 0x2 |
#define APIC_TDR_DIV_16 0x3 |
#define APIC_TDR_DIV_32 0x8 |
#define APIC_TDR_DIV_64 0x9 |
#define APIC_TDR_DIV_128 0xA |
#define APIC_EFEAT 0x400 |
#define APIC_ECTRL 0x410 |
#define APIC_EILVTn(n) (0x500 + 0x10 * n) |
#define APIC_EILVT_NR_AMD_K8 1 /* # of extended interrupts */ |
#define APIC_EILVT_NR_AMD_10H 4 |
#define APIC_EILVT_NR_MAX APIC_EILVT_NR_AMD_10H |
#define APIC_EILVT_LVTOFF(x) (((x) >> 4) & 0xF) |
#define APIC_EILVT_MSG_FIX 0x0 |
#define APIC_EILVT_MSG_SMI 0x2 |
#define APIC_EILVT_MSG_NMI 0x4 |
#define APIC_EILVT_MSG_EXT 0x7 |
#define APIC_EILVT_MASKED (1 << 16) |
#define APIC_BASE (fix_to_virt(FIX_APIC_BASE)) |
#define APIC_BASE_MSR 0x800 |
#define XAPIC_ENABLE (1UL << 11) |
#define X2APIC_ENABLE (1UL << 10) |
#ifdef CONFIG_X86_32 |
# define MAX_IO_APICS 64 |
# define MAX_LOCAL_APIC 256 |
#else |
# define MAX_IO_APICS 128 |
# define MAX_LOCAL_APIC 32768 |
#endif |
/* |
* All x86-64 systems are xAPIC compatible. |
* In the following, "apicid" is a physical APIC ID. |
*/ |
#define XAPIC_DEST_CPUS_SHIFT 4 |
#define XAPIC_DEST_CPUS_MASK ((1u << XAPIC_DEST_CPUS_SHIFT) - 1) |
#define XAPIC_DEST_CLUSTER_MASK (XAPIC_DEST_CPUS_MASK << XAPIC_DEST_CPUS_SHIFT) |
#define APIC_CLUSTER(apicid) ((apicid) & XAPIC_DEST_CLUSTER_MASK) |
#define APIC_CLUSTERID(apicid) (APIC_CLUSTER(apicid) >> XAPIC_DEST_CPUS_SHIFT) |
#define APIC_CPUID(apicid) ((apicid) & XAPIC_DEST_CPUS_MASK) |
#define NUM_APIC_CLUSTERS ((BAD_APICID + 1) >> XAPIC_DEST_CPUS_SHIFT) |
/* |
* the local APIC register structure, memory mapped. Not terribly well |
* tested, but we might eventually use this one in the future - the |
* problem why we cannot use it right now is the P5 APIC, it has an |
* errata which cannot take 8-bit reads and writes, only 32-bit ones ... |
*/ |
#define u32 unsigned int |
struct local_apic { |
/*000*/ struct { u32 __reserved[4]; } __reserved_01; |
/*010*/ struct { u32 __reserved[4]; } __reserved_02; |
/*020*/ struct { /* APIC ID Register */ |
u32 __reserved_1 : 24, |
phys_apic_id : 4, |
__reserved_2 : 4; |
u32 __reserved[3]; |
} id; |
/*030*/ const |
struct { /* APIC Version Register */ |
u32 version : 8, |
__reserved_1 : 8, |
max_lvt : 8, |
__reserved_2 : 8; |
u32 __reserved[3]; |
} version; |
/*040*/ struct { u32 __reserved[4]; } __reserved_03; |
/*050*/ struct { u32 __reserved[4]; } __reserved_04; |
/*060*/ struct { u32 __reserved[4]; } __reserved_05; |
/*070*/ struct { u32 __reserved[4]; } __reserved_06; |
/*080*/ struct { /* Task Priority Register */ |
u32 priority : 8, |
__reserved_1 : 24; |
u32 __reserved_2[3]; |
} tpr; |
/*090*/ const |
struct { /* Arbitration Priority Register */ |
u32 priority : 8, |
__reserved_1 : 24; |
u32 __reserved_2[3]; |
} apr; |
/*0A0*/ const |
struct { /* Processor Priority Register */ |
u32 priority : 8, |
__reserved_1 : 24; |
u32 __reserved_2[3]; |
} ppr; |
/*0B0*/ struct { /* End Of Interrupt Register */ |
u32 eoi; |
u32 __reserved[3]; |
} eoi; |
/*0C0*/ struct { u32 __reserved[4]; } __reserved_07; |
/*0D0*/ struct { /* Logical Destination Register */ |
u32 __reserved_1 : 24, |
logical_dest : 8; |
u32 __reserved_2[3]; |
} ldr; |
/*0E0*/ struct { /* Destination Format Register */ |
u32 __reserved_1 : 28, |
model : 4; |
u32 __reserved_2[3]; |
} dfr; |
/*0F0*/ struct { /* Spurious Interrupt Vector Register */ |
u32 spurious_vector : 8, |
apic_enabled : 1, |
focus_cpu : 1, |
__reserved_2 : 22; |
u32 __reserved_3[3]; |
} svr; |
/*100*/ struct { /* In Service Register */ |
/*170*/ u32 bitfield; |
u32 __reserved[3]; |
} isr [8]; |
/*180*/ struct { /* Trigger Mode Register */ |
/*1F0*/ u32 bitfield; |
u32 __reserved[3]; |
} tmr [8]; |
/*200*/ struct { /* Interrupt Request Register */ |
/*270*/ u32 bitfield; |
u32 __reserved[3]; |
} irr [8]; |
/*280*/ union { /* Error Status Register */ |
struct { |
u32 send_cs_error : 1, |
receive_cs_error : 1, |
send_accept_error : 1, |
receive_accept_error : 1, |
__reserved_1 : 1, |
send_illegal_vector : 1, |
receive_illegal_vector : 1, |
illegal_register_address : 1, |
__reserved_2 : 24; |
u32 __reserved_3[3]; |
} error_bits; |
struct { |
u32 errors; |
u32 __reserved_3[3]; |
} all_errors; |
} esr; |
/*290*/ struct { u32 __reserved[4]; } __reserved_08; |
/*2A0*/ struct { u32 __reserved[4]; } __reserved_09; |
/*2B0*/ struct { u32 __reserved[4]; } __reserved_10; |
/*2C0*/ struct { u32 __reserved[4]; } __reserved_11; |
/*2D0*/ struct { u32 __reserved[4]; } __reserved_12; |
/*2E0*/ struct { u32 __reserved[4]; } __reserved_13; |
/*2F0*/ struct { u32 __reserved[4]; } __reserved_14; |
/*300*/ struct { /* Interrupt Command Register 1 */ |
u32 vector : 8, |
delivery_mode : 3, |
destination_mode : 1, |
delivery_status : 1, |
__reserved_1 : 1, |
level : 1, |
trigger : 1, |
__reserved_2 : 2, |
shorthand : 2, |
__reserved_3 : 12; |
u32 __reserved_4[3]; |
} icr1; |
/*310*/ struct { /* Interrupt Command Register 2 */ |
union { |
u32 __reserved_1 : 24, |
phys_dest : 4, |
__reserved_2 : 4; |
u32 __reserved_3 : 24, |
logical_dest : 8; |
} dest; |
u32 __reserved_4[3]; |
} icr2; |
/*320*/ struct { /* LVT - Timer */ |
u32 vector : 8, |
__reserved_1 : 4, |
delivery_status : 1, |
__reserved_2 : 3, |
mask : 1, |
timer_mode : 1, |
__reserved_3 : 14; |
u32 __reserved_4[3]; |
} lvt_timer; |
/*330*/ struct { /* LVT - Thermal Sensor */ |
u32 vector : 8, |
delivery_mode : 3, |
__reserved_1 : 1, |
delivery_status : 1, |
__reserved_2 : 3, |
mask : 1, |
__reserved_3 : 15; |
u32 __reserved_4[3]; |
} lvt_thermal; |
/*340*/ struct { /* LVT - Performance Counter */ |
u32 vector : 8, |
delivery_mode : 3, |
__reserved_1 : 1, |
delivery_status : 1, |
__reserved_2 : 3, |
mask : 1, |
__reserved_3 : 15; |
u32 __reserved_4[3]; |
} lvt_pc; |
/*350*/ struct { /* LVT - LINT0 */ |
u32 vector : 8, |
delivery_mode : 3, |
__reserved_1 : 1, |
delivery_status : 1, |
polarity : 1, |
remote_irr : 1, |
trigger : 1, |
mask : 1, |
__reserved_2 : 15; |
u32 __reserved_3[3]; |
} lvt_lint0; |
/*360*/ struct { /* LVT - LINT1 */ |
u32 vector : 8, |
delivery_mode : 3, |
__reserved_1 : 1, |
delivery_status : 1, |
polarity : 1, |
remote_irr : 1, |
trigger : 1, |
mask : 1, |
__reserved_2 : 15; |
u32 __reserved_3[3]; |
} lvt_lint1; |
/*370*/ struct { /* LVT - Error */ |
u32 vector : 8, |
__reserved_1 : 4, |
delivery_status : 1, |
__reserved_2 : 3, |
mask : 1, |
__reserved_3 : 15; |
u32 __reserved_4[3]; |
} lvt_error; |
/*380*/ struct { /* Timer Initial Count Register */ |
u32 initial_count; |
u32 __reserved_2[3]; |
} timer_icr; |
/*390*/ const |
struct { /* Timer Current Count Register */ |
u32 curr_count; |
u32 __reserved_2[3]; |
} timer_ccr; |
/*3A0*/ struct { u32 __reserved[4]; } __reserved_16; |
/*3B0*/ struct { u32 __reserved[4]; } __reserved_17; |
/*3C0*/ struct { u32 __reserved[4]; } __reserved_18; |
/*3D0*/ struct { u32 __reserved[4]; } __reserved_19; |
/*3E0*/ struct { /* Timer Divide Configuration Register */ |
u32 divisor : 4, |
__reserved_1 : 28; |
u32 __reserved_2[3]; |
} timer_dcr; |
/*3F0*/ struct { u32 __reserved[4]; } __reserved_20; |
} __attribute__ ((packed)); |
#undef u32 |
#ifdef CONFIG_X86_32 |
#define BAD_APICID 0xFFu |
#else |
#define BAD_APICID 0xFFFFu |
#endif |
enum ioapic_irq_destination_types { |
dest_Fixed = 0, |
dest_LowestPrio = 1, |
dest_SMI = 2, |
dest__reserved_1 = 3, |
dest_NMI = 4, |
dest_INIT = 5, |
dest__reserved_2 = 6, |
dest_ExtINT = 7 |
}; |
#endif /* _ASM_X86_APICDEF_H */ |
/drivers/include/asm/atomic64_32.h |
---|
312,4 → 312,18 |
#undef alternative_atomic64 |
#undef __alternative_atomic64 |
#define ATOMIC64_OP(op, c_op) \ |
static inline void atomic64_##op(long long i, atomic64_t *v) \ |
{ \ |
long long old, c = 0; \ |
while ((old = atomic64_cmpxchg(v, c, c c_op i)) != c) \ |
c = old; \ |
} |
ATOMIC64_OP(and, &) |
ATOMIC64_OP(or, |) |
ATOMIC64_OP(xor, ^) |
#undef ATOMIC64_OP |
#endif /* _ASM_X86_ATOMIC64_32_H */ |
/drivers/include/asm/fixmap.h |
---|
0,0 → 1,170 |
/* |
* fixmap.h: compile-time virtual memory allocation |
* |
* This file is subject to the terms and conditions of the GNU General Public |
* License. See the file "COPYING" in the main directory of this archive |
* for more details. |
* |
* Copyright (C) 1998 Ingo Molnar |
* |
* Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999 |
* x86_32 and x86_64 integration by Gustavo F. Padovan, February 2009 |
*/ |
#ifndef _ASM_X86_FIXMAP_H |
#define _ASM_X86_FIXMAP_H |
#ifndef __ASSEMBLY__ |
#include <linux/kernel.h> |
#include <asm/acpi.h> |
#include <asm/apicdef.h> |
#include <asm/page.h> |
#include <asm/pvclock.h> |
#ifdef CONFIG_X86_32 |
#include <linux/threads.h> |
#include <asm/kmap_types.h> |
#else |
#include <uapi/asm/vsyscall.h> |
#endif |
/* |
* We can't declare FIXADDR_TOP as variable for x86_64 because vsyscall |
* uses fixmaps that relies on FIXADDR_TOP for proper address calculation. |
* Because of this, FIXADDR_TOP x86 integration was left as later work. |
*/ |
#ifdef CONFIG_X86_32 |
/* used by vmalloc.c, vsyscall.lds.S. |
* |
* Leave one empty page between vmalloc'ed areas and |
* the start of the fixmap. |
*/ |
extern unsigned long __FIXADDR_TOP; |
#define FIXADDR_TOP ((unsigned long)__FIXADDR_TOP) |
#else |
#define FIXADDR_TOP (round_up(VSYSCALL_ADDR + PAGE_SIZE, 1<<PMD_SHIFT) - \ |
PAGE_SIZE) |
#endif |
/* |
* Here we define all the compile-time 'special' virtual |
* addresses. The point is to have a constant address at |
* compile time, but to set the physical address only |
* in the boot process. |
* for x86_32: We allocate these special addresses |
* from the end of virtual memory (0xfffff000) backwards. |
* Also this lets us do fail-safe vmalloc(), we |
* can guarantee that these special addresses and |
* vmalloc()-ed addresses never overlap. |
* |
* These 'compile-time allocated' memory buffers are |
* fixed-size 4k pages (or larger if used with an increment |
* higher than 1). Use set_fixmap(idx,phys) to associate |
* physical memory with fixmap indices. |
* |
* TLB entries of such buffers will not be flushed across |
* task switches. |
*/ |
enum fixed_addresses { |
#ifdef CONFIG_X86_32 |
FIX_HOLE, |
#else |
#ifdef CONFIG_X86_VSYSCALL_EMULATION |
VSYSCALL_PAGE = (FIXADDR_TOP - VSYSCALL_ADDR) >> PAGE_SHIFT, |
#endif |
#ifdef CONFIG_PARAVIRT_CLOCK |
PVCLOCK_FIXMAP_BEGIN, |
PVCLOCK_FIXMAP_END = PVCLOCK_FIXMAP_BEGIN+PVCLOCK_VSYSCALL_NR_PAGES-1, |
#endif |
#endif |
FIX_DBGP_BASE, |
FIX_EARLYCON_MEM_BASE, |
#ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT |
FIX_OHCI1394_BASE, |
#endif |
#ifdef CONFIG_X86_LOCAL_APIC |
FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */ |
#endif |
#ifdef CONFIG_X86_IO_APIC |
FIX_IO_APIC_BASE_0, |
FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS - 1, |
#endif |
FIX_RO_IDT, /* Virtual mapping for read-only IDT */ |
#ifdef CONFIG_X86_32 |
FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */ |
FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1, |
#ifdef CONFIG_PCI_MMCONFIG |
FIX_PCIE_MCFG, |
#endif |
#endif |
#ifdef CONFIG_PARAVIRT |
FIX_PARAVIRT_BOOTMAP, |
#endif |
FIX_TEXT_POKE1, /* reserve 2 pages for text_poke() */ |
FIX_TEXT_POKE0, /* first page is last, because allocation is backward */ |
#ifdef CONFIG_X86_INTEL_MID |
FIX_LNW_VRTC, |
#endif |
__end_of_permanent_fixed_addresses, |
/* |
* 512 temporary boot-time mappings, used by early_ioremap(), |
* before ioremap() is functional. |
* |
* If necessary we round it up to the next 512 pages boundary so |
* that we can have a single pgd entry and a single pte table: |
*/ |
#define NR_FIX_BTMAPS 64 |
#define FIX_BTMAPS_SLOTS 8 |
#define TOTAL_FIX_BTMAPS (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS) |
FIX_BTMAP_END = |
(__end_of_permanent_fixed_addresses ^ |
(__end_of_permanent_fixed_addresses + TOTAL_FIX_BTMAPS - 1)) & |
-PTRS_PER_PTE |
? __end_of_permanent_fixed_addresses + TOTAL_FIX_BTMAPS - |
(__end_of_permanent_fixed_addresses & (TOTAL_FIX_BTMAPS - 1)) |
: __end_of_permanent_fixed_addresses, |
FIX_BTMAP_BEGIN = FIX_BTMAP_END + TOTAL_FIX_BTMAPS - 1, |
#ifdef CONFIG_X86_32 |
FIX_WP_TEST, |
#endif |
#ifdef CONFIG_INTEL_TXT |
FIX_TBOOT_BASE, |
#endif |
__end_of_fixed_addresses |
}; |
extern void reserve_top_address(unsigned long reserve); |
#define FIXADDR_SIZE (__end_of_permanent_fixed_addresses << PAGE_SHIFT) |
#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) |
extern int fixmaps_set; |
extern pte_t *kmap_pte; |
extern pgprot_t kmap_prot; |
extern pte_t *pkmap_page_table; |
void __native_set_fixmap(enum fixed_addresses idx, pte_t pte); |
void native_set_fixmap(enum fixed_addresses idx, |
phys_addr_t phys, pgprot_t flags); |
#ifndef CONFIG_PARAVIRT |
static inline void __set_fixmap(enum fixed_addresses idx, |
phys_addr_t phys, pgprot_t flags) |
{ |
native_set_fixmap(idx, phys, flags); |
} |
#endif |
#include <asm-generic/fixmap.h> |
#define __late_set_fixmap(idx, phys, flags) __set_fixmap(idx, phys, flags) |
#define __late_clear_fixmap(idx) __set_fixmap(idx, 0, __pgprot(0)) |
void __early_set_fixmap(enum fixed_addresses idx, |
phys_addr_t phys, pgprot_t flags); |
#endif /* !__ASSEMBLY__ */ |
#endif /* _ASM_X86_FIXMAP_H */ |
/drivers/include/asm/kmap_types.h |
---|
0,0 → 1,12 |
#ifndef _ASM_X86_KMAP_TYPES_H |
#define _ASM_X86_KMAP_TYPES_H |
#if defined(CONFIG_X86_32) && defined(CONFIG_DEBUG_HIGHMEM) |
#define __WITH_KM_FENCE |
#endif |
#include <asm-generic/kmap_types.h> |
#undef __WITH_KM_FENCE |
#endif /* _ASM_X86_KMAP_TYPES_H */ |
/drivers/include/asm/numa.h |
---|
0,0 → 1,82 |
#ifndef _ASM_X86_NUMA_H |
#define _ASM_X86_NUMA_H |
#include <linux/nodemask.h> |
#include <asm/topology.h> |
#include <asm/apicdef.h> |
#ifdef CONFIG_NUMA |
#define NR_NODE_MEMBLKS (MAX_NUMNODES*2) |
/* |
* Too small node sizes may confuse the VM badly. Usually they |
* result from BIOS bugs. So dont recognize nodes as standalone |
* NUMA entities that have less than this amount of RAM listed: |
*/ |
#define NODE_MIN_SIZE (4*1024*1024) |
extern int numa_off; |
/* |
* __apicid_to_node[] stores the raw mapping between physical apicid and |
* node and is used to initialize cpu_to_node mapping. |
* |
* The mapping may be overridden by apic->numa_cpu_node() on 32bit and thus |
* should be accessed by the accessors - set_apicid_to_node() and |
* numa_cpu_node(). |
*/ |
extern s16 __apicid_to_node[MAX_LOCAL_APIC]; |
extern nodemask_t numa_nodes_parsed __initdata; |
extern int __init numa_add_memblk(int nodeid, u64 start, u64 end); |
extern void __init numa_set_distance(int from, int to, int distance); |
static inline void set_apicid_to_node(int apicid, s16 node) |
{ |
__apicid_to_node[apicid] = node; |
} |
extern int numa_cpu_node(int cpu); |
#else /* CONFIG_NUMA */ |
static inline void set_apicid_to_node(int apicid, s16 node) |
{ |
} |
static inline int numa_cpu_node(int cpu) |
{ |
return NUMA_NO_NODE; |
} |
#endif /* CONFIG_NUMA */ |
#ifdef CONFIG_X86_32 |
# include <asm/numa_32.h> |
#endif |
#ifdef CONFIG_NUMA |
extern void numa_set_node(int cpu, int node); |
extern void numa_clear_node(int cpu); |
extern void __init init_cpu_to_node(void); |
extern void numa_add_cpu(int cpu); |
extern void numa_remove_cpu(int cpu); |
#else /* CONFIG_NUMA */ |
static inline void numa_set_node(int cpu, int node) { } |
static inline void numa_clear_node(int cpu) { } |
static inline void init_cpu_to_node(void) { } |
static inline void numa_add_cpu(int cpu) { } |
static inline void numa_remove_cpu(int cpu) { } |
#endif /* CONFIG_NUMA */ |
#ifdef CONFIG_DEBUG_PER_CPU_MAPS |
void debug_cpumask_set_cpu(int cpu, int node, bool enable); |
#endif |
#ifdef CONFIG_NUMA_EMU |
#define FAKE_NODE_MIN_SIZE ((u64)32 << 20) |
#define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1UL)) |
void numa_emu_cmdline(char *); |
#endif /* CONFIG_NUMA_EMU */ |
#endif /* _ASM_X86_NUMA_H */ |
/drivers/include/asm/numa_32.h |
---|
0,0 → 1,12 |
#ifndef _ASM_X86_NUMA_32_H |
#define _ASM_X86_NUMA_32_H |
#ifdef CONFIG_HIGHMEM |
extern void set_highmem_pages_init(void); |
#else |
static inline void set_highmem_pages_init(void) |
{ |
} |
#endif |
#endif /* _ASM_X86_NUMA_32_H */ |
/drivers/include/asm/pgtable_types.h |
---|
363,10 → 363,9 |
} |
static inline pgprot_t pgprot_4k_2_large(pgprot_t pgprot) |
{ |
pgprotval_t val = pgprot_val(pgprot); |
pgprot_t new; |
unsigned long val; |
val = pgprot_val(pgprot); |
pgprot_val(new) = (val & ~(_PAGE_PAT | _PAGE_PAT_LARGE)) | |
((val & _PAGE_PAT) << (_PAGE_BIT_PAT_LARGE - _PAGE_BIT_PAT)); |
return new; |
373,10 → 372,9 |
} |
static inline pgprot_t pgprot_large_2_4k(pgprot_t pgprot) |
{ |
pgprotval_t val = pgprot_val(pgprot); |
pgprot_t new; |
unsigned long val; |
val = pgprot_val(pgprot); |
pgprot_val(new) = (val & ~(_PAGE_PAT | _PAGE_PAT_LARGE)) | |
((val & _PAGE_PAT_LARGE) >> |
(_PAGE_BIT_PAT_LARGE - _PAGE_BIT_PAT)); |
/drivers/include/asm/pvclock-abi.h |
---|
0,0 → 1,47 |
#ifndef _ASM_X86_PVCLOCK_ABI_H |
#define _ASM_X86_PVCLOCK_ABI_H |
#ifndef __ASSEMBLY__ |
/* |
* These structs MUST NOT be changed. |
* They are the ABI between hypervisor and guest OS. |
* Both Xen and KVM are using this. |
* |
* pvclock_vcpu_time_info holds the system time and the tsc timestamp |
* of the last update. So the guest can use the tsc delta to get a |
* more precise system time. There is one per virtual cpu. |
* |
* pvclock_wall_clock references the point in time when the system |
* time was zero (usually boot time), thus the guest calculates the |
* current wall clock by adding the system time. |
* |
* Protocol for the "version" fields is: hypervisor raises it (making |
* it uneven) before it starts updating the fields and raises it again |
* (making it even) when it is done. Thus the guest can make sure the |
* time values it got are consistent by checking the version before |
* and after reading them. |
*/ |
struct pvclock_vcpu_time_info { |
u32 version; |
u32 pad0; |
u64 tsc_timestamp; |
u64 system_time; |
u32 tsc_to_system_mul; |
s8 tsc_shift; |
u8 flags; |
u8 pad[2]; |
} __attribute__((__packed__)); /* 32 bytes */ |
struct pvclock_wall_clock { |
u32 version; |
u32 sec; |
u32 nsec; |
} __attribute__((__packed__)); |
#define PVCLOCK_TSC_STABLE_BIT (1 << 0) |
#define PVCLOCK_GUEST_STOPPED (1 << 1) |
/* PVCLOCK_COUNTS_FROM_ZERO broke ABI and can't be used anymore. */ |
#define PVCLOCK_COUNTS_FROM_ZERO (1 << 2) |
#endif /* __ASSEMBLY__ */ |
#endif /* _ASM_X86_PVCLOCK_ABI_H */ |
/drivers/include/asm/pvclock.h |
---|
0,0 → 1,74 |
#ifndef _ASM_X86_PVCLOCK_H |
#define _ASM_X86_PVCLOCK_H |
#include <linux/clocksource.h> |
#include <asm/pvclock-abi.h> |
/* some helper functions for xen and kvm pv clock sources */ |
cycle_t pvclock_clocksource_read(struct pvclock_vcpu_time_info *src); |
u8 pvclock_read_flags(struct pvclock_vcpu_time_info *src); |
void pvclock_set_flags(u8 flags); |
unsigned long pvclock_tsc_khz(struct pvclock_vcpu_time_info *src); |
void pvclock_read_wallclock(struct pvclock_wall_clock *wall, |
struct pvclock_vcpu_time_info *vcpu, |
struct timespec *ts); |
void pvclock_resume(void); |
void pvclock_touch_watchdogs(void); |
/* |
* Scale a 64-bit delta by scaling and multiplying by a 32-bit fraction, |
* yielding a 64-bit result. |
*/ |
static inline u64 pvclock_scale_delta(u64 delta, u32 mul_frac, int shift) |
{ |
u64 product; |
#ifdef __i386__ |
u32 tmp1, tmp2; |
#else |
ulong tmp; |
#endif |
if (shift < 0) |
delta >>= -shift; |
else |
delta <<= shift; |
#ifdef __i386__ |
__asm__ ( |
"mul %5 ; " |
"mov %4,%%eax ; " |
"mov %%edx,%4 ; " |
"mul %5 ; " |
"xor %5,%5 ; " |
"add %4,%%eax ; " |
"adc %5,%%edx ; " |
: "=A" (product), "=r" (tmp1), "=r" (tmp2) |
: "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (mul_frac) ); |
#elif defined(__x86_64__) |
__asm__ ( |
"mulq %[mul_frac] ; shrd $32, %[hi], %[lo]" |
: [lo]"=a"(product), |
[hi]"=d"(tmp) |
: "0"(delta), |
[mul_frac]"rm"((u64)mul_frac)); |
#else |
#error implement me! |
#endif |
return product; |
} |
struct pvclock_vsyscall_time_info { |
struct pvclock_vcpu_time_info pvti; |
} __attribute__((__aligned__(SMP_CACHE_BYTES))); |
#define PVTI_SIZE sizeof(struct pvclock_vsyscall_time_info) |
#define PVCLOCK_VSYSCALL_NR_PAGES (((NR_CPUS-1)/(PAGE_SIZE/PVTI_SIZE))+1) |
int __init pvclock_init_vsyscall(struct pvclock_vsyscall_time_info *i, |
int size); |
struct pvclock_vcpu_time_info *pvclock_get_vsyscall_time_info(int cpu); |
#endif /* _ASM_X86_PVCLOCK_H */ |
/drivers/include/asm/scatterlist.h |
---|
36,6 → 36,4 |
int dma_map_sg(struct device *dev, struct scatterlist *sglist, |
int nelems, int dir); |
#define dma_unmap_sg(d, s, n, r) |
#endif /* __ASM_GENERIC_SCATTERLIST_H */ |
/drivers/include/asm/topology.h |
---|
0,0 → 1,138 |
/* |
* Written by: Matthew Dobson, IBM Corporation |
* |
* Copyright (C) 2002, IBM Corp. |
* |
* All rights reserved. |
* |
* This program is free software; you can redistribute it and/or modify |
* it under the terms of the GNU General Public License as published by |
* the Free Software Foundation; either version 2 of the License, or |
* (at your option) any later version. |
* |
* This program is distributed in the hope that it will be useful, but |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or |
* NON INFRINGEMENT. See the GNU General Public License for more |
* details. |
* |
* You should have received a copy of the GNU General Public License |
* along with this program; if not, write to the Free Software |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
* |
* Send feedback to <colpatch@us.ibm.com> |
*/ |
#ifndef _ASM_X86_TOPOLOGY_H |
#define _ASM_X86_TOPOLOGY_H |
#ifdef CONFIG_X86_32 |
# ifdef CONFIG_SMP |
# define ENABLE_TOPO_DEFINES |
# endif |
#else |
# ifdef CONFIG_SMP |
# define ENABLE_TOPO_DEFINES |
# endif |
#endif |
/* |
* to preserve the visibility of NUMA_NO_NODE definition, |
* moved to there from here. May be used independent of |
* CONFIG_NUMA. |
*/ |
#include <linux/numa.h> |
#ifdef CONFIG_NUMA |
#include <linux/cpumask.h> |
#include <asm/mpspec.h> |
/* Mappings between logical cpu number and node number */ |
DECLARE_EARLY_PER_CPU(int, x86_cpu_to_node_map); |
#ifdef CONFIG_DEBUG_PER_CPU_MAPS |
/* |
* override generic percpu implementation of cpu_to_node |
*/ |
extern int __cpu_to_node(int cpu); |
#define cpu_to_node __cpu_to_node |
extern int early_cpu_to_node(int cpu); |
#else /* !CONFIG_DEBUG_PER_CPU_MAPS */ |
/* Same function but used if called before per_cpu areas are setup */ |
static inline int early_cpu_to_node(int cpu) |
{ |
return early_per_cpu(x86_cpu_to_node_map, cpu); |
} |
#endif /* !CONFIG_DEBUG_PER_CPU_MAPS */ |
/* Mappings between node number and cpus on that node. */ |
extern cpumask_var_t node_to_cpumask_map[MAX_NUMNODES]; |
#ifdef CONFIG_DEBUG_PER_CPU_MAPS |
extern const struct cpumask *cpumask_of_node(int node); |
#else |
/* Returns a pointer to the cpumask of CPUs on Node 'node'. */ |
static inline const struct cpumask *cpumask_of_node(int node) |
{ |
return node_to_cpumask_map[node]; |
} |
#endif |
extern void setup_node_to_cpumask_map(void); |
/* |
* Returns the number of the node containing Node 'node'. This |
* architecture is flat, so it is a pretty simple function! |
*/ |
#define parent_node(node) (node) |
#define pcibus_to_node(bus) __pcibus_to_node(bus) |
extern int __node_distance(int, int); |
#define node_distance(a, b) __node_distance(a, b) |
#else /* !CONFIG_NUMA */ |
static inline int numa_node_id(void) |
{ |
return 0; |
} |
/* |
* indicate override: |
*/ |
#define numa_node_id numa_node_id |
static inline int early_cpu_to_node(int cpu) |
{ |
return 0; |
} |
static inline void setup_node_to_cpumask_map(void) { } |
#endif |
#include <asm-generic/topology.h> |
extern const struct cpumask *cpu_coregroup_mask(int cpu); |
#define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id) |
#define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id) |
#ifdef ENABLE_TOPO_DEFINES |
#define topology_core_cpumask(cpu) (per_cpu(cpu_core_map, cpu)) |
#define topology_sibling_cpumask(cpu) (per_cpu(cpu_sibling_map, cpu)) |
#endif |
static inline void arch_fix_phys_package_id(int num, u32 slot) |
{ |
} |
struct pci_bus; |
int x86_pci_root_bus_node(int bus); |
void x86_pci_root_bus_resources(int bus, struct list_head *resources); |
#endif /* _ASM_X86_TOPOLOGY_H */ |
/drivers/include/asm-generic/fixmap.h |
---|
0,0 → 1,103 |
/* |
* fixmap.h: compile-time virtual memory allocation |
* |
* This file is subject to the terms and conditions of the GNU General Public |
* License. See the file "COPYING" in the main directory of this archive |
* for more details. |
* |
* Copyright (C) 1998 Ingo Molnar |
* |
* Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999 |
* x86_32 and x86_64 integration by Gustavo F. Padovan, February 2009 |
* Break out common bits to asm-generic by Mark Salter, November 2013 |
*/ |
#ifndef __ASM_GENERIC_FIXMAP_H |
#define __ASM_GENERIC_FIXMAP_H |
#include <linux/bug.h> |
#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) |
#define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT) |
#ifndef __ASSEMBLY__ |
/* |
* 'index to address' translation. If anyone tries to use the idx |
* directly without translation, we catch the bug with a NULL-deference |
* kernel oops. Illegal ranges of incoming indices are caught too. |
*/ |
static __always_inline unsigned long fix_to_virt(const unsigned int idx) |
{ |
BUILD_BUG_ON(idx >= __end_of_fixed_addresses); |
return __fix_to_virt(idx); |
} |
static inline unsigned long virt_to_fix(const unsigned long vaddr) |
{ |
BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START); |
return __virt_to_fix(vaddr); |
} |
/* |
* Provide some reasonable defaults for page flags. |
* Not all architectures use all of these different types and some |
* architectures use different names. |
*/ |
#ifndef FIXMAP_PAGE_NORMAL |
#define FIXMAP_PAGE_NORMAL PAGE_KERNEL |
#endif |
#if !defined(FIXMAP_PAGE_RO) && defined(PAGE_KERNEL_RO) |
#define FIXMAP_PAGE_RO PAGE_KERNEL_RO |
#endif |
#ifndef FIXMAP_PAGE_NOCACHE |
#define FIXMAP_PAGE_NOCACHE PAGE_KERNEL_NOCACHE |
#endif |
#ifndef FIXMAP_PAGE_IO |
#define FIXMAP_PAGE_IO PAGE_KERNEL_IO |
#endif |
#ifndef FIXMAP_PAGE_CLEAR |
#define FIXMAP_PAGE_CLEAR __pgprot(0) |
#endif |
#ifndef set_fixmap |
#define set_fixmap(idx, phys) \ |
__set_fixmap(idx, phys, FIXMAP_PAGE_NORMAL) |
#endif |
#ifndef clear_fixmap |
#define clear_fixmap(idx) \ |
__set_fixmap(idx, 0, FIXMAP_PAGE_CLEAR) |
#endif |
/* Return a pointer with offset calculated */ |
#define __set_fixmap_offset(idx, phys, flags) \ |
({ \ |
unsigned long addr; \ |
__set_fixmap(idx, phys, flags); \ |
addr = fix_to_virt(idx) + ((phys) & (PAGE_SIZE - 1)); \ |
addr; \ |
}) |
#define set_fixmap_offset(idx, phys) \ |
__set_fixmap_offset(idx, phys, FIXMAP_PAGE_NORMAL) |
/* |
* Some hardware wants to get fixmapped without caching. |
*/ |
#define set_fixmap_nocache(idx, phys) \ |
__set_fixmap(idx, phys, FIXMAP_PAGE_NOCACHE) |
#define set_fixmap_offset_nocache(idx, phys) \ |
__set_fixmap_offset(idx, phys, FIXMAP_PAGE_NOCACHE) |
/* |
* Some fixmaps are for IO |
*/ |
#define set_fixmap_io(idx, phys) \ |
__set_fixmap(idx, phys, FIXMAP_PAGE_IO) |
#define set_fixmap_offset_io(idx, phys) \ |
__set_fixmap_offset(idx, phys, FIXMAP_PAGE_IO) |
#endif /* __ASSEMBLY__ */ |
#endif /* __ASM_GENERIC_FIXMAP_H */ |
/drivers/include/asm-generic/kmap_types.h |
---|
0,0 → 1,10 |
#ifndef _ASM_GENERIC_KMAP_TYPES_H |
#define _ASM_GENERIC_KMAP_TYPES_H |
#ifdef __WITH_KM_FENCE |
# define KM_TYPE_NR 41 |
#else |
# define KM_TYPE_NR 20 |
#endif |
#endif |
/drivers/include/asm-generic/pci-dma-compat.h |
---|
7,6 → 7,13 |
#include <linux/dma-mapping.h> |
static inline void * |
pci_alloc_consistent(struct pci_dev *hwdev, size_t size, |
dma_addr_t *dma_handle) |
{ |
return dma_alloc_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, dma_handle, GFP_ATOMIC); |
} |
static inline void * |
pci_zalloc_consistent(struct pci_dev *hwdev, size_t size, |
dma_addr_t *dma_handle) |
{ |
14,6 → 21,13 |
size, dma_handle, GFP_ATOMIC); |
} |
static inline void |
pci_free_consistent(struct pci_dev *hwdev, size_t size, |
void *vaddr, dma_addr_t dma_handle) |
{ |
dma_free_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, vaddr, dma_handle); |
} |
static inline dma_addr_t |
pci_map_single(struct pci_dev *hwdev, void *ptr, size_t size, int direction) |
{ |
/drivers/include/asm-generic/topology.h |
---|
0,0 → 1,76 |
/* |
* linux/include/asm-generic/topology.h |
* |
* Written by: Matthew Dobson, IBM Corporation |
* |
* Copyright (C) 2002, IBM Corp. |
* |
* All rights reserved. |
* |
* This program is free software; you can redistribute it and/or modify |
* it under the terms of the GNU General Public License as published by |
* the Free Software Foundation; either version 2 of the License, or |
* (at your option) any later version. |
* |
* This program is distributed in the hope that it will be useful, but |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or |
* NON INFRINGEMENT. See the GNU General Public License for more |
* details. |
* |
* You should have received a copy of the GNU General Public License |
* along with this program; if not, write to the Free Software |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
* |
* Send feedback to <colpatch@us.ibm.com> |
*/ |
#ifndef _ASM_GENERIC_TOPOLOGY_H |
#define _ASM_GENERIC_TOPOLOGY_H |
#ifndef CONFIG_NUMA |
/* Other architectures wishing to use this simple topology API should fill |
in the below functions as appropriate in their own <asm/topology.h> file. */ |
#ifndef cpu_to_node |
#define cpu_to_node(cpu) ((void)(cpu),0) |
#endif |
#ifndef set_numa_node |
#define set_numa_node(node) |
#endif |
#ifndef set_cpu_numa_node |
#define set_cpu_numa_node(cpu, node) |
#endif |
#ifndef cpu_to_mem |
#define cpu_to_mem(cpu) ((void)(cpu),0) |
#endif |
#ifndef parent_node |
#define parent_node(node) ((void)(node),0) |
#endif |
#ifndef cpumask_of_node |
#define cpumask_of_node(node) ((void)node, cpu_online_mask) |
#endif |
#ifndef pcibus_to_node |
#define pcibus_to_node(bus) ((void)(bus), -1) |
#endif |
#ifndef cpumask_of_pcibus |
#define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \ |
cpu_all_mask : \ |
cpumask_of_node(pcibus_to_node(bus))) |
#endif |
#endif /* CONFIG_NUMA */ |
#if !defined(CONFIG_NUMA) || !defined(CONFIG_HAVE_MEMORYLESS_NODES) |
#ifndef set_numa_mem |
#define set_numa_mem(node) |
#endif |
#ifndef set_cpu_numa_mem |
#define set_cpu_numa_mem(cpu, node) |
#endif |
#endif /* !CONFIG_NUMA || !CONFIG_HAVE_MEMORYLESS_NODES */ |
#endif /* _ASM_GENERIC_TOPOLOGY_H */ |
/drivers/include/drm/drm_cache.h |
---|
39,6 → 39,8 |
{ |
#if defined(CONFIG_PPC) && !defined(CONFIG_NOT_COHERENT_CACHE) |
return false; |
#elif defined(CONFIG_MIPS) && defined(CONFIG_CPU_LOONGSON3) |
return false; |
#else |
return true; |
#endif |
/drivers/include/drm/ttm/ttm_bo_api.h |
---|
316,7 → 316,21 |
*/ |
extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy, |
bool interruptible, bool no_wait); |
/** |
* ttm_bo_mem_compat - Check if proposed placement is compatible with a bo |
* |
* @placement: Return immediately if buffer is busy. |
* @mem: The struct ttm_mem_reg indicating the region where the bo resides |
* @new_flags: Describes compatible placement found |
* |
* Returns true if the placement is compatible |
*/ |
extern bool ttm_bo_mem_compat(struct ttm_placement *placement, |
struct ttm_mem_reg *mem, |
uint32_t *new_flags); |
/** |
* ttm_bo_validate |
* |
* @bo: The buffer object. |
/drivers/include/linux/acpi.h |
---|
0,0 → 1,935 |
/* |
* acpi.h - ACPI Interface |
* |
* Copyright (C) 2001 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> |
* |
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
* |
* This program is free software; you can redistribute it and/or modify |
* it under the terms of the GNU General Public License as published by |
* the Free Software Foundation; either version 2 of the License, or |
* (at your option) any later version. |
* |
* This program is distributed in the hope that it will be useful, |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* GNU General Public License for more details. |
* |
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
*/ |
#ifndef _LINUX_ACPI_H |
#define _LINUX_ACPI_H |
#include <linux/errno.h> |
#include <linux/ioport.h> /* for struct resource */ |
#include <linux/resource_ext.h> |
#include <linux/device.h> |
#include <linux/property.h> |
#ifndef _LINUX |
#define _LINUX |
#endif |
#include <acpi/acpi.h> |
#ifdef CONFIG_ACPI |
#include <linux/list.h> |
#include <linux/mod_devicetable.h> |
#include <linux/dynamic_debug.h> |
#include <acpi/acpi_bus.h> |
#include <acpi/acpi_drivers.h> |
#include <acpi/acpi_numa.h> |
#include <acpi/acpi_io.h> |
#include <asm/acpi.h> |
static inline acpi_handle acpi_device_handle(struct acpi_device *adev) |
{ |
return adev ? adev->handle : NULL; |
} |
#define ACPI_COMPANION(dev) to_acpi_device_node((dev)->fwnode) |
#define ACPI_COMPANION_SET(dev, adev) set_primary_fwnode(dev, (adev) ? \ |
acpi_fwnode_handle(adev) : NULL) |
#define ACPI_HANDLE(dev) acpi_device_handle(ACPI_COMPANION(dev)) |
/** |
* ACPI_DEVICE_CLASS - macro used to describe an ACPI device with |
* the PCI-defined class-code information |
* |
* @_cls : the class, subclass, prog-if triple for this device |
* @_msk : the class mask for this device |
* |
* This macro is used to create a struct acpi_device_id that matches a |
* specific PCI class. The .id and .driver_data fields will be left |
* initialized with the default value. |
*/ |
#define ACPI_DEVICE_CLASS(_cls, _msk) .cls = (_cls), .cls_msk = (_msk), |
//static inline bool has_acpi_companion(struct device *dev) |
//{ |
// return is_acpi_device_node(dev->fwnode); |
//} |
//static inline void acpi_preset_companion(struct device *dev, |
// struct acpi_device *parent, u64 addr) |
//{ |
// ACPI_COMPANION_SET(dev, acpi_find_child_device(parent, addr, NULL)); |
//} |
static inline const char *acpi_dev_name(struct acpi_device *adev) |
{ |
return dev_name(&adev->dev); |
} |
enum acpi_irq_model_id { |
ACPI_IRQ_MODEL_PIC = 0, |
ACPI_IRQ_MODEL_IOAPIC, |
ACPI_IRQ_MODEL_IOSAPIC, |
ACPI_IRQ_MODEL_PLATFORM, |
ACPI_IRQ_MODEL_GIC, |
ACPI_IRQ_MODEL_COUNT |
}; |
extern enum acpi_irq_model_id acpi_irq_model; |
enum acpi_interrupt_id { |
ACPI_INTERRUPT_PMI = 1, |
ACPI_INTERRUPT_INIT, |
ACPI_INTERRUPT_CPEI, |
ACPI_INTERRUPT_COUNT |
}; |
#define ACPI_SPACE_MEM 0 |
enum acpi_address_range_id { |
ACPI_ADDRESS_RANGE_MEMORY = 1, |
ACPI_ADDRESS_RANGE_RESERVED = 2, |
ACPI_ADDRESS_RANGE_ACPI = 3, |
ACPI_ADDRESS_RANGE_NVS = 4, |
ACPI_ADDRESS_RANGE_COUNT |
}; |
/* Table Handlers */ |
typedef int (*acpi_tbl_table_handler)(struct acpi_table_header *table); |
typedef int (*acpi_tbl_entry_handler)(struct acpi_subtable_header *header, |
const unsigned long end); |
#ifdef CONFIG_ACPI_INITRD_TABLE_OVERRIDE |
void acpi_initrd_override(void *data, size_t size); |
#else |
static inline void acpi_initrd_override(void *data, size_t size) |
{ |
} |
#endif |
#define BAD_MADT_ENTRY(entry, end) ( \ |
(!entry) || (unsigned long)entry + sizeof(*entry) > end || \ |
((struct acpi_subtable_header *)entry)->length < sizeof(*entry)) |
struct acpi_subtable_proc { |
int id; |
acpi_tbl_entry_handler handler; |
int count; |
}; |
char * __acpi_map_table (unsigned long phys_addr, unsigned long size); |
void __acpi_unmap_table(char *map, unsigned long size); |
int early_acpi_boot_init(void); |
int acpi_boot_init (void); |
void acpi_boot_table_init (void); |
int acpi_mps_check (void); |
int acpi_numa_init (void); |
int acpi_table_init (void); |
int acpi_table_parse(char *id, acpi_tbl_table_handler handler); |
int __init acpi_parse_entries(char *id, unsigned long table_size, |
acpi_tbl_entry_handler handler, |
struct acpi_table_header *table_header, |
int entry_id, unsigned int max_entries); |
int __init acpi_table_parse_entries(char *id, unsigned long table_size, |
int entry_id, |
acpi_tbl_entry_handler handler, |
unsigned int max_entries); |
int __init acpi_table_parse_entries(char *id, unsigned long table_size, |
int entry_id, |
acpi_tbl_entry_handler handler, |
unsigned int max_entries); |
int __init acpi_table_parse_entries_array(char *id, unsigned long table_size, |
struct acpi_subtable_proc *proc, int proc_num, |
unsigned int max_entries); |
int acpi_table_parse_madt(enum acpi_madt_type id, |
acpi_tbl_entry_handler handler, |
unsigned int max_entries); |
int acpi_parse_mcfg (struct acpi_table_header *header); |
void acpi_table_print_madt_entry (struct acpi_subtable_header *madt); |
/* the following four functions are architecture-dependent */ |
void acpi_numa_slit_init (struct acpi_table_slit *slit); |
void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa); |
void acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa); |
int acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma); |
void acpi_numa_arch_fixup(void); |
#ifndef PHYS_CPUID_INVALID |
typedef u32 phys_cpuid_t; |
#define PHYS_CPUID_INVALID (phys_cpuid_t)(-1) |
#endif |
static inline bool invalid_logical_cpuid(u32 cpuid) |
{ |
return (int)cpuid < 0; |
} |
static inline bool invalid_phys_cpuid(phys_cpuid_t phys_id) |
{ |
return phys_id == PHYS_CPUID_INVALID; |
} |
#ifdef CONFIG_ACPI_HOTPLUG_CPU |
/* Arch dependent functions for cpu hotplug support */ |
int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, int *pcpu); |
int acpi_unmap_cpu(int cpu); |
#endif /* CONFIG_ACPI_HOTPLUG_CPU */ |
#ifdef CONFIG_ACPI_HOTPLUG_IOAPIC |
int acpi_get_ioapic_id(acpi_handle handle, u32 gsi_base, u64 *phys_addr); |
#endif |
int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base); |
int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base); |
int acpi_ioapic_registered(acpi_handle handle, u32 gsi_base); |
void acpi_irq_stats_init(void); |
extern u32 acpi_irq_handled; |
extern u32 acpi_irq_not_handled; |
extern unsigned int acpi_sci_irq; |
#define INVALID_ACPI_IRQ ((unsigned)-1) |
static inline bool acpi_sci_irq_valid(void) |
{ |
return acpi_sci_irq != INVALID_ACPI_IRQ; |
} |
extern int sbf_port; |
extern unsigned long acpi_realmode_flags; |
int acpi_register_gsi (struct device *dev, u32 gsi, int triggering, int polarity); |
int acpi_gsi_to_irq (u32 gsi, unsigned int *irq); |
int acpi_isa_irq_to_gsi (unsigned isa_irq, u32 *gsi); |
void acpi_set_irq_model(enum acpi_irq_model_id model, |
struct fwnode_handle *fwnode); |
#ifdef CONFIG_X86_IO_APIC |
extern int acpi_get_override_irq(u32 gsi, int *trigger, int *polarity); |
#else |
#define acpi_get_override_irq(gsi, trigger, polarity) (-1) |
#endif |
/* |
* This function undoes the effect of one call to acpi_register_gsi(). |
* If this matches the last registration, any IRQ resources for gsi |
* are freed. |
*/ |
void acpi_unregister_gsi (u32 gsi); |
struct pci_dev; |
int acpi_pci_irq_enable (struct pci_dev *dev); |
void acpi_penalize_isa_irq(int irq, int active); |
bool acpi_isa_irq_available(int irq); |
void acpi_penalize_sci_irq(int irq, int trigger, int polarity); |
void acpi_pci_irq_disable (struct pci_dev *dev); |
extern int ec_read(u8 addr, u8 *val); |
extern int ec_write(u8 addr, u8 val); |
extern int ec_transaction(u8 command, |
const u8 *wdata, unsigned wdata_len, |
u8 *rdata, unsigned rdata_len); |
extern acpi_handle ec_get_handle(void); |
extern bool acpi_is_pnp_device(struct acpi_device *); |
#if defined(CONFIG_ACPI_WMI) || defined(CONFIG_ACPI_WMI_MODULE) |
typedef void (*wmi_notify_handler) (u32 value, void *context); |
extern acpi_status wmi_evaluate_method(const char *guid, u8 instance, |
u32 method_id, |
const struct acpi_buffer *in, |
struct acpi_buffer *out); |
extern acpi_status wmi_query_block(const char *guid, u8 instance, |
struct acpi_buffer *out); |
extern acpi_status wmi_set_block(const char *guid, u8 instance, |
const struct acpi_buffer *in); |
extern acpi_status wmi_install_notify_handler(const char *guid, |
wmi_notify_handler handler, void *data); |
extern acpi_status wmi_remove_notify_handler(const char *guid); |
extern acpi_status wmi_get_event_data(u32 event, struct acpi_buffer *out); |
extern bool wmi_has_guid(const char *guid); |
#endif /* CONFIG_ACPI_WMI */ |
#define ACPI_VIDEO_OUTPUT_SWITCHING 0x0001 |
#define ACPI_VIDEO_DEVICE_POSTING 0x0002 |
#define ACPI_VIDEO_ROM_AVAILABLE 0x0004 |
#define ACPI_VIDEO_BACKLIGHT 0x0008 |
#define ACPI_VIDEO_BACKLIGHT_FORCE_VENDOR 0x0010 |
#define ACPI_VIDEO_BACKLIGHT_FORCE_VIDEO 0x0020 |
#define ACPI_VIDEO_OUTPUT_SWITCHING_FORCE_VENDOR 0x0040 |
#define ACPI_VIDEO_OUTPUT_SWITCHING_FORCE_VIDEO 0x0080 |
#define ACPI_VIDEO_BACKLIGHT_DMI_VENDOR 0x0100 |
#define ACPI_VIDEO_BACKLIGHT_DMI_VIDEO 0x0200 |
#define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VENDOR 0x0400 |
#define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VIDEO 0x0800 |
extern char acpi_video_backlight_string[]; |
extern long acpi_is_video_device(acpi_handle handle); |
extern int acpi_blacklisted(void); |
extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d); |
extern void acpi_osi_setup(char *str); |
extern bool acpi_osi_is_win8(void); |
#ifdef CONFIG_ACPI_NUMA |
int acpi_map_pxm_to_online_node(int pxm); |
int acpi_get_node(acpi_handle handle); |
#else |
static inline int acpi_map_pxm_to_online_node(int pxm) |
{ |
return 0; |
} |
static inline int acpi_get_node(acpi_handle handle) |
{ |
return 0; |
} |
#endif |
extern int acpi_paddr_to_node(u64 start_addr, u64 size); |
extern int pnpacpi_disabled; |
#define PXM_INVAL (-1) |
bool acpi_dev_resource_memory(struct acpi_resource *ares, struct resource *res); |
bool acpi_dev_resource_io(struct acpi_resource *ares, struct resource *res); |
bool acpi_dev_resource_address_space(struct acpi_resource *ares, |
struct resource_win *win); |
bool acpi_dev_resource_ext_address_space(struct acpi_resource *ares, |
struct resource_win *win); |
unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable); |
bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index, |
struct resource *res); |
void acpi_dev_free_resource_list(struct list_head *list); |
int acpi_dev_get_resources(struct acpi_device *adev, struct list_head *list, |
int (*preproc)(struct acpi_resource *, void *), |
void *preproc_data); |
int acpi_dev_filter_resource_type(struct acpi_resource *ares, |
unsigned long types); |
static inline int acpi_dev_filter_resource_type_cb(struct acpi_resource *ares, |
void *arg) |
{ |
return acpi_dev_filter_resource_type(ares, (unsigned long)arg); |
} |
int acpi_check_resource_conflict(const struct resource *res); |
int acpi_check_region(resource_size_t start, resource_size_t n, |
const char *name); |
int acpi_resources_are_enforced(void); |
#ifdef CONFIG_HIBERNATION |
void __init acpi_no_s4_hw_signature(void); |
#endif |
#ifdef CONFIG_PM_SLEEP |
void __init acpi_old_suspend_ordering(void); |
void __init acpi_nvs_nosave(void); |
void __init acpi_nvs_nosave_s3(void); |
#endif /* CONFIG_PM_SLEEP */ |
struct acpi_osc_context { |
char *uuid_str; /* UUID string */ |
int rev; |
struct acpi_buffer cap; /* list of DWORD capabilities */ |
struct acpi_buffer ret; /* free by caller if success */ |
}; |
acpi_status acpi_str_to_uuid(char *str, u8 *uuid); |
acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context); |
/* Indexes into _OSC Capabilities Buffer (DWORDs 2 & 3 are device-specific) */ |
#define OSC_QUERY_DWORD 0 /* DWORD 1 */ |
#define OSC_SUPPORT_DWORD 1 /* DWORD 2 */ |
#define OSC_CONTROL_DWORD 2 /* DWORD 3 */ |
/* _OSC Capabilities DWORD 1: Query/Control and Error Returns (generic) */ |
#define OSC_QUERY_ENABLE 0x00000001 /* input */ |
#define OSC_REQUEST_ERROR 0x00000002 /* return */ |
#define OSC_INVALID_UUID_ERROR 0x00000004 /* return */ |
#define OSC_INVALID_REVISION_ERROR 0x00000008 /* return */ |
#define OSC_CAPABILITIES_MASK_ERROR 0x00000010 /* return */ |
/* Platform-Wide Capabilities _OSC: Capabilities DWORD 2: Support Field */ |
#define OSC_SB_PAD_SUPPORT 0x00000001 |
#define OSC_SB_PPC_OST_SUPPORT 0x00000002 |
#define OSC_SB_PR3_SUPPORT 0x00000004 |
#define OSC_SB_HOTPLUG_OST_SUPPORT 0x00000008 |
#define OSC_SB_APEI_SUPPORT 0x00000010 |
#define OSC_SB_CPC_SUPPORT 0x00000020 |
extern bool osc_sb_apei_support_acked; |
/* PCI Host Bridge _OSC: Capabilities DWORD 2: Support Field */ |
#define OSC_PCI_EXT_CONFIG_SUPPORT 0x00000001 |
#define OSC_PCI_ASPM_SUPPORT 0x00000002 |
#define OSC_PCI_CLOCK_PM_SUPPORT 0x00000004 |
#define OSC_PCI_SEGMENT_GROUPS_SUPPORT 0x00000008 |
#define OSC_PCI_MSI_SUPPORT 0x00000010 |
#define OSC_PCI_SUPPORT_MASKS 0x0000001f |
/* PCI Host Bridge _OSC: Capabilities DWORD 3: Control Field */ |
#define OSC_PCI_EXPRESS_NATIVE_HP_CONTROL 0x00000001 |
#define OSC_PCI_SHPC_NATIVE_HP_CONTROL 0x00000002 |
#define OSC_PCI_EXPRESS_PME_CONTROL 0x00000004 |
#define OSC_PCI_EXPRESS_AER_CONTROL 0x00000008 |
#define OSC_PCI_EXPRESS_CAPABILITY_CONTROL 0x00000010 |
#define OSC_PCI_CONTROL_MASKS 0x0000001f |
#define ACPI_GSB_ACCESS_ATTRIB_QUICK 0x00000002 |
#define ACPI_GSB_ACCESS_ATTRIB_SEND_RCV 0x00000004 |
#define ACPI_GSB_ACCESS_ATTRIB_BYTE 0x00000006 |
#define ACPI_GSB_ACCESS_ATTRIB_WORD 0x00000008 |
#define ACPI_GSB_ACCESS_ATTRIB_BLOCK 0x0000000A |
#define ACPI_GSB_ACCESS_ATTRIB_MULTIBYTE 0x0000000B |
#define ACPI_GSB_ACCESS_ATTRIB_WORD_CALL 0x0000000C |
#define ACPI_GSB_ACCESS_ATTRIB_BLOCK_CALL 0x0000000D |
#define ACPI_GSB_ACCESS_ATTRIB_RAW_BYTES 0x0000000E |
#define ACPI_GSB_ACCESS_ATTRIB_RAW_PROCESS 0x0000000F |
extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, |
u32 *mask, u32 req); |
/* Enable _OST when all relevant hotplug operations are enabled */ |
#if defined(CONFIG_ACPI_HOTPLUG_CPU) && \ |
defined(CONFIG_ACPI_HOTPLUG_MEMORY) && \ |
defined(CONFIG_ACPI_CONTAINER) |
#define ACPI_HOTPLUG_OST |
#endif |
/* _OST Source Event Code (OSPM Action) */ |
#define ACPI_OST_EC_OSPM_SHUTDOWN 0x100 |
#define ACPI_OST_EC_OSPM_EJECT 0x103 |
#define ACPI_OST_EC_OSPM_INSERTION 0x200 |
/* _OST General Processing Status Code */ |
#define ACPI_OST_SC_SUCCESS 0x0 |
#define ACPI_OST_SC_NON_SPECIFIC_FAILURE 0x1 |
#define ACPI_OST_SC_UNRECOGNIZED_NOTIFY 0x2 |
/* _OST OS Shutdown Processing (0x100) Status Code */ |
#define ACPI_OST_SC_OS_SHUTDOWN_DENIED 0x80 |
#define ACPI_OST_SC_OS_SHUTDOWN_IN_PROGRESS 0x81 |
#define ACPI_OST_SC_OS_SHUTDOWN_COMPLETED 0x82 |
#define ACPI_OST_SC_OS_SHUTDOWN_NOT_SUPPORTED 0x83 |
/* _OST Ejection Request (0x3, 0x103) Status Code */ |
#define ACPI_OST_SC_EJECT_NOT_SUPPORTED 0x80 |
#define ACPI_OST_SC_DEVICE_IN_USE 0x81 |
#define ACPI_OST_SC_DEVICE_BUSY 0x82 |
#define ACPI_OST_SC_EJECT_DEPENDENCY_BUSY 0x83 |
#define ACPI_OST_SC_EJECT_IN_PROGRESS 0x84 |
/* _OST Insertion Request (0x200) Status Code */ |
#define ACPI_OST_SC_INSERT_IN_PROGRESS 0x80 |
#define ACPI_OST_SC_DRIVER_LOAD_FAILURE 0x81 |
#define ACPI_OST_SC_INSERT_NOT_SUPPORTED 0x82 |
extern void acpi_early_init(void); |
extern void acpi_subsystem_init(void); |
extern int acpi_nvs_register(__u64 start, __u64 size); |
extern int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *), |
void *data); |
const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids, |
const struct device *dev); |
extern bool acpi_driver_match_device(struct device *dev, |
const struct device_driver *drv); |
int acpi_device_uevent_modalias(struct device *, struct kobj_uevent_env *); |
int acpi_device_modalias(struct device *, char *, int); |
void acpi_walk_dep_device_list(acpi_handle handle); |
struct platform_device *acpi_create_platform_device(struct acpi_device *); |
#define ACPI_PTR(_ptr) (_ptr) |
#else /* !CONFIG_ACPI */ |
#define acpi_disabled 1 |
#define ACPI_COMPANION(dev) (NULL) |
#define ACPI_COMPANION_SET(dev, adev) do { } while (0) |
#define ACPI_HANDLE(dev) (NULL) |
#define ACPI_DEVICE_CLASS(_cls, _msk) .cls = (0), .cls_msk = (0), |
struct fwnode_handle; |
static inline bool is_acpi_node(struct fwnode_handle *fwnode) |
{ |
return false; |
} |
static inline bool is_acpi_device_node(struct fwnode_handle *fwnode) |
{ |
return false; |
} |
static inline struct acpi_device *to_acpi_device_node(struct fwnode_handle *fwnode) |
{ |
return NULL; |
} |
static inline bool is_acpi_data_node(struct fwnode_handle *fwnode) |
{ |
return false; |
} |
static inline struct acpi_data_node *to_acpi_data_node(struct fwnode_handle *fwnode) |
{ |
return NULL; |
} |
static inline struct fwnode_handle *acpi_fwnode_handle(struct acpi_device *adev) |
{ |
return NULL; |
} |
static inline bool has_acpi_companion(struct device *dev) |
{ |
return false; |
} |
static inline void acpi_preset_companion(struct device *dev, |
struct acpi_device *parent, u64 addr) |
{ |
} |
static inline const char *acpi_dev_name(struct acpi_device *adev) |
{ |
return NULL; |
} |
static inline void acpi_early_init(void) { } |
static inline void acpi_subsystem_init(void) { } |
static inline int early_acpi_boot_init(void) |
{ |
return 0; |
} |
static inline int acpi_boot_init(void) |
{ |
return 0; |
} |
static inline void acpi_boot_table_init(void) |
{ |
return; |
} |
static inline int acpi_mps_check(void) |
{ |
return 0; |
} |
static inline int acpi_check_resource_conflict(struct resource *res) |
{ |
return 0; |
} |
static inline int acpi_check_region(resource_size_t start, resource_size_t n, |
const char *name) |
{ |
return 0; |
} |
struct acpi_table_header; |
static inline int acpi_table_parse(char *id, |
int (*handler)(struct acpi_table_header *)) |
{ |
return -ENODEV; |
} |
static inline int acpi_nvs_register(__u64 start, __u64 size) |
{ |
return 0; |
} |
static inline int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *), |
void *data) |
{ |
return 0; |
} |
struct acpi_device_id; |
static inline const struct acpi_device_id *acpi_match_device( |
const struct acpi_device_id *ids, const struct device *dev) |
{ |
return NULL; |
} |
static inline bool acpi_driver_match_device(struct device *dev, |
const struct device_driver *drv) |
{ |
return false; |
} |
static inline int acpi_device_uevent_modalias(struct device *dev, |
struct kobj_uevent_env *env) |
{ |
return -ENODEV; |
} |
static inline int acpi_device_modalias(struct device *dev, |
char *buf, int size) |
{ |
return -ENODEV; |
} |
static inline bool acpi_dma_supported(struct acpi_device *adev) |
{ |
return false; |
} |
static inline enum dev_dma_attr acpi_get_dma_attr(struct acpi_device *adev) |
{ |
return DEV_DMA_NOT_SUPPORTED; |
} |
#define ACPI_PTR(_ptr) (NULL) |
#endif /* !CONFIG_ACPI */ |
#ifdef CONFIG_ACPI |
void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, |
u32 pm1a_ctrl, u32 pm1b_ctrl)); |
acpi_status acpi_os_prepare_sleep(u8 sleep_state, |
u32 pm1a_control, u32 pm1b_control); |
void acpi_os_set_prepare_extended_sleep(int (*func)(u8 sleep_state, |
u32 val_a, u32 val_b)); |
acpi_status acpi_os_prepare_extended_sleep(u8 sleep_state, |
u32 val_a, u32 val_b); |
#ifdef CONFIG_X86 |
void arch_reserve_mem_area(acpi_physical_address addr, size_t size); |
#else |
static inline void arch_reserve_mem_area(acpi_physical_address addr, |
size_t size) |
{ |
} |
#endif /* CONFIG_X86 */ |
#else |
#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0) |
#endif |
#if defined(CONFIG_ACPI) && defined(CONFIG_PM) |
int acpi_dev_runtime_suspend(struct device *dev); |
int acpi_dev_runtime_resume(struct device *dev); |
int acpi_subsys_runtime_suspend(struct device *dev); |
int acpi_subsys_runtime_resume(struct device *dev); |
struct acpi_device *acpi_dev_pm_get_node(struct device *dev); |
int acpi_dev_pm_attach(struct device *dev, bool power_on); |
#else |
static inline int acpi_dev_runtime_suspend(struct device *dev) { return 0; } |
static inline int acpi_dev_runtime_resume(struct device *dev) { return 0; } |
static inline int acpi_subsys_runtime_suspend(struct device *dev) { return 0; } |
static inline int acpi_subsys_runtime_resume(struct device *dev) { return 0; } |
static inline struct acpi_device *acpi_dev_pm_get_node(struct device *dev) |
{ |
return NULL; |
} |
static inline int acpi_dev_pm_attach(struct device *dev, bool power_on) |
{ |
return -ENODEV; |
} |
#endif |
#if defined(CONFIG_ACPI) && defined(CONFIG_PM_SLEEP) |
int acpi_dev_suspend_late(struct device *dev); |
int acpi_dev_resume_early(struct device *dev); |
int acpi_subsys_prepare(struct device *dev); |
void acpi_subsys_complete(struct device *dev); |
int acpi_subsys_suspend_late(struct device *dev); |
int acpi_subsys_resume_early(struct device *dev); |
int acpi_subsys_suspend(struct device *dev); |
int acpi_subsys_freeze(struct device *dev); |
#else |
static inline int acpi_dev_suspend_late(struct device *dev) { return 0; } |
static inline int acpi_dev_resume_early(struct device *dev) { return 0; } |
static inline int acpi_subsys_prepare(struct device *dev) { return 0; } |
static inline void acpi_subsys_complete(struct device *dev) {} |
static inline int acpi_subsys_suspend_late(struct device *dev) { return 0; } |
static inline int acpi_subsys_resume_early(struct device *dev) { return 0; } |
static inline int acpi_subsys_suspend(struct device *dev) { return 0; } |
static inline int acpi_subsys_freeze(struct device *dev) { return 0; } |
#endif |
#ifdef CONFIG_ACPI |
__printf(3, 4) |
void acpi_handle_printk(const char *level, acpi_handle handle, |
const char *fmt, ...); |
#else /* !CONFIG_ACPI */ |
static inline __printf(3, 4) void |
acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {} |
#endif /* !CONFIG_ACPI */ |
#if defined(CONFIG_ACPI) && defined(CONFIG_DYNAMIC_DEBUG) |
__printf(3, 4) |
void __acpi_handle_debug(struct _ddebug *descriptor, acpi_handle handle, const char *fmt, ...); |
#else |
#define __acpi_handle_debug(descriptor, handle, fmt, ...) \ |
acpi_handle_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__); |
#endif |
/* |
* acpi_handle_<level>: Print message with ACPI prefix and object path |
* |
* These interfaces acquire the global namespace mutex to obtain an object |
* path. In interrupt context, it shows the object path as <n/a>. |
*/ |
#define acpi_handle_emerg(handle, fmt, ...) \ |
acpi_handle_printk(KERN_EMERG, handle, fmt, ##__VA_ARGS__) |
#define acpi_handle_alert(handle, fmt, ...) \ |
acpi_handle_printk(KERN_ALERT, handle, fmt, ##__VA_ARGS__) |
#define acpi_handle_crit(handle, fmt, ...) \ |
acpi_handle_printk(KERN_CRIT, handle, fmt, ##__VA_ARGS__) |
#define acpi_handle_err(handle, fmt, ...) \ |
acpi_handle_printk(KERN_ERR, handle, fmt, ##__VA_ARGS__) |
#define acpi_handle_warn(handle, fmt, ...) \ |
acpi_handle_printk(KERN_WARNING, handle, fmt, ##__VA_ARGS__) |
#define acpi_handle_notice(handle, fmt, ...) \ |
acpi_handle_printk(KERN_NOTICE, handle, fmt, ##__VA_ARGS__) |
#define acpi_handle_info(handle, fmt, ...) \ |
acpi_handle_printk(KERN_INFO, handle, fmt, ##__VA_ARGS__) |
#if defined(DEBUG) |
#define acpi_handle_debug(handle, fmt, ...) \ |
acpi_handle_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__) |
#else |
#if defined(CONFIG_DYNAMIC_DEBUG) |
#define acpi_handle_debug(handle, fmt, ...) \ |
do { \ |
DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ |
if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \ |
__acpi_handle_debug(&descriptor, handle, pr_fmt(fmt), \ |
##__VA_ARGS__); \ |
} while (0) |
#else |
#define acpi_handle_debug(handle, fmt, ...) \ |
({ \ |
if (0) \ |
acpi_handle_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__); \ |
0; \ |
}) |
#endif |
#endif |
struct acpi_gpio_params { |
unsigned int crs_entry_index; |
unsigned int line_index; |
bool active_low; |
}; |
struct acpi_gpio_mapping { |
const char *name; |
const struct acpi_gpio_params *data; |
unsigned int size; |
}; |
#if defined(CONFIG_ACPI) && defined(CONFIG_GPIOLIB) |
int acpi_dev_add_driver_gpios(struct acpi_device *adev, |
const struct acpi_gpio_mapping *gpios); |
static inline void acpi_dev_remove_driver_gpios(struct acpi_device *adev) |
{ |
if (adev) |
adev->driver_gpios = NULL; |
} |
int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index); |
#else |
static inline int acpi_dev_add_driver_gpios(struct acpi_device *adev, |
const struct acpi_gpio_mapping *gpios) |
{ |
return -ENXIO; |
} |
static inline void acpi_dev_remove_driver_gpios(struct acpi_device *adev) {} |
static inline int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index) |
{ |
return -ENXIO; |
} |
#endif |
/* Device properties */ |
#define MAX_ACPI_REFERENCE_ARGS 8 |
struct acpi_reference_args { |
struct acpi_device *adev; |
size_t nargs; |
u64 args[MAX_ACPI_REFERENCE_ARGS]; |
}; |
#ifdef CONFIG_ACPI |
int acpi_dev_get_property(struct acpi_device *adev, const char *name, |
acpi_object_type type, const union acpi_object **obj); |
int acpi_node_get_property_reference(struct fwnode_handle *fwnode, |
const char *name, size_t index, |
struct acpi_reference_args *args); |
int acpi_node_prop_get(struct fwnode_handle *fwnode, const char *propname, |
void **valptr); |
int acpi_dev_prop_read_single(struct acpi_device *adev, const char *propname, |
enum dev_prop_type proptype, void *val); |
int acpi_node_prop_read(struct fwnode_handle *fwnode, const char *propname, |
enum dev_prop_type proptype, void *val, size_t nval); |
int acpi_dev_prop_read(struct acpi_device *adev, const char *propname, |
enum dev_prop_type proptype, void *val, size_t nval); |
struct fwnode_handle *acpi_get_next_subnode(struct device *dev, |
struct fwnode_handle *subnode); |
struct acpi_probe_entry; |
typedef bool (*acpi_probe_entry_validate_subtbl)(struct acpi_subtable_header *, |
struct acpi_probe_entry *); |
#define ACPI_TABLE_ID_LEN 5 |
/** |
* struct acpi_probe_entry - boot-time probing entry |
* @id: ACPI table name |
* @type: Optional subtable type to match |
* (if @id contains subtables) |
* @subtable_valid: Optional callback to check the validity of |
* the subtable |
* @probe_table: Callback to the driver being probed when table |
* match is successful |
* @probe_subtbl: Callback to the driver being probed when table and |
* subtable match (and optional callback is successful) |
* @driver_data: Sideband data provided back to the driver |
*/ |
struct acpi_probe_entry { |
__u8 id[ACPI_TABLE_ID_LEN]; |
__u8 type; |
acpi_probe_entry_validate_subtbl subtable_valid; |
union { |
acpi_tbl_table_handler probe_table; |
acpi_tbl_entry_handler probe_subtbl; |
}; |
kernel_ulong_t driver_data; |
}; |
#define ACPI_DECLARE_PROBE_ENTRY(table, name, table_id, subtable, valid, data, fn) \ |
static const struct acpi_probe_entry __acpi_probe_##name \ |
__used __section(__##table##_acpi_probe_table) \ |
= { \ |
.id = table_id, \ |
.type = subtable, \ |
.subtable_valid = valid, \ |
.probe_table = (acpi_tbl_table_handler)fn, \ |
.driver_data = data, \ |
} |
#define ACPI_PROBE_TABLE(name) __##name##_acpi_probe_table |
#define ACPI_PROBE_TABLE_END(name) __##name##_acpi_probe_table_end |
int __acpi_probe_device_table(struct acpi_probe_entry *start, int nr); |
#define acpi_probe_device_table(t) \ |
({ \ |
extern struct acpi_probe_entry ACPI_PROBE_TABLE(t), \ |
ACPI_PROBE_TABLE_END(t); \ |
__acpi_probe_device_table(&ACPI_PROBE_TABLE(t), \ |
(&ACPI_PROBE_TABLE_END(t) - \ |
&ACPI_PROBE_TABLE(t))); \ |
}) |
#else |
static inline int acpi_dev_get_property(struct acpi_device *adev, |
const char *name, acpi_object_type type, |
const union acpi_object **obj) |
{ |
return -ENXIO; |
} |
static inline int acpi_node_get_property_reference(struct fwnode_handle *fwnode, |
const char *name, size_t index, |
struct acpi_reference_args *args) |
{ |
return -ENXIO; |
} |
static inline int acpi_node_prop_get(struct fwnode_handle *fwnode, |
const char *propname, |
void **valptr) |
{ |
return -ENXIO; |
} |
static inline int acpi_dev_prop_get(struct acpi_device *adev, |
const char *propname, |
void **valptr) |
{ |
return -ENXIO; |
} |
static inline int acpi_dev_prop_read_single(struct acpi_device *adev, |
const char *propname, |
enum dev_prop_type proptype, |
void *val) |
{ |
return -ENXIO; |
} |
static inline int acpi_node_prop_read(struct fwnode_handle *fwnode, |
const char *propname, |
enum dev_prop_type proptype, |
void *val, size_t nval) |
{ |
return -ENXIO; |
} |
static inline int acpi_dev_prop_read(struct acpi_device *adev, |
const char *propname, |
enum dev_prop_type proptype, |
void *val, size_t nval) |
{ |
return -ENXIO; |
} |
static inline struct fwnode_handle *acpi_get_next_subnode(struct device *dev, |
struct fwnode_handle *subnode) |
{ |
return NULL; |
} |
#define ACPI_DECLARE_PROBE_ENTRY(table, name, table_id, subtable, valid, data, fn) \ |
static const void * __acpi_table_##name[] \ |
__attribute__((unused)) \ |
= { (void *) table_id, \ |
(void *) subtable, \ |
(void *) valid, \ |
(void *) fn, \ |
(void *) data } |
#define acpi_probe_device_table(t) ({ int __r = 0; __r;}) |
#endif |
#endif /*_LINUX_ACPI_H*/ |
/drivers/include/linux/bug.h |
---|
3,6 → 3,8 |
#include <linux/compiler.h> |
int printf(const char *fmt, ...); |
#define __WARN() printf("\nWARNING: at %s:%d\n", __FILE__, __LINE__) |
//#define __WARN_printf(arg...) printf("\nWARNING: at %s:%d\n", __FILE__, __LINE__) |
#define __WARN_printf(arg...) do { printf(arg); __WARN(); } while (0) |
/drivers/include/linux/clocksource.h |
---|
0,0 → 1,257 |
/* linux/include/linux/clocksource.h |
* |
* This file contains the structure definitions for clocksources. |
* |
* If you are not a clocksource, or timekeeping code, you should |
* not be including this file! |
*/ |
#ifndef _LINUX_CLOCKSOURCE_H |
#define _LINUX_CLOCKSOURCE_H |
#include <linux/types.h> |
#include <linux/timex.h> |
#include <linux/time.h> |
#include <linux/list.h> |
#include <linux/cache.h> |
#include <linux/init.h> |
#include <asm/div64.h> |
#include <asm/io.h> |
struct clocksource; |
struct module; |
#ifdef CONFIG_ARCH_CLOCKSOURCE_DATA |
#include <asm/clocksource.h> |
#endif |
/** |
* struct clocksource - hardware abstraction for a free running counter |
* Provides mostly state-free accessors to the underlying hardware. |
* This is the structure used for system time. |
* |
* @name: ptr to clocksource name |
* @list: list head for registration |
* @rating: rating value for selection (higher is better) |
* To avoid rating inflation the following |
* list should give you a guide as to how |
* to assign your clocksource a rating |
* 1-99: Unfit for real use |
* Only available for bootup and testing purposes. |
* 100-199: Base level usability. |
* Functional for real use, but not desired. |
* 200-299: Good. |
* A correct and usable clocksource. |
* 300-399: Desired. |
* A reasonably fast and accurate clocksource. |
* 400-499: Perfect |
* The ideal clocksource. A must-use where |
* available. |
* @read: returns a cycle value, passes clocksource as argument |
* @enable: optional function to enable the clocksource |
* @disable: optional function to disable the clocksource |
* @mask: bitmask for two's complement |
* subtraction of non 64 bit counters |
* @mult: cycle to nanosecond multiplier |
* @shift: cycle to nanosecond divisor (power of two) |
* @max_idle_ns: max idle time permitted by the clocksource (nsecs) |
* @maxadj: maximum adjustment value to mult (~11%) |
* @max_cycles: maximum safe cycle value which won't overflow on multiplication |
* @flags: flags describing special properties |
* @archdata: arch-specific data |
* @suspend: suspend function for the clocksource, if necessary |
* @resume: resume function for the clocksource, if necessary |
* @owner: module reference, must be set by clocksource in modules |
*/ |
struct clocksource { |
/* |
* Hotpath data, fits in a single cache line when the |
* clocksource itself is cacheline aligned. |
*/ |
cycle_t (*read)(struct clocksource *cs); |
cycle_t mask; |
u32 mult; |
u32 shift; |
u64 max_idle_ns; |
u32 maxadj; |
#ifdef CONFIG_ARCH_CLOCKSOURCE_DATA |
struct arch_clocksource_data archdata; |
#endif |
u64 max_cycles; |
const char *name; |
struct list_head list; |
int rating; |
int (*enable)(struct clocksource *cs); |
void (*disable)(struct clocksource *cs); |
unsigned long flags; |
void (*suspend)(struct clocksource *cs); |
void (*resume)(struct clocksource *cs); |
/* private: */ |
#ifdef CONFIG_CLOCKSOURCE_WATCHDOG |
/* Watchdog related data, used by the framework */ |
struct list_head wd_list; |
cycle_t cs_last; |
cycle_t wd_last; |
#endif |
struct module *owner; |
} ____cacheline_aligned; |
/* |
* Clock source flags bits:: |
*/ |
#define CLOCK_SOURCE_IS_CONTINUOUS 0x01 |
#define CLOCK_SOURCE_MUST_VERIFY 0x02 |
#define CLOCK_SOURCE_WATCHDOG 0x10 |
#define CLOCK_SOURCE_VALID_FOR_HRES 0x20 |
#define CLOCK_SOURCE_UNSTABLE 0x40 |
#define CLOCK_SOURCE_SUSPEND_NONSTOP 0x80 |
#define CLOCK_SOURCE_RESELECT 0x100 |
/* simplify initialization of mask field */ |
#define CLOCKSOURCE_MASK(bits) (cycle_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1) |
/** |
* clocksource_khz2mult - calculates mult from khz and shift |
* @khz: Clocksource frequency in KHz |
* @shift_constant: Clocksource shift factor |
* |
* Helper functions that converts a khz counter frequency to a timsource |
* multiplier, given the clocksource shift value |
*/ |
static inline u32 clocksource_khz2mult(u32 khz, u32 shift_constant) |
{ |
/* khz = cyc/(Million ns) |
* mult/2^shift = ns/cyc |
* mult = ns/cyc * 2^shift |
* mult = 1Million/khz * 2^shift |
* mult = 1000000 * 2^shift / khz |
* mult = (1000000<<shift) / khz |
*/ |
u64 tmp = ((u64)1000000) << shift_constant; |
tmp += khz/2; /* round for do_div */ |
do_div(tmp, khz); |
return (u32)tmp; |
} |
/** |
* clocksource_hz2mult - calculates mult from hz and shift |
* @hz: Clocksource frequency in Hz |
* @shift_constant: Clocksource shift factor |
* |
* Helper functions that converts a hz counter |
* frequency to a timsource multiplier, given the |
* clocksource shift value |
*/ |
static inline u32 clocksource_hz2mult(u32 hz, u32 shift_constant) |
{ |
/* hz = cyc/(Billion ns) |
* mult/2^shift = ns/cyc |
* mult = ns/cyc * 2^shift |
* mult = 1Billion/hz * 2^shift |
* mult = 1000000000 * 2^shift / hz |
* mult = (1000000000<<shift) / hz |
*/ |
u64 tmp = ((u64)1000000000) << shift_constant; |
tmp += hz/2; /* round for do_div */ |
do_div(tmp, hz); |
return (u32)tmp; |
} |
/** |
* clocksource_cyc2ns - converts clocksource cycles to nanoseconds |
* @cycles: cycles |
* @mult: cycle to nanosecond multiplier |
* @shift: cycle to nanosecond divisor (power of two) |
* |
* Converts cycles to nanoseconds, using the given mult and shift. |
* |
* XXX - This could use some mult_lxl_ll() asm optimization |
*/ |
static inline s64 clocksource_cyc2ns(cycle_t cycles, u32 mult, u32 shift) |
{ |
return ((u64) cycles * mult) >> shift; |
} |
extern int clocksource_unregister(struct clocksource*); |
extern void clocksource_touch_watchdog(void); |
extern void clocksource_change_rating(struct clocksource *cs, int rating); |
extern void clocksource_suspend(void); |
extern void clocksource_resume(void); |
extern struct clocksource * __init clocksource_default_clock(void); |
extern void clocksource_mark_unstable(struct clocksource *cs); |
extern u64 |
clocks_calc_max_nsecs(u32 mult, u32 shift, u32 maxadj, u64 mask, u64 *max_cycles); |
extern void |
clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec); |
/* |
* Don't call __clocksource_register_scale directly, use |
* clocksource_register_hz/khz |
*/ |
extern int |
__clocksource_register_scale(struct clocksource *cs, u32 scale, u32 freq); |
extern void |
__clocksource_update_freq_scale(struct clocksource *cs, u32 scale, u32 freq); |
/* |
* Don't call this unless you are a default clocksource |
* (AKA: jiffies) and absolutely have to. |
*/ |
static inline int __clocksource_register(struct clocksource *cs) |
{ |
return __clocksource_register_scale(cs, 1, 0); |
} |
static inline int clocksource_register_hz(struct clocksource *cs, u32 hz) |
{ |
return __clocksource_register_scale(cs, 1, hz); |
} |
static inline int clocksource_register_khz(struct clocksource *cs, u32 khz) |
{ |
return __clocksource_register_scale(cs, 1000, khz); |
} |
static inline void __clocksource_update_freq_hz(struct clocksource *cs, u32 hz) |
{ |
__clocksource_update_freq_scale(cs, 1, hz); |
} |
static inline void __clocksource_update_freq_khz(struct clocksource *cs, u32 khz) |
{ |
__clocksource_update_freq_scale(cs, 1000, khz); |
} |
extern int timekeeping_notify(struct clocksource *clock); |
extern cycle_t clocksource_mmio_readl_up(struct clocksource *); |
extern cycle_t clocksource_mmio_readl_down(struct clocksource *); |
extern cycle_t clocksource_mmio_readw_up(struct clocksource *); |
extern cycle_t clocksource_mmio_readw_down(struct clocksource *); |
extern int clocksource_mmio_init(void __iomem *, const char *, |
unsigned long, int, unsigned, cycle_t (*)(struct clocksource *)); |
extern int clocksource_i8253_init(void); |
#define CLOCKSOURCE_OF_DECLARE(name, compat, fn) \ |
OF_DECLARE_1(clksrc, name, compat, fn) |
#ifdef CONFIG_CLKSRC_PROBE |
extern void clocksource_probe(void); |
#else |
static inline void clocksource_probe(void) {} |
#endif |
#define CLOCKSOURCE_ACPI_DECLARE(name, table_id, fn) \ |
ACPI_DECLARE_PROBE_ENTRY(clksrc, name, table_id, 0, NULL, 0, fn) |
#endif /* _LINUX_CLOCKSOURCE_H */ |
/drivers/include/linux/compiler-gcc.h |
---|
199,7 → 199,7 |
#define unreachable() __builtin_unreachable() |
/* Mark a function definition as prohibited from being cloned. */ |
#define __noclone __attribute__((__noclone__)) |
#define __noclone __attribute__((__noclone__, __optimize__("no-tracer"))) |
#endif /* GCC_VERSION >= 40500 */ |
/drivers/include/linux/dma-mapping.h |
---|
5,6 → 5,7 |
#include <linux/string.h> |
#include <linux/device.h> |
#include <linux/err.h> |
#include <linux/dma-attrs.h> |
#include <linux/dma-direction.h> |
#include <linux/scatterlist.h> |
26,6 → 27,12 |
{ |
return dev->dma_mask != NULL && *dev->dma_mask != DMA_MASK_NONE; |
} |
#ifdef CONFIG_HAS_DMA |
#include <asm/dma-mapping.h> |
#else |
#include <asm-generic/dma-mapping-broken.h> |
#endif |
#ifndef dma_max_pfn |
static inline unsigned long dma_max_pfn(struct device *dev) |
{ |
/drivers/include/linux/dynamic_debug.h |
---|
0,0 → 1,137 |
#ifndef _DYNAMIC_DEBUG_H |
#define _DYNAMIC_DEBUG_H |
/* |
* An instance of this structure is created in a special |
* ELF section at every dynamic debug callsite. At runtime, |
* the special section is treated as an array of these. |
*/ |
struct _ddebug { |
/* |
* These fields are used to drive the user interface |
* for selecting and displaying debug callsites. |
*/ |
const char *modname; |
const char *function; |
const char *filename; |
const char *format; |
unsigned int lineno:18; |
/* |
* The flags field controls the behaviour at the callsite. |
* The bits here are changed dynamically when the user |
* writes commands to <debugfs>/dynamic_debug/control |
*/ |
#define _DPRINTK_FLAGS_NONE 0 |
#define _DPRINTK_FLAGS_PRINT (1<<0) /* printk() a message using the format */ |
#define _DPRINTK_FLAGS_INCL_MODNAME (1<<1) |
#define _DPRINTK_FLAGS_INCL_FUNCNAME (1<<2) |
#define _DPRINTK_FLAGS_INCL_LINENO (1<<3) |
#define _DPRINTK_FLAGS_INCL_TID (1<<4) |
#if defined DEBUG |
#define _DPRINTK_FLAGS_DEFAULT _DPRINTK_FLAGS_PRINT |
#else |
#define _DPRINTK_FLAGS_DEFAULT 0 |
#endif |
unsigned int flags:8; |
} __attribute__((aligned(8))); |
int ddebug_add_module(struct _ddebug *tab, unsigned int n, |
const char *modname); |
#if defined(CONFIG_DYNAMIC_DEBUG) |
extern int ddebug_remove_module(const char *mod_name); |
extern __printf(2, 3) |
void __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...); |
extern int ddebug_dyndbg_module_param_cb(char *param, char *val, |
const char *modname); |
struct device; |
extern __printf(3, 4) |
void __dynamic_dev_dbg(struct _ddebug *descriptor, const struct device *dev, |
const char *fmt, ...); |
struct net_device; |
extern __printf(3, 4) |
void __dynamic_netdev_dbg(struct _ddebug *descriptor, |
const struct net_device *dev, |
const char *fmt, ...); |
#define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \ |
static struct _ddebug __aligned(8) \ |
__attribute__((section("__verbose"))) name = { \ |
.modname = KBUILD_MODNAME, \ |
.function = __func__, \ |
.filename = __FILE__, \ |
.format = (fmt), \ |
.lineno = __LINE__, \ |
.flags = _DPRINTK_FLAGS_DEFAULT, \ |
} |
#define dynamic_pr_debug(fmt, ...) \ |
do { \ |
DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ |
if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \ |
__dynamic_pr_debug(&descriptor, pr_fmt(fmt), \ |
##__VA_ARGS__); \ |
} while (0) |
#define dynamic_dev_dbg(dev, fmt, ...) \ |
do { \ |
DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ |
if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \ |
__dynamic_dev_dbg(&descriptor, dev, fmt, \ |
##__VA_ARGS__); \ |
} while (0) |
#define dynamic_netdev_dbg(dev, fmt, ...) \ |
do { \ |
DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ |
if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \ |
__dynamic_netdev_dbg(&descriptor, dev, fmt, \ |
##__VA_ARGS__); \ |
} while (0) |
#define dynamic_hex_dump(prefix_str, prefix_type, rowsize, \ |
groupsize, buf, len, ascii) \ |
do { \ |
DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, \ |
__builtin_constant_p(prefix_str) ? prefix_str : "hexdump");\ |
if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \ |
print_hex_dump(KERN_DEBUG, prefix_str, \ |
prefix_type, rowsize, groupsize, \ |
buf, len, ascii); \ |
} while (0) |
#else |
#include <linux/string.h> |
#include <linux/errno.h> |
static inline int ddebug_remove_module(const char *mod) |
{ |
return 0; |
} |
static inline int ddebug_dyndbg_module_param_cb(char *param, char *val, |
const char *modname) |
{ |
if (strstr(param, "dyndbg")) { |
/* avoid pr_warn(), which wants pr_fmt() fully defined */ |
printk(KERN_WARNING "dyndbg param is supported only in " |
"CONFIG_DYNAMIC_DEBUG builds\n"); |
return 0; /* allow and ignore */ |
} |
return -EINVAL; |
} |
#define dynamic_pr_debug(fmt, ...) \ |
do { if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); } while (0) |
#define dynamic_dev_dbg(dev, fmt, ...) \ |
do { if (0) dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); } while (0) |
#endif |
#endif |
/drivers/include/linux/fwnode.h |
---|
0,0 → 1,29 |
/* |
* fwnode.h - Firmware device node object handle type definition. |
* |
* Copyright (C) 2015, Intel Corporation |
* Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com> |
* |
* This program is free software; you can redistribute it and/or modify |
* it under the terms of the GNU General Public License version 2 as |
* published by the Free Software Foundation. |
*/ |
#ifndef _LINUX_FWNODE_H_ |
#define _LINUX_FWNODE_H_ |
enum fwnode_type { |
FWNODE_INVALID = 0, |
FWNODE_OF, |
FWNODE_ACPI, |
FWNODE_ACPI_DATA, |
FWNODE_PDATA, |
FWNODE_IRQCHIP, |
}; |
struct fwnode_handle { |
enum fwnode_type type; |
struct fwnode_handle *secondary; |
}; |
#endif |
/drivers/include/linux/init.h |
---|
1,0 → 0,0 |
//stub |
#ifndef _LINUX_INIT_H |
#define _LINUX_INIT_H |
#include <linux/compiler.h> |
#include <linux/types.h> |
#define __initdata |
#define __initdata |
#define __initconst |
#endif /* _LINUX_INIT_H */ |
/drivers/include/linux/nodemask.h |
---|
0,0 → 1,527 |
#ifndef __LINUX_NODEMASK_H |
#define __LINUX_NODEMASK_H |
/* |
* Nodemasks provide a bitmap suitable for representing the |
* set of Node's in a system, one bit position per Node number. |
* |
* See detailed comments in the file linux/bitmap.h describing the |
* data type on which these nodemasks are based. |
* |
* For details of nodemask_parse_user(), see bitmap_parse_user() in |
* lib/bitmap.c. For details of nodelist_parse(), see bitmap_parselist(), |
* also in bitmap.c. For details of node_remap(), see bitmap_bitremap in |
* lib/bitmap.c. For details of nodes_remap(), see bitmap_remap in |
* lib/bitmap.c. For details of nodes_onto(), see bitmap_onto in |
* lib/bitmap.c. For details of nodes_fold(), see bitmap_fold in |
* lib/bitmap.c. |
* |
* The available nodemask operations are: |
* |
* void node_set(node, mask) turn on bit 'node' in mask |
* void node_clear(node, mask) turn off bit 'node' in mask |
* void nodes_setall(mask) set all bits |
* void nodes_clear(mask) clear all bits |
* int node_isset(node, mask) true iff bit 'node' set in mask |
* int node_test_and_set(node, mask) test and set bit 'node' in mask |
* |
* void nodes_and(dst, src1, src2) dst = src1 & src2 [intersection] |
* void nodes_or(dst, src1, src2) dst = src1 | src2 [union] |
* void nodes_xor(dst, src1, src2) dst = src1 ^ src2 |
* void nodes_andnot(dst, src1, src2) dst = src1 & ~src2 |
* void nodes_complement(dst, src) dst = ~src |
* |
* int nodes_equal(mask1, mask2) Does mask1 == mask2? |
* int nodes_intersects(mask1, mask2) Do mask1 and mask2 intersect? |
* int nodes_subset(mask1, mask2) Is mask1 a subset of mask2? |
* int nodes_empty(mask) Is mask empty (no bits sets)? |
* int nodes_full(mask) Is mask full (all bits sets)? |
* int nodes_weight(mask) Hamming weight - number of set bits |
* |
* void nodes_shift_right(dst, src, n) Shift right |
* void nodes_shift_left(dst, src, n) Shift left |
* |
* int first_node(mask) Number lowest set bit, or MAX_NUMNODES |
* int next_node(node, mask) Next node past 'node', or MAX_NUMNODES |
* int first_unset_node(mask) First node not set in mask, or |
* MAX_NUMNODES. |
* |
* nodemask_t nodemask_of_node(node) Return nodemask with bit 'node' set |
* NODE_MASK_ALL Initializer - all bits set |
* NODE_MASK_NONE Initializer - no bits set |
* unsigned long *nodes_addr(mask) Array of unsigned long's in mask |
* |
* int nodemask_parse_user(ubuf, ulen, mask) Parse ascii string as nodemask |
* int nodelist_parse(buf, map) Parse ascii string as nodelist |
* int node_remap(oldbit, old, new) newbit = map(old, new)(oldbit) |
* void nodes_remap(dst, src, old, new) *dst = map(old, new)(src) |
* void nodes_onto(dst, orig, relmap) *dst = orig relative to relmap |
* void nodes_fold(dst, orig, sz) dst bits = orig bits mod sz |
* |
* for_each_node_mask(node, mask) for-loop node over mask |
* |
* int num_online_nodes() Number of online Nodes |
* int num_possible_nodes() Number of all possible Nodes |
* |
* int node_random(mask) Random node with set bit in mask |
* |
* int node_online(node) Is some node online? |
* int node_possible(node) Is some node possible? |
* |
* node_set_online(node) set bit 'node' in node_online_map |
* node_set_offline(node) clear bit 'node' in node_online_map |
* |
* for_each_node(node) for-loop node over node_possible_map |
* for_each_online_node(node) for-loop node over node_online_map |
* |
* Subtlety: |
* 1) The 'type-checked' form of node_isset() causes gcc (3.3.2, anyway) |
* to generate slightly worse code. So use a simple one-line #define |
* for node_isset(), instead of wrapping an inline inside a macro, the |
* way we do the other calls. |
* |
* NODEMASK_SCRATCH |
* When doing above logical AND, OR, XOR, Remap operations the callers tend to |
* need temporary nodemask_t's on the stack. But if NODES_SHIFT is large, |
* nodemask_t's consume too much stack space. NODEMASK_SCRATCH is a helper |
* for such situations. See below and CPUMASK_ALLOC also. |
*/ |
#include <linux/kernel.h> |
#include <linux/threads.h> |
#include <linux/bitmap.h> |
#include <linux/numa.h> |
typedef struct { DECLARE_BITMAP(bits, MAX_NUMNODES); } nodemask_t; |
extern nodemask_t _unused_nodemask_arg_; |
/** |
* nodemask_pr_args - printf args to output a nodemask |
* @maskp: nodemask to be printed |
* |
* Can be used to provide arguments for '%*pb[l]' when printing a nodemask. |
*/ |
#define nodemask_pr_args(maskp) MAX_NUMNODES, (maskp)->bits |
/* |
* The inline keyword gives the compiler room to decide to inline, or |
* not inline a function as it sees best. However, as these functions |
* are called in both __init and non-__init functions, if they are not |
* inlined we will end up with a section mis-match error (of the type of |
* freeable items not being freed). So we must use __always_inline here |
* to fix the problem. If other functions in the future also end up in |
* this situation they will also need to be annotated as __always_inline |
*/ |
#define node_set(node, dst) __node_set((node), &(dst)) |
static __always_inline void __node_set(int node, volatile nodemask_t *dstp) |
{ |
set_bit(node, dstp->bits); |
} |
#define node_clear(node, dst) __node_clear((node), &(dst)) |
static inline void __node_clear(int node, volatile nodemask_t *dstp) |
{ |
clear_bit(node, dstp->bits); |
} |
#define nodes_setall(dst) __nodes_setall(&(dst), MAX_NUMNODES) |
static inline void __nodes_setall(nodemask_t *dstp, unsigned int nbits) |
{ |
bitmap_fill(dstp->bits, nbits); |
} |
#define nodes_clear(dst) __nodes_clear(&(dst), MAX_NUMNODES) |
static inline void __nodes_clear(nodemask_t *dstp, unsigned int nbits) |
{ |
bitmap_zero(dstp->bits, nbits); |
} |
/* No static inline type checking - see Subtlety (1) above. */ |
#define node_isset(node, nodemask) test_bit((node), (nodemask).bits) |
#define node_test_and_set(node, nodemask) \ |
__node_test_and_set((node), &(nodemask)) |
static inline int __node_test_and_set(int node, nodemask_t *addr) |
{ |
return test_and_set_bit(node, addr->bits); |
} |
#define nodes_and(dst, src1, src2) \ |
__nodes_and(&(dst), &(src1), &(src2), MAX_NUMNODES) |
static inline void __nodes_and(nodemask_t *dstp, const nodemask_t *src1p, |
const nodemask_t *src2p, unsigned int nbits) |
{ |
bitmap_and(dstp->bits, src1p->bits, src2p->bits, nbits); |
} |
#define nodes_or(dst, src1, src2) \ |
__nodes_or(&(dst), &(src1), &(src2), MAX_NUMNODES) |
static inline void __nodes_or(nodemask_t *dstp, const nodemask_t *src1p, |
const nodemask_t *src2p, unsigned int nbits) |
{ |
bitmap_or(dstp->bits, src1p->bits, src2p->bits, nbits); |
} |
#define nodes_xor(dst, src1, src2) \ |
__nodes_xor(&(dst), &(src1), &(src2), MAX_NUMNODES) |
static inline void __nodes_xor(nodemask_t *dstp, const nodemask_t *src1p, |
const nodemask_t *src2p, unsigned int nbits) |
{ |
bitmap_xor(dstp->bits, src1p->bits, src2p->bits, nbits); |
} |
#define nodes_andnot(dst, src1, src2) \ |
__nodes_andnot(&(dst), &(src1), &(src2), MAX_NUMNODES) |
static inline void __nodes_andnot(nodemask_t *dstp, const nodemask_t *src1p, |
const nodemask_t *src2p, unsigned int nbits) |
{ |
bitmap_andnot(dstp->bits, src1p->bits, src2p->bits, nbits); |
} |
#define nodes_complement(dst, src) \ |
__nodes_complement(&(dst), &(src), MAX_NUMNODES) |
static inline void __nodes_complement(nodemask_t *dstp, |
const nodemask_t *srcp, unsigned int nbits) |
{ |
bitmap_complement(dstp->bits, srcp->bits, nbits); |
} |
#define nodes_equal(src1, src2) \ |
__nodes_equal(&(src1), &(src2), MAX_NUMNODES) |
static inline int __nodes_equal(const nodemask_t *src1p, |
const nodemask_t *src2p, unsigned int nbits) |
{ |
return bitmap_equal(src1p->bits, src2p->bits, nbits); |
} |
#define nodes_intersects(src1, src2) \ |
__nodes_intersects(&(src1), &(src2), MAX_NUMNODES) |
static inline int __nodes_intersects(const nodemask_t *src1p, |
const nodemask_t *src2p, unsigned int nbits) |
{ |
return bitmap_intersects(src1p->bits, src2p->bits, nbits); |
} |
#define nodes_subset(src1, src2) \ |
__nodes_subset(&(src1), &(src2), MAX_NUMNODES) |
static inline int __nodes_subset(const nodemask_t *src1p, |
const nodemask_t *src2p, unsigned int nbits) |
{ |
return bitmap_subset(src1p->bits, src2p->bits, nbits); |
} |
#define nodes_empty(src) __nodes_empty(&(src), MAX_NUMNODES) |
static inline int __nodes_empty(const nodemask_t *srcp, unsigned int nbits) |
{ |
return bitmap_empty(srcp->bits, nbits); |
} |
#define nodes_full(nodemask) __nodes_full(&(nodemask), MAX_NUMNODES) |
static inline int __nodes_full(const nodemask_t *srcp, unsigned int nbits) |
{ |
return bitmap_full(srcp->bits, nbits); |
} |
#define nodes_weight(nodemask) __nodes_weight(&(nodemask), MAX_NUMNODES) |
static inline int __nodes_weight(const nodemask_t *srcp, unsigned int nbits) |
{ |
return bitmap_weight(srcp->bits, nbits); |
} |
#define nodes_shift_right(dst, src, n) \ |
__nodes_shift_right(&(dst), &(src), (n), MAX_NUMNODES) |
static inline void __nodes_shift_right(nodemask_t *dstp, |
const nodemask_t *srcp, int n, int nbits) |
{ |
bitmap_shift_right(dstp->bits, srcp->bits, n, nbits); |
} |
#define nodes_shift_left(dst, src, n) \ |
__nodes_shift_left(&(dst), &(src), (n), MAX_NUMNODES) |
static inline void __nodes_shift_left(nodemask_t *dstp, |
const nodemask_t *srcp, int n, int nbits) |
{ |
bitmap_shift_left(dstp->bits, srcp->bits, n, nbits); |
} |
/* FIXME: better would be to fix all architectures to never return |
> MAX_NUMNODES, then the silly min_ts could be dropped. */ |
#define first_node(src) __first_node(&(src)) |
static inline int __first_node(const nodemask_t *srcp) |
{ |
return min_t(int, MAX_NUMNODES, find_first_bit(srcp->bits, MAX_NUMNODES)); |
} |
#define next_node(n, src) __next_node((n), &(src)) |
static inline int __next_node(int n, const nodemask_t *srcp) |
{ |
return min_t(int,MAX_NUMNODES,find_next_bit(srcp->bits, MAX_NUMNODES, n+1)); |
} |
static inline void init_nodemask_of_node(nodemask_t *mask, int node) |
{ |
nodes_clear(*mask); |
node_set(node, *mask); |
} |
#define nodemask_of_node(node) \ |
({ \ |
typeof(_unused_nodemask_arg_) m; \ |
if (sizeof(m) == sizeof(unsigned long)) { \ |
m.bits[0] = 1UL << (node); \ |
} else { \ |
init_nodemask_of_node(&m, (node)); \ |
} \ |
m; \ |
}) |
#define first_unset_node(mask) __first_unset_node(&(mask)) |
static inline int __first_unset_node(const nodemask_t *maskp) |
{ |
return min_t(int,MAX_NUMNODES, |
find_first_zero_bit(maskp->bits, MAX_NUMNODES)); |
} |
#define NODE_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(MAX_NUMNODES) |
#if MAX_NUMNODES <= BITS_PER_LONG |
#define NODE_MASK_ALL \ |
((nodemask_t) { { \ |
[BITS_TO_LONGS(MAX_NUMNODES)-1] = NODE_MASK_LAST_WORD \ |
} }) |
#else |
#define NODE_MASK_ALL \ |
((nodemask_t) { { \ |
[0 ... BITS_TO_LONGS(MAX_NUMNODES)-2] = ~0UL, \ |
[BITS_TO_LONGS(MAX_NUMNODES)-1] = NODE_MASK_LAST_WORD \ |
} }) |
#endif |
#define NODE_MASK_NONE \ |
((nodemask_t) { { \ |
[0 ... BITS_TO_LONGS(MAX_NUMNODES)-1] = 0UL \ |
} }) |
#define nodes_addr(src) ((src).bits) |
#define nodemask_parse_user(ubuf, ulen, dst) \ |
__nodemask_parse_user((ubuf), (ulen), &(dst), MAX_NUMNODES) |
static inline int __nodemask_parse_user(const char __user *buf, int len, |
nodemask_t *dstp, int nbits) |
{ |
return bitmap_parse_user(buf, len, dstp->bits, nbits); |
} |
#define nodelist_parse(buf, dst) __nodelist_parse((buf), &(dst), MAX_NUMNODES) |
static inline int __nodelist_parse(const char *buf, nodemask_t *dstp, int nbits) |
{ |
return bitmap_parselist(buf, dstp->bits, nbits); |
} |
#define node_remap(oldbit, old, new) \ |
__node_remap((oldbit), &(old), &(new), MAX_NUMNODES) |
static inline int __node_remap(int oldbit, |
const nodemask_t *oldp, const nodemask_t *newp, int nbits) |
{ |
return bitmap_bitremap(oldbit, oldp->bits, newp->bits, nbits); |
} |
#define nodes_remap(dst, src, old, new) \ |
__nodes_remap(&(dst), &(src), &(old), &(new), MAX_NUMNODES) |
static inline void __nodes_remap(nodemask_t *dstp, const nodemask_t *srcp, |
const nodemask_t *oldp, const nodemask_t *newp, int nbits) |
{ |
bitmap_remap(dstp->bits, srcp->bits, oldp->bits, newp->bits, nbits); |
} |
#define nodes_onto(dst, orig, relmap) \ |
__nodes_onto(&(dst), &(orig), &(relmap), MAX_NUMNODES) |
static inline void __nodes_onto(nodemask_t *dstp, const nodemask_t *origp, |
const nodemask_t *relmapp, int nbits) |
{ |
bitmap_onto(dstp->bits, origp->bits, relmapp->bits, nbits); |
} |
#define nodes_fold(dst, orig, sz) \ |
__nodes_fold(&(dst), &(orig), sz, MAX_NUMNODES) |
static inline void __nodes_fold(nodemask_t *dstp, const nodemask_t *origp, |
int sz, int nbits) |
{ |
bitmap_fold(dstp->bits, origp->bits, sz, nbits); |
} |
#if MAX_NUMNODES > 1 |
#define for_each_node_mask(node, mask) \ |
for ((node) = first_node(mask); \ |
(node) < MAX_NUMNODES; \ |
(node) = next_node((node), (mask))) |
#else /* MAX_NUMNODES == 1 */ |
#define for_each_node_mask(node, mask) \ |
if (!nodes_empty(mask)) \ |
for ((node) = 0; (node) < 1; (node)++) |
#endif /* MAX_NUMNODES */ |
/* |
* Bitmasks that are kept for all the nodes. |
*/ |
enum node_states { |
N_POSSIBLE, /* The node could become online at some point */ |
N_ONLINE, /* The node is online */ |
N_NORMAL_MEMORY, /* The node has regular memory */ |
#ifdef CONFIG_HIGHMEM |
N_HIGH_MEMORY, /* The node has regular or high memory */ |
#else |
N_HIGH_MEMORY = N_NORMAL_MEMORY, |
#endif |
#ifdef CONFIG_MOVABLE_NODE |
N_MEMORY, /* The node has memory(regular, high, movable) */ |
#else |
N_MEMORY = N_HIGH_MEMORY, |
#endif |
N_CPU, /* The node has one or more cpus */ |
NR_NODE_STATES |
}; |
/* |
* The following particular system nodemasks and operations |
* on them manage all possible and online nodes. |
*/ |
extern nodemask_t node_states[NR_NODE_STATES]; |
#if MAX_NUMNODES > 1 |
static inline int node_state(int node, enum node_states state) |
{ |
return node_isset(node, node_states[state]); |
} |
static inline void node_set_state(int node, enum node_states state) |
{ |
__node_set(node, &node_states[state]); |
} |
static inline void node_clear_state(int node, enum node_states state) |
{ |
__node_clear(node, &node_states[state]); |
} |
static inline int num_node_state(enum node_states state) |
{ |
return nodes_weight(node_states[state]); |
} |
#define for_each_node_state(__node, __state) \ |
for_each_node_mask((__node), node_states[__state]) |
#define first_online_node first_node(node_states[N_ONLINE]) |
#define first_memory_node first_node(node_states[N_MEMORY]) |
static inline int next_online_node(int nid) |
{ |
return next_node(nid, node_states[N_ONLINE]); |
} |
static inline int next_memory_node(int nid) |
{ |
return next_node(nid, node_states[N_MEMORY]); |
} |
extern int nr_node_ids; |
extern int nr_online_nodes; |
static inline void node_set_online(int nid) |
{ |
node_set_state(nid, N_ONLINE); |
nr_online_nodes = num_node_state(N_ONLINE); |
} |
static inline void node_set_offline(int nid) |
{ |
node_clear_state(nid, N_ONLINE); |
nr_online_nodes = num_node_state(N_ONLINE); |
} |
#else |
static inline int node_state(int node, enum node_states state) |
{ |
return node == 0; |
} |
static inline void node_set_state(int node, enum node_states state) |
{ |
} |
static inline void node_clear_state(int node, enum node_states state) |
{ |
} |
static inline int num_node_state(enum node_states state) |
{ |
return 1; |
} |
#define for_each_node_state(node, __state) \ |
for ( (node) = 0; (node) == 0; (node) = 1) |
#define first_online_node 0 |
#define first_memory_node 0 |
#define next_online_node(nid) (MAX_NUMNODES) |
#define nr_node_ids 1 |
#define nr_online_nodes 1 |
#define node_set_online(node) node_set_state((node), N_ONLINE) |
#define node_set_offline(node) node_clear_state((node), N_ONLINE) |
#endif |
#if defined(CONFIG_NUMA) && (MAX_NUMNODES > 1) |
extern int node_random(const nodemask_t *maskp); |
#else |
static inline int node_random(const nodemask_t *mask) |
{ |
return 0; |
} |
#endif |
#define node_online_map node_states[N_ONLINE] |
#define node_possible_map node_states[N_POSSIBLE] |
#define num_online_nodes() num_node_state(N_ONLINE) |
#define num_possible_nodes() num_node_state(N_POSSIBLE) |
#define node_online(node) node_state((node), N_ONLINE) |
#define node_possible(node) node_state((node), N_POSSIBLE) |
#define for_each_node(node) for_each_node_state(node, N_POSSIBLE) |
#define for_each_online_node(node) for_each_node_state(node, N_ONLINE) |
/* |
* For nodemask scrach area. |
* NODEMASK_ALLOC(type, name) allocates an object with a specified type and |
* name. |
*/ |
#if NODES_SHIFT > 8 /* nodemask_t > 256 bytes */ |
#define NODEMASK_ALLOC(type, name, gfp_flags) \ |
type *name = kmalloc(sizeof(*name), gfp_flags) |
#define NODEMASK_FREE(m) kfree(m) |
#else |
#define NODEMASK_ALLOC(type, name, gfp_flags) type _##name, *name = &_##name |
#define NODEMASK_FREE(m) do {} while (0) |
#endif |
/* A example struture for using NODEMASK_ALLOC, used in mempolicy. */ |
struct nodemask_scratch { |
nodemask_t mask1; |
nodemask_t mask2; |
}; |
#define NODEMASK_SCRATCH(x) \ |
NODEMASK_ALLOC(struct nodemask_scratch, x, \ |
GFP_KERNEL | __GFP_NORETRY) |
#define NODEMASK_SCRATCH_FREE(x) NODEMASK_FREE(x) |
#endif /* __LINUX_NODEMASK_H */ |
/drivers/include/linux/numa.h |
---|
0,0 → 1,15 |
#ifndef _LINUX_NUMA_H |
#define _LINUX_NUMA_H |
#ifdef CONFIG_NODES_SHIFT |
#define NODES_SHIFT CONFIG_NODES_SHIFT |
#else |
#define NODES_SHIFT 0 |
#endif |
#define MAX_NUMNODES (1 << NODES_SHIFT) |
#define NUMA_NO_NODE (-1) |
#endif /* _LINUX_NUMA_H */ |
/drivers/include/linux/property.h |
---|
0,0 → 1,185 |
/* |
* property.h - Unified device property interface. |
* |
* Copyright (C) 2014, Intel Corporation |
* Authors: Rafael J. Wysocki <rafael.j.wysocki@intel.com> |
* Mika Westerberg <mika.westerberg@linux.intel.com> |
* |
* This program is free software; you can redistribute it and/or modify |
* it under the terms of the GNU General Public License version 2 as |
* published by the Free Software Foundation. |
*/ |
#ifndef _LINUX_PROPERTY_H_ |
#define _LINUX_PROPERTY_H_ |
#include <linux/fwnode.h> |
#include <linux/types.h> |
struct device; |
enum dev_prop_type { |
DEV_PROP_U8, |
DEV_PROP_U16, |
DEV_PROP_U32, |
DEV_PROP_U64, |
DEV_PROP_STRING, |
DEV_PROP_MAX, |
}; |
enum dev_dma_attr { |
DEV_DMA_NOT_SUPPORTED, |
DEV_DMA_NON_COHERENT, |
DEV_DMA_COHERENT, |
}; |
bool device_property_present(struct device *dev, const char *propname); |
int device_property_read_u8_array(struct device *dev, const char *propname, |
u8 *val, size_t nval); |
int device_property_read_u16_array(struct device *dev, const char *propname, |
u16 *val, size_t nval); |
int device_property_read_u32_array(struct device *dev, const char *propname, |
u32 *val, size_t nval); |
int device_property_read_u64_array(struct device *dev, const char *propname, |
u64 *val, size_t nval); |
int device_property_read_string_array(struct device *dev, const char *propname, |
const char **val, size_t nval); |
int device_property_read_string(struct device *dev, const char *propname, |
const char **val); |
int device_property_match_string(struct device *dev, |
const char *propname, const char *string); |
bool fwnode_property_present(struct fwnode_handle *fwnode, const char *propname); |
int fwnode_property_read_u8_array(struct fwnode_handle *fwnode, |
const char *propname, u8 *val, |
size_t nval); |
int fwnode_property_read_u16_array(struct fwnode_handle *fwnode, |
const char *propname, u16 *val, |
size_t nval); |
int fwnode_property_read_u32_array(struct fwnode_handle *fwnode, |
const char *propname, u32 *val, |
size_t nval); |
int fwnode_property_read_u64_array(struct fwnode_handle *fwnode, |
const char *propname, u64 *val, |
size_t nval); |
int fwnode_property_read_string_array(struct fwnode_handle *fwnode, |
const char *propname, const char **val, |
size_t nval); |
int fwnode_property_read_string(struct fwnode_handle *fwnode, |
const char *propname, const char **val); |
int fwnode_property_match_string(struct fwnode_handle *fwnode, |
const char *propname, const char *string); |
struct fwnode_handle *device_get_next_child_node(struct device *dev, |
struct fwnode_handle *child); |
#define device_for_each_child_node(dev, child) \ |
for (child = device_get_next_child_node(dev, NULL); child; \ |
child = device_get_next_child_node(dev, child)) |
void fwnode_handle_put(struct fwnode_handle *fwnode); |
unsigned int device_get_child_node_count(struct device *dev); |
static inline bool device_property_read_bool(struct device *dev, |
const char *propname) |
{ |
return device_property_present(dev, propname); |
} |
static inline int device_property_read_u8(struct device *dev, |
const char *propname, u8 *val) |
{ |
return device_property_read_u8_array(dev, propname, val, 1); |
} |
static inline int device_property_read_u16(struct device *dev, |
const char *propname, u16 *val) |
{ |
return device_property_read_u16_array(dev, propname, val, 1); |
} |
static inline int device_property_read_u32(struct device *dev, |
const char *propname, u32 *val) |
{ |
return device_property_read_u32_array(dev, propname, val, 1); |
} |
static inline int device_property_read_u64(struct device *dev, |
const char *propname, u64 *val) |
{ |
return device_property_read_u64_array(dev, propname, val, 1); |
} |
static inline bool fwnode_property_read_bool(struct fwnode_handle *fwnode, |
const char *propname) |
{ |
return fwnode_property_present(fwnode, propname); |
} |
static inline int fwnode_property_read_u8(struct fwnode_handle *fwnode, |
const char *propname, u8 *val) |
{ |
return fwnode_property_read_u8_array(fwnode, propname, val, 1); |
} |
static inline int fwnode_property_read_u16(struct fwnode_handle *fwnode, |
const char *propname, u16 *val) |
{ |
return fwnode_property_read_u16_array(fwnode, propname, val, 1); |
} |
static inline int fwnode_property_read_u32(struct fwnode_handle *fwnode, |
const char *propname, u32 *val) |
{ |
return fwnode_property_read_u32_array(fwnode, propname, val, 1); |
} |
static inline int fwnode_property_read_u64(struct fwnode_handle *fwnode, |
const char *propname, u64 *val) |
{ |
return fwnode_property_read_u64_array(fwnode, propname, val, 1); |
} |
/** |
* struct property_entry - "Built-in" device property representation. |
* @name: Name of the property. |
* @type: Type of the property. |
* @nval: Number of items of type @type making up the value. |
* @value: Value of the property (an array of @nval items of type @type). |
*/ |
struct property_entry { |
const char *name; |
enum dev_prop_type type; |
size_t nval; |
union { |
void *raw_data; |
u8 *u8_data; |
u16 *u16_data; |
u32 *u32_data; |
u64 *u64_data; |
const char **str; |
} value; |
}; |
/** |
* struct property_set - Collection of "built-in" device properties. |
* @fwnode: Handle to be pointed to by the fwnode field of struct device. |
* @properties: Array of properties terminated with a null entry. |
*/ |
struct property_set { |
struct fwnode_handle fwnode; |
struct property_entry *properties; |
}; |
void device_add_property_set(struct device *dev, struct property_set *pset); |
bool device_dma_supported(struct device *dev); |
enum dev_dma_attr device_get_dma_attr(struct device *dev); |
int device_get_phy_mode(struct device *dev); |
void *device_get_mac_address(struct device *dev, char *addr, int alen); |
#endif /* _LINUX_PROPERTY_H_ */ |
/drivers/include/linux/rcupdate.h |
---|
217,6 → 217,7 |
void synchronize_sched(void); |
#define wait_rcu_gp(...) |
/** |
* call_rcu_tasks() - Queue an RCU for invocation task-based grace period |
* @head: structure to be used for queueing the RCU updates. |
/drivers/include/linux/scatterlist.h |
---|
378,6 → 378,4 |
bool sg_miter_next(struct sg_mapping_iter *miter); |
void sg_miter_stop(struct sg_mapping_iter *miter); |
#define dma_unmap_sg(d, s, n, r) |
#endif /* _LINUX_SCATTERLIST_H */ |
/drivers/include/linux/timex.h |
---|
0,0 → 1,158 |
/***************************************************************************** |
* * |
* Copyright (c) David L. Mills 1993 * |
* * |
* Permission to use, copy, modify, and distribute this software and its * |
* documentation for any purpose and without fee is hereby granted, provided * |
* that the above copyright notice appears in all copies and that both the * |
* copyright notice and this permission notice appear in supporting * |
* documentation, and that the name University of Delaware not be used in * |
* advertising or publicity pertaining to distribution of the software * |
* without specific, written prior permission. The University of Delaware * |
* makes no representations about the suitability this software for any * |
* purpose. It is provided "as is" without express or implied warranty. * |
* * |
*****************************************************************************/ |
/* |
* Modification history timex.h |
* |
* 29 Dec 97 Russell King |
* Moved CLOCK_TICK_RATE, CLOCK_TICK_FACTOR and FINETUNE to asm/timex.h |
* for ARM machines |
* |
* 9 Jan 97 Adrian Sun |
* Shifted LATCH define to allow access to alpha machines. |
* |
* 26 Sep 94 David L. Mills |
* Added defines for hybrid phase/frequency-lock loop. |
* |
* 19 Mar 94 David L. Mills |
* Moved defines from kernel routines to header file and added new |
* defines for PPS phase-lock loop. |
* |
* 20 Feb 94 David L. Mills |
* Revised status codes and structures for external clock and PPS |
* signal discipline. |
* |
* 28 Nov 93 David L. Mills |
* Adjusted parameters to improve stability and increase poll |
* interval. |
* |
* 17 Sep 93 David L. Mills |
* Created file $NTP/include/sys/timex.h |
* 07 Oct 93 Torsten Duwe |
* Derived linux/timex.h |
* 1995-08-13 Torsten Duwe |
* kernel PLL updated to 1994-12-13 specs (rfc-1589) |
* 1997-08-30 Ulrich Windl |
* Added new constant NTP_PHASE_LIMIT |
* 2004-08-12 Christoph Lameter |
* Reworked time interpolation logic |
*/ |
#ifndef _LINUX_TIMEX_H |
#define _LINUX_TIMEX_H |
#define ADJ_ADJTIME 0x8000 /* switch between adjtime/adjtimex modes */ |
#define ADJ_OFFSET_SINGLESHOT 0x0001 /* old-fashioned adjtime */ |
#define ADJ_OFFSET_READONLY 0x2000 /* read-only adjtime */ |
#include <linux/compiler.h> |
#include <linux/types.h> |
#ifndef random_get_entropy |
/* |
* The random_get_entropy() function is used by the /dev/random driver |
* in order to extract entropy via the relative unpredictability of |
* when an interrupt takes places versus a high speed, fine-grained |
* timing source or cycle counter. Since it will be occurred on every |
* single interrupt, it must have a very low cost/overhead. |
* |
* By default we use get_cycles() for this purpose, but individual |
* architectures may override this in their asm/timex.h header file. |
*/ |
#define random_get_entropy() get_cycles() |
#endif |
/* |
* SHIFT_PLL is used as a dampening factor to define how much we |
* adjust the frequency correction for a given offset in PLL mode. |
* It also used in dampening the offset correction, to define how |
* much of the current value in time_offset we correct for each |
* second. Changing this value changes the stiffness of the ntp |
* adjustment code. A lower value makes it more flexible, reducing |
* NTP convergence time. A higher value makes it stiffer, increasing |
* convergence time, but making the clock more stable. |
* |
* In David Mills' nanokernel reference implementation SHIFT_PLL is 4. |
* However this seems to increase convergence time much too long. |
* |
* https://lists.ntp.org/pipermail/hackers/2008-January/003487.html |
* |
* In the above mailing list discussion, it seems the value of 4 |
* was appropriate for other Unix systems with HZ=100, and that |
* SHIFT_PLL should be decreased as HZ increases. However, Linux's |
* clock steering implementation is HZ independent. |
* |
* Through experimentation, a SHIFT_PLL value of 2 was found to allow |
* for fast convergence (very similar to the NTPv3 code used prior to |
* v2.6.19), with good clock stability. |
* |
* |
* SHIFT_FLL is used as a dampening factor to define how much we |
* adjust the frequency correction for a given offset in FLL mode. |
* In David Mills' nanokernel reference implementation SHIFT_FLL is 2. |
* |
* MAXTC establishes the maximum time constant of the PLL. |
*/ |
#define SHIFT_PLL 2 /* PLL frequency factor (shift) */ |
#define SHIFT_FLL 2 /* FLL frequency factor (shift) */ |
#define MAXTC 10 /* maximum time constant (shift) */ |
/* |
* SHIFT_USEC defines the scaling (shift) of the time_freq and |
* time_tolerance variables, which represent the current frequency |
* offset and maximum frequency tolerance. |
*/ |
#define SHIFT_USEC 16 /* frequency offset scale (shift) */ |
#define PPM_SCALE ((s64)NSEC_PER_USEC << (NTP_SCALE_SHIFT - SHIFT_USEC)) |
#define PPM_SCALE_INV_SHIFT 19 |
#define PPM_SCALE_INV ((1LL << (PPM_SCALE_INV_SHIFT + NTP_SCALE_SHIFT)) / \ |
PPM_SCALE + 1) |
#define MAXPHASE 500000000L /* max phase error (ns) */ |
#define MAXFREQ 500000 /* max frequency error (ns/s) */ |
#define MAXFREQ_SCALED ((s64)MAXFREQ << NTP_SCALE_SHIFT) |
#define MINSEC 256 /* min interval between updates (s) */ |
#define MAXSEC 2048 /* max interval between updates (s) */ |
#define NTP_PHASE_LIMIT ((MAXPHASE / NSEC_PER_USEC) << 5) /* beyond max. dispersion */ |
/* |
* kernel variables |
* Note: maximum error = NTP synch distance = dispersion + delay / 2; |
* estimated error = NTP dispersion. |
*/ |
extern unsigned long tick_usec; /* USER_HZ period (usec) */ |
extern unsigned long tick_nsec; /* SHIFTED_HZ period (nsec) */ |
/* Required to safely shift negative values */ |
#define shift_right(x, s) ({ \ |
__typeof__(x) __x = (x); \ |
__typeof__(s) __s = (s); \ |
__x < 0 ? -(-__x >> __s) : __x >> __s; \ |
}) |
#define NTP_SCALE_SHIFT 32 |
#define NTP_INTERVAL_FREQ (HZ) |
#define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ) |
int read_current_timer(unsigned long *timer_val); |
void ntp_notify_cmos_timer(void); |
/* The clock frequency of the i8253/i8254 PIT */ |
#define PIT_TICK_RATE 1193182ul |
#endif /* LINUX_TIMEX_H */ |
/drivers/include/syscall.h |
---|
530,5 → 530,4 |
static inline int power_supply_is_system_supplied(void) { return -1; }; |
#endif |