МЦСТ 5.10
This commit is contained in:
parent
64bcf9af6d
commit
6177a9853b
|
@ -0,0 +1,210 @@
|
|||
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: acbuffer.h - Support for buffers returned by ACPI predefined names
|
||||
*
|
||||
* Copyright (C) 2000 - 2020, Intel Corp.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#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 */
|
|
@ -0,0 +1,226 @@
|
|||
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: acconfig.h - Global configuration constants
|
||||
*
|
||||
* Copyright (C) 2000 - 2020, Intel Corp.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#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 */
|
||||
#define ACPI_MAX_COMMENT_CACHE_DEPTH 96 /* Comments for the -ca option */
|
||||
|
||||
/*
|
||||
* 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 0x4000
|
||||
|
||||
/* 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. 128 entries allows for 4095 owner_ids */
|
||||
|
||||
#define ACPI_NUM_OWNERID_MASKS 128
|
||||
|
||||
/* 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
|
||||
|
||||
/* Maximum time (default 30s) of While() loops before abort */
|
||||
|
||||
#define ACPI_MAX_LOOP_TIMEOUT 30
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* ACPI Specification constants (Do not change unless the specification changes)
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/* Method info (in WALK_STATE), containing local variables and arguments */
|
||||
|
||||
#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 arbitrary 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 buffer sizes. All have a 2-byte header,
|
||||
* containing both Status and Length.
|
||||
*/
|
||||
#define ACPI_SERIAL_HEADER_SIZE 2 /* Common for below. Status and Length fields */
|
||||
|
||||
#define ACPI_SMBUS_DATA_SIZE 32
|
||||
#define ACPI_SMBUS_BUFFER_SIZE ACPI_SERIAL_HEADER_SIZE + ACPI_SMBUS_DATA_SIZE
|
||||
|
||||
#define ACPI_IPMI_DATA_SIZE 64
|
||||
#define ACPI_IPMI_BUFFER_SIZE ACPI_SERIAL_HEADER_SIZE + ACPI_IPMI_DATA_SIZE
|
||||
|
||||
#define ACPI_MAX_GSBUS_DATA_SIZE 255
|
||||
#define ACPI_MAX_GSBUS_BUFFER_SIZE ACPI_SERIAL_HEADER_SIZE + ACPI_MAX_GSBUS_DATA_SIZE
|
||||
|
||||
/* _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 */
|
|
@ -0,0 +1,377 @@
|
|||
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: acexcep.h - Exception codes returned by the ACPI subsystem
|
||||
*
|
||||
* Copyright (C) 2000 - 2020, Intel Corp.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#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;
|
||||
|
||||
#if defined (ACPI_HELP_APP) || defined (ACPI_ASL_COMPILER)
|
||||
char *description;
|
||||
#endif
|
||||
};
|
||||
|
||||
#if defined (ACPI_HELP_APP) || defined (ACPI_ASL_COMPILER)
|
||||
#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 AE_OK (acpi_status) 0x0000
|
||||
|
||||
#define ACPI_ENV_EXCEPTION(status) (((status) & AE_CODE_MASK) == AE_CODE_ENVIRONMENTAL)
|
||||
#define ACPI_AML_EXCEPTION(status) (((status) & AE_CODE_MASK) == AE_CODE_AML)
|
||||
#define ACPI_PROG_EXCEPTION(status) (((status) & AE_CODE_MASK) == AE_CODE_PROGRAMMER)
|
||||
#define ACPI_TABLE_EXCEPTION(status) (((status) & AE_CODE_MASK) == AE_CODE_ACPI_TABLES)
|
||||
#define ACPI_CNTL_EXCEPTION(status) (((status) & AE_CODE_MASK) == AE_CODE_CONTROL)
|
||||
|
||||
/*
|
||||
* 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_IO_ERROR EXCEP_ENV (0x001E)
|
||||
#define AE_NUMERIC_OVERFLOW EXCEP_ENV (0x001F)
|
||||
#define AE_HEX_OVERFLOW EXCEP_ENV (0x0020)
|
||||
#define AE_DECIMAL_OVERFLOW EXCEP_ENV (0x0021)
|
||||
#define AE_OCTAL_OVERFLOW EXCEP_ENV (0x0022)
|
||||
#define AE_END_OF_TABLE EXCEP_ENV (0x0023)
|
||||
|
||||
#define AE_CODE_ENV_MAX 0x0023
|
||||
|
||||
/*
|
||||
* 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_LOOP_TIMEOUT EXCEP_AML (0x0021)
|
||||
#define AE_AML_UNINITIALIZED_NODE EXCEP_AML (0x0022)
|
||||
#define AE_AML_TARGET_TYPE EXCEP_AML (0x0023)
|
||||
#define AE_AML_PROTOCOL EXCEP_AML (0x0024)
|
||||
#define AE_AML_BUFFER_LENGTH EXCEP_AML (0x0025)
|
||||
|
||||
#define AE_CODE_AML_MAX 0x0025
|
||||
|
||||
/*
|
||||
* 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_PARSE_CONTINUE EXCEP_CTL (0x000B)
|
||||
#define AE_CTRL_PARSE_PENDING EXCEP_CTL (0x000C)
|
||||
|
||||
#define AE_CODE_CTRL_MAX 0x000C
|
||||
|
||||
/* 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"),
|
||||
EXCEP_TXT("AE_IO_ERROR", "An I/O error occurred"),
|
||||
EXCEP_TXT("AE_NUMERIC_OVERFLOW",
|
||||
"Overflow during string-to-integer conversion"),
|
||||
EXCEP_TXT("AE_HEX_OVERFLOW",
|
||||
"Overflow during ASCII hex-to-binary conversion"),
|
||||
EXCEP_TXT("AE_DECIMAL_OVERFLOW",
|
||||
"Overflow during ASCII decimal-to-binary conversion"),
|
||||
EXCEP_TXT("AE_OCTAL_OVERFLOW",
|
||||
"Overflow during ASCII octal-to-binary conversion"),
|
||||
EXCEP_TXT("AE_END_OF_TABLE", "Reached the end of table")
|
||||
};
|
||||
|
||||
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 interpreter"),
|
||||
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_LOOP_TIMEOUT",
|
||||
"An AML While loop exceeded the maximum execution time"),
|
||||
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"),
|
||||
EXCEP_TXT("AE_AML_PROTOCOL", "Violation of a fixed ACPI protocol"),
|
||||
EXCEP_TXT("AE_AML_BUFFER_LENGTH",
|
||||
"The length of the buffer is invalid/incorrect")
|
||||
};
|
||||
|
||||
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_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__ */
|
|
@ -0,0 +1,62 @@
|
|||
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: acnames.h - Global names and strings
|
||||
*
|
||||
* Copyright (C) 2000 - 2020, Intel Corp.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#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__DMA "_DMA"
|
||||
#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_PREFIX_MIXED (u32) 0x69706341 /* "Acpi" */
|
||||
#define ACPI_PREFIX_LOWER (u32) 0x69706361 /* "acpi" */
|
||||
|
||||
/* Root name stuff */
|
||||
|
||||
#define ACPI_ROOT_NAME (u32) 0x5F5F5F5C /* Root name is "\___" */
|
||||
#define ACPI_ROOT_PATHNAME "\\___"
|
||||
#define ACPI_NAMESPACE_ROOT "Namespace Root"
|
||||
#define ACPI_NS_ROOT_PATH "\\"
|
||||
|
||||
#endif /* __ACNAMES_H__ */
|
|
@ -0,0 +1,466 @@
|
|||
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: acoutput.h -- debug output
|
||||
*
|
||||
* Copyright (C) 2000 - 2020, Intel Corp.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#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_EVALUATION 0x00080000
|
||||
#define ACPI_LV_VERBOSITY1 0x000FFF40 | 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_PARSE_TREES 0x00800000
|
||||
#define ACPI_LV_VERBOSITY2 0x00F00000 | 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_PARSE_TREES ACPI_DEBUG_LEVEL (ACPI_LV_PARSE_TREES)
|
||||
#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_EVALUATION ACPI_DEBUG_LEVEL (ACPI_LV_EVALUATION)
|
||||
#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 */
|
||||
|
||||
#ifndef ACPI_DEBUG_DEFAULT
|
||||
#define ACPI_DEBUG_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT | ACPI_LV_EVALUATION | ACPI_LV_REPAIR)
|
||||
#endif
|
||||
|
||||
#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_EXCEPTION(plist) acpi_bios_exception 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_EXCEPTION(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 non-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, const 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_STR(string) \
|
||||
ACPI_TRACE_EXIT (acpi_ut_str_exit, const char *, string)
|
||||
|
||||
#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_STR(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__ */
|
|
@ -0,0 +1,33 @@
|
|||
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: acpi.h - Master public include file used to interface to ACPICA
|
||||
*
|
||||
* Copyright (C) 2000 - 2020, Intel Corp.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#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/acrestyp.h> /* Resource Descriptor structs */
|
||||
#include <acpi/platform/acenvex.h> /* Extra environment-specific items */
|
||||
#include <acpi/acoutput.h> /* Error output and Debug macros */
|
||||
#include <acpi/acpiosxf.h> /* OSL interfaces (ACPICA-to-OS) */
|
||||
#include <acpi/acpixf.h> /* ACPI core subsystem external interfaces */
|
||||
|
||||
#endif /* __ACPI_H__ */
|
|
@ -0,0 +1,703 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
/*
|
||||
* 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>
|
||||
*/
|
||||
|
||||
#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);
|
||||
acpi_status acpi_evaluate_reg(acpi_handle handle, u8 space_id, u32 function);
|
||||
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 guid_t *guid, u64 rev, u64 funcs);
|
||||
union acpi_object *acpi_evaluate_dsm(acpi_handle handle, const guid_t *guid,
|
||||
u64 rev, u64 func, union acpi_object *argv4);
|
||||
|
||||
static inline union acpi_object *
|
||||
acpi_evaluate_dsm_typed(acpi_handle handle, const guid_t *guid, u64 rev,
|
||||
u64 func, union acpi_object *argv4,
|
||||
acpi_object_type type)
|
||||
{
|
||||
union acpi_object *obj;
|
||||
|
||||
obj = acpi_evaluate_dsm(handle, guid, 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) \
|
||||
}
|
||||
|
||||
bool acpi_dev_found(const char *hid);
|
||||
bool acpi_dev_present(const char *hid, const char *uid, s64 hrv);
|
||||
|
||||
#ifdef CONFIG_ACPI
|
||||
|
||||
struct proc_dir_entry;
|
||||
|
||||
#define ACPI_BUS_FILE_ROOT "acpi"
|
||||
extern struct proc_dir_entry *acpi_root_dir;
|
||||
|
||||
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_TYPE_ECDT_EC,
|
||||
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 enumeration_by_parent:1;
|
||||
u32 reserved:19;
|
||||
};
|
||||
|
||||
/* 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 u64 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 */
|
||||
int instance_no; /* Instance number of this object */
|
||||
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 notifier_present:1; /* Wake-up notify handler has been installed */
|
||||
};
|
||||
|
||||
struct acpi_device_wakeup_context {
|
||||
void (*func)(struct acpi_device_wakeup_context *context);
|
||||
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;
|
||||
int enable_count;
|
||||
};
|
||||
|
||||
struct acpi_device_physical_node {
|
||||
unsigned int node_id;
|
||||
struct list_head node;
|
||||
struct device *dev;
|
||||
bool put_online:1;
|
||||
};
|
||||
|
||||
struct acpi_device_properties {
|
||||
const guid_t *guid;
|
||||
const union acpi_object *properties;
|
||||
struct list_head list;
|
||||
};
|
||||
|
||||
/* ACPI Device Specific Data (_DSD) */
|
||||
struct acpi_device_data {
|
||||
const union acpi_object *pointer;
|
||||
struct list_head 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 fwnode_handle *parent;
|
||||
struct acpi_device_data data;
|
||||
struct list_head sibling;
|
||||
struct kobject kobj;
|
||||
struct completion kobj_done;
|
||||
};
|
||||
|
||||
extern const struct fwnode_operations acpi_device_fwnode_ops;
|
||||
extern const struct fwnode_operations acpi_data_fwnode_ops;
|
||||
extern const struct fwnode_operations acpi_static_fwnode_ops;
|
||||
|
||||
bool is_acpi_device_node(const struct fwnode_handle *fwnode);
|
||||
bool is_acpi_data_node(const struct fwnode_handle *fwnode);
|
||||
|
||||
static inline bool is_acpi_node(const struct fwnode_handle *fwnode)
|
||||
{
|
||||
return (is_acpi_device_node(fwnode) || is_acpi_data_node(fwnode));
|
||||
}
|
||||
|
||||
#define to_acpi_device_node(__fwnode) \
|
||||
({ \
|
||||
typeof(__fwnode) __to_acpi_device_node_fwnode = __fwnode; \
|
||||
\
|
||||
is_acpi_device_node(__to_acpi_device_node_fwnode) ? \
|
||||
container_of(__to_acpi_device_node_fwnode, \
|
||||
struct acpi_device, fwnode) : \
|
||||
NULL; \
|
||||
})
|
||||
|
||||
#define to_acpi_data_node(__fwnode) \
|
||||
({ \
|
||||
typeof(__fwnode) __to_acpi_data_node_fwnode = __fwnode; \
|
||||
\
|
||||
is_acpi_data_node(__to_acpi_data_node_fwnode) ? \
|
||||
container_of(__to_acpi_data_node_fwnode, \
|
||||
struct acpi_data_node, fwnode) : \
|
||||
NULL; \
|
||||
})
|
||||
|
||||
static inline bool is_acpi_static_node(const struct fwnode_handle *fwnode)
|
||||
{
|
||||
return !IS_ERR_OR_NULL(fwnode) &&
|
||||
fwnode->ops == &acpi_static_fwnode_ops;
|
||||
}
|
||||
|
||||
static inline bool acpi_data_node_match(const struct fwnode_handle *fwnode,
|
||||
const char *name)
|
||||
{
|
||||
return is_acpi_data_node(fwnode) ?
|
||||
(!strcmp(to_acpi_data_node(fwnode)->name, name)) : false;
|
||||
}
|
||||
|
||||
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);
|
||||
extern int register_acpi_notifier(struct notifier_block *);
|
||||
extern int unregister_acpi_notifier(struct notifier_block *);
|
||||
|
||||
/*
|
||||
* 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_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);
|
||||
int acpi_device_power_add_dependent(struct acpi_device *adev,
|
||||
struct device *dev);
|
||||
void acpi_device_power_remove_dependent(struct acpi_device *adev,
|
||||
struct device *dev);
|
||||
|
||||
#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);
|
||||
void acpi_set_modalias(struct acpi_device *adev, const char *default_id,
|
||||
char *modalias, size_t len);
|
||||
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);
|
||||
int acpi_dma_get_range(struct device *dev, u64 *dma_addr, u64 *offset,
|
||||
u64 *size);
|
||||
int acpi_dma_configure_id(struct device *dev, enum dev_dma_attr attr,
|
||||
const u32 *input_id);
|
||||
static inline int acpi_dma_configure(struct device *dev,
|
||||
enum dev_dma_attr attr)
|
||||
{
|
||||
return acpi_dma_configure_id(dev, attr, NULL);
|
||||
}
|
||||
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_X86
|
||||
bool acpi_device_override_status(struct acpi_device *adev, unsigned long long *status);
|
||||
#else
|
||||
static inline bool acpi_device_override_status(struct acpi_device *adev,
|
||||
unsigned long long *status)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
void acpi_pm_wakeup_event(struct device *dev);
|
||||
acpi_status acpi_add_pm_notifier(struct acpi_device *adev, struct device *dev,
|
||||
void (*func)(struct acpi_device_wakeup_context *context));
|
||||
acpi_status acpi_remove_pm_notifier(struct acpi_device *adev);
|
||||
bool acpi_pm_device_can_wakeup(struct device *dev);
|
||||
int acpi_pm_device_sleep_state(struct device *, int *, int);
|
||||
int acpi_pm_set_device_wakeup(struct device *dev, bool enable);
|
||||
#else
|
||||
static inline void acpi_pm_wakeup_event(struct device *dev)
|
||||
{
|
||||
}
|
||||
static inline acpi_status acpi_add_pm_notifier(struct acpi_device *adev,
|
||||
struct device *dev,
|
||||
void (*func)(struct acpi_device_wakeup_context *context))
|
||||
{
|
||||
return AE_SUPPORT;
|
||||
}
|
||||
static inline acpi_status acpi_remove_pm_notifier(struct acpi_device *adev)
|
||||
{
|
||||
return AE_SUPPORT;
|
||||
}
|
||||
static inline bool acpi_pm_device_can_wakeup(struct device *dev)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
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_set_device_wakeup(struct device *dev, bool enable)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT
|
||||
bool acpi_sleep_state_supported(u8 sleep_state);
|
||||
#else
|
||||
static inline bool acpi_sleep_state_supported(u8 sleep_state) { return false; }
|
||||
#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 ||
|
||||
((acpi_gbl_FADT.header.revision < 6) &&
|
||||
adev->power.states[ACPI_STATE_D3_HOT].flags.explicit_set);
|
||||
}
|
||||
|
||||
bool acpi_dev_hid_uid_match(struct acpi_device *adev, const char *hid2, const char *uid2);
|
||||
|
||||
struct acpi_device *
|
||||
acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv);
|
||||
|
||||
static inline void acpi_dev_put(struct acpi_device *adev)
|
||||
{
|
||||
if (adev)
|
||||
put_device(&adev->dev);
|
||||
}
|
||||
#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__*/
|
|
@ -0,0 +1,118 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
/*
|
||||
* 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>
|
||||
*/
|
||||
|
||||
#ifndef __ACPI_DRIVERS_H__
|
||||
#define __ACPI_DRIVERS_H__
|
||||
|
||||
#define ACPI_MAX_STRING 80
|
||||
|
||||
/*
|
||||
* Please update drivers/acpi/debug.c and Documentation/firmware-guide/acpi/debug.rst
|
||||
* 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"
|
||||
#define ACPI_ECDT_HID "LNXEC"
|
||||
/* 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;
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
struct pci_dev *acpi_get_pci_dev(acpi_handle);
|
||||
#else
|
||||
static inline struct pci_dev *acpi_get_pci_dev(acpi_handle handle)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* 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__*/
|
|
@ -0,0 +1,27 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ACPI_IO_H_
|
||||
#define _ACPI_IO_H_
|
||||
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <asm/acpi.h>
|
||||
|
||||
#ifndef acpi_os_ioremap
|
||||
static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
|
||||
acpi_size size)
|
||||
{
|
||||
return ioremap_cache(phys, size);
|
||||
}
|
||||
#endif
|
||||
|
||||
extern bool acpi_permanent_mmap;
|
||||
|
||||
void __iomem __ref
|
||||
*acpi_os_map_iomem(acpi_physical_address phys, acpi_size size);
|
||||
void __ref acpi_os_unmap_iomem(void __iomem *virt, acpi_size size);
|
||||
void __iomem *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size);
|
||||
|
||||
void __iomem *acpi_os_map_generic_address(struct acpi_generic_address *addr);
|
||||
void acpi_os_unmap_generic_address(struct acpi_generic_address *addr);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,57 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* acpi_lpat.h - LPAT table processing functions
|
||||
*
|
||||
* Copyright (C) 2015 Intel Corporation. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef ACPI_LPAT_H
|
||||
#define ACPI_LPAT_H
|
||||
|
||||
struct acpi_lpat {
|
||||
int temp;
|
||||
int raw;
|
||||
};
|
||||
|
||||
struct acpi_lpat_conversion_table {
|
||||
struct acpi_lpat *lpat;
|
||||
int lpat_count;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_ACPI
|
||||
|
||||
int acpi_lpat_raw_to_temp(struct acpi_lpat_conversion_table *lpat_table,
|
||||
int raw);
|
||||
int acpi_lpat_temp_to_raw(struct acpi_lpat_conversion_table *lpat_table,
|
||||
int temp);
|
||||
struct acpi_lpat_conversion_table *acpi_lpat_get_conversion_table(acpi_handle
|
||||
handle);
|
||||
void acpi_lpat_free_conversion_table(struct acpi_lpat_conversion_table
|
||||
*lpat_table);
|
||||
|
||||
#else
|
||||
static int acpi_lpat_raw_to_temp(struct acpi_lpat_conversion_table *lpat_table,
|
||||
int raw)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int acpi_lpat_temp_to_raw(struct acpi_lpat_conversion_table *lpat_table,
|
||||
int temp)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct acpi_lpat_conversion_table *acpi_lpat_get_conversion_table(
|
||||
acpi_handle handle)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void acpi_lpat_free_conversion_table(struct acpi_lpat_conversion_table
|
||||
*lpat_table)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -0,0 +1,42 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef __ACPI_NUMA_H
|
||||
#define __ACPI_NUMA_H
|
||||
|
||||
#ifdef CONFIG_ACPI_NUMA
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/numa.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;
|
||||
extern void disable_srat(void);
|
||||
|
||||
extern void bad_srat(void);
|
||||
extern int srat_disabled(void);
|
||||
|
||||
#else /* CONFIG_ACPI_NUMA */
|
||||
static inline void disable_srat(void)
|
||||
{
|
||||
}
|
||||
static inline int pxm_to_node(int pxm)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_ACPI_NUMA */
|
||||
|
||||
#ifdef CONFIG_ACPI_HMAT
|
||||
extern void disable_hmat(void);
|
||||
#else /* CONFIG_ACPI_HMAT */
|
||||
static inline void disable_hmat(void)
|
||||
{
|
||||
}
|
||||
#endif /* CONFIG_ACPI_HMAT */
|
||||
#endif /* __ACP_NUMA_H */
|
|
@ -0,0 +1,419 @@
|
|||
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
|
||||
/******************************************************************************
|
||||
*
|
||||
* 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 - 2020, Intel Corp.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#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,
|
||||
acpi_string *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
|
||||
|
||||
/*
|
||||
* RAW spinlock primitives. If the OS does not provide them, fallback to
|
||||
* spinlock primitives
|
||||
*/
|
||||
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_raw_lock
|
||||
# define acpi_os_create_raw_lock(out_handle) acpi_os_create_lock(out_handle)
|
||||
#endif
|
||||
|
||||
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_delete_raw_lock
|
||||
# define acpi_os_delete_raw_lock(handle) acpi_os_delete_lock(handle)
|
||||
#endif
|
||||
|
||||
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_raw_lock
|
||||
# define acpi_os_acquire_raw_lock(handle) acpi_os_acquire_lock(handle)
|
||||
#endif
|
||||
|
||||
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_release_raw_lock
|
||||
# define acpi_os_release_raw_lock(handle, flags) \
|
||||
acpi_os_release_lock(handle, 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
|
||||
*/
|
||||
int acpi_os_read_iomem(void __iomem *virt_addr, u64 *value, u32 width);
|
||||
|
||||
#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
|
||||
|
||||
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_enter_sleep
|
||||
acpi_status acpi_os_enter_sleep(u8 sleep_state, u32 rega_value, u32 regb_value);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Debug print routines
|
||||
*/
|
||||
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_printf
|
||||
ACPI_PRINTF_LIKE(1)
|
||||
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 IO
|
||||
*/
|
||||
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_line
|
||||
acpi_status acpi_os_get_line(char *buffer, u32 buffer_length, u32 *bytes_read);
|
||||
#endif
|
||||
|
||||
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize_debugger
|
||||
acpi_status acpi_os_initialize_debugger(void);
|
||||
#endif
|
||||
|
||||
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate_debugger
|
||||
void acpi_os_terminate_debugger(void);
|
||||
#endif
|
||||
|
||||
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_wait_command_ready
|
||||
acpi_status acpi_os_wait_command_ready(void);
|
||||
#endif
|
||||
|
||||
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_notify_command_complete
|
||||
acpi_status acpi_os_notify_command_complete(void);
|
||||
#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
|
||||
|
||||
/*
|
||||
* 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
|
||||
|
||||
#endif /* __ACPIOSXF_H__ */
|
|
@ -0,0 +1,964 @@
|
|||
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: acpixf.h - External interfaces to the ACPI subsystem
|
||||
*
|
||||
* Copyright (C) 2000 - 2020, Intel Corp.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef __ACXFACE_H__
|
||||
#define __ACXFACE_H__
|
||||
|
||||
/* Current ACPICA subsystem version in YYYYMMDD format */
|
||||
|
||||
#define ACPI_CA_VERSION 0x20200925
|
||||
|
||||
#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 validate (map) an entire table to verify
|
||||
* checksum/duplication in early stage before install. Set this to TRUE to
|
||||
* allow early table validation 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 allow such
|
||||
* validation.
|
||||
*/
|
||||
ACPI_INIT_GLOBAL(u8, acpi_gbl_enable_table_validation, 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);
|
||||
|
||||
/*
|
||||
* Maximum timeout for While() loop iterations before forced method abort.
|
||||
* This mechanism is intended to prevent infinite loops during interpreter
|
||||
* execution within a host kernel.
|
||||
*/
|
||||
ACPI_INIT_GLOBAL(u32, acpi_gbl_max_loop_iterations, ACPI_MAX_LOOP_TIMEOUT);
|
||||
|
||||
/*
|
||||
* Optionally ignore AE_NOT_FOUND errors from named reference package elements
|
||||
* during DSDT/SSDT table loading. This reduces error "noise" in platforms
|
||||
* whose firmware is carrying around a bunch of unused package objects that
|
||||
* refer to non-existent named objects. However, If the AML actually tries to
|
||||
* use such a package, the unresolved element(s) will be replaced with NULL
|
||||
* elements.
|
||||
*/
|
||||
ACPI_INIT_GLOBAL(u8, acpi_gbl_ignore_package_resolution_errors, 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);
|
||||
|
||||
/* Optionally enable timer output with Debug Object output */
|
||||
|
||||
ACPI_INIT_GLOBAL(u8, acpi_gbl_display_debug_timer, FALSE);
|
||||
|
||||
/*
|
||||
* Debugger command handshake globals. Host OSes need to access these
|
||||
* variables to implement their own command handshake mechanism.
|
||||
*/
|
||||
#ifdef ACPI_DEBUGGER
|
||||
ACPI_INIT_GLOBAL(u8, acpi_gbl_method_executing, FALSE);
|
||||
ACPI_GLOBAL(char, acpi_gbl_db_line_buf[ACPI_DB_LINE_BUFFER_SIZE]);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 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_UINT32(prototype) \
|
||||
ACPI_EXTERNAL_RETURN_UINT32(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_UINT32(prototype) \
|
||||
static ACPI_INLINE prototype {return(0);}
|
||||
|
||||
#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 */
|
||||
|
||||
/*
|
||||
* Debugger prototypes
|
||||
*
|
||||
* All interfaces used by debugger will be configured
|
||||
* out of the ACPICA build unless the ACPI_DEBUGGER
|
||||
* flag is defined.
|
||||
*/
|
||||
#ifdef ACPI_DEBUGGER
|
||||
#define ACPI_DBR_DEPENDENT_RETURN_OK(prototype) \
|
||||
ACPI_EXTERNAL_RETURN_OK(prototype)
|
||||
|
||||
#define ACPI_DBR_DEPENDENT_RETURN_VOID(prototype) \
|
||||
ACPI_EXTERNAL_RETURN_VOID(prototype)
|
||||
|
||||
#else
|
||||
#define ACPI_DBR_DEPENDENT_RETURN_OK(prototype) \
|
||||
static ACPI_INLINE prototype {return(AE_OK);}
|
||||
|
||||
#define ACPI_DBR_DEPENDENT_RETURN_VOID(prototype) \
|
||||
static ACPI_INLINE prototype {return;}
|
||||
|
||||
#endif /* ACPI_DEBUGGER */
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* ACPICA public interface prototypes
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
* Initialization
|
||||
*/
|
||||
ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_INIT_FUNCTION
|
||||
acpi_initialize_tables(struct acpi_table_desc
|
||||
*initial_storage,
|
||||
u32 initial_table_count,
|
||||
u8 allow_resize))
|
||||
ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_INIT_FUNCTION
|
||||
acpi_initialize_subsystem(void))
|
||||
ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_INIT_FUNCTION
|
||||
acpi_enable_subsystem(u32 flags))
|
||||
ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_INIT_FUNCTION
|
||||
acpi_initialize_objects(u32 flags))
|
||||
ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_INIT_FUNCTION
|
||||
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 ACPI_INIT_FUNCTION
|
||||
acpi_install_table(acpi_physical_address address,
|
||||
u8 physical))
|
||||
|
||||
ACPI_EXTERNAL_RETURN_STATUS(acpi_status
|
||||
acpi_load_table(struct acpi_table_header *table,
|
||||
u32 *table_idx))
|
||||
|
||||
ACPI_EXTERNAL_RETURN_STATUS(acpi_status
|
||||
acpi_unload_table(u32 table_index))
|
||||
|
||||
ACPI_EXTERNAL_RETURN_STATUS(acpi_status
|
||||
acpi_unload_parent_table(acpi_handle object))
|
||||
|
||||
ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_INIT_FUNCTION
|
||||
acpi_load_tables(void))
|
||||
|
||||
/*
|
||||
* ACPI table manipulation interfaces
|
||||
*/
|
||||
ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_INIT_FUNCTION
|
||||
acpi_reallocate_root_table(void))
|
||||
|
||||
ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_INIT_FUNCTION
|
||||
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_VOID(void acpi_put_table(struct acpi_table_header *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_mask_gpe(acpi_handle gpe_device,
|
||||
u32 gpe_number, u8 is_masked))
|
||||
|
||||
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_UINT32(u32 acpi_dispatch_gpe(acpi_handle gpe_device, u32 gpe_number))
|
||||
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_UINT32(u32 acpi_any_gpe_status_set(u32 gpe_skip_number))
|
||||
ACPI_HW_DEPENDENT_RETURN_UINT32(u32 acpi_any_fixed_event_status_set(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_vector
|
||||
(acpi_physical_address physical_address,
|
||||
acpi_physical_address physical_address64))
|
||||
/*
|
||||
* 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(1)
|
||||
void ACPI_INTERNAL_VAR_XFACE
|
||||
acpi_info(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(4)
|
||||
void ACPI_INTERNAL_VAR_XFACE
|
||||
acpi_bios_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_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_status acpi_initialize_debugger(void);
|
||||
|
||||
void acpi_terminate_debugger(void);
|
||||
|
||||
/*
|
||||
* Divergences
|
||||
*/
|
||||
ACPI_EXTERNAL_RETURN_STATUS(acpi_status
|
||||
acpi_get_data_full(acpi_handle object,
|
||||
acpi_object_handler handler,
|
||||
void **data,
|
||||
void (*callback)(void *)))
|
||||
|
||||
void acpi_run_debugger(char *batch_buffer);
|
||||
|
||||
void acpi_set_debugger_thread_id(acpi_thread_id thread_id);
|
||||
|
||||
#endif /* __ACXFACE_H__ */
|
|
@ -0,0 +1,678 @@
|
|||
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: acrestyp.h - Defines, types, and structures for resource descriptors
|
||||
*
|
||||
* Copyright (C) 2000 - 2020, Intel Corp.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#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 shareable;
|
||||
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_label {
|
||||
u16 string_length;
|
||||
char *string_ptr;
|
||||
};
|
||||
|
||||
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 shareable;
|
||||
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 shareable; /* 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 connection_sharing; \
|
||||
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)
|
||||
|
||||
struct acpi_resource_pin_function {
|
||||
u8 revision_id;
|
||||
u8 pin_config;
|
||||
u8 shareable; /* For values, see Interrupt Attributes above */
|
||||
u16 function_number;
|
||||
u16 pin_table_length;
|
||||
u16 vendor_length;
|
||||
struct acpi_resource_source resource_source;
|
||||
u16 *pin_table;
|
||||
u8 *vendor_data;
|
||||
};
|
||||
|
||||
struct acpi_resource_pin_config {
|
||||
u8 revision_id;
|
||||
u8 producer_consumer; /* For values, see Producer/Consumer above */
|
||||
u8 shareable; /* For values, see Interrupt Attributes above */
|
||||
u8 pin_config_type;
|
||||
u32 pin_config_value;
|
||||
u16 pin_table_length;
|
||||
u16 vendor_length;
|
||||
struct acpi_resource_source resource_source;
|
||||
u16 *pin_table;
|
||||
u8 *vendor_data;
|
||||
};
|
||||
|
||||
/* Values for pin_config_type field above */
|
||||
|
||||
#define ACPI_PIN_CONFIG_DEFAULT 0
|
||||
#define ACPI_PIN_CONFIG_BIAS_PULL_UP 1
|
||||
#define ACPI_PIN_CONFIG_BIAS_PULL_DOWN 2
|
||||
#define ACPI_PIN_CONFIG_BIAS_DEFAULT 3
|
||||
#define ACPI_PIN_CONFIG_BIAS_DISABLE 4
|
||||
#define ACPI_PIN_CONFIG_BIAS_HIGH_IMPEDANCE 5
|
||||
#define ACPI_PIN_CONFIG_BIAS_BUS_HOLD 6
|
||||
#define ACPI_PIN_CONFIG_DRIVE_OPEN_DRAIN 7
|
||||
#define ACPI_PIN_CONFIG_DRIVE_OPEN_SOURCE 8
|
||||
#define ACPI_PIN_CONFIG_DRIVE_PUSH_PULL 9
|
||||
#define ACPI_PIN_CONFIG_DRIVE_STRENGTH 10
|
||||
#define ACPI_PIN_CONFIG_SLEW_RATE 11
|
||||
#define ACPI_PIN_CONFIG_INPUT_DEBOUNCE 12
|
||||
#define ACPI_PIN_CONFIG_INPUT_SCHMITT_TRIGGER 13
|
||||
|
||||
struct acpi_resource_pin_group {
|
||||
u8 revision_id;
|
||||
u8 producer_consumer; /* For values, see Producer/Consumer above */
|
||||
u16 pin_table_length;
|
||||
u16 vendor_length;
|
||||
u16 *pin_table;
|
||||
struct acpi_resource_label resource_label;
|
||||
u8 *vendor_data;
|
||||
};
|
||||
|
||||
struct acpi_resource_pin_group_function {
|
||||
u8 revision_id;
|
||||
u8 producer_consumer; /* For values, see Producer/Consumer above */
|
||||
u8 shareable; /* For values, see Interrupt Attributes above */
|
||||
u16 function_number;
|
||||
u16 vendor_length;
|
||||
struct acpi_resource_source resource_source;
|
||||
struct acpi_resource_label resource_source_label;
|
||||
u8 *vendor_data;
|
||||
};
|
||||
|
||||
struct acpi_resource_pin_group_config {
|
||||
u8 revision_id;
|
||||
u8 producer_consumer; /* For values, see Producer/Consumer above */
|
||||
u8 shareable; /* For values, see Interrupt Attributes above */
|
||||
u8 pin_config_type; /* For values, see pin_config_type above */
|
||||
u32 pin_config_value;
|
||||
u16 vendor_length;
|
||||
struct acpi_resource_source resource_source;
|
||||
struct acpi_resource_label resource_source_label;
|
||||
u8 *vendor_data;
|
||||
};
|
||||
|
||||
/* 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_PIN_FUNCTION 20 /* ACPI 6.2 */
|
||||
#define ACPI_RESOURCE_TYPE_PIN_CONFIG 21 /* ACPI 6.2 */
|
||||
#define ACPI_RESOURCE_TYPE_PIN_GROUP 22 /* ACPI 6.2 */
|
||||
#define ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION 23 /* ACPI 6.2 */
|
||||
#define ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG 24 /* ACPI 6.2 */
|
||||
#define ACPI_RESOURCE_TYPE_MAX 24
|
||||
|
||||
/* 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;
|
||||
struct acpi_resource_pin_function pin_function;
|
||||
struct acpi_resource_pin_config pin_config;
|
||||
struct acpi_resource_pin_group pin_group;
|
||||
struct acpi_resource_pin_group_function pin_group_function;
|
||||
struct acpi_resource_pin_group_config pin_group_config;
|
||||
|
||||
/* 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__ */
|
|
@ -0,0 +1,401 @@
|
|||
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: actbl.h - Basic ACPI Table Definitions
|
||||
*
|
||||
* Copyright (C) 2000 - 2020, Intel Corp.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#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 */
|
||||
#define ACPI_OEM_NAME "OEM" /* Short name for OEM, 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_NAMESEG_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_NAMESEG_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 6
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/* 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;
|
||||
u16 validation_count;
|
||||
};
|
||||
|
||||
/*
|
||||
* Maximum value of the validation_count field in struct acpi_table_desc.
|
||||
* When reached, validation_count cannot be changed any more and the table will
|
||||
* be permanently regarded as validated.
|
||||
*
|
||||
* This is to prevent situations in which unbalanced table get/put operations
|
||||
* may cause premature table unmapping in the OS to happen.
|
||||
*
|
||||
* The maximum validation count can be defined to any value, but should be
|
||||
* greater than the maximum number of OS early stage mapping slots to avoid
|
||||
* leaking early stage table mappings to the late stage.
|
||||
*/
|
||||
#define ACPI_MAX_TABLE_VALIDATIONS ACPI_UINT16_MAX
|
||||
|
||||
/* 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_VERIFIED (4)
|
||||
#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))
|
||||
|
||||
#define ACPI_FADT_CONFORMANCE "ACPI 6.1 (FADT version 6)"
|
||||
|
||||
#endif /* __ACTBL_H__ */
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,723 @@
|
|||
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: actbl3.h - ACPI Table Definitions
|
||||
*
|
||||
* Copyright (C) 2000 - 2020, Intel Corp.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef __ACTBL3_H__
|
||||
#define __ACTBL3_H__
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Additional ACPI Tables
|
||||
*
|
||||
* These tables are not consumed directly by the ACPICA subsystem, but are
|
||||
* included here to support device drivers and the AML disassembler.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
* 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_SLIC "SLIC" /* Software Licensing Description Table */
|
||||
#define ACPI_SIG_SLIT "SLIT" /* System Locality Distance Information Table */
|
||||
#define ACPI_SIG_SPCR "SPCR" /* Serial Port Console Redirection table */
|
||||
#define ACPI_SIG_SPMI "SPMI" /* Server Platform Management Interface table */
|
||||
#define ACPI_SIG_SRAT "SRAT" /* System Resource Affinity Table */
|
||||
#define ACPI_SIG_STAO "STAO" /* Status Override 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 */
|
||||
#define ACPI_SIG_WPBT "WPBT" /* Windows Platform Binary Table */
|
||||
#define ACPI_SIG_WSMT "WSMT" /* Windows SMM Security Mitigations Table */
|
||||
#define ACPI_SIG_XENV "XENV" /* Xen Environment table */
|
||||
#define ACPI_SIG_XXXX "XXXX" /* Intermediate AML header for ASL/ASL+ converter */
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* 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 */
|
||||
};
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* 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 */
|
||||
};
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* SPCR - Serial Port Console Redirection table
|
||||
* Version 2
|
||||
*
|
||||
* Conforms to "Serial Port Console Redirection Table",
|
||||
* Version 1.03, August 10, 2015
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
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)
|
||||
|
||||
/* Values for Interface Type: See the definition of the DBG2 table */
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* 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 */
|
||||
};
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* 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_GIC_ITS_AFFINITY = 4, /* ACPI 6.2 */
|
||||
ACPI_SRAT_TYPE_GENERIC_AFFINITY = 5, /* ACPI 6.3 */
|
||||
ACPI_SRAT_TYPE_RESERVED = 6 /* 5 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 */
|
||||
|
||||
/* 4: GCC ITS Affinity (ACPI 6.2) */
|
||||
|
||||
struct acpi_srat_gic_its_affinity {
|
||||
struct acpi_subtable_header header;
|
||||
u32 proximity_domain;
|
||||
u16 reserved;
|
||||
u32 its_id;
|
||||
};
|
||||
|
||||
/* 5: Generic Initiator Affinity Structure (ACPI 6.3) */
|
||||
|
||||
struct acpi_srat_generic_affinity {
|
||||
struct acpi_subtable_header header;
|
||||
u8 reserved;
|
||||
u8 device_handle_type;
|
||||
u32 proximity_domain;
|
||||
u8 device_handle[16];
|
||||
u32 flags;
|
||||
u32 reserved1;
|
||||
};
|
||||
|
||||
/* Flags for struct acpi_srat_generic_affinity */
|
||||
|
||||
#define ACPI_SRAT_GENERIC_AFFINITY_ENABLED (1) /* 00: Use affinity structure */
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* STAO - Status Override Table (_STA override) - ACPI 6.0
|
||||
* Version 1
|
||||
*
|
||||
* Conforms to "ACPI Specification for Status Override Table"
|
||||
* 6 January 2015
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
struct acpi_table_stao {
|
||||
struct acpi_table_header header; /* Common ACPI table header */
|
||||
u8 ignore_uart;
|
||||
};
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* TCPA - Trusted Computing Platform Alliance table
|
||||
* Version 2
|
||||
*
|
||||
* TCG Hardware Interface Table for TPM 1.2 Clients and Servers
|
||||
*
|
||||
* Conforms to "TCG ACPI Specification, Family 1.2 and 2.0",
|
||||
* Version 1.2, Revision 8
|
||||
* February 27, 2017
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* TCG Hardware Interface Table for TPM 2.0 Clients and Servers
|
||||
*
|
||||
* Conforms to "TCG ACPI Specification, Family 1.2 and 2.0",
|
||||
* Version 1.2, Revision 8
|
||||
* February 27, 2017
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/* Revision 3 */
|
||||
|
||||
struct acpi_table_tpm23 {
|
||||
struct acpi_table_header header; /* Common ACPI table header */
|
||||
u32 reserved;
|
||||
u64 control_address;
|
||||
u32 start_method;
|
||||
};
|
||||
|
||||
/* Value for start_method above */
|
||||
|
||||
#define ACPI_TPM23_ACPI_START_METHOD 2
|
||||
|
||||
/*
|
||||
* Optional trailer for revision 3. If start method is 2, there is a 4 byte
|
||||
* reserved area of all zeros.
|
||||
*/
|
||||
struct acpi_tmp23_trailer {
|
||||
u32 reserved;
|
||||
};
|
||||
|
||||
/* Revision 4 */
|
||||
|
||||
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 */
|
||||
};
|
||||
|
||||
/* Optional trailer for revision 4 holding platform-specific data */
|
||||
struct acpi_tpm2_phy {
|
||||
u8 start_method_specific[12];
|
||||
u32 log_area_minimum_length;
|
||||
u64 log_area_start_address;
|
||||
};
|
||||
|
||||
/* Values for start_method above */
|
||||
|
||||
#define ACPI_TPM2_NOT_ALLOWED 0
|
||||
#define ACPI_TPM2_RESERVED1 1
|
||||
#define ACPI_TPM2_START_METHOD 2
|
||||
#define ACPI_TPM2_RESERVED3 3
|
||||
#define ACPI_TPM2_RESERVED4 4
|
||||
#define ACPI_TPM2_RESERVED5 5
|
||||
#define ACPI_TPM2_MEMORY_MAPPED 6
|
||||
#define ACPI_TPM2_COMMAND_BUFFER 7
|
||||
#define ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD 8
|
||||
#define ACPI_TPM2_RESERVED9 9
|
||||
#define ACPI_TPM2_RESERVED10 10
|
||||
#define ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC 11 /* V1.2 Rev 8 */
|
||||
#define ACPI_TPM2_RESERVED 12
|
||||
|
||||
/* Optional trailer appears after any start_method subtables */
|
||||
|
||||
struct acpi_tpm2_trailer {
|
||||
u8 method_parameters[12];
|
||||
u32 minimum_log_length; /* Minimum length for the event log area */
|
||||
u64 log_address; /* Address of the event log area */
|
||||
};
|
||||
|
||||
/*
|
||||
* Subtables (start_method-specific)
|
||||
*/
|
||||
|
||||
/* 11: Start Method for ARM SMC (V1.2 Rev 8) */
|
||||
|
||||
struct acpi_tpm2_arm_smc {
|
||||
u32 global_interrupt;
|
||||
u8 interrupt_flags;
|
||||
u8 operation_flags;
|
||||
u16 reserved;
|
||||
u32 function_id;
|
||||
};
|
||||
|
||||
/* Values for interrupt_flags above */
|
||||
|
||||
#define ACPI_TPM2_INTERRUPT_SUPPORT (1)
|
||||
|
||||
/* Values for operation_flags above */
|
||||
|
||||
#define ACPI_TPM2_IDLE_SUPPORT (1)
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* 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;
|
||||
};
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* WPBT - Windows Platform Environment Table (ACPI 6.0)
|
||||
* Version 1
|
||||
*
|
||||
* Conforms to "Windows Platform Binary Table (WPBT)" 29 November 2011
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
struct acpi_table_wpbt {
|
||||
struct acpi_table_header header; /* Common ACPI table header */
|
||||
u32 handoff_size;
|
||||
u64 handoff_address;
|
||||
u8 layout;
|
||||
u8 type;
|
||||
u16 arguments_length;
|
||||
};
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* WSMT - Windows SMM Security Mitigations Table
|
||||
* Version 1
|
||||
*
|
||||
* Conforms to "Windows SMM Security Mitigations Table",
|
||||
* Version 1.0, April 18, 2016
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
struct acpi_table_wsmt {
|
||||
struct acpi_table_header header; /* Common ACPI table header */
|
||||
u32 protection_flags;
|
||||
};
|
||||
|
||||
/* Flags for protection_flags field above */
|
||||
|
||||
#define ACPI_WSMT_FIXED_COMM_BUFFERS (1)
|
||||
#define ACPI_WSMT_COMM_BUFFER_NESTED_PTR_PROTECTION (2)
|
||||
#define ACPI_WSMT_SYSTEM_RESOURCE_PROTECTION (4)
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* XENV - Xen Environment Table (ACPI 6.0)
|
||||
* Version 1
|
||||
*
|
||||
* Conforms to "ACPI Specification for Xen Environment Table" 4 January 2015
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
struct acpi_table_xenv {
|
||||
struct acpi_table_header header; /* Common ACPI table header */
|
||||
u64 grant_table_address;
|
||||
u64 grant_table_size;
|
||||
u32 event_interrupt;
|
||||
u8 event_flags;
|
||||
};
|
||||
|
||||
/* Reset to default packing */
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#endif /* __ACTBL3_H__ */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,67 @@
|
|||
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: acuuid.h - ACPI-related UUID/GUID definitions
|
||||
*
|
||||
* Copyright (C) 2000 - 2020, Intel Corp.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef __ACUUID_H__
|
||||
#define __ACUUID_H__
|
||||
|
||||
/*
|
||||
* Note1: UUIDs and GUIDs are defined to be identical in ACPI.
|
||||
*
|
||||
* Note2: This file is standalone and should remain that way.
|
||||
*/
|
||||
|
||||
/* Controllers */
|
||||
|
||||
#define UUID_GPIO_CONTROLLER "4f248f40-d5e2-499f-834c-27758ea1cd3f"
|
||||
#define UUID_USB_CONTROLLER "ce2ee385-00e6-48cb-9f05-2edb927c4899"
|
||||
#define UUID_SATA_CONTROLLER "e4db149b-fcfe-425b-a6d8-92357d78fc7f"
|
||||
|
||||
/* Devices */
|
||||
|
||||
#define UUID_PCI_HOST_BRIDGE "33db4d5b-1ff7-401c-9657-7441c03dd766"
|
||||
#define UUID_I2C_DEVICE "3cdff6f7-4267-4555-ad05-b30a3d8938de"
|
||||
#define UUID_POWER_BUTTON "dfbcf3c5-e7a5-44e6-9c1f-29c76f6e059c"
|
||||
#define UUID_MEMORY_DEVICE "03b19910-f473-11dd-87af-0800200c9a66"
|
||||
#define UUID_GENERIC_BUTTONS_DEVICE "fa6bd625-9ce8-470d-a2c7-b3ca36c4282e"
|
||||
#define UUID_NVDIMM_ROOT_DEVICE "2f10e7a4-9e91-11e4-89d3-123b93f75cba"
|
||||
#define UUID_CONTROL_METHOD_BATTERY "f18fc78b-0f15-4978-b793-53f833a1d35b"
|
||||
|
||||
/* Interfaces */
|
||||
|
||||
#define UUID_DEVICE_LABELING "e5c937d0-3553-4d7a-9117-ea4d19c3434d"
|
||||
#define UUID_PHYSICAL_PRESENCE "3dddfaa6-361b-4eb4-a424-8d10089d1653"
|
||||
|
||||
/* NVDIMM - NFIT table */
|
||||
|
||||
#define UUID_VOLATILE_MEMORY "7305944f-fdda-44e3-b16c-3f22d252e5d0"
|
||||
#define UUID_PERSISTENT_MEMORY "66f0d379-b4f3-4074-ac43-0d3318b78cdb"
|
||||
#define UUID_CONTROL_REGION "92f701f6-13b4-405d-910b-299367e8234c"
|
||||
#define UUID_DATA_REGION "91af0530-5d86-470e-a6b0-0a2db9408249"
|
||||
#define UUID_VOLATILE_VIRTUAL_DISK "77ab535a-45fc-624b-5560-f7b281d1f96e"
|
||||
#define UUID_VOLATILE_VIRTUAL_CD "3d5abd30-4175-87ce-6d64-d2ade523c4bb"
|
||||
#define UUID_PERSISTENT_VIRTUAL_DISK "5cea02c9-4d07-69d3-269f-4496fbe096f9"
|
||||
#define UUID_PERSISTENT_VIRTUAL_CD "08018188-42cd-bb48-100f-5387d53ded3d"
|
||||
|
||||
/* Processor Properties (ACPI 6.2) */
|
||||
|
||||
#define UUID_CACHE_PROPERTIES "6DC63E77-257E-4E78-A973-A21F2796898D"
|
||||
#define UUID_PHYSICAL_PROPERTY "DDE4D59A-AA42-4349-B407-EA40F57D9FB7"
|
||||
|
||||
/* Miscellaneous */
|
||||
|
||||
#define UUID_PLATFORM_CAPABILITIES "0811b06e-4a27-44f9-8d60-3cbbc22e7b48"
|
||||
#define UUID_DYNAMIC_ENUMERATION "d8c1a3a6-be9b-4c9b-91bf-c3cb81fc5daf"
|
||||
#define UUID_BATTERY_THERMAL_LIMIT "4c2067e3-887d-475c-9720-4af1d3ed602e"
|
||||
#define UUID_THERMAL_EXTENSIONS "14d399cd-7a27-4b18-8fb4-7cb7b9f4e500"
|
||||
#define UUID_DEVICE_PROPERTIES "daffd814-6eba-4d8c-8a91-bc9bbf4aa301"
|
||||
#define UUID_DEVICE_GRAPHS "ab02a46b-74c7-45a2-bd68-f7d344ef2153"
|
||||
#define UUID_HIERARCHICAL_DATA_EXTENSION "dbb8e3e6-5886-4ba6-8795-1319f52a966b"
|
||||
#define UUID_CORESIGHT_GRAPH "3ecbc8b6-1d0e-4fb3-8107-e627f805c6cd"
|
||||
|
||||
#endif /* __ACUUID_H__ */
|
|
@ -0,0 +1,58 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* apei.h - ACPI Platform Error Interface
|
||||
*/
|
||||
|
||||
#ifndef ACPI_APEI_H
|
||||
#define ACPI_APEI_H
|
||||
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/cper.h>
|
||||
#include <asm/ioctls.h>
|
||||
|
||||
#define APEI_ERST_INVALID_RECORD_ID 0xffffffffffffffffULL
|
||||
|
||||
#define APEI_ERST_CLEAR_RECORD _IOW('E', 1, u64)
|
||||
#define APEI_ERST_GET_RECORD_COUNT _IOR('E', 2, u32)
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
enum hest_status {
|
||||
HEST_ENABLED,
|
||||
HEST_DISABLED,
|
||||
HEST_NOT_FOUND,
|
||||
};
|
||||
|
||||
extern int hest_disable;
|
||||
extern int erst_disable;
|
||||
#ifdef CONFIG_ACPI_APEI_GHES
|
||||
extern bool ghes_disable;
|
||||
void __init ghes_init(void);
|
||||
#else
|
||||
#define ghes_disable 1
|
||||
static inline void ghes_init(void) { }
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ACPI_APEI
|
||||
void __init acpi_hest_init(void);
|
||||
#else
|
||||
static inline void acpi_hest_init(void) { }
|
||||
#endif
|
||||
|
||||
typedef int (*apei_hest_func_t)(struct acpi_hest_header *hest_hdr, void *data);
|
||||
int apei_hest_parse(apei_hest_func_t func, void *data);
|
||||
|
||||
int erst_write(const struct cper_record_header *record);
|
||||
ssize_t erst_get_record_count(void);
|
||||
int erst_get_record_id_begin(int *pos);
|
||||
int erst_get_record_id_next(int *pos, u64 *record_id);
|
||||
void erst_get_record_id_end(void);
|
||||
ssize_t erst_read(u64 record_id, struct cper_record_header *record,
|
||||
size_t buflen);
|
||||
int erst_clear(u64 record_id);
|
||||
|
||||
int arch_apei_enable_cmcff(struct acpi_hest_header *hest_hdr, void *data);
|
||||
void arch_apei_report_mem_error(int sev, struct cper_sec_mem_err *mem_err);
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -0,0 +1,23 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef __ACPI_BATTERY_H
|
||||
#define __ACPI_BATTERY_H
|
||||
|
||||
#include <linux/power_supply.h>
|
||||
|
||||
#define ACPI_BATTERY_CLASS "battery"
|
||||
|
||||
#define ACPI_BATTERY_NOTIFY_STATUS 0x80
|
||||
#define ACPI_BATTERY_NOTIFY_INFO 0x81
|
||||
#define ACPI_BATTERY_NOTIFY_THRESHOLD 0x82
|
||||
|
||||
struct acpi_battery_hook {
|
||||
const char *name;
|
||||
int (*add_battery)(struct power_supply *battery);
|
||||
int (*remove_battery)(struct power_supply *battery);
|
||||
struct list_head list;
|
||||
};
|
||||
|
||||
void battery_hook_register(struct acpi_battery_hook *hook);
|
||||
void battery_hook_unregister(struct acpi_battery_hook *hook);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,18 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef ACPI_BUTTON_H
|
||||
#define ACPI_BUTTON_H
|
||||
|
||||
#define ACPI_BUTTON_HID_POWER "PNP0C0C"
|
||||
#define ACPI_BUTTON_HID_LID "PNP0C0D"
|
||||
#define ACPI_BUTTON_HID_SLEEP "PNP0C0E"
|
||||
|
||||
#if IS_ENABLED(CONFIG_ACPI_BUTTON)
|
||||
extern int acpi_lid_open(void);
|
||||
#else
|
||||
static inline int acpi_lid_open(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#endif /* IS_ENABLED(CONFIG_ACPI_BUTTON) */
|
||||
|
||||
#endif /* ACPI_BUTTON_H */
|
|
@ -0,0 +1,146 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* CPPC (Collaborative Processor Performance Control) methods used
|
||||
* by CPUfreq drivers.
|
||||
*
|
||||
* (C) Copyright 2014, 2015 Linaro Ltd.
|
||||
* Author: Ashwin Chaugule <ashwin.chaugule@linaro.org>
|
||||
*/
|
||||
|
||||
#ifndef _CPPC_ACPI_H
|
||||
#define _CPPC_ACPI_H
|
||||
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
#include <acpi/pcc.h>
|
||||
#include <acpi/processor.h>
|
||||
|
||||
/* CPPCv2 and CPPCv3 support */
|
||||
#define CPPC_V2_REV 2
|
||||
#define CPPC_V3_REV 3
|
||||
#define CPPC_V2_NUM_ENT 21
|
||||
#define CPPC_V3_NUM_ENT 23
|
||||
|
||||
#define PCC_CMD_COMPLETE_MASK (1 << 0)
|
||||
#define PCC_ERROR_MASK (1 << 2)
|
||||
|
||||
#define MAX_CPC_REG_ENT 21
|
||||
|
||||
/* CPPC specific PCC commands. */
|
||||
#define CMD_READ 0
|
||||
#define CMD_WRITE 1
|
||||
|
||||
/* Each register has the folowing format. */
|
||||
struct cpc_reg {
|
||||
u8 descriptor;
|
||||
u16 length;
|
||||
u8 space_id;
|
||||
u8 bit_width;
|
||||
u8 bit_offset;
|
||||
u8 access_width;
|
||||
u64 __iomem address;
|
||||
} __packed;
|
||||
|
||||
/*
|
||||
* Each entry in the CPC table is either
|
||||
* of type ACPI_TYPE_BUFFER or
|
||||
* ACPI_TYPE_INTEGER.
|
||||
*/
|
||||
struct cpc_register_resource {
|
||||
acpi_object_type type;
|
||||
u64 __iomem *sys_mem_vaddr;
|
||||
union {
|
||||
struct cpc_reg reg;
|
||||
u64 int_value;
|
||||
} cpc_entry;
|
||||
};
|
||||
|
||||
/* Container to hold the CPC details for each CPU */
|
||||
struct cpc_desc {
|
||||
int num_entries;
|
||||
int version;
|
||||
int cpu_id;
|
||||
int write_cmd_status;
|
||||
int write_cmd_id;
|
||||
struct cpc_register_resource cpc_regs[MAX_CPC_REG_ENT];
|
||||
struct acpi_psd_package domain_info;
|
||||
struct kobject kobj;
|
||||
};
|
||||
|
||||
/* These are indexes into the per-cpu cpc_regs[]. Order is important. */
|
||||
enum cppc_regs {
|
||||
HIGHEST_PERF,
|
||||
NOMINAL_PERF,
|
||||
LOW_NON_LINEAR_PERF,
|
||||
LOWEST_PERF,
|
||||
GUARANTEED_PERF,
|
||||
DESIRED_PERF,
|
||||
MIN_PERF,
|
||||
MAX_PERF,
|
||||
PERF_REDUC_TOLERANCE,
|
||||
TIME_WINDOW,
|
||||
CTR_WRAP_TIME,
|
||||
REFERENCE_CTR,
|
||||
DELIVERED_CTR,
|
||||
PERF_LIMITED,
|
||||
ENABLE,
|
||||
AUTO_SEL_ENABLE,
|
||||
AUTO_ACT_WINDOW,
|
||||
ENERGY_PERF,
|
||||
REFERENCE_PERF,
|
||||
LOWEST_FREQ,
|
||||
NOMINAL_FREQ,
|
||||
};
|
||||
|
||||
/*
|
||||
* Categorization of registers as described
|
||||
* in the ACPI v.5.1 spec.
|
||||
* XXX: Only filling up ones which are used by governors
|
||||
* today.
|
||||
*/
|
||||
struct cppc_perf_caps {
|
||||
u32 guaranteed_perf;
|
||||
u32 highest_perf;
|
||||
u32 nominal_perf;
|
||||
u32 lowest_perf;
|
||||
u32 lowest_nonlinear_perf;
|
||||
u32 lowest_freq;
|
||||
u32 nominal_freq;
|
||||
};
|
||||
|
||||
struct cppc_perf_ctrls {
|
||||
u32 max_perf;
|
||||
u32 min_perf;
|
||||
u32 desired_perf;
|
||||
};
|
||||
|
||||
struct cppc_perf_fb_ctrs {
|
||||
u64 reference;
|
||||
u64 delivered;
|
||||
u64 reference_perf;
|
||||
u64 wraparound_time;
|
||||
};
|
||||
|
||||
/* Per CPU container for runtime CPPC management. */
|
||||
struct cppc_cpudata {
|
||||
int cpu;
|
||||
struct cppc_perf_caps perf_caps;
|
||||
struct cppc_perf_ctrls perf_ctrls;
|
||||
struct cppc_perf_fb_ctrs perf_fb_ctrs;
|
||||
struct cpufreq_policy *cur_policy;
|
||||
unsigned int shared_type;
|
||||
cpumask_var_t shared_cpu_map;
|
||||
};
|
||||
|
||||
extern int cppc_get_desired_perf(int cpunum, u64 *desired_perf);
|
||||
extern int cppc_get_perf_ctrs(int cpu, struct cppc_perf_fb_ctrs *perf_fb_ctrs);
|
||||
extern int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls);
|
||||
extern int cppc_get_perf_caps(int cpu, struct cppc_perf_caps *caps);
|
||||
extern int acpi_get_psd_map(struct cppc_cpudata **);
|
||||
extern unsigned int cppc_get_transition_latency(int cpu);
|
||||
extern bool cpc_ffh_supported(void);
|
||||
extern int cpc_read_ffh(int cpunum, struct cpc_reg *reg, u64 *val);
|
||||
extern int cpc_write_ffh(int cpunum, struct cpc_reg *reg, u64 val);
|
||||
|
||||
#endif /* _CPPC_ACPI_H*/
|
|
@ -0,0 +1,148 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef GHES_H
|
||||
#define GHES_H
|
||||
|
||||
#include <acpi/apei.h>
|
||||
#include <acpi/hed.h>
|
||||
|
||||
/*
|
||||
* One struct ghes is created for each generic hardware error source.
|
||||
* It provides the context for APEI hardware error timer/IRQ/SCI/NMI
|
||||
* handler.
|
||||
*
|
||||
* estatus: memory buffer for error status block, allocated during
|
||||
* HEST parsing.
|
||||
*/
|
||||
#define GHES_EXITING 0x0002
|
||||
|
||||
struct ghes {
|
||||
union {
|
||||
struct acpi_hest_generic *generic;
|
||||
struct acpi_hest_generic_v2 *generic_v2;
|
||||
};
|
||||
struct acpi_hest_generic_status *estatus;
|
||||
unsigned long flags;
|
||||
union {
|
||||
struct list_head list;
|
||||
struct timer_list timer;
|
||||
unsigned int irq;
|
||||
};
|
||||
};
|
||||
|
||||
struct ghes_estatus_node {
|
||||
struct llist_node llnode;
|
||||
struct acpi_hest_generic *generic;
|
||||
struct ghes *ghes;
|
||||
|
||||
int task_work_cpu;
|
||||
struct callback_head task_work;
|
||||
};
|
||||
|
||||
struct ghes_estatus_cache {
|
||||
u32 estatus_len;
|
||||
atomic_t count;
|
||||
struct acpi_hest_generic *generic;
|
||||
unsigned long long time_in;
|
||||
struct rcu_head rcu;
|
||||
};
|
||||
|
||||
enum {
|
||||
GHES_SEV_NO = 0x0,
|
||||
GHES_SEV_CORRECTED = 0x1,
|
||||
GHES_SEV_RECOVERABLE = 0x2,
|
||||
GHES_SEV_PANIC = 0x3,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_ACPI_APEI_GHES
|
||||
/**
|
||||
* ghes_register_vendor_record_notifier - register a notifier for vendor
|
||||
* records that the kernel would otherwise ignore.
|
||||
* @nb: pointer to the notifier_block structure of the event handler.
|
||||
*
|
||||
* return 0 : SUCCESS, non-zero : FAIL
|
||||
*/
|
||||
int ghes_register_vendor_record_notifier(struct notifier_block *nb);
|
||||
|
||||
/**
|
||||
* ghes_unregister_vendor_record_notifier - unregister the previously
|
||||
* registered vendor record notifier.
|
||||
* @nb: pointer to the notifier_block structure of the vendor record handler.
|
||||
*/
|
||||
void ghes_unregister_vendor_record_notifier(struct notifier_block *nb);
|
||||
#endif
|
||||
|
||||
int ghes_estatus_pool_init(unsigned int num_ghes);
|
||||
|
||||
/* From drivers/edac/ghes_edac.c */
|
||||
|
||||
#ifdef CONFIG_EDAC_GHES
|
||||
void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err);
|
||||
|
||||
int ghes_edac_register(struct ghes *ghes, struct device *dev);
|
||||
|
||||
void ghes_edac_unregister(struct ghes *ghes);
|
||||
|
||||
#else
|
||||
static inline void ghes_edac_report_mem_error(int sev,
|
||||
struct cper_sec_mem_err *mem_err)
|
||||
{
|
||||
}
|
||||
|
||||
static inline int ghes_edac_register(struct ghes *ghes, struct device *dev)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static inline void ghes_edac_unregister(struct ghes *ghes)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline int acpi_hest_get_version(struct acpi_hest_generic_data *gdata)
|
||||
{
|
||||
return gdata->revision >> 8;
|
||||
}
|
||||
|
||||
static inline void *acpi_hest_get_payload(struct acpi_hest_generic_data *gdata)
|
||||
{
|
||||
if (acpi_hest_get_version(gdata) >= 3)
|
||||
return (void *)(((struct acpi_hest_generic_data_v300 *)(gdata)) + 1);
|
||||
|
||||
return gdata + 1;
|
||||
}
|
||||
|
||||
static inline int acpi_hest_get_error_length(struct acpi_hest_generic_data *gdata)
|
||||
{
|
||||
return ((struct acpi_hest_generic_data *)(gdata))->error_data_length;
|
||||
}
|
||||
|
||||
static inline int acpi_hest_get_size(struct acpi_hest_generic_data *gdata)
|
||||
{
|
||||
if (acpi_hest_get_version(gdata) >= 3)
|
||||
return sizeof(struct acpi_hest_generic_data_v300);
|
||||
|
||||
return sizeof(struct acpi_hest_generic_data);
|
||||
}
|
||||
|
||||
static inline int acpi_hest_get_record_size(struct acpi_hest_generic_data *gdata)
|
||||
{
|
||||
return (acpi_hest_get_size(gdata) + acpi_hest_get_error_length(gdata));
|
||||
}
|
||||
|
||||
static inline void *acpi_hest_get_next(struct acpi_hest_generic_data *gdata)
|
||||
{
|
||||
return (void *)(gdata) + acpi_hest_get_record_size(gdata);
|
||||
}
|
||||
|
||||
#define apei_estatus_for_each_section(estatus, section) \
|
||||
for (section = (struct acpi_hest_generic_data *)(estatus + 1); \
|
||||
(void *)section - (void *)(estatus + 1) < estatus->data_length; \
|
||||
section = acpi_hest_get_next(section))
|
||||
|
||||
#ifdef CONFIG_ACPI_APEI_SEA
|
||||
int ghes_notify_sea(void);
|
||||
#else
|
||||
static inline int ghes_notify_sea(void) { return -ENOENT; }
|
||||
#endif
|
||||
|
||||
#endif /* GHES_H */
|
|
@ -0,0 +1,17 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* hed.h - ACPI Hardware Error Device
|
||||
*
|
||||
* Copyright (C) 2009, Intel Corp.
|
||||
* Author: Huang Ying <ying.huang@intel.com>
|
||||
*/
|
||||
|
||||
#ifndef ACPI_HED_H
|
||||
#define ACPI_HED_H
|
||||
|
||||
#include <linux/notifier.h>
|
||||
|
||||
int register_acpi_hed_notifier(struct notifier_block *nb);
|
||||
void unregister_acpi_hed_notifier(struct notifier_block *nb);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* SPDX-License-Identifier: GPL-2.0
|
||||
* Copyright (C) 2018 Intel Corporation
|
||||
*/
|
||||
|
||||
#ifndef __ACPI_NFIT_H
|
||||
#define __ACPI_NFIT_H
|
||||
|
||||
#if IS_ENABLED(CONFIG_ACPI_NFIT)
|
||||
int nfit_get_smbios_id(u32 device_handle, u16 *flags);
|
||||
#else
|
||||
static inline int nfit_get_smbios_id(u32 device_handle, u16 *flags)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ACPI_NFIT_H */
|
|
@ -0,0 +1,26 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* PCC (Platform Communications Channel) methods
|
||||
*/
|
||||
|
||||
#ifndef _PCC_H
|
||||
#define _PCC_H
|
||||
|
||||
#include <linux/mailbox_controller.h>
|
||||
#include <linux/mailbox_client.h>
|
||||
|
||||
#define MAX_PCC_SUBSPACES 256
|
||||
#ifdef CONFIG_PCC
|
||||
extern struct mbox_chan *pcc_mbox_request_channel(struct mbox_client *cl,
|
||||
int subspace_id);
|
||||
extern void pcc_mbox_free_channel(struct mbox_chan *chan);
|
||||
#else
|
||||
static inline struct mbox_chan *pcc_mbox_request_channel(struct mbox_client *cl,
|
||||
int subspace_id)
|
||||
{
|
||||
return ERR_PTR(-ENODEV);
|
||||
}
|
||||
static inline void pcc_mbox_free_channel(struct mbox_chan *chan) { }
|
||||
#endif
|
||||
|
||||
#endif /* _PCC_H */
|
|
@ -0,0 +1,36 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
|
||||
/* _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__ */
|
|
@ -0,0 +1,367 @@
|
|||
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: acenv.h - Host and compiler configuration
|
||||
*
|
||||
* Copyright (C) 2000 - 2020, Intel Corp.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#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
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/* Common application configuration. All single threaded except for acpi_exec. */
|
||||
|
||||
#if (defined ACPI_ASL_COMPILER) || \
|
||||
(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) || \
|
||||
(defined ACPI_EFI_HELLO)
|
||||
#define ACPI_APPLICATION
|
||||
#define ACPI_SINGLE_THREADED
|
||||
#define USE_NATIVE_ALLOCATE_ZEROED
|
||||
#endif
|
||||
|
||||
/* iASL configuration */
|
||||
|
||||
#ifdef ACPI_ASL_COMPILER
|
||||
#define ACPI_DEBUG_OUTPUT
|
||||
#define ACPI_CONSTANT_EVAL_ONLY
|
||||
#define ACPI_LARGE_NAMESPACE_NODE
|
||||
#define ACPI_DATA_TABLE_DISASSEMBLY
|
||||
#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_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
|
||||
#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. Two versions, one with full debug. */
|
||||
|
||||
#ifdef ACPI_LIBRARY
|
||||
#define ACPI_USE_LOCAL_CACHE
|
||||
#define ACPI_DEBUGGER 1
|
||||
#define ACPI_DISASSEMBLER 1
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define ACPI_DEBUG_OUTPUT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Common for all ACPICA applications */
|
||||
|
||||
#ifdef ACPI_APPLICATION
|
||||
#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
|
||||
|
||||
|
||||
/*
|
||||
* acpisrc CR\LF support
|
||||
* Unix file line endings do not include the carriage return.
|
||||
* If the acpisrc utility is being built using a microsoft compiler, it means
|
||||
* that it will be running on a windows machine which means that the output is
|
||||
* expected to have CR/LF newlines. If the acpisrc utility is built with
|
||||
* anything else, it will likely run on a system with LF newlines. This flag
|
||||
* tells the acpisrc utility that newlines will be in the LF format.
|
||||
*/
|
||||
#define ACPI_SRC_OS_LF_ONLY 0
|
||||
|
||||
/*! [Begin] no source code translation */
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Host configuration files. The compiler configuration files are included
|
||||
* first.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
|
||||
#include <acpi/platform/acgcc.h>
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
#include "acmsvc.h"
|
||||
|
||||
#elif defined(__INTEL_COMPILER)
|
||||
#include <acpi/platform/acintel.h>
|
||||
|
||||
#endif
|
||||
|
||||
#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(__HAIKU__)
|
||||
#include "achaiku.h"
|
||||
|
||||
#elif defined(__QNX__)
|
||||
#include "acqnx.h"
|
||||
|
||||
/*
|
||||
* EFI applications can be built with -nostdlib, in this case, it must be
|
||||
* included after including all other host environmental definitions, in
|
||||
* order to override the definitions.
|
||||
*/
|
||||
#elif defined(_AED_EFI) || defined(_GNU_EFI) || defined(_EDK2_EFI)
|
||||
#include "acefi.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
|
||||
|
||||
/* Use ordered initialization if compiler doesn't support designated. */
|
||||
#ifndef ACPI_STRUCT_INIT
|
||||
#define ACPI_STRUCT_INIT(field, value) value
|
||||
#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. Defining this implies that
|
||||
* ACPI_USE_SYSTEM_CLIBRARY has been defined.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* 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 <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#if defined (ACPI_APPLICATION) || defined(ACPI_LIBRARY)
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#endif /* ACPI_USE_STANDARD_HEADERS */
|
||||
|
||||
#ifdef ACPI_APPLICATION
|
||||
#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 */
|
||||
|
||||
#ifndef ACPI_INIT_FUNCTION
|
||||
#define ACPI_INIT_FUNCTION
|
||||
#endif
|
||||
|
||||
#endif /* __ACENV_H__ */
|
|
@ -0,0 +1,48 @@
|
|||
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: acenvex.h - Extra host and compiler configuration
|
||||
*
|
||||
* Copyright (C) 2000 - 2020, Intel Corp.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#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(__DragonFly__)
|
||||
#include "acdragonflyex.h"
|
||||
|
||||
/*
|
||||
* EFI applications can be built with -nostdlib, in this case, it must be
|
||||
* included after including all other host environmental definitions, in
|
||||
* order to override the definitions.
|
||||
*/
|
||||
#elif defined(_AED_EFI) || defined(_GNU_EFI) || defined(_EDK2_EFI)
|
||||
#include "acefiex.h"
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
|
||||
#include "acgccex.h"
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
#include "acmsvcex.h"
|
||||
|
||||
#endif
|
||||
|
||||
/*! [End] no source code translation !*/
|
||||
|
||||
#endif /* __ACENVEX_H__ */
|
|
@ -0,0 +1,57 @@
|
|||
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: acgcc.h - GCC specific defines, etc.
|
||||
*
|
||||
* Copyright (C) 2000 - 2020, Intel Corp.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef __ACGCC_H__
|
||||
#define __ACGCC_H__
|
||||
|
||||
/*
|
||||
* Use compiler specific <stdarg.h> is a good practice for even when
|
||||
* -nostdinc is specified (i.e., ACPI_USE_STANDARD_HEADERS undefined.
|
||||
*/
|
||||
#ifndef va_arg
|
||||
#ifdef ACPI_USE_BUILTIN_STDARG
|
||||
typedef __builtin_va_list va_list;
|
||||
#define va_start(v, l) __builtin_va_start(v, l)
|
||||
#define va_end(v) __builtin_va_end(v)
|
||||
#define va_arg(v, l) __builtin_va_arg(v, l)
|
||||
#define va_copy(d, s) __builtin_va_copy(d, s)
|
||||
#else
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#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))
|
||||
|
||||
/* GCC supports __VA_ARGS__ in macros */
|
||||
|
||||
#define COMPILER_VA_MACRO 1
|
||||
|
||||
/* GCC supports native multiply/shift on 32-bit platforms */
|
||||
|
||||
#define ACPI_USE_NATIVE_MATH64
|
||||
|
||||
#endif /* __ACGCC_H__ */
|
|
@ -0,0 +1,24 @@
|
|||
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: acgccex.h - Extra GCC specific defines, etc.
|
||||
*
|
||||
* Copyright (C) 2000 - 2020, Intel Corp.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef __ACGCCEX_H__
|
||||
#define __ACGCCEX_H__
|
||||
|
||||
/*
|
||||
* Some versions of gcc implement strchr() with a buggy macro. So,
|
||||
* undef it here. Prevents error messages of this form (usually from the
|
||||
* file getopt.c):
|
||||
*
|
||||
* error: logical '&&' with non-zero constant will always evaluate as true
|
||||
*/
|
||||
#ifdef strchr
|
||||
#undef strchr
|
||||
#endif
|
||||
|
||||
#endif /* __ACGCCEX_H__ */
|
|
@ -0,0 +1,55 @@
|
|||
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: acintel.h - VC specific defines, etc.
|
||||
*
|
||||
* Copyright (C) 2000 - 2020, Intel Corp.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef __ACINTEL_H__
|
||||
#define __ACINTEL_H__
|
||||
|
||||
/*
|
||||
* Use compiler specific <stdarg.h> is a good practice for even when
|
||||
* -nostdinc is specified (i.e., ACPI_USE_STANDARD_HEADERS undefined.
|
||||
*/
|
||||
#ifndef va_arg
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
/* Configuration specific to Intel 64-bit C compiler */
|
||||
|
||||
#define COMPILER_DEPENDENT_INT64 __int64
|
||||
#define COMPILER_DEPENDENT_UINT64 unsigned __int64
|
||||
#define ACPI_INLINE __inline
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
#define ACPI_SYSTEM_XFACE
|
||||
#define ACPI_EXTERNAL_XFACE
|
||||
#define ACPI_INTERNAL_XFACE
|
||||
#define ACPI_INTERNAL_VAR_XFACE
|
||||
|
||||
/* remark 981 - operands evaluated in no particular order */
|
||||
#pragma warning(disable:981)
|
||||
|
||||
/* warn C4100: unreferenced formal parameter */
|
||||
#pragma warning(disable:4100)
|
||||
|
||||
/* warn C4127: conditional expression is constant */
|
||||
#pragma warning(disable:4127)
|
||||
|
||||
/* warn C4706: assignment within conditional expression */
|
||||
#pragma warning(disable:4706)
|
||||
|
||||
/* warn C4214: bit field types other than int */
|
||||
#pragma warning(disable:4214)
|
||||
|
||||
#endif /* __ACINTEL_H__ */
|
|
@ -0,0 +1,216 @@
|
|||
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: aclinux.h - OS specific defines, etc. for Linux
|
||||
*
|
||||
* Copyright (C) 2000 - 2020, Intel Corp.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#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
|
||||
#define ACPI_IGNORE_PACKAGE_RESOLUTION_ERRORS
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#define ACPI_USE_SYSTEM_INTTYPES
|
||||
#define ACPI_USE_GPE_POLLING
|
||||
|
||||
/* Kernel specific ACPICA configuration */
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
#define ACPI_PCI_CONFIGURED
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ACPI_REDUCED_HARDWARE_ONLY
|
||||
#define ACPI_REDUCED_HARDWARE 1
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ACPI_DEBUGGER
|
||||
#define ACPI_DEBUGGER
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ACPI_DEBUG
|
||||
#define ACPI_MUTEX_DEBUG
|
||||
#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
|
||||
|
||||
#define ACPI_INIT_FUNCTION __init
|
||||
|
||||
/* Use a specific bugging default separate from ACPICA */
|
||||
|
||||
#undef ACPI_DEBUG_DEFAULT
|
||||
#define ACPI_DEBUG_DEFAULT (ACPI_LV_INFO | ACPI_LV_REPAIR)
|
||||
|
||||
#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_USE_NATIVE_MATH64
|
||||
#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_raw_spinlock raw_spinlock_t *
|
||||
#define acpi_cpu_flags unsigned long
|
||||
|
||||
/* Use native linux version of acpi_os_allocate_zeroed */
|
||||
|
||||
#define USE_NATIVE_ALLOCATE_ZEROED
|
||||
|
||||
/* Use logical addresses for accessing GPE registers in system memory */
|
||||
|
||||
#define ACPI_GPE_USE_LOGICAL_ADDRESSES
|
||||
|
||||
/*
|
||||
* 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
|
||||
#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_raw_lock
|
||||
#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_delete_raw_lock
|
||||
#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_raw_lock
|
||||
#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_release_raw_lock
|
||||
|
||||
/*
|
||||
* OSL interfaces used by debugger/disassembler
|
||||
*/
|
||||
#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_readable
|
||||
#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_writable
|
||||
#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize_debugger
|
||||
#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate_debugger
|
||||
|
||||
/*
|
||||
* 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
|
||||
|
||||
#define ACPI_MSG_ERROR KERN_ERR "ACPI Error: "
|
||||
#define ACPI_MSG_EXCEPTION KERN_ERR "ACPI Exception: "
|
||||
#define ACPI_MSG_WARNING KERN_WARNING "ACPI Warning: "
|
||||
#define ACPI_MSG_INFO KERN_INFO "ACPI: "
|
||||
|
||||
#define ACPI_MSG_BIOS_ERROR KERN_ERR "ACPI BIOS Error (bug): "
|
||||
#define ACPI_MSG_BIOS_WARNING KERN_WARNING "ACPI BIOS Warning (bug): "
|
||||
|
||||
/*
|
||||
* Linux wants to use designated initializers for function pointer structs.
|
||||
*/
|
||||
#define ACPI_STRUCT_INIT(field, value) .field = value
|
||||
|
||||
#else /* !__KERNEL__ */
|
||||
|
||||
#define ACPI_USE_STANDARD_HEADERS
|
||||
|
||||
#ifdef ACPI_USE_STANDARD_HEADERS
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
/* Define/disable kernel-specific declarators */
|
||||
|
||||
#ifndef __init
|
||||
#define __init
|
||||
#endif
|
||||
#ifndef __iomem
|
||||
#define __iomem
|
||||
#endif
|
||||
|
||||
/* Host-dependent types and defines for user-space ACPICA */
|
||||
|
||||
#define ACPI_FLUSH_CPU_CACHE()
|
||||
#define ACPI_CAST_PTHREAD_T(pthread) ((acpi_thread_id) (pthread))
|
||||
|
||||
#if defined(__ia64__) || (defined(__x86_64__) && !defined(__ILP32__)) ||\
|
||||
defined(__aarch64__) || defined(__PPC64__) ||\
|
||||
defined(__s390x__) ||\
|
||||
(defined(__riscv) && (defined(__LP64__) || defined(_LP64)))
|
||||
#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
|
||||
#define ACPI_USE_NATIVE_MATH64
|
||||
#endif
|
||||
|
||||
#ifndef __cdecl
|
||||
#define __cdecl
|
||||
#endif
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* __ACLINUX_H__ */
|
|
@ -0,0 +1,144 @@
|
|||
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: aclinuxex.h - Extra OS specific defines, etc. for Linux
|
||||
*
|
||||
* Copyright (C) 2000 - 2020, Intel Corp.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#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 ACPI_INIT_FUNCTION 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 void *acpi_os_acquire_object(acpi_cache_t * cache)
|
||||
{
|
||||
return kmem_cache_zalloc(cache,
|
||||
irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
|
||||
}
|
||||
|
||||
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; \
|
||||
})
|
||||
|
||||
|
||||
#define acpi_os_create_raw_lock(__handle) \
|
||||
({ \
|
||||
raw_spinlock_t *lock = ACPI_ALLOCATE(sizeof(*lock)); \
|
||||
if (lock) { \
|
||||
*(__handle) = lock; \
|
||||
raw_spin_lock_init(*(__handle)); \
|
||||
} \
|
||||
lock ? AE_OK : AE_NO_MEMORY; \
|
||||
})
|
||||
|
||||
static inline acpi_cpu_flags acpi_os_acquire_raw_lock(acpi_raw_spinlock lockp)
|
||||
{
|
||||
acpi_cpu_flags flags;
|
||||
|
||||
raw_spin_lock_irqsave(lockp, flags);
|
||||
return flags;
|
||||
}
|
||||
|
||||
static inline void acpi_os_release_raw_lock(acpi_raw_spinlock lockp,
|
||||
acpi_cpu_flags flags)
|
||||
{
|
||||
raw_spin_unlock_irqrestore(lockp, flags);
|
||||
}
|
||||
|
||||
static inline void acpi_os_delete_raw_lock(acpi_raw_spinlock handle)
|
||||
{
|
||||
ACPI_FREE(handle);
|
||||
}
|
||||
|
||||
static inline u8 acpi_os_readable(void *pointer, acpi_size length)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static inline acpi_status acpi_os_initialize_debugger(void)
|
||||
{
|
||||
return AE_OK;
|
||||
}
|
||||
|
||||
static inline void acpi_os_terminate_debugger(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* OSL interfaces added by Linux
|
||||
*/
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* __ACLINUXEX_H__ */
|
|
@ -0,0 +1,455 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef __ACPI_PROCESSOR_H
|
||||
#define __ACPI_PROCESSOR_H
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/cpu.h>
|
||||
#include <linux/cpufreq.h>
|
||||
#include <linux/pm_qos.h>
|
||||
#include <linux/thermal.h>
|
||||
#include <asm/acpi.h>
|
||||
|
||||
#define ACPI_PROCESSOR_CLASS "processor"
|
||||
#define ACPI_PROCESSOR_DEVICE_NAME "Processor"
|
||||
#define ACPI_PROCESSOR_DEVICE_HID "ACPI0007"
|
||||
#define ACPI_PROCESSOR_CONTAINER_HID "ACPI0010"
|
||||
|
||||
#define ACPI_PROCESSOR_BUSY_METRIC 10
|
||||
|
||||
#define ACPI_PROCESSOR_MAX_POWER 8
|
||||
#define ACPI_PROCESSOR_MAX_C2_LATENCY 100
|
||||
#define ACPI_PROCESSOR_MAX_C3_LATENCY 1000
|
||||
|
||||
#define ACPI_PROCESSOR_MAX_THROTTLING 16
|
||||
#define ACPI_PROCESSOR_MAX_THROTTLE 250 /* 25% */
|
||||
#define ACPI_PROCESSOR_MAX_DUTY_WIDTH 4
|
||||
|
||||
#define ACPI_PDC_REVISION_ID 0x1
|
||||
|
||||
#define ACPI_PSD_REV0_REVISION 0 /* Support for _PSD as in ACPI 3.0 */
|
||||
#define ACPI_PSD_REV0_ENTRIES 5
|
||||
|
||||
#define ACPI_TSD_REV0_REVISION 0 /* Support for _PSD as in ACPI 3.0 */
|
||||
#define ACPI_TSD_REV0_ENTRIES 5
|
||||
/*
|
||||
* Types of coordination defined in ACPI 3.0. Same macros can be used across
|
||||
* P, C and T states
|
||||
*/
|
||||
#define DOMAIN_COORD_TYPE_SW_ALL 0xfc
|
||||
#define DOMAIN_COORD_TYPE_SW_ANY 0xfd
|
||||
#define DOMAIN_COORD_TYPE_HW_ALL 0xfe
|
||||
|
||||
#define ACPI_CSTATE_SYSTEMIO 0
|
||||
#define ACPI_CSTATE_FFH 1
|
||||
#define ACPI_CSTATE_HALT 2
|
||||
#define ACPI_CSTATE_INTEGER 3
|
||||
|
||||
#define ACPI_CX_DESC_LEN 32
|
||||
|
||||
/* Power Management */
|
||||
|
||||
struct acpi_processor_cx;
|
||||
|
||||
struct acpi_power_register {
|
||||
u8 descriptor;
|
||||
u16 length;
|
||||
u8 space_id;
|
||||
u8 bit_width;
|
||||
u8 bit_offset;
|
||||
u8 access_size;
|
||||
u64 address;
|
||||
} __packed;
|
||||
|
||||
struct acpi_processor_cx {
|
||||
u8 valid;
|
||||
u8 type;
|
||||
u32 address;
|
||||
u8 entry_method;
|
||||
u8 index;
|
||||
u32 latency;
|
||||
u8 bm_sts_skip;
|
||||
char desc[ACPI_CX_DESC_LEN];
|
||||
};
|
||||
|
||||
struct acpi_lpi_state {
|
||||
u32 min_residency;
|
||||
u32 wake_latency; /* worst case */
|
||||
u32 flags;
|
||||
u32 arch_flags;
|
||||
u32 res_cnt_freq;
|
||||
u32 enable_parent_state;
|
||||
u64 address;
|
||||
u8 index;
|
||||
u8 entry_method;
|
||||
char desc[ACPI_CX_DESC_LEN];
|
||||
};
|
||||
|
||||
struct acpi_processor_power {
|
||||
int count;
|
||||
union {
|
||||
struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER];
|
||||
struct acpi_lpi_state lpi_states[ACPI_PROCESSOR_MAX_POWER];
|
||||
};
|
||||
int timer_broadcast_on_state;
|
||||
};
|
||||
|
||||
/* Performance Management */
|
||||
|
||||
struct acpi_psd_package {
|
||||
u64 num_entries;
|
||||
u64 revision;
|
||||
u64 domain;
|
||||
u64 coord_type;
|
||||
u64 num_processors;
|
||||
} __packed;
|
||||
|
||||
struct acpi_pct_register {
|
||||
u8 descriptor;
|
||||
u16 length;
|
||||
u8 space_id;
|
||||
u8 bit_width;
|
||||
u8 bit_offset;
|
||||
u8 reserved;
|
||||
u64 address;
|
||||
} __packed;
|
||||
|
||||
struct acpi_processor_px {
|
||||
u64 core_frequency; /* megahertz */
|
||||
u64 power; /* milliWatts */
|
||||
u64 transition_latency; /* microseconds */
|
||||
u64 bus_master_latency; /* microseconds */
|
||||
u64 control; /* control value */
|
||||
u64 status; /* success indicator */
|
||||
};
|
||||
|
||||
struct acpi_processor_performance {
|
||||
unsigned int state;
|
||||
unsigned int platform_limit;
|
||||
struct acpi_pct_register control_register;
|
||||
struct acpi_pct_register status_register;
|
||||
unsigned int state_count;
|
||||
struct acpi_processor_px *states;
|
||||
struct acpi_psd_package domain_info;
|
||||
cpumask_var_t shared_cpu_map;
|
||||
unsigned int shared_type;
|
||||
};
|
||||
|
||||
/* Throttling Control */
|
||||
|
||||
struct acpi_tsd_package {
|
||||
u64 num_entries;
|
||||
u64 revision;
|
||||
u64 domain;
|
||||
u64 coord_type;
|
||||
u64 num_processors;
|
||||
} __packed;
|
||||
|
||||
struct acpi_ptc_register {
|
||||
u8 descriptor;
|
||||
u16 length;
|
||||
u8 space_id;
|
||||
u8 bit_width;
|
||||
u8 bit_offset;
|
||||
u8 reserved;
|
||||
u64 address;
|
||||
} __packed;
|
||||
|
||||
struct acpi_processor_tx_tss {
|
||||
u64 freqpercentage; /* */
|
||||
u64 power; /* milliWatts */
|
||||
u64 transition_latency; /* microseconds */
|
||||
u64 control; /* control value */
|
||||
u64 status; /* success indicator */
|
||||
};
|
||||
struct acpi_processor_tx {
|
||||
u16 power;
|
||||
u16 performance;
|
||||
};
|
||||
|
||||
struct acpi_processor;
|
||||
struct acpi_processor_throttling {
|
||||
unsigned int state;
|
||||
unsigned int platform_limit;
|
||||
struct acpi_pct_register control_register;
|
||||
struct acpi_pct_register status_register;
|
||||
unsigned int state_count;
|
||||
struct acpi_processor_tx_tss *states_tss;
|
||||
struct acpi_tsd_package domain_info;
|
||||
cpumask_var_t shared_cpu_map;
|
||||
int (*acpi_processor_get_throttling) (struct acpi_processor * pr);
|
||||
int (*acpi_processor_set_throttling) (struct acpi_processor * pr,
|
||||
int state, bool force);
|
||||
|
||||
u32 address;
|
||||
u8 duty_offset;
|
||||
u8 duty_width;
|
||||
u8 tsd_valid_flag;
|
||||
unsigned int shared_type;
|
||||
struct acpi_processor_tx states[ACPI_PROCESSOR_MAX_THROTTLING];
|
||||
};
|
||||
|
||||
/* Limit Interface */
|
||||
|
||||
struct acpi_processor_lx {
|
||||
int px; /* performance state */
|
||||
int tx; /* throttle level */
|
||||
};
|
||||
|
||||
struct acpi_processor_limit {
|
||||
struct acpi_processor_lx state; /* current limit */
|
||||
struct acpi_processor_lx thermal; /* thermal limit */
|
||||
struct acpi_processor_lx user; /* user limit */
|
||||
};
|
||||
|
||||
struct acpi_processor_flags {
|
||||
u8 power:1;
|
||||
u8 performance:1;
|
||||
u8 throttling:1;
|
||||
u8 limit:1;
|
||||
u8 bm_control:1;
|
||||
u8 bm_check:1;
|
||||
u8 has_cst:1;
|
||||
u8 has_lpi:1;
|
||||
u8 power_setup_done:1;
|
||||
u8 bm_rld_set:1;
|
||||
u8 need_hotplug_init:1;
|
||||
};
|
||||
|
||||
struct acpi_processor {
|
||||
acpi_handle handle;
|
||||
u32 acpi_id;
|
||||
phys_cpuid_t phys_id; /* CPU hardware ID such as APIC ID for x86 */
|
||||
u32 id; /* CPU logical ID allocated by OS */
|
||||
u32 pblk;
|
||||
int performance_platform_limit;
|
||||
int throttling_platform_limit;
|
||||
/* 0 - states 0..n-th state available */
|
||||
|
||||
struct acpi_processor_flags flags;
|
||||
struct acpi_processor_power power;
|
||||
struct acpi_processor_performance *performance;
|
||||
struct acpi_processor_throttling throttling;
|
||||
struct acpi_processor_limit limit;
|
||||
struct thermal_cooling_device *cdev;
|
||||
struct device *dev; /* Processor device. */
|
||||
struct freq_qos_request perflib_req;
|
||||
struct freq_qos_request thermal_req;
|
||||
};
|
||||
|
||||
struct acpi_processor_errata {
|
||||
u8 smp;
|
||||
struct {
|
||||
u8 throttle:1;
|
||||
u8 fdma:1;
|
||||
u8 reserved:6;
|
||||
u32 bmisx;
|
||||
} piix4;
|
||||
};
|
||||
|
||||
extern int acpi_processor_preregister_performance(struct
|
||||
acpi_processor_performance
|
||||
__percpu *performance);
|
||||
|
||||
extern int acpi_processor_register_performance(struct acpi_processor_performance
|
||||
*performance, unsigned int cpu);
|
||||
extern void acpi_processor_unregister_performance(unsigned int cpu);
|
||||
|
||||
int acpi_processor_pstate_control(void);
|
||||
/* note: this locks both the calling module and the processor module
|
||||
if a _PPC object exists, rmmod is disallowed then */
|
||||
int acpi_processor_notify_smm(struct module *calling_module);
|
||||
int acpi_processor_get_psd(acpi_handle handle,
|
||||
struct acpi_psd_package *pdomain);
|
||||
|
||||
/* parsing the _P* objects. */
|
||||
extern int acpi_processor_get_performance_info(struct acpi_processor *pr);
|
||||
|
||||
/* for communication between multiple parts of the processor kernel module */
|
||||
DECLARE_PER_CPU(struct acpi_processor *, processors);
|
||||
extern struct acpi_processor_errata errata;
|
||||
|
||||
#if defined(ARCH_HAS_POWER_INIT) && defined(CONFIG_ACPI_PROCESSOR_CSTATE)
|
||||
void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags,
|
||||
unsigned int cpu);
|
||||
int acpi_processor_ffh_cstate_probe(unsigned int cpu,
|
||||
struct acpi_processor_cx *cx,
|
||||
struct acpi_power_register *reg);
|
||||
void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx *cstate);
|
||||
#else
|
||||
static inline void acpi_processor_power_init_bm_check(struct
|
||||
acpi_processor_flags
|
||||
*flags, unsigned int cpu)
|
||||
{
|
||||
flags->bm_check = 1;
|
||||
return;
|
||||
}
|
||||
static inline int acpi_processor_ffh_cstate_probe(unsigned int cpu,
|
||||
struct acpi_processor_cx *cx,
|
||||
struct acpi_power_register
|
||||
*reg)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
static inline void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx
|
||||
*cstate)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline int call_on_cpu(int cpu, long (*fn)(void *), void *arg,
|
||||
bool direct)
|
||||
{
|
||||
if (direct || (is_percpu_thread() && cpu == smp_processor_id()))
|
||||
return fn(arg);
|
||||
return work_on_cpu(cpu, fn, arg);
|
||||
}
|
||||
|
||||
/* in processor_perflib.c */
|
||||
|
||||
#ifdef CONFIG_CPU_FREQ
|
||||
extern bool acpi_processor_cpufreq_init;
|
||||
void acpi_processor_ignore_ppc_init(void);
|
||||
void acpi_processor_ppc_init(struct cpufreq_policy *policy);
|
||||
void acpi_processor_ppc_exit(struct cpufreq_policy *policy);
|
||||
void acpi_processor_ppc_has_changed(struct acpi_processor *pr, int event_flag);
|
||||
extern int acpi_processor_get_bios_limit(int cpu, unsigned int *limit);
|
||||
#else
|
||||
static inline void acpi_processor_ignore_ppc_init(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
static inline void acpi_processor_ppc_init(struct cpufreq_policy *policy)
|
||||
{
|
||||
return;
|
||||
}
|
||||
static inline void acpi_processor_ppc_exit(struct cpufreq_policy *policy)
|
||||
{
|
||||
return;
|
||||
}
|
||||
static inline void acpi_processor_ppc_has_changed(struct acpi_processor *pr,
|
||||
int event_flag)
|
||||
{
|
||||
static unsigned int printout = 1;
|
||||
if (printout) {
|
||||
printk(KERN_WARNING
|
||||
"Warning: Processor Platform Limit event detected, but not handled.\n");
|
||||
printk(KERN_WARNING
|
||||
"Consider compiling CPUfreq support into your kernel.\n");
|
||||
printout = 0;
|
||||
}
|
||||
}
|
||||
static inline int acpi_processor_get_bios_limit(int cpu, unsigned int *limit)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_CPU_FREQ */
|
||||
|
||||
/* in processor_core.c */
|
||||
phys_cpuid_t acpi_get_phys_id(acpi_handle, int type, u32 acpi_id);
|
||||
phys_cpuid_t acpi_map_madt_entry(u32 acpi_id);
|
||||
int acpi_map_cpuid(phys_cpuid_t phys_id, u32 acpi_id);
|
||||
int acpi_get_cpuid(acpi_handle, int type, u32 acpi_id);
|
||||
|
||||
#ifdef CONFIG_ACPI_CPPC_LIB
|
||||
extern int acpi_cppc_processor_probe(struct acpi_processor *pr);
|
||||
extern void acpi_cppc_processor_exit(struct acpi_processor *pr);
|
||||
#else
|
||||
static inline int acpi_cppc_processor_probe(struct acpi_processor *pr)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline void acpi_cppc_processor_exit(struct acpi_processor *pr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif /* CONFIG_ACPI_CPPC_LIB */
|
||||
|
||||
/* in processor_pdc.c */
|
||||
void acpi_processor_set_pdc(acpi_handle handle);
|
||||
|
||||
/* in processor_throttling.c */
|
||||
#ifdef CONFIG_ACPI_CPU_FREQ_PSS
|
||||
int acpi_processor_tstate_has_changed(struct acpi_processor *pr);
|
||||
int acpi_processor_get_throttling_info(struct acpi_processor *pr);
|
||||
extern int acpi_processor_set_throttling(struct acpi_processor *pr,
|
||||
int state, bool force);
|
||||
/*
|
||||
* Reevaluate whether the T-state is invalid after one cpu is
|
||||
* onlined/offlined. In such case the flags.throttling will be updated.
|
||||
*/
|
||||
extern void acpi_processor_reevaluate_tstate(struct acpi_processor *pr,
|
||||
bool is_dead);
|
||||
extern const struct file_operations acpi_processor_throttling_fops;
|
||||
extern void acpi_processor_throttling_init(void);
|
||||
#else
|
||||
static inline int acpi_processor_tstate_has_changed(struct acpi_processor *pr)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int acpi_processor_get_throttling_info(struct acpi_processor *pr)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static inline int acpi_processor_set_throttling(struct acpi_processor *pr,
|
||||
int state, bool force)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static inline void acpi_processor_reevaluate_tstate(struct acpi_processor *pr,
|
||||
bool is_dead) {}
|
||||
|
||||
static inline void acpi_processor_throttling_init(void) {}
|
||||
#endif /* CONFIG_ACPI_CPU_FREQ_PSS */
|
||||
|
||||
/* in processor_idle.c */
|
||||
extern struct cpuidle_driver acpi_idle_driver;
|
||||
#ifdef CONFIG_ACPI_PROCESSOR_IDLE
|
||||
int acpi_processor_power_init(struct acpi_processor *pr);
|
||||
int acpi_processor_power_exit(struct acpi_processor *pr);
|
||||
int acpi_processor_power_state_has_changed(struct acpi_processor *pr);
|
||||
int acpi_processor_hotplug(struct acpi_processor *pr);
|
||||
#else
|
||||
static inline int acpi_processor_power_init(struct acpi_processor *pr)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static inline int acpi_processor_power_exit(struct acpi_processor *pr)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static inline int acpi_processor_power_state_has_changed(struct acpi_processor *pr)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static inline int acpi_processor_hotplug(struct acpi_processor *pr)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
#endif /* CONFIG_ACPI_PROCESSOR_IDLE */
|
||||
|
||||
/* in processor_thermal.c */
|
||||
int acpi_processor_get_limit_info(struct acpi_processor *pr);
|
||||
extern const struct thermal_cooling_device_ops processor_cooling_ops;
|
||||
#if defined(CONFIG_ACPI_CPU_FREQ_PSS) & defined(CONFIG_CPU_FREQ)
|
||||
void acpi_thermal_cpufreq_init(struct cpufreq_policy *policy);
|
||||
void acpi_thermal_cpufreq_exit(struct cpufreq_policy *policy);
|
||||
#else
|
||||
static inline void acpi_thermal_cpufreq_init(struct cpufreq_policy *policy)
|
||||
{
|
||||
return;
|
||||
}
|
||||
static inline void acpi_thermal_cpufreq_exit(struct cpufreq_policy *policy)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif /* CONFIG_ACPI_CPU_FREQ_PSS */
|
||||
|
||||
#endif
|
|
@ -0,0 +1,12 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef __ACPI_REBOOT_H
|
||||
#define __ACPI_REBOOT_H
|
||||
|
||||
#ifdef CONFIG_ACPI
|
||||
extern void acpi_reboot(void);
|
||||
#else
|
||||
static inline void acpi_reboot(void) { }
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef __ACPI_VIDEO_H
|
||||
#define __ACPI_VIDEO_H
|
||||
|
||||
#include <linux/errno.h> /* for ENODEV */
|
||||
#include <linux/types.h> /* for bool */
|
||||
|
||||
struct acpi_video_brightness_flags {
|
||||
u8 _BCL_no_ac_battery_levels:1; /* no AC/Battery levels in _BCL */
|
||||
u8 _BCL_reversed:1; /* _BCL package is in a reversed order */
|
||||
u8 _BQC_use_index:1; /* _BQC returns an index value */
|
||||
};
|
||||
|
||||
struct acpi_video_device_brightness {
|
||||
int curr;
|
||||
int count;
|
||||
int *levels;
|
||||
struct acpi_video_brightness_flags flags;
|
||||
};
|
||||
|
||||
struct acpi_device;
|
||||
|
||||
#define ACPI_VIDEO_CLASS "video"
|
||||
|
||||
#define ACPI_VIDEO_DISPLAY_CRT 1
|
||||
#define ACPI_VIDEO_DISPLAY_TV 2
|
||||
#define ACPI_VIDEO_DISPLAY_DVI 3
|
||||
#define ACPI_VIDEO_DISPLAY_LCD 4
|
||||
|
||||
#define ACPI_VIDEO_DISPLAY_LEGACY_MONITOR 0x0100
|
||||
#define ACPI_VIDEO_DISPLAY_LEGACY_PANEL 0x0110
|
||||
#define ACPI_VIDEO_DISPLAY_LEGACY_TV 0x0200
|
||||
|
||||
#define ACPI_VIDEO_NOTIFY_SWITCH 0x80
|
||||
#define ACPI_VIDEO_NOTIFY_PROBE 0x81
|
||||
#define ACPI_VIDEO_NOTIFY_CYCLE 0x82
|
||||
#define ACPI_VIDEO_NOTIFY_NEXT_OUTPUT 0x83
|
||||
#define ACPI_VIDEO_NOTIFY_PREV_OUTPUT 0x84
|
||||
#define ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS 0x85
|
||||
#define ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS 0x86
|
||||
#define ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS 0x87
|
||||
#define ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS 0x88
|
||||
#define ACPI_VIDEO_NOTIFY_DISPLAY_OFF 0x89
|
||||
|
||||
enum acpi_backlight_type {
|
||||
acpi_backlight_undef = -1,
|
||||
acpi_backlight_none = 0,
|
||||
acpi_backlight_video,
|
||||
acpi_backlight_vendor,
|
||||
acpi_backlight_native,
|
||||
};
|
||||
|
||||
#if IS_ENABLED(CONFIG_ACPI_VIDEO)
|
||||
extern int acpi_video_register(void);
|
||||
extern void acpi_video_unregister(void);
|
||||
extern int acpi_video_get_edid(struct acpi_device *device, int type,
|
||||
int device_id, void **edid);
|
||||
extern enum acpi_backlight_type acpi_video_get_backlight_type(void);
|
||||
extern void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type);
|
||||
/*
|
||||
* Note: The value returned by acpi_video_handles_brightness_key_presses()
|
||||
* may change over time and should not be cached.
|
||||
*/
|
||||
extern bool acpi_video_handles_brightness_key_presses(void);
|
||||
extern int acpi_video_get_levels(struct acpi_device *device,
|
||||
struct acpi_video_device_brightness **dev_br,
|
||||
int *pmax_level);
|
||||
#else
|
||||
static inline int acpi_video_register(void) { return -ENODEV; }
|
||||
static inline void acpi_video_unregister(void) { return; }
|
||||
static inline int acpi_video_get_edid(struct acpi_device *device, int type,
|
||||
int device_id, void **edid)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
static inline enum acpi_backlight_type acpi_video_get_backlight_type(void)
|
||||
{
|
||||
return acpi_backlight_vendor;
|
||||
}
|
||||
static inline void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type)
|
||||
{
|
||||
}
|
||||
static inline bool acpi_video_handles_brightness_key_presses(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
static inline int acpi_video_get_levels(struct acpi_device *device,
|
||||
struct acpi_video_device_brightness **dev_br,
|
||||
int *pmax_level)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,64 @@
|
|||
# SPDX-License-Identifier: GPL-2.0
|
||||
#
|
||||
# asm headers that all architectures except um should have
|
||||
# (This file is not included when SRCARCH=um since UML borrows several
|
||||
# asm headers from the host architecutre.)
|
||||
|
||||
mandatory-y += atomic.h
|
||||
mandatory-y += barrier.h
|
||||
mandatory-y += bitops.h
|
||||
mandatory-y += bug.h
|
||||
mandatory-y += bugs.h
|
||||
mandatory-y += cacheflush.h
|
||||
mandatory-y += checksum.h
|
||||
mandatory-y += compat.h
|
||||
mandatory-y += current.h
|
||||
mandatory-y += delay.h
|
||||
mandatory-y += device.h
|
||||
mandatory-y += div64.h
|
||||
mandatory-y += dma-mapping.h
|
||||
mandatory-y += dma.h
|
||||
mandatory-y += emergency-restart.h
|
||||
mandatory-y += exec.h
|
||||
mandatory-y += fb.h
|
||||
mandatory-y += ftrace.h
|
||||
mandatory-y += futex.h
|
||||
mandatory-y += hardirq.h
|
||||
mandatory-y += hw_irq.h
|
||||
mandatory-y += io.h
|
||||
mandatory-y += irq.h
|
||||
mandatory-y += irq_regs.h
|
||||
mandatory-y += irq_work.h
|
||||
mandatory-y += kdebug.h
|
||||
mandatory-y += kmap_size.h
|
||||
mandatory-y += kprobes.h
|
||||
mandatory-y += linkage.h
|
||||
mandatory-y += local.h
|
||||
mandatory-y += local64.h
|
||||
mandatory-y += mm-arch-hooks.h
|
||||
mandatory-y += mmiowb.h
|
||||
mandatory-y += mmu.h
|
||||
mandatory-y += mmu_context.h
|
||||
mandatory-y += module.h
|
||||
mandatory-y += module.lds.h
|
||||
mandatory-y += msi.h
|
||||
mandatory-y += pci.h
|
||||
mandatory-y += percpu.h
|
||||
mandatory-y += pgalloc.h
|
||||
mandatory-y += preempt.h
|
||||
mandatory-y += rwonce.h
|
||||
mandatory-y += sections.h
|
||||
mandatory-y += serial.h
|
||||
mandatory-y += shmparam.h
|
||||
mandatory-y += simd.h
|
||||
mandatory-y += switch_to.h
|
||||
mandatory-y += timex.h
|
||||
mandatory-y += tlbflush.h
|
||||
mandatory-y += topology.h
|
||||
mandatory-y += trace_clock.h
|
||||
mandatory-y += uaccess.h
|
||||
mandatory-y += unaligned.h
|
||||
mandatory-y += vermagic.h
|
||||
mandatory-y += vga.h
|
||||
mandatory-y += word-at-a-time.h
|
||||
mandatory-y += xor.h
|
|
@ -0,0 +1 @@
|
|||
#include <generated/asm-offsets.h>
|
|
@ -0,0 +1,14 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#include <linux/bitops.h>
|
||||
#undef __memset
|
||||
extern void *__memset(void *, int, __kernel_size_t);
|
||||
#undef __memcpy
|
||||
extern void *__memcpy(void *, const void *, __kernel_size_t);
|
||||
#undef __memmove
|
||||
extern void *__memmove(void *, const void *, __kernel_size_t);
|
||||
#undef memset
|
||||
extern void *memset(void *, int, __kernel_size_t);
|
||||
#undef memcpy
|
||||
extern void *memcpy(void *, const void *, __kernel_size_t);
|
||||
#undef memmove
|
||||
extern void *memmove(void *, const void *, __kernel_size_t);
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,196 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
/*
|
||||
* Generic C implementation of atomic counter operations. Usable on
|
||||
* UP systems only. Do not include in machine independent code.
|
||||
*
|
||||
* Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
|
||||
* Written by David Howells (dhowells@redhat.com)
|
||||
*/
|
||||
#ifndef __ASM_GENERIC_ATOMIC_H
|
||||
#define __ASM_GENERIC_ATOMIC_H
|
||||
|
||||
#include <asm/cmpxchg.h>
|
||||
#include <asm/barrier.h>
|
||||
|
||||
/*
|
||||
* atomic_$op() - $op integer to atomic variable
|
||||
* @i: integer value to $op
|
||||
* @v: pointer to the atomic variable
|
||||
*
|
||||
* Atomically $ops @i to @v. Does not strictly guarantee a memory-barrier, use
|
||||
* smp_mb__{before,after}_atomic().
|
||||
*/
|
||||
|
||||
/*
|
||||
* atomic_$op_return() - $op interer to atomic variable and returns the result
|
||||
* @i: integer value to $op
|
||||
* @v: pointer to the atomic variable
|
||||
*
|
||||
* Atomically $ops @i to @v. Does imply a full memory barrier.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
|
||||
/* we can build all atomic primitives from cmpxchg */
|
||||
|
||||
#define ATOMIC_OP(op, c_op) \
|
||||
static inline void atomic_##op(int i, atomic_t *v) \
|
||||
{ \
|
||||
int c, old; \
|
||||
\
|
||||
c = v->counter; \
|
||||
while ((old = cmpxchg(&v->counter, c, c c_op i)) != c) \
|
||||
c = old; \
|
||||
}
|
||||
|
||||
#define ATOMIC_OP_RETURN(op, c_op) \
|
||||
static inline int atomic_##op##_return(int i, atomic_t *v) \
|
||||
{ \
|
||||
int c, old; \
|
||||
\
|
||||
c = v->counter; \
|
||||
while ((old = cmpxchg(&v->counter, c, c c_op i)) != c) \
|
||||
c = old; \
|
||||
\
|
||||
return c c_op i; \
|
||||
}
|
||||
|
||||
#define ATOMIC_FETCH_OP(op, c_op) \
|
||||
static inline int atomic_fetch_##op(int i, atomic_t *v) \
|
||||
{ \
|
||||
int c, old; \
|
||||
\
|
||||
c = v->counter; \
|
||||
while ((old = cmpxchg(&v->counter, c, c c_op i)) != c) \
|
||||
c = old; \
|
||||
\
|
||||
return c; \
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <linux/irqflags.h>
|
||||
|
||||
#define ATOMIC_OP(op, c_op) \
|
||||
static inline void atomic_##op(int i, atomic_t *v) \
|
||||
{ \
|
||||
unsigned long flags; \
|
||||
\
|
||||
raw_local_irq_save(flags); \
|
||||
v->counter = v->counter c_op i; \
|
||||
raw_local_irq_restore(flags); \
|
||||
}
|
||||
|
||||
#define ATOMIC_OP_RETURN(op, c_op) \
|
||||
static inline int atomic_##op##_return(int i, atomic_t *v) \
|
||||
{ \
|
||||
unsigned long flags; \
|
||||
int ret; \
|
||||
\
|
||||
raw_local_irq_save(flags); \
|
||||
ret = (v->counter = v->counter c_op i); \
|
||||
raw_local_irq_restore(flags); \
|
||||
\
|
||||
return ret; \
|
||||
}
|
||||
|
||||
#define ATOMIC_FETCH_OP(op, c_op) \
|
||||
static inline int atomic_fetch_##op(int i, atomic_t *v) \
|
||||
{ \
|
||||
unsigned long flags; \
|
||||
int ret; \
|
||||
\
|
||||
raw_local_irq_save(flags); \
|
||||
ret = v->counter; \
|
||||
v->counter = v->counter c_op i; \
|
||||
raw_local_irq_restore(flags); \
|
||||
\
|
||||
return ret; \
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SMP */
|
||||
|
||||
#ifndef atomic_add_return
|
||||
ATOMIC_OP_RETURN(add, +)
|
||||
#endif
|
||||
|
||||
#ifndef atomic_sub_return
|
||||
ATOMIC_OP_RETURN(sub, -)
|
||||
#endif
|
||||
|
||||
#ifndef atomic_fetch_add
|
||||
ATOMIC_FETCH_OP(add, +)
|
||||
#endif
|
||||
|
||||
#ifndef atomic_fetch_sub
|
||||
ATOMIC_FETCH_OP(sub, -)
|
||||
#endif
|
||||
|
||||
#ifndef atomic_fetch_and
|
||||
ATOMIC_FETCH_OP(and, &)
|
||||
#endif
|
||||
|
||||
#ifndef atomic_fetch_or
|
||||
ATOMIC_FETCH_OP(or, |)
|
||||
#endif
|
||||
|
||||
#ifndef atomic_fetch_xor
|
||||
ATOMIC_FETCH_OP(xor, ^)
|
||||
#endif
|
||||
|
||||
#ifndef atomic_and
|
||||
ATOMIC_OP(and, &)
|
||||
#endif
|
||||
|
||||
#ifndef atomic_or
|
||||
ATOMIC_OP(or, |)
|
||||
#endif
|
||||
|
||||
#ifndef atomic_xor
|
||||
ATOMIC_OP(xor, ^)
|
||||
#endif
|
||||
|
||||
#undef ATOMIC_FETCH_OP
|
||||
#undef ATOMIC_OP_RETURN
|
||||
#undef ATOMIC_OP
|
||||
|
||||
/*
|
||||
* Atomic operations that C can't guarantee us. Useful for
|
||||
* resource counting etc..
|
||||
*/
|
||||
|
||||
/**
|
||||
* atomic_read - read atomic variable
|
||||
* @v: pointer of type atomic_t
|
||||
*
|
||||
* Atomically reads the value of @v.
|
||||
*/
|
||||
#ifndef atomic_read
|
||||
#define atomic_read(v) READ_ONCE((v)->counter)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* atomic_set - set atomic variable
|
||||
* @v: pointer of type atomic_t
|
||||
* @i: required value
|
||||
*
|
||||
* Atomically sets the value of @v to @i.
|
||||
*/
|
||||
#define atomic_set(v, i) WRITE_ONCE(((v)->counter), (i))
|
||||
|
||||
#include <linux/irqflags.h>
|
||||
|
||||
static inline void atomic_add(int i, atomic_t *v)
|
||||
{
|
||||
atomic_add_return(i, v);
|
||||
}
|
||||
|
||||
static inline void atomic_sub(int i, atomic_t *v)
|
||||
{
|
||||
atomic_sub_return(i, v);
|
||||
}
|
||||
|
||||
#define atomic_xchg(ptr, v) (xchg(&(ptr)->counter, (v)))
|
||||
#define atomic_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), (old), (new)))
|
||||
|
||||
#endif /* __ASM_GENERIC_ATOMIC_H */
|
|
@ -0,0 +1,56 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
/*
|
||||
* Generic implementation of 64-bit atomics using spinlocks,
|
||||
* useful on processors that don't have 64-bit atomic instructions.
|
||||
*
|
||||
* Copyright © 2009 Paul Mackerras, IBM Corp. <paulus@au1.ibm.com>
|
||||
*/
|
||||
#ifndef _ASM_GENERIC_ATOMIC64_H
|
||||
#define _ASM_GENERIC_ATOMIC64_H
|
||||
#include <linux/types.h>
|
||||
|
||||
typedef struct {
|
||||
s64 counter;
|
||||
} atomic64_t;
|
||||
|
||||
#define ATOMIC64_INIT(i) { (i) }
|
||||
|
||||
extern s64 atomic64_read(const atomic64_t *v);
|
||||
extern void atomic64_set(atomic64_t *v, s64 i);
|
||||
|
||||
#define atomic64_set_release(v, i) atomic64_set((v), (i))
|
||||
|
||||
#define ATOMIC64_OP(op) \
|
||||
extern void atomic64_##op(s64 a, atomic64_t *v);
|
||||
|
||||
#define ATOMIC64_OP_RETURN(op) \
|
||||
extern s64 atomic64_##op##_return(s64 a, atomic64_t *v);
|
||||
|
||||
#define ATOMIC64_FETCH_OP(op) \
|
||||
extern s64 atomic64_fetch_##op(s64 a, atomic64_t *v);
|
||||
|
||||
#define ATOMIC64_OPS(op) ATOMIC64_OP(op) ATOMIC64_OP_RETURN(op) ATOMIC64_FETCH_OP(op)
|
||||
|
||||
ATOMIC64_OPS(add)
|
||||
ATOMIC64_OPS(sub)
|
||||
|
||||
#undef ATOMIC64_OPS
|
||||
#define ATOMIC64_OPS(op) ATOMIC64_OP(op) ATOMIC64_FETCH_OP(op)
|
||||
|
||||
ATOMIC64_OPS(and)
|
||||
ATOMIC64_OPS(or)
|
||||
ATOMIC64_OPS(xor)
|
||||
|
||||
#undef ATOMIC64_OPS
|
||||
#undef ATOMIC64_FETCH_OP
|
||||
#undef ATOMIC64_OP_RETURN
|
||||
#undef ATOMIC64_OP
|
||||
|
||||
extern s64 atomic64_dec_if_positive(atomic64_t *v);
|
||||
#define atomic64_dec_if_positive atomic64_dec_if_positive
|
||||
extern s64 atomic64_cmpxchg(atomic64_t *v, s64 o, s64 n);
|
||||
extern s64 atomic64_xchg(atomic64_t *v, s64 new);
|
||||
extern s64 atomic64_fetch_add_unless(atomic64_t *v, s64 a, s64 u);
|
||||
#define atomic64_fetch_add_unless atomic64_fetch_add_unless
|
||||
|
||||
#endif /* _ASM_GENERIC_ATOMIC64_H */
|
|
@ -0,0 +1,33 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifdef __NR_chmod
|
||||
__NR_chmod,
|
||||
#endif
|
||||
__NR_fchmod,
|
||||
#ifdef __NR_chown
|
||||
__NR_chown,
|
||||
__NR_lchown,
|
||||
#endif
|
||||
#ifdef __NR_fchown
|
||||
__NR_fchown,
|
||||
#endif
|
||||
__NR_setxattr,
|
||||
__NR_lsetxattr,
|
||||
__NR_fsetxattr,
|
||||
__NR_removexattr,
|
||||
__NR_lremovexattr,
|
||||
__NR_fremovexattr,
|
||||
#ifdef __NR_fchownat
|
||||
__NR_fchownat,
|
||||
__NR_fchmodat,
|
||||
#endif
|
||||
#ifdef __NR_chown32
|
||||
__NR_chown32,
|
||||
__NR_fchown32,
|
||||
__NR_lchown32,
|
||||
#endif
|
||||
#ifdef __NR_link
|
||||
__NR_link,
|
||||
#endif
|
||||
#ifdef __NR_linkat
|
||||
__NR_linkat,
|
||||
#endif
|
|
@ -0,0 +1,38 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifdef __NR_rename
|
||||
__NR_rename,
|
||||
#endif
|
||||
#ifdef __NR_mkdir
|
||||
__NR_mkdir,
|
||||
#endif
|
||||
#ifdef __NR_rmdir
|
||||
__NR_rmdir,
|
||||
#endif
|
||||
#ifdef __NR_creat
|
||||
__NR_creat,
|
||||
#endif
|
||||
#ifdef __NR_link
|
||||
__NR_link,
|
||||
#endif
|
||||
#ifdef __NR_unlink
|
||||
__NR_unlink,
|
||||
#endif
|
||||
#ifdef __NR_symlink
|
||||
__NR_symlink,
|
||||
#endif
|
||||
#ifdef __NR_mknod
|
||||
__NR_mknod,
|
||||
#endif
|
||||
#ifdef __NR_mkdirat
|
||||
__NR_mkdirat,
|
||||
__NR_mknodat,
|
||||
__NR_unlinkat,
|
||||
#ifdef __NR_renameat
|
||||
__NR_renameat,
|
||||
#endif
|
||||
__NR_linkat,
|
||||
__NR_symlinkat,
|
||||
#endif
|
||||
#ifdef __NR_renameat2
|
||||
__NR_renameat2,
|
||||
#endif
|
|
@ -0,0 +1,14 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifdef __NR_readlink
|
||||
__NR_readlink,
|
||||
#endif
|
||||
__NR_quotactl,
|
||||
__NR_listxattr,
|
||||
__NR_llistxattr,
|
||||
__NR_flistxattr,
|
||||
__NR_getxattr,
|
||||
__NR_lgetxattr,
|
||||
__NR_fgetxattr,
|
||||
#ifdef __NR_readlinkat
|
||||
__NR_readlinkat,
|
||||
#endif
|
|
@ -0,0 +1,3 @@
|
|||
__NR_kill,
|
||||
__NR_tgkill,
|
||||
__NR_tkill,
|
|
@ -0,0 +1,25 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#include <asm-generic/audit_dir_write.h>
|
||||
__NR_acct,
|
||||
#ifdef __NR_swapon
|
||||
__NR_swapon,
|
||||
#endif
|
||||
__NR_quotactl,
|
||||
#ifdef __NR_truncate
|
||||
__NR_truncate,
|
||||
#endif
|
||||
#ifdef __NR_truncate64
|
||||
__NR_truncate64,
|
||||
#endif
|
||||
#ifdef __NR_ftruncate
|
||||
__NR_ftruncate,
|
||||
#endif
|
||||
#ifdef __NR_ftruncate64
|
||||
__NR_ftruncate64,
|
||||
#endif
|
||||
#ifdef __NR_bind
|
||||
__NR_bind, /* bind can affect fs object only in one way... */
|
||||
#endif
|
||||
#ifdef __NR_fallocate
|
||||
__NR_fallocate,
|
||||
#endif
|
|
@ -0,0 +1,255 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
/*
|
||||
* Generic barrier definitions.
|
||||
*
|
||||
* It should be possible to use these on really simple architectures,
|
||||
* but it serves more as a starting point for new ports.
|
||||
*
|
||||
* Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
|
||||
* Written by David Howells (dhowells@redhat.com)
|
||||
*/
|
||||
#ifndef __ASM_GENERIC_BARRIER_H
|
||||
#define __ASM_GENERIC_BARRIER_H
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#include <linux/compiler.h>
|
||||
#include <asm/rwonce.h>
|
||||
|
||||
#ifndef nop
|
||||
#define nop() asm volatile ("nop")
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Force strict CPU ordering. And yes, this is required on UP too when we're
|
||||
* talking to devices.
|
||||
*
|
||||
* Fall back to compiler barriers if nothing better is provided.
|
||||
*/
|
||||
|
||||
#ifndef mb
|
||||
#define mb() barrier()
|
||||
#endif
|
||||
|
||||
#ifndef rmb
|
||||
#define rmb() mb()
|
||||
#endif
|
||||
|
||||
#ifndef wmb
|
||||
#define wmb() mb()
|
||||
#endif
|
||||
|
||||
#ifndef dma_rmb
|
||||
#define dma_rmb() rmb()
|
||||
#endif
|
||||
|
||||
#ifndef dma_wmb
|
||||
#define dma_wmb() wmb()
|
||||
#endif
|
||||
|
||||
#ifndef __smp_mb
|
||||
#define __smp_mb() mb()
|
||||
#endif
|
||||
|
||||
#ifndef __smp_rmb
|
||||
#define __smp_rmb() rmb()
|
||||
#endif
|
||||
|
||||
#ifndef __smp_wmb
|
||||
#define __smp_wmb() wmb()
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
|
||||
#ifndef smp_mb
|
||||
#define smp_mb() __smp_mb()
|
||||
#endif
|
||||
|
||||
#ifndef smp_rmb
|
||||
#define smp_rmb() __smp_rmb()
|
||||
#endif
|
||||
|
||||
#ifndef smp_wmb
|
||||
#define smp_wmb() __smp_wmb()
|
||||
#endif
|
||||
|
||||
#else /* !CONFIG_SMP */
|
||||
|
||||
#ifndef smp_mb
|
||||
#define smp_mb() barrier()
|
||||
#endif
|
||||
|
||||
#ifndef smp_rmb
|
||||
#define smp_rmb() barrier()
|
||||
#endif
|
||||
|
||||
#ifndef smp_wmb
|
||||
#define smp_wmb() barrier()
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_SMP */
|
||||
|
||||
#ifndef __smp_store_mb
|
||||
#define __smp_store_mb(var, value) do { WRITE_ONCE(var, value); __smp_mb(); } while (0)
|
||||
#endif
|
||||
|
||||
#ifndef __smp_mb__before_atomic
|
||||
#define __smp_mb__before_atomic() __smp_mb()
|
||||
#endif
|
||||
|
||||
#ifndef __smp_mb__after_atomic
|
||||
#define __smp_mb__after_atomic() __smp_mb()
|
||||
#endif
|
||||
|
||||
#ifndef __smp_store_release
|
||||
#define __smp_store_release(p, v) \
|
||||
do { \
|
||||
compiletime_assert_atomic_type(*p); \
|
||||
__smp_mb(); \
|
||||
WRITE_ONCE(*p, v); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef __smp_load_acquire
|
||||
#define __smp_load_acquire(p) \
|
||||
({ \
|
||||
__unqual_scalar_typeof(*p) ___p1 = READ_ONCE(*p); \
|
||||
compiletime_assert_atomic_type(*p); \
|
||||
__smp_mb(); \
|
||||
(typeof(*p))___p1; \
|
||||
})
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
|
||||
#ifndef smp_store_mb
|
||||
#define smp_store_mb(var, value) __smp_store_mb(var, value)
|
||||
#endif
|
||||
|
||||
#ifndef smp_mb__before_atomic
|
||||
#define smp_mb__before_atomic() __smp_mb__before_atomic()
|
||||
#endif
|
||||
|
||||
#ifndef smp_mb__after_atomic
|
||||
#define smp_mb__after_atomic() __smp_mb__after_atomic()
|
||||
#endif
|
||||
|
||||
#ifndef smp_store_release
|
||||
#define smp_store_release(p, v) __smp_store_release(p, v)
|
||||
#endif
|
||||
|
||||
#ifndef smp_load_acquire
|
||||
#define smp_load_acquire(p) __smp_load_acquire(p)
|
||||
#endif
|
||||
|
||||
#else /* !CONFIG_SMP */
|
||||
|
||||
#ifndef smp_store_mb
|
||||
#define smp_store_mb(var, value) do { WRITE_ONCE(var, value); barrier(); } while (0)
|
||||
#endif
|
||||
|
||||
#ifndef smp_mb__before_atomic
|
||||
#define smp_mb__before_atomic() barrier()
|
||||
#endif
|
||||
|
||||
#ifndef smp_mb__after_atomic
|
||||
#define smp_mb__after_atomic() barrier()
|
||||
#endif
|
||||
|
||||
#ifndef smp_store_release
|
||||
#define smp_store_release(p, v) \
|
||||
do { \
|
||||
compiletime_assert_atomic_type(*p); \
|
||||
barrier(); \
|
||||
WRITE_ONCE(*p, v); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef smp_load_acquire
|
||||
#define smp_load_acquire(p) \
|
||||
({ \
|
||||
__unqual_scalar_typeof(*p) ___p1 = READ_ONCE(*p); \
|
||||
compiletime_assert_atomic_type(*p); \
|
||||
barrier(); \
|
||||
(typeof(*p))___p1; \
|
||||
})
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_SMP */
|
||||
|
||||
/* Barriers for virtual machine guests when talking to an SMP host */
|
||||
#define virt_mb() __smp_mb()
|
||||
#define virt_rmb() __smp_rmb()
|
||||
#define virt_wmb() __smp_wmb()
|
||||
#define virt_store_mb(var, value) __smp_store_mb(var, value)
|
||||
#define virt_mb__before_atomic() __smp_mb__before_atomic()
|
||||
#define virt_mb__after_atomic() __smp_mb__after_atomic()
|
||||
#define virt_store_release(p, v) __smp_store_release(p, v)
|
||||
#define virt_load_acquire(p) __smp_load_acquire(p)
|
||||
|
||||
/**
|
||||
* smp_acquire__after_ctrl_dep() - Provide ACQUIRE ordering after a control dependency
|
||||
*
|
||||
* A control dependency provides a LOAD->STORE order, the additional RMB
|
||||
* provides LOAD->LOAD order, together they provide LOAD->{LOAD,STORE} order,
|
||||
* aka. (load)-ACQUIRE.
|
||||
*
|
||||
* Architectures that do not do load speculation can have this be barrier().
|
||||
*/
|
||||
#ifndef smp_acquire__after_ctrl_dep
|
||||
#define smp_acquire__after_ctrl_dep() smp_rmb()
|
||||
#endif
|
||||
|
||||
/**
|
||||
* smp_cond_load_relaxed() - (Spin) wait for cond with no ordering guarantees
|
||||
* @ptr: pointer to the variable to wait on
|
||||
* @cond: boolean expression to wait for
|
||||
*
|
||||
* Equivalent to using READ_ONCE() on the condition variable.
|
||||
*
|
||||
* Due to C lacking lambda expressions we load the value of *ptr into a
|
||||
* pre-named variable @VAL to be used in @cond.
|
||||
*/
|
||||
#ifndef smp_cond_load_relaxed
|
||||
#define smp_cond_load_relaxed(ptr, cond_expr) ({ \
|
||||
typeof(ptr) __PTR = (ptr); \
|
||||
__unqual_scalar_typeof(*ptr) VAL; \
|
||||
for (;;) { \
|
||||
VAL = READ_ONCE(*__PTR); \
|
||||
if (cond_expr) \
|
||||
break; \
|
||||
cpu_relax(); \
|
||||
} \
|
||||
(typeof(*ptr))VAL; \
|
||||
})
|
||||
#endif
|
||||
|
||||
/**
|
||||
* smp_cond_load_acquire() - (Spin) wait for cond with ACQUIRE ordering
|
||||
* @ptr: pointer to the variable to wait on
|
||||
* @cond: boolean expression to wait for
|
||||
*
|
||||
* Equivalent to using smp_load_acquire() on the condition variable but employs
|
||||
* the control dependency of the wait to reduce the barrier on many platforms.
|
||||
*/
|
||||
#ifndef smp_cond_load_acquire
|
||||
#define smp_cond_load_acquire(ptr, cond_expr) ({ \
|
||||
__unqual_scalar_typeof(*ptr) _val; \
|
||||
_val = smp_cond_load_relaxed(ptr, cond_expr); \
|
||||
smp_acquire__after_ctrl_dep(); \
|
||||
(typeof(*ptr))_val; \
|
||||
})
|
||||
#endif
|
||||
|
||||
/*
|
||||
* pmem_wmb() ensures that all stores for which the modification
|
||||
* are written to persistent storage by preceding instructions have
|
||||
* updated persistent storage before any data access or data transfer
|
||||
* caused by subsequent instructions is initiated.
|
||||
*/
|
||||
#ifndef pmem_wmb
|
||||
#define pmem_wmb() wmb()
|
||||
#endif
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
#endif /* __ASM_GENERIC_BARRIER_H */
|
|
@ -0,0 +1,39 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef __ASM_GENERIC_BITOPS_H
|
||||
#define __ASM_GENERIC_BITOPS_H
|
||||
|
||||
/*
|
||||
* For the benefit of those who are trying to port Linux to another
|
||||
* architecture, here are some C-language equivalents. They should
|
||||
* generate reasonable code, so take a look at what your compiler spits
|
||||
* out before rolling your own buggy implementation in assembly language.
|
||||
*
|
||||
* C language equivalents written by Theodore Ts'o, 9/26/92
|
||||
*/
|
||||
|
||||
#include <linux/irqflags.h>
|
||||
#include <linux/compiler.h>
|
||||
#include <asm/barrier.h>
|
||||
|
||||
#include <asm-generic/bitops/__ffs.h>
|
||||
#include <asm-generic/bitops/ffz.h>
|
||||
#include <asm-generic/bitops/fls.h>
|
||||
#include <asm-generic/bitops/__fls.h>
|
||||
#include <asm-generic/bitops/fls64.h>
|
||||
#include <asm-generic/bitops/find.h>
|
||||
|
||||
#ifndef _LINUX_BITOPS_H
|
||||
#error only <linux/bitops.h> can be included directly
|
||||
#endif
|
||||
|
||||
#include <asm-generic/bitops/sched.h>
|
||||
#include <asm-generic/bitops/ffs.h>
|
||||
#include <asm-generic/bitops/hweight.h>
|
||||
#include <asm-generic/bitops/lock.h>
|
||||
|
||||
#include <asm-generic/bitops/atomic.h>
|
||||
#include <asm-generic/bitops/non-atomic.h>
|
||||
#include <asm-generic/bitops/le.h>
|
||||
#include <asm-generic/bitops/ext2-atomic.h>
|
||||
|
||||
#endif /* __ASM_GENERIC_BITOPS_H */
|
|
@ -0,0 +1,44 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_GENERIC_BITOPS___FFS_H_
|
||||
#define _ASM_GENERIC_BITOPS___FFS_H_
|
||||
|
||||
#include <asm/types.h>
|
||||
|
||||
/**
|
||||
* __ffs - find first bit in word.
|
||||
* @word: The word to search
|
||||
*
|
||||
* Undefined if no bit exists, so code should check against 0 first.
|
||||
*/
|
||||
static __always_inline unsigned long __ffs(unsigned long word)
|
||||
{
|
||||
int num = 0;
|
||||
|
||||
#if BITS_PER_LONG == 64
|
||||
if ((word & 0xffffffff) == 0) {
|
||||
num += 32;
|
||||
word >>= 32;
|
||||
}
|
||||
#endif
|
||||
if ((word & 0xffff) == 0) {
|
||||
num += 16;
|
||||
word >>= 16;
|
||||
}
|
||||
if ((word & 0xff) == 0) {
|
||||
num += 8;
|
||||
word >>= 8;
|
||||
}
|
||||
if ((word & 0xf) == 0) {
|
||||
num += 4;
|
||||
word >>= 4;
|
||||
}
|
||||
if ((word & 0x3) == 0) {
|
||||
num += 2;
|
||||
word >>= 2;
|
||||
}
|
||||
if ((word & 0x1) == 0)
|
||||
num += 1;
|
||||
return num;
|
||||
}
|
||||
|
||||
#endif /* _ASM_GENERIC_BITOPS___FFS_H_ */
|
|
@ -0,0 +1,44 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_GENERIC_BITOPS___FLS_H_
|
||||
#define _ASM_GENERIC_BITOPS___FLS_H_
|
||||
|
||||
#include <asm/types.h>
|
||||
|
||||
/**
|
||||
* __fls - find last (most-significant) set bit in a long word
|
||||
* @word: the word to search
|
||||
*
|
||||
* Undefined if no set bit exists, so code should check against 0 first.
|
||||
*/
|
||||
static __always_inline unsigned long __fls(unsigned long word)
|
||||
{
|
||||
int num = BITS_PER_LONG - 1;
|
||||
|
||||
#if BITS_PER_LONG == 64
|
||||
if (!(word & (~0ul << 32))) {
|
||||
num -= 32;
|
||||
word <<= 32;
|
||||
}
|
||||
#endif
|
||||
if (!(word & (~0ul << (BITS_PER_LONG-16)))) {
|
||||
num -= 16;
|
||||
word <<= 16;
|
||||
}
|
||||
if (!(word & (~0ul << (BITS_PER_LONG-8)))) {
|
||||
num -= 8;
|
||||
word <<= 8;
|
||||
}
|
||||
if (!(word & (~0ul << (BITS_PER_LONG-4)))) {
|
||||
num -= 4;
|
||||
word <<= 4;
|
||||
}
|
||||
if (!(word & (~0ul << (BITS_PER_LONG-2)))) {
|
||||
num -= 2;
|
||||
word <<= 2;
|
||||
}
|
||||
if (!(word & (~0ul << (BITS_PER_LONG-1))))
|
||||
num -= 1;
|
||||
return num;
|
||||
}
|
||||
|
||||
#endif /* _ASM_GENERIC_BITOPS___FLS_H_ */
|
|
@ -0,0 +1,26 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_GENERIC_BITOPS_ARCH_HWEIGHT_H_
|
||||
#define _ASM_GENERIC_BITOPS_ARCH_HWEIGHT_H_
|
||||
|
||||
#include <asm/types.h>
|
||||
|
||||
static inline unsigned int __arch_hweight32(unsigned int w)
|
||||
{
|
||||
return __sw_hweight32(w);
|
||||
}
|
||||
|
||||
static inline unsigned int __arch_hweight16(unsigned int w)
|
||||
{
|
||||
return __sw_hweight16(w);
|
||||
}
|
||||
|
||||
static inline unsigned int __arch_hweight8(unsigned int w)
|
||||
{
|
||||
return __sw_hweight8(w);
|
||||
}
|
||||
|
||||
static inline unsigned long __arch_hweight64(__u64 w)
|
||||
{
|
||||
return __sw_hweight64(w);
|
||||
}
|
||||
#endif /* _ASM_GENERIC_BITOPS_HWEIGHT_H_ */
|
|
@ -0,0 +1,62 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_GENERIC_BITOPS_ATOMIC_H_
|
||||
#define _ASM_GENERIC_BITOPS_ATOMIC_H_
|
||||
|
||||
#include <linux/atomic.h>
|
||||
#include <linux/compiler.h>
|
||||
#include <asm/barrier.h>
|
||||
|
||||
/*
|
||||
* Implementation of atomic bitops using atomic-fetch ops.
|
||||
* See Documentation/atomic_bitops.txt for details.
|
||||
*/
|
||||
|
||||
static __always_inline void set_bit(unsigned int nr, volatile unsigned long *p)
|
||||
{
|
||||
p += BIT_WORD(nr);
|
||||
atomic_long_or(BIT_MASK(nr), (atomic_long_t *)p);
|
||||
}
|
||||
|
||||
static __always_inline void clear_bit(unsigned int nr, volatile unsigned long *p)
|
||||
{
|
||||
p += BIT_WORD(nr);
|
||||
atomic_long_andnot(BIT_MASK(nr), (atomic_long_t *)p);
|
||||
}
|
||||
|
||||
static __always_inline void change_bit(unsigned int nr, volatile unsigned long *p)
|
||||
{
|
||||
p += BIT_WORD(nr);
|
||||
atomic_long_xor(BIT_MASK(nr), (atomic_long_t *)p);
|
||||
}
|
||||
|
||||
static inline int test_and_set_bit(unsigned int nr, volatile unsigned long *p)
|
||||
{
|
||||
long old;
|
||||
unsigned long mask = BIT_MASK(nr);
|
||||
|
||||
p += BIT_WORD(nr);
|
||||
old = atomic_long_fetch_or(mask, (atomic_long_t *)p);
|
||||
return !!(old & mask);
|
||||
}
|
||||
|
||||
static inline int test_and_clear_bit(unsigned int nr, volatile unsigned long *p)
|
||||
{
|
||||
long old;
|
||||
unsigned long mask = BIT_MASK(nr);
|
||||
|
||||
p += BIT_WORD(nr);
|
||||
old = atomic_long_fetch_andnot(mask, (atomic_long_t *)p);
|
||||
return !!(old & mask);
|
||||
}
|
||||
|
||||
static inline int test_and_change_bit(unsigned int nr, volatile unsigned long *p)
|
||||
{
|
||||
long old;
|
||||
unsigned long mask = BIT_MASK(nr);
|
||||
|
||||
p += BIT_WORD(nr);
|
||||
old = atomic_long_fetch_xor(mask, (atomic_long_t *)p);
|
||||
return !!(old & mask);
|
||||
}
|
||||
|
||||
#endif /* _ASM_GENERIC_BITOPS_ATOMIC_H */
|
|
@ -0,0 +1,16 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_GENERIC_BITOPS_BUILTIN___FFS_H_
|
||||
#define _ASM_GENERIC_BITOPS_BUILTIN___FFS_H_
|
||||
|
||||
/**
|
||||
* __ffs - find first bit in word.
|
||||
* @word: The word to search
|
||||
*
|
||||
* Undefined if no bit exists, so code should check against 0 first.
|
||||
*/
|
||||
static __always_inline unsigned long __ffs(unsigned long word)
|
||||
{
|
||||
return __builtin_ctzl(word);
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,16 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_GENERIC_BITOPS_BUILTIN___FLS_H_
|
||||
#define _ASM_GENERIC_BITOPS_BUILTIN___FLS_H_
|
||||
|
||||
/**
|
||||
* __fls - find last (most-significant) set bit in a long word
|
||||
* @word: the word to search
|
||||
*
|
||||
* Undefined if no set bit exists, so code should check against 0 first.
|
||||
*/
|
||||
static __always_inline unsigned long __fls(unsigned long word)
|
||||
{
|
||||
return (sizeof(word) * 8) - 1 - __builtin_clzl(word);
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,18 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_GENERIC_BITOPS_BUILTIN_FFS_H_
|
||||
#define _ASM_GENERIC_BITOPS_BUILTIN_FFS_H_
|
||||
|
||||
/**
|
||||
* ffs - find first bit set
|
||||
* @x: the word to search
|
||||
*
|
||||
* This is defined the same way as
|
||||
* the libc and compiler builtin ffs routines, therefore
|
||||
* differs in spirit from the above ffz (man ffs).
|
||||
*/
|
||||
static __always_inline int ffs(int x)
|
||||
{
|
||||
return __builtin_ffs(x);
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,17 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_GENERIC_BITOPS_BUILTIN_FLS_H_
|
||||
#define _ASM_GENERIC_BITOPS_BUILTIN_FLS_H_
|
||||
|
||||
/**
|
||||
* fls - find last (most-significant) bit set
|
||||
* @x: the word to search
|
||||
*
|
||||
* This is defined the same way as ffs.
|
||||
* Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
|
||||
*/
|
||||
static __always_inline int fls(unsigned int x)
|
||||
{
|
||||
return x ? sizeof(x) * 8 - __builtin_clz(x) : 0;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,44 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_GENERIC_BITOPS_CONST_HWEIGHT_H_
|
||||
#define _ASM_GENERIC_BITOPS_CONST_HWEIGHT_H_
|
||||
|
||||
/*
|
||||
* Compile time versions of __arch_hweightN()
|
||||
*/
|
||||
#define __const_hweight8(w) \
|
||||
((unsigned int) \
|
||||
((!!((w) & (1ULL << 0))) + \
|
||||
(!!((w) & (1ULL << 1))) + \
|
||||
(!!((w) & (1ULL << 2))) + \
|
||||
(!!((w) & (1ULL << 3))) + \
|
||||
(!!((w) & (1ULL << 4))) + \
|
||||
(!!((w) & (1ULL << 5))) + \
|
||||
(!!((w) & (1ULL << 6))) + \
|
||||
(!!((w) & (1ULL << 7)))))
|
||||
|
||||
#define __const_hweight16(w) (__const_hweight8(w) + __const_hweight8((w) >> 8 ))
|
||||
#define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
|
||||
#define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
|
||||
|
||||
/*
|
||||
* Generic interface.
|
||||
*/
|
||||
#define hweight8(w) (__builtin_constant_p(w) ? __const_hweight8(w) : __arch_hweight8(w))
|
||||
#define hweight16(w) (__builtin_constant_p(w) ? __const_hweight16(w) : __arch_hweight16(w))
|
||||
#define hweight32(w) (__builtin_constant_p(w) ? __const_hweight32(w) : __arch_hweight32(w))
|
||||
#define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
|
||||
|
||||
/*
|
||||
* Interface for known constant arguments
|
||||
*/
|
||||
#define HWEIGHT8(w) (BUILD_BUG_ON_ZERO(!__builtin_constant_p(w)) + __const_hweight8(w))
|
||||
#define HWEIGHT16(w) (BUILD_BUG_ON_ZERO(!__builtin_constant_p(w)) + __const_hweight16(w))
|
||||
#define HWEIGHT32(w) (BUILD_BUG_ON_ZERO(!__builtin_constant_p(w)) + __const_hweight32(w))
|
||||
#define HWEIGHT64(w) (BUILD_BUG_ON_ZERO(!__builtin_constant_p(w)) + __const_hweight64(w))
|
||||
|
||||
/*
|
||||
* Type invariant interface to the compile time constant hweight functions.
|
||||
*/
|
||||
#define HWEIGHT(w) HWEIGHT64((u64)w)
|
||||
|
||||
#endif /* _ASM_GENERIC_BITOPS_CONST_HWEIGHT_H_ */
|
|
@ -0,0 +1,12 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_GENERIC_BITOPS_EXT2_ATOMIC_SETBIT_H_
|
||||
#define _ASM_GENERIC_BITOPS_EXT2_ATOMIC_SETBIT_H_
|
||||
|
||||
/*
|
||||
* Atomic bitops based version of ext2 atomic bitops
|
||||
*/
|
||||
|
||||
#define ext2_set_bit_atomic(l, nr, addr) test_and_set_bit_le(nr, addr)
|
||||
#define ext2_clear_bit_atomic(l, nr, addr) test_and_clear_bit_le(nr, addr)
|
||||
|
||||
#endif /* _ASM_GENERIC_BITOPS_EXT2_ATOMIC_SETBIT_H_ */
|
|
@ -0,0 +1,27 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_
|
||||
#define _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_
|
||||
|
||||
/*
|
||||
* Spinlock based version of ext2 atomic bitops
|
||||
*/
|
||||
|
||||
#define ext2_set_bit_atomic(lock, nr, addr) \
|
||||
({ \
|
||||
int ret; \
|
||||
spin_lock(lock); \
|
||||
ret = __test_and_set_bit_le(nr, addr); \
|
||||
spin_unlock(lock); \
|
||||
ret; \
|
||||
})
|
||||
|
||||
#define ext2_clear_bit_atomic(lock, nr, addr) \
|
||||
({ \
|
||||
int ret; \
|
||||
spin_lock(lock); \
|
||||
ret = __test_and_clear_bit_le(nr, addr); \
|
||||
spin_unlock(lock); \
|
||||
ret; \
|
||||
})
|
||||
|
||||
#endif /* _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_ */
|
|
@ -0,0 +1,42 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_GENERIC_BITOPS_FFS_H_
|
||||
#define _ASM_GENERIC_BITOPS_FFS_H_
|
||||
|
||||
/**
|
||||
* ffs - find first bit set
|
||||
* @x: the word to search
|
||||
*
|
||||
* This is defined the same way as
|
||||
* the libc and compiler builtin ffs routines, therefore
|
||||
* differs in spirit from the above ffz (man ffs).
|
||||
*/
|
||||
static inline int ffs(int x)
|
||||
{
|
||||
int r = 1;
|
||||
|
||||
if (!x)
|
||||
return 0;
|
||||
if (!(x & 0xffff)) {
|
||||
x >>= 16;
|
||||
r += 16;
|
||||
}
|
||||
if (!(x & 0xff)) {
|
||||
x >>= 8;
|
||||
r += 8;
|
||||
}
|
||||
if (!(x & 0xf)) {
|
||||
x >>= 4;
|
||||
r += 4;
|
||||
}
|
||||
if (!(x & 3)) {
|
||||
x >>= 2;
|
||||
r += 2;
|
||||
}
|
||||
if (!(x & 1)) {
|
||||
x >>= 1;
|
||||
r += 1;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
#endif /* _ASM_GENERIC_BITOPS_FFS_H_ */
|
|
@ -0,0 +1,13 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_GENERIC_BITOPS_FFZ_H_
|
||||
#define _ASM_GENERIC_BITOPS_FFZ_H_
|
||||
|
||||
/*
|
||||
* ffz - find first zero in word.
|
||||
* @word: The word to search
|
||||
*
|
||||
* Undefined if no zero exists, so code should check against ~0UL first.
|
||||
*/
|
||||
#define ffz(x) __ffs(~(x))
|
||||
|
||||
#endif /* _ASM_GENERIC_BITOPS_FFZ_H_ */
|
|
@ -0,0 +1,100 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_GENERIC_BITOPS_FIND_H_
|
||||
#define _ASM_GENERIC_BITOPS_FIND_H_
|
||||
|
||||
#ifndef find_next_bit
|
||||
/**
|
||||
* find_next_bit - find the next set bit in a memory region
|
||||
* @addr: The address to base the search on
|
||||
* @offset: The bitnumber to start searching at
|
||||
* @size: The bitmap size in bits
|
||||
*
|
||||
* Returns the bit number for the next set bit
|
||||
* If no bits are set, returns @size.
|
||||
*/
|
||||
extern unsigned long find_next_bit(const unsigned long *addr, unsigned long
|
||||
size, unsigned long offset);
|
||||
#endif
|
||||
|
||||
#ifndef find_next_and_bit
|
||||
/**
|
||||
* find_next_and_bit - find the next set bit in both memory regions
|
||||
* @addr1: The first address to base the search on
|
||||
* @addr2: The second address to base the search on
|
||||
* @offset: The bitnumber to start searching at
|
||||
* @size: The bitmap size in bits
|
||||
*
|
||||
* Returns the bit number for the next set bit
|
||||
* If no bits are set, returns @size.
|
||||
*/
|
||||
extern unsigned long find_next_and_bit(const unsigned long *addr1,
|
||||
const unsigned long *addr2, unsigned long size,
|
||||
unsigned long offset);
|
||||
#endif
|
||||
|
||||
#ifndef find_next_zero_bit
|
||||
/**
|
||||
* find_next_zero_bit - find the next cleared bit in a memory region
|
||||
* @addr: The address to base the search on
|
||||
* @offset: The bitnumber to start searching at
|
||||
* @size: The bitmap size in bits
|
||||
*
|
||||
* Returns the bit number of the next zero bit
|
||||
* If no bits are zero, returns @size.
|
||||
*/
|
||||
extern unsigned long find_next_zero_bit(const unsigned long *addr, unsigned
|
||||
long size, unsigned long offset);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_GENERIC_FIND_FIRST_BIT
|
||||
|
||||
/**
|
||||
* find_first_bit - find the first set bit in a memory region
|
||||
* @addr: The address to start the search at
|
||||
* @size: The maximum number of bits to search
|
||||
*
|
||||
* Returns the bit number of the first set bit.
|
||||
* If no bits are set, returns @size.
|
||||
*/
|
||||
extern unsigned long find_first_bit(const unsigned long *addr,
|
||||
unsigned long size);
|
||||
|
||||
/**
|
||||
* find_first_zero_bit - find the first cleared bit in a memory region
|
||||
* @addr: The address to start the search at
|
||||
* @size: The maximum number of bits to search
|
||||
*
|
||||
* Returns the bit number of the first cleared bit.
|
||||
* If no bits are zero, returns @size.
|
||||
*/
|
||||
extern unsigned long find_first_zero_bit(const unsigned long *addr,
|
||||
unsigned long size);
|
||||
#else /* CONFIG_GENERIC_FIND_FIRST_BIT */
|
||||
|
||||
#ifndef find_first_bit
|
||||
#define find_first_bit(addr, size) find_next_bit((addr), (size), 0)
|
||||
#endif
|
||||
#ifndef find_first_zero_bit
|
||||
#define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0)
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_GENERIC_FIND_FIRST_BIT */
|
||||
|
||||
/**
|
||||
* find_next_clump8 - find next 8-bit clump with set bits in a memory region
|
||||
* @clump: location to store copy of found clump
|
||||
* @addr: address to base the search on
|
||||
* @size: bitmap size in number of bits
|
||||
* @offset: bit offset at which to start searching
|
||||
*
|
||||
* Returns the bit offset for the next set clump; the found clump value is
|
||||
* copied to the location pointed by @clump. If no bits are set, returns @size.
|
||||
*/
|
||||
extern unsigned long find_next_clump8(unsigned long *clump,
|
||||
const unsigned long *addr,
|
||||
unsigned long size, unsigned long offset);
|
||||
|
||||
#define find_first_clump8(clump, bits, size) \
|
||||
find_next_clump8((clump), (bits), (size), 0)
|
||||
|
||||
#endif /*_ASM_GENERIC_BITOPS_FIND_H_ */
|
|
@ -0,0 +1,42 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_GENERIC_BITOPS_FLS_H_
|
||||
#define _ASM_GENERIC_BITOPS_FLS_H_
|
||||
|
||||
/**
|
||||
* fls - find last (most-significant) bit set
|
||||
* @x: the word to search
|
||||
*
|
||||
* This is defined the same way as ffs.
|
||||
* Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
|
||||
*/
|
||||
|
||||
static __always_inline int fls(unsigned int x)
|
||||
{
|
||||
int r = 32;
|
||||
|
||||
if (!x)
|
||||
return 0;
|
||||
if (!(x & 0xffff0000u)) {
|
||||
x <<= 16;
|
||||
r -= 16;
|
||||
}
|
||||
if (!(x & 0xff000000u)) {
|
||||
x <<= 8;
|
||||
r -= 8;
|
||||
}
|
||||
if (!(x & 0xf0000000u)) {
|
||||
x <<= 4;
|
||||
r -= 4;
|
||||
}
|
||||
if (!(x & 0xc0000000u)) {
|
||||
x <<= 2;
|
||||
r -= 2;
|
||||
}
|
||||
if (!(x & 0x80000000u)) {
|
||||
x <<= 1;
|
||||
r -= 1;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
#endif /* _ASM_GENERIC_BITOPS_FLS_H_ */
|
|
@ -0,0 +1,37 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_GENERIC_BITOPS_FLS64_H_
|
||||
#define _ASM_GENERIC_BITOPS_FLS64_H_
|
||||
|
||||
#include <asm/types.h>
|
||||
|
||||
/**
|
||||
* fls64 - find last set bit in a 64-bit word
|
||||
* @x: the word to search
|
||||
*
|
||||
* This is defined in a similar way as the libc and compiler builtin
|
||||
* ffsll, but returns the position of the most significant set bit.
|
||||
*
|
||||
* fls64(value) returns 0 if value is 0 or the position of the last
|
||||
* set bit if value is nonzero. The last (most significant) bit is
|
||||
* at position 64.
|
||||
*/
|
||||
#if BITS_PER_LONG == 32
|
||||
static __always_inline int fls64(__u64 x)
|
||||
{
|
||||
__u32 h = x >> 32;
|
||||
if (h)
|
||||
return fls(h) + 32;
|
||||
return fls(x);
|
||||
}
|
||||
#elif BITS_PER_LONG == 64
|
||||
static __always_inline int fls64(__u64 x)
|
||||
{
|
||||
if (x == 0)
|
||||
return 0;
|
||||
return __fls(x) + 1;
|
||||
}
|
||||
#else
|
||||
#error BITS_PER_LONG not 32 or 64
|
||||
#endif
|
||||
|
||||
#endif /* _ASM_GENERIC_BITOPS_FLS64_H_ */
|
|
@ -0,0 +1,8 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_GENERIC_BITOPS_HWEIGHT_H_
|
||||
#define _ASM_GENERIC_BITOPS_HWEIGHT_H_
|
||||
|
||||
#include <asm-generic/bitops/arch_hweight.h>
|
||||
#include <asm-generic/bitops/const_hweight.h>
|
||||
|
||||
#endif /* _ASM_GENERIC_BITOPS_HWEIGHT_H_ */
|
|
@ -0,0 +1,100 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
|
||||
/*
|
||||
* This file provides wrappers with sanitizer instrumentation for atomic bit
|
||||
* operations.
|
||||
*
|
||||
* To use this functionality, an arch's bitops.h file needs to define each of
|
||||
* the below bit operations with an arch_ prefix (e.g. arch_set_bit(),
|
||||
* arch___set_bit(), etc.).
|
||||
*/
|
||||
#ifndef _ASM_GENERIC_BITOPS_INSTRUMENTED_ATOMIC_H
|
||||
#define _ASM_GENERIC_BITOPS_INSTRUMENTED_ATOMIC_H
|
||||
|
||||
#include <linux/instrumented.h>
|
||||
|
||||
/**
|
||||
* set_bit - Atomically set a bit in memory
|
||||
* @nr: the bit to set
|
||||
* @addr: the address to start counting from
|
||||
*
|
||||
* This is a relaxed atomic operation (no implied memory barriers).
|
||||
*
|
||||
* Note that @nr may be almost arbitrarily large; this function is not
|
||||
* restricted to acting on a single-word quantity.
|
||||
*/
|
||||
static inline void set_bit(long nr, volatile unsigned long *addr)
|
||||
{
|
||||
instrument_atomic_write(addr + BIT_WORD(nr), sizeof(long));
|
||||
arch_set_bit(nr, addr);
|
||||
}
|
||||
|
||||
/**
|
||||
* clear_bit - Clears a bit in memory
|
||||
* @nr: Bit to clear
|
||||
* @addr: Address to start counting from
|
||||
*
|
||||
* This is a relaxed atomic operation (no implied memory barriers).
|
||||
*/
|
||||
static inline void clear_bit(long nr, volatile unsigned long *addr)
|
||||
{
|
||||
instrument_atomic_write(addr + BIT_WORD(nr), sizeof(long));
|
||||
arch_clear_bit(nr, addr);
|
||||
}
|
||||
|
||||
/**
|
||||
* change_bit - Toggle a bit in memory
|
||||
* @nr: Bit to change
|
||||
* @addr: Address to start counting from
|
||||
*
|
||||
* This is a relaxed atomic operation (no implied memory barriers).
|
||||
*
|
||||
* Note that @nr may be almost arbitrarily large; this function is not
|
||||
* restricted to acting on a single-word quantity.
|
||||
*/
|
||||
static inline void change_bit(long nr, volatile unsigned long *addr)
|
||||
{
|
||||
instrument_atomic_write(addr + BIT_WORD(nr), sizeof(long));
|
||||
arch_change_bit(nr, addr);
|
||||
}
|
||||
|
||||
/**
|
||||
* test_and_set_bit - Set a bit and return its old value
|
||||
* @nr: Bit to set
|
||||
* @addr: Address to count from
|
||||
*
|
||||
* This is an atomic fully-ordered operation (implied full memory barrier).
|
||||
*/
|
||||
static inline bool test_and_set_bit(long nr, volatile unsigned long *addr)
|
||||
{
|
||||
instrument_atomic_read_write(addr + BIT_WORD(nr), sizeof(long));
|
||||
return arch_test_and_set_bit(nr, addr);
|
||||
}
|
||||
|
||||
/**
|
||||
* test_and_clear_bit - Clear a bit and return its old value
|
||||
* @nr: Bit to clear
|
||||
* @addr: Address to count from
|
||||
*
|
||||
* This is an atomic fully-ordered operation (implied full memory barrier).
|
||||
*/
|
||||
static inline bool test_and_clear_bit(long nr, volatile unsigned long *addr)
|
||||
{
|
||||
instrument_atomic_read_write(addr + BIT_WORD(nr), sizeof(long));
|
||||
return arch_test_and_clear_bit(nr, addr);
|
||||
}
|
||||
|
||||
/**
|
||||
* test_and_change_bit - Change a bit and return its old value
|
||||
* @nr: Bit to change
|
||||
* @addr: Address to count from
|
||||
*
|
||||
* This is an atomic fully-ordered operation (implied full memory barrier).
|
||||
*/
|
||||
static inline bool test_and_change_bit(long nr, volatile unsigned long *addr)
|
||||
{
|
||||
instrument_atomic_read_write(addr + BIT_WORD(nr), sizeof(long));
|
||||
return arch_test_and_change_bit(nr, addr);
|
||||
}
|
||||
|
||||
#endif /* _ASM_GENERIC_BITOPS_INSTRUMENTED_NON_ATOMIC_H */
|
|
@ -0,0 +1,81 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
|
||||
/*
|
||||
* This file provides wrappers with sanitizer instrumentation for bit
|
||||
* locking operations.
|
||||
*
|
||||
* To use this functionality, an arch's bitops.h file needs to define each of
|
||||
* the below bit operations with an arch_ prefix (e.g. arch_set_bit(),
|
||||
* arch___set_bit(), etc.).
|
||||
*/
|
||||
#ifndef _ASM_GENERIC_BITOPS_INSTRUMENTED_LOCK_H
|
||||
#define _ASM_GENERIC_BITOPS_INSTRUMENTED_LOCK_H
|
||||
|
||||
#include <linux/instrumented.h>
|
||||
|
||||
/**
|
||||
* clear_bit_unlock - Clear a bit in memory, for unlock
|
||||
* @nr: the bit to set
|
||||
* @addr: the address to start counting from
|
||||
*
|
||||
* This operation is atomic and provides release barrier semantics.
|
||||
*/
|
||||
static inline void clear_bit_unlock(long nr, volatile unsigned long *addr)
|
||||
{
|
||||
instrument_atomic_write(addr + BIT_WORD(nr), sizeof(long));
|
||||
arch_clear_bit_unlock(nr, addr);
|
||||
}
|
||||
|
||||
/**
|
||||
* __clear_bit_unlock - Clears a bit in memory
|
||||
* @nr: Bit to clear
|
||||
* @addr: Address to start counting from
|
||||
*
|
||||
* This is a non-atomic operation but implies a release barrier before the
|
||||
* memory operation. It can be used for an unlock if no other CPUs can
|
||||
* concurrently modify other bits in the word.
|
||||
*/
|
||||
static inline void __clear_bit_unlock(long nr, volatile unsigned long *addr)
|
||||
{
|
||||
instrument_write(addr + BIT_WORD(nr), sizeof(long));
|
||||
arch___clear_bit_unlock(nr, addr);
|
||||
}
|
||||
|
||||
/**
|
||||
* test_and_set_bit_lock - Set a bit and return its old value, for lock
|
||||
* @nr: Bit to set
|
||||
* @addr: Address to count from
|
||||
*
|
||||
* This operation is atomic and provides acquire barrier semantics if
|
||||
* the returned value is 0.
|
||||
* It can be used to implement bit locks.
|
||||
*/
|
||||
static inline bool test_and_set_bit_lock(long nr, volatile unsigned long *addr)
|
||||
{
|
||||
instrument_atomic_read_write(addr + BIT_WORD(nr), sizeof(long));
|
||||
return arch_test_and_set_bit_lock(nr, addr);
|
||||
}
|
||||
|
||||
#if defined(arch_clear_bit_unlock_is_negative_byte)
|
||||
/**
|
||||
* clear_bit_unlock_is_negative_byte - Clear a bit in memory and test if bottom
|
||||
* byte is negative, for unlock.
|
||||
* @nr: the bit to clear
|
||||
* @addr: the address to start counting from
|
||||
*
|
||||
* This operation is atomic and provides release barrier semantics.
|
||||
*
|
||||
* This is a bit of a one-trick-pony for the filemap code, which clears
|
||||
* PG_locked and tests PG_waiters,
|
||||
*/
|
||||
static inline bool
|
||||
clear_bit_unlock_is_negative_byte(long nr, volatile unsigned long *addr)
|
||||
{
|
||||
instrument_atomic_write(addr + BIT_WORD(nr), sizeof(long));
|
||||
return arch_clear_bit_unlock_is_negative_byte(nr, addr);
|
||||
}
|
||||
/* Let everybody know we have it. */
|
||||
#define clear_bit_unlock_is_negative_byte clear_bit_unlock_is_negative_byte
|
||||
#endif
|
||||
|
||||
#endif /* _ASM_GENERIC_BITOPS_INSTRUMENTED_LOCK_H */
|
|
@ -0,0 +1,138 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
|
||||
/*
|
||||
* This file provides wrappers with sanitizer instrumentation for non-atomic
|
||||
* bit operations.
|
||||
*
|
||||
* To use this functionality, an arch's bitops.h file needs to define each of
|
||||
* the below bit operations with an arch_ prefix (e.g. arch_set_bit(),
|
||||
* arch___set_bit(), etc.).
|
||||
*/
|
||||
#ifndef _ASM_GENERIC_BITOPS_INSTRUMENTED_NON_ATOMIC_H
|
||||
#define _ASM_GENERIC_BITOPS_INSTRUMENTED_NON_ATOMIC_H
|
||||
|
||||
#include <linux/instrumented.h>
|
||||
|
||||
/**
|
||||
* __set_bit - Set a bit in memory
|
||||
* @nr: the bit to set
|
||||
* @addr: the address to start counting from
|
||||
*
|
||||
* Unlike set_bit(), this function is non-atomic. If it is called on the same
|
||||
* region of memory concurrently, the effect may be that only one operation
|
||||
* succeeds.
|
||||
*/
|
||||
static inline void __set_bit(long nr, volatile unsigned long *addr)
|
||||
{
|
||||
instrument_write(addr + BIT_WORD(nr), sizeof(long));
|
||||
arch___set_bit(nr, addr);
|
||||
}
|
||||
|
||||
/**
|
||||
* __clear_bit - Clears a bit in memory
|
||||
* @nr: the bit to clear
|
||||
* @addr: the address to start counting from
|
||||
*
|
||||
* Unlike clear_bit(), this function is non-atomic. If it is called on the same
|
||||
* region of memory concurrently, the effect may be that only one operation
|
||||
* succeeds.
|
||||
*/
|
||||
static inline void __clear_bit(long nr, volatile unsigned long *addr)
|
||||
{
|
||||
instrument_write(addr + BIT_WORD(nr), sizeof(long));
|
||||
arch___clear_bit(nr, addr);
|
||||
}
|
||||
|
||||
/**
|
||||
* __change_bit - Toggle a bit in memory
|
||||
* @nr: the bit to change
|
||||
* @addr: the address to start counting from
|
||||
*
|
||||
* Unlike change_bit(), this function is non-atomic. If it is called on the same
|
||||
* region of memory concurrently, the effect may be that only one operation
|
||||
* succeeds.
|
||||
*/
|
||||
static inline void __change_bit(long nr, volatile unsigned long *addr)
|
||||
{
|
||||
instrument_write(addr + BIT_WORD(nr), sizeof(long));
|
||||
arch___change_bit(nr, addr);
|
||||
}
|
||||
|
||||
static inline void __instrument_read_write_bitop(long nr, volatile unsigned long *addr)
|
||||
{
|
||||
if (IS_ENABLED(CONFIG_KCSAN_ASSUME_PLAIN_WRITES_ATOMIC)) {
|
||||
/*
|
||||
* We treat non-atomic read-write bitops a little more special.
|
||||
* Given the operations here only modify a single bit, assuming
|
||||
* non-atomicity of the writer is sufficient may be reasonable
|
||||
* for certain usage (and follows the permissible nature of the
|
||||
* assume-plain-writes-atomic rule):
|
||||
* 1. report read-modify-write races -> check read;
|
||||
* 2. do not report races with marked readers, but do report
|
||||
* races with unmarked readers -> check "atomic" write.
|
||||
*/
|
||||
kcsan_check_read(addr + BIT_WORD(nr), sizeof(long));
|
||||
/*
|
||||
* Use generic write instrumentation, in case other sanitizers
|
||||
* or tools are enabled alongside KCSAN.
|
||||
*/
|
||||
instrument_write(addr + BIT_WORD(nr), sizeof(long));
|
||||
} else {
|
||||
instrument_read_write(addr + BIT_WORD(nr), sizeof(long));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* __test_and_set_bit - Set a bit and return its old value
|
||||
* @nr: Bit to set
|
||||
* @addr: Address to count from
|
||||
*
|
||||
* This operation is non-atomic. If two instances of this operation race, one
|
||||
* can appear to succeed but actually fail.
|
||||
*/
|
||||
static inline bool __test_and_set_bit(long nr, volatile unsigned long *addr)
|
||||
{
|
||||
__instrument_read_write_bitop(nr, addr);
|
||||
return arch___test_and_set_bit(nr, addr);
|
||||
}
|
||||
|
||||
/**
|
||||
* __test_and_clear_bit - Clear a bit and return its old value
|
||||
* @nr: Bit to clear
|
||||
* @addr: Address to count from
|
||||
*
|
||||
* This operation is non-atomic. If two instances of this operation race, one
|
||||
* can appear to succeed but actually fail.
|
||||
*/
|
||||
static inline bool __test_and_clear_bit(long nr, volatile unsigned long *addr)
|
||||
{
|
||||
__instrument_read_write_bitop(nr, addr);
|
||||
return arch___test_and_clear_bit(nr, addr);
|
||||
}
|
||||
|
||||
/**
|
||||
* __test_and_change_bit - Change a bit and return its old value
|
||||
* @nr: Bit to change
|
||||
* @addr: Address to count from
|
||||
*
|
||||
* This operation is non-atomic. If two instances of this operation race, one
|
||||
* can appear to succeed but actually fail.
|
||||
*/
|
||||
static inline bool __test_and_change_bit(long nr, volatile unsigned long *addr)
|
||||
{
|
||||
__instrument_read_write_bitop(nr, addr);
|
||||
return arch___test_and_change_bit(nr, addr);
|
||||
}
|
||||
|
||||
/**
|
||||
* test_bit - Determine whether a bit is set
|
||||
* @nr: bit number to test
|
||||
* @addr: Address to start counting from
|
||||
*/
|
||||
static inline bool test_bit(long nr, const volatile unsigned long *addr)
|
||||
{
|
||||
instrument_atomic_read(addr + BIT_WORD(nr), sizeof(long));
|
||||
return arch_test_bit(nr, addr);
|
||||
}
|
||||
|
||||
#endif /* _ASM_GENERIC_BITOPS_INSTRUMENTED_NON_ATOMIC_H */
|
|
@ -0,0 +1,98 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_GENERIC_BITOPS_LE_H_
|
||||
#define _ASM_GENERIC_BITOPS_LE_H_
|
||||
|
||||
#include <asm/types.h>
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
#if defined(__LITTLE_ENDIAN)
|
||||
|
||||
#define BITOP_LE_SWIZZLE 0
|
||||
|
||||
static inline unsigned long find_next_zero_bit_le(const void *addr,
|
||||
unsigned long size, unsigned long offset)
|
||||
{
|
||||
return find_next_zero_bit(addr, size, offset);
|
||||
}
|
||||
|
||||
static inline unsigned long find_next_bit_le(const void *addr,
|
||||
unsigned long size, unsigned long offset)
|
||||
{
|
||||
return find_next_bit(addr, size, offset);
|
||||
}
|
||||
|
||||
static inline unsigned long find_first_zero_bit_le(const void *addr,
|
||||
unsigned long size)
|
||||
{
|
||||
return find_first_zero_bit(addr, size);
|
||||
}
|
||||
|
||||
#elif defined(__BIG_ENDIAN)
|
||||
|
||||
#define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7)
|
||||
|
||||
#ifndef find_next_zero_bit_le
|
||||
extern unsigned long find_next_zero_bit_le(const void *addr,
|
||||
unsigned long size, unsigned long offset);
|
||||
#endif
|
||||
|
||||
#ifndef find_next_bit_le
|
||||
extern unsigned long find_next_bit_le(const void *addr,
|
||||
unsigned long size, unsigned long offset);
|
||||
#endif
|
||||
|
||||
#ifndef find_first_zero_bit_le
|
||||
#define find_first_zero_bit_le(addr, size) \
|
||||
find_next_zero_bit_le((addr), (size), 0)
|
||||
#endif
|
||||
|
||||
#else
|
||||
#error "Please fix <asm/byteorder.h>"
|
||||
#endif
|
||||
|
||||
static inline int test_bit_le(int nr, const void *addr)
|
||||
{
|
||||
return test_bit(nr ^ BITOP_LE_SWIZZLE, addr);
|
||||
}
|
||||
|
||||
static inline void set_bit_le(int nr, void *addr)
|
||||
{
|
||||
set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
|
||||
}
|
||||
|
||||
static inline void clear_bit_le(int nr, void *addr)
|
||||
{
|
||||
clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
|
||||
}
|
||||
|
||||
static inline void __set_bit_le(int nr, void *addr)
|
||||
{
|
||||
__set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
|
||||
}
|
||||
|
||||
static inline void __clear_bit_le(int nr, void *addr)
|
||||
{
|
||||
__clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
|
||||
}
|
||||
|
||||
static inline int test_and_set_bit_le(int nr, void *addr)
|
||||
{
|
||||
return test_and_set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
|
||||
}
|
||||
|
||||
static inline int test_and_clear_bit_le(int nr, void *addr)
|
||||
{
|
||||
return test_and_clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
|
||||
}
|
||||
|
||||
static inline int __test_and_set_bit_le(int nr, void *addr)
|
||||
{
|
||||
return __test_and_set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
|
||||
}
|
||||
|
||||
static inline int __test_and_clear_bit_le(int nr, void *addr)
|
||||
{
|
||||
return __test_and_clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
|
||||
}
|
||||
|
||||
#endif /* _ASM_GENERIC_BITOPS_LE_H_ */
|
|
@ -0,0 +1,91 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_GENERIC_BITOPS_LOCK_H_
|
||||
#define _ASM_GENERIC_BITOPS_LOCK_H_
|
||||
|
||||
#include <linux/atomic.h>
|
||||
#include <linux/compiler.h>
|
||||
#include <asm/barrier.h>
|
||||
|
||||
/**
|
||||
* test_and_set_bit_lock - Set a bit and return its old value, for lock
|
||||
* @nr: Bit to set
|
||||
* @addr: Address to count from
|
||||
*
|
||||
* This operation is atomic and provides acquire barrier semantics if
|
||||
* the returned value is 0.
|
||||
* It can be used to implement bit locks.
|
||||
*/
|
||||
static inline int test_and_set_bit_lock(unsigned int nr,
|
||||
volatile unsigned long *p)
|
||||
{
|
||||
long old;
|
||||
unsigned long mask = BIT_MASK(nr);
|
||||
|
||||
p += BIT_WORD(nr);
|
||||
if (READ_ONCE(*p) & mask)
|
||||
return 1;
|
||||
|
||||
old = atomic_long_fetch_or_acquire(mask, (atomic_long_t *)p);
|
||||
return !!(old & mask);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* clear_bit_unlock - Clear a bit in memory, for unlock
|
||||
* @nr: the bit to set
|
||||
* @addr: the address to start counting from
|
||||
*
|
||||
* This operation is atomic and provides release barrier semantics.
|
||||
*/
|
||||
static inline void clear_bit_unlock(unsigned int nr, volatile unsigned long *p)
|
||||
{
|
||||
p += BIT_WORD(nr);
|
||||
atomic_long_fetch_andnot_release(BIT_MASK(nr), (atomic_long_t *)p);
|
||||
}
|
||||
|
||||
/**
|
||||
* __clear_bit_unlock - Clear a bit in memory, for unlock
|
||||
* @nr: the bit to set
|
||||
* @addr: the address to start counting from
|
||||
*
|
||||
* A weaker form of clear_bit_unlock() as used by __bit_lock_unlock(). If all
|
||||
* the bits in the word are protected by this lock some archs can use weaker
|
||||
* ops to safely unlock.
|
||||
*
|
||||
* See for example x86's implementation.
|
||||
*/
|
||||
static inline void __clear_bit_unlock(unsigned int nr,
|
||||
volatile unsigned long *p)
|
||||
{
|
||||
unsigned long old;
|
||||
|
||||
p += BIT_WORD(nr);
|
||||
old = READ_ONCE(*p);
|
||||
old &= ~BIT_MASK(nr);
|
||||
atomic_long_set_release((atomic_long_t *)p, old);
|
||||
}
|
||||
|
||||
/**
|
||||
* clear_bit_unlock_is_negative_byte - Clear a bit in memory and test if bottom
|
||||
* byte is negative, for unlock.
|
||||
* @nr: the bit to clear
|
||||
* @addr: the address to start counting from
|
||||
*
|
||||
* This is a bit of a one-trick-pony for the filemap code, which clears
|
||||
* PG_locked and tests PG_waiters,
|
||||
*/
|
||||
#ifndef clear_bit_unlock_is_negative_byte
|
||||
static inline bool clear_bit_unlock_is_negative_byte(unsigned int nr,
|
||||
volatile unsigned long *p)
|
||||
{
|
||||
long old;
|
||||
unsigned long mask = BIT_MASK(nr);
|
||||
|
||||
p += BIT_WORD(nr);
|
||||
old = atomic_long_fetch_andnot_release(mask, (atomic_long_t *)p);
|
||||
return !!(old & BIT(7));
|
||||
}
|
||||
#define clear_bit_unlock_is_negative_byte clear_bit_unlock_is_negative_byte
|
||||
#endif
|
||||
|
||||
#endif /* _ASM_GENERIC_BITOPS_LOCK_H_ */
|
|
@ -0,0 +1,109 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_GENERIC_BITOPS_NON_ATOMIC_H_
|
||||
#define _ASM_GENERIC_BITOPS_NON_ATOMIC_H_
|
||||
|
||||
#include <asm/types.h>
|
||||
|
||||
/**
|
||||
* __set_bit - Set a bit in memory
|
||||
* @nr: the bit to set
|
||||
* @addr: the address to start counting from
|
||||
*
|
||||
* Unlike set_bit(), this function is non-atomic and may be reordered.
|
||||
* If it's called on the same region of memory simultaneously, the effect
|
||||
* may be that only one operation succeeds.
|
||||
*/
|
||||
static inline void __set_bit(int nr, volatile unsigned long *addr)
|
||||
{
|
||||
unsigned long mask = BIT_MASK(nr);
|
||||
unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
|
||||
|
||||
*p |= mask;
|
||||
}
|
||||
|
||||
static inline void __clear_bit(int nr, volatile unsigned long *addr)
|
||||
{
|
||||
unsigned long mask = BIT_MASK(nr);
|
||||
unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
|
||||
|
||||
*p &= ~mask;
|
||||
}
|
||||
|
||||
/**
|
||||
* __change_bit - Toggle a bit in memory
|
||||
* @nr: the bit to change
|
||||
* @addr: the address to start counting from
|
||||
*
|
||||
* Unlike change_bit(), this function is non-atomic and may be reordered.
|
||||
* If it's called on the same region of memory simultaneously, the effect
|
||||
* may be that only one operation succeeds.
|
||||
*/
|
||||
static inline void __change_bit(int nr, volatile unsigned long *addr)
|
||||
{
|
||||
unsigned long mask = BIT_MASK(nr);
|
||||
unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
|
||||
|
||||
*p ^= mask;
|
||||
}
|
||||
|
||||
/**
|
||||
* __test_and_set_bit - Set a bit and return its old value
|
||||
* @nr: Bit to set
|
||||
* @addr: Address to count from
|
||||
*
|
||||
* This operation is non-atomic and can be reordered.
|
||||
* If two examples of this operation race, one can appear to succeed
|
||||
* but actually fail. You must protect multiple accesses with a lock.
|
||||
*/
|
||||
static inline int __test_and_set_bit(int nr, volatile unsigned long *addr)
|
||||
{
|
||||
unsigned long mask = BIT_MASK(nr);
|
||||
unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
|
||||
unsigned long old = *p;
|
||||
|
||||
*p = old | mask;
|
||||
return (old & mask) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* __test_and_clear_bit - Clear a bit and return its old value
|
||||
* @nr: Bit to clear
|
||||
* @addr: Address to count from
|
||||
*
|
||||
* This operation is non-atomic and can be reordered.
|
||||
* If two examples of this operation race, one can appear to succeed
|
||||
* but actually fail. You must protect multiple accesses with a lock.
|
||||
*/
|
||||
static inline int __test_and_clear_bit(int nr, volatile unsigned long *addr)
|
||||
{
|
||||
unsigned long mask = BIT_MASK(nr);
|
||||
unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
|
||||
unsigned long old = *p;
|
||||
|
||||
*p = old & ~mask;
|
||||
return (old & mask) != 0;
|
||||
}
|
||||
|
||||
/* WARNING: non atomic and it can be reordered! */
|
||||
static inline int __test_and_change_bit(int nr,
|
||||
volatile unsigned long *addr)
|
||||
{
|
||||
unsigned long mask = BIT_MASK(nr);
|
||||
unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
|
||||
unsigned long old = *p;
|
||||
|
||||
*p = old ^ mask;
|
||||
return (old & mask) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* test_bit - Determine whether a bit is set
|
||||
* @nr: bit number to test
|
||||
* @addr: Address to start counting from
|
||||
*/
|
||||
static inline int test_bit(int nr, const volatile unsigned long *addr)
|
||||
{
|
||||
return 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
|
||||
}
|
||||
|
||||
#endif /* _ASM_GENERIC_BITOPS_NON_ATOMIC_H_ */
|
|
@ -0,0 +1,32 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_GENERIC_BITOPS_SCHED_H_
|
||||
#define _ASM_GENERIC_BITOPS_SCHED_H_
|
||||
|
||||
#include <linux/compiler.h> /* unlikely() */
|
||||
#include <asm/types.h>
|
||||
|
||||
/*
|
||||
* Every architecture must define this function. It's the fastest
|
||||
* way of searching a 100-bit bitmap. It's guaranteed that at least
|
||||
* one of the 100 bits is cleared.
|
||||
*/
|
||||
static inline int sched_find_first_bit(const unsigned long *b)
|
||||
{
|
||||
#if BITS_PER_LONG == 64
|
||||
if (b[0])
|
||||
return __ffs(b[0]);
|
||||
return __ffs(b[1]) + 64;
|
||||
#elif BITS_PER_LONG == 32
|
||||
if (b[0])
|
||||
return __ffs(b[0]);
|
||||
if (b[1])
|
||||
return __ffs(b[1]) + 32;
|
||||
if (b[2])
|
||||
return __ffs(b[2]) + 64;
|
||||
return __ffs(b[3]) + 96;
|
||||
#else
|
||||
#error BITS_PER_LONG not defined
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* _ASM_GENERIC_BITOPS_SCHED_H_ */
|
|
@ -0,0 +1,26 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef __ASM_GENERIC_BITS_PER_LONG
|
||||
#define __ASM_GENERIC_BITS_PER_LONG
|
||||
|
||||
#include <uapi/asm-generic/bitsperlong.h>
|
||||
|
||||
|
||||
#ifdef CONFIG_64BIT
|
||||
#define BITS_PER_LONG 64
|
||||
#else
|
||||
#define BITS_PER_LONG 32
|
||||
#endif /* CONFIG_64BIT */
|
||||
|
||||
/*
|
||||
* FIXME: The check currently breaks x86-64 build, so it's
|
||||
* temporarily disabled. Please fix x86-64 and reenable
|
||||
*/
|
||||
#if 0 && BITS_PER_LONG != __BITS_PER_LONG
|
||||
#error Inconsistent word size. Check asm/bitsperlong.h
|
||||
#endif
|
||||
|
||||
#ifndef BITS_PER_LONG_LONG
|
||||
#define BITS_PER_LONG_LONG 64
|
||||
#endif
|
||||
|
||||
#endif /* __ASM_GENERIC_BITS_PER_LONG */
|
|
@ -0,0 +1,246 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_GENERIC_BUG_H
|
||||
#define _ASM_GENERIC_BUG_H
|
||||
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/instrumentation.h>
|
||||
|
||||
#define CUT_HERE "------------[ cut here ]------------\n"
|
||||
|
||||
#ifdef CONFIG_GENERIC_BUG
|
||||
#define BUGFLAG_WARNING (1 << 0)
|
||||
#define BUGFLAG_ONCE (1 << 1)
|
||||
#define BUGFLAG_DONE (1 << 2)
|
||||
#define BUGFLAG_NO_CUT_HERE (1 << 3) /* CUT_HERE already sent */
|
||||
#define BUGFLAG_TAINT(taint) ((taint) << 8)
|
||||
#define BUG_GET_TAINT(bug) ((bug)->flags >> 8)
|
||||
#endif
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#include <linux/kernel.h>
|
||||
|
||||
#ifdef CONFIG_BUG
|
||||
|
||||
#ifdef CONFIG_GENERIC_BUG
|
||||
struct bug_entry {
|
||||
#ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS
|
||||
unsigned long bug_addr;
|
||||
#else
|
||||
signed int bug_addr_disp;
|
||||
#endif
|
||||
#ifdef CONFIG_DEBUG_BUGVERBOSE
|
||||
#ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS
|
||||
const char *file;
|
||||
#else
|
||||
signed int file_disp;
|
||||
#endif
|
||||
unsigned short line;
|
||||
#endif
|
||||
unsigned short flags;
|
||||
};
|
||||
#endif /* CONFIG_GENERIC_BUG */
|
||||
|
||||
/*
|
||||
* Don't use BUG() or BUG_ON() unless there's really no way out; one
|
||||
* example might be detecting data structure corruption in the middle
|
||||
* of an operation that can't be backed out of. If the (sub)system
|
||||
* can somehow continue operating, perhaps with reduced functionality,
|
||||
* it's probably not BUG-worthy.
|
||||
*
|
||||
* If you're tempted to BUG(), think again: is completely giving up
|
||||
* really the *only* solution? There are usually better options, where
|
||||
* users don't need to reboot ASAP and can mostly shut down cleanly.
|
||||
*/
|
||||
#ifndef HAVE_ARCH_BUG
|
||||
#define BUG() do { \
|
||||
printk("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __func__); \
|
||||
barrier_before_unreachable(); \
|
||||
panic("BUG!"); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ARCH_BUG_ON
|
||||
#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* WARN(), WARN_ON(), WARN_ON_ONCE, and so on can be used to report
|
||||
* significant kernel issues that need prompt attention if they should ever
|
||||
* appear at runtime.
|
||||
*
|
||||
* Do not use these macros when checking for invalid external inputs
|
||||
* (e.g. invalid system call arguments, or invalid data coming from
|
||||
* network/devices), and on transient conditions like ENOMEM or EAGAIN.
|
||||
* These macros should be used for recoverable kernel issues only.
|
||||
* For invalid external inputs, transient conditions, etc use
|
||||
* pr_err[_once/_ratelimited]() followed by dump_stack(), if necessary.
|
||||
* Do not include "BUG"/"WARNING" in format strings manually to make these
|
||||
* conditions distinguishable from kernel issues.
|
||||
*
|
||||
* Use the versions with printk format strings to provide better diagnostics.
|
||||
*/
|
||||
#ifndef __WARN_FLAGS
|
||||
extern __printf(4, 5)
|
||||
void warn_slowpath_fmt(const char *file, const int line, unsigned taint,
|
||||
const char *fmt, ...);
|
||||
#define __WARN() __WARN_printf(TAINT_WARN, NULL)
|
||||
#define __WARN_printf(taint, arg...) do { \
|
||||
instrumentation_begin(); \
|
||||
warn_slowpath_fmt(__FILE__, __LINE__, taint, arg); \
|
||||
instrumentation_end(); \
|
||||
} while (0)
|
||||
#else
|
||||
extern __printf(1, 2) void __warn_printk(const char *fmt, ...);
|
||||
#define __WARN() __WARN_FLAGS(BUGFLAG_TAINT(TAINT_WARN))
|
||||
#define __WARN_printf(taint, arg...) do { \
|
||||
instrumentation_begin(); \
|
||||
__warn_printk(arg); \
|
||||
__WARN_FLAGS(BUGFLAG_NO_CUT_HERE | BUGFLAG_TAINT(taint));\
|
||||
instrumentation_end(); \
|
||||
} while (0)
|
||||
#define WARN_ON_ONCE(condition) ({ \
|
||||
int __ret_warn_on = !!(condition); \
|
||||
if (unlikely(__ret_warn_on)) \
|
||||
__WARN_FLAGS(BUGFLAG_ONCE | \
|
||||
BUGFLAG_TAINT(TAINT_WARN)); \
|
||||
unlikely(__ret_warn_on); \
|
||||
})
|
||||
#endif
|
||||
|
||||
/* used internally by panic.c */
|
||||
struct warn_args;
|
||||
struct pt_regs;
|
||||
|
||||
void __warn(const char *file, int line, void *caller, unsigned taint,
|
||||
struct pt_regs *regs, struct warn_args *args);
|
||||
|
||||
#ifndef WARN_ON
|
||||
#define WARN_ON(condition) ({ \
|
||||
int __ret_warn_on = !!(condition); \
|
||||
if (unlikely(__ret_warn_on)) \
|
||||
__WARN(); \
|
||||
unlikely(__ret_warn_on); \
|
||||
})
|
||||
#endif
|
||||
|
||||
#ifndef WARN
|
||||
#define WARN(condition, format...) ({ \
|
||||
int __ret_warn_on = !!(condition); \
|
||||
if (unlikely(__ret_warn_on)) \
|
||||
__WARN_printf(TAINT_WARN, format); \
|
||||
unlikely(__ret_warn_on); \
|
||||
})
|
||||
#endif
|
||||
|
||||
#define WARN_TAINT(condition, taint, format...) ({ \
|
||||
int __ret_warn_on = !!(condition); \
|
||||
if (unlikely(__ret_warn_on)) \
|
||||
__WARN_printf(taint, format); \
|
||||
unlikely(__ret_warn_on); \
|
||||
})
|
||||
|
||||
#ifndef WARN_ON_ONCE
|
||||
#define WARN_ON_ONCE(condition) ({ \
|
||||
static bool __section(".data.once") __warned; \
|
||||
int __ret_warn_once = !!(condition); \
|
||||
\
|
||||
if (unlikely(__ret_warn_once && !__warned)) { \
|
||||
__warned = true; \
|
||||
WARN_ON(1); \
|
||||
} \
|
||||
unlikely(__ret_warn_once); \
|
||||
})
|
||||
#endif
|
||||
|
||||
#define WARN_ONCE(condition, format...) ({ \
|
||||
static bool __section(".data.once") __warned; \
|
||||
int __ret_warn_once = !!(condition); \
|
||||
\
|
||||
if (unlikely(__ret_warn_once && !__warned)) { \
|
||||
__warned = true; \
|
||||
WARN(1, format); \
|
||||
} \
|
||||
unlikely(__ret_warn_once); \
|
||||
})
|
||||
|
||||
#define WARN_TAINT_ONCE(condition, taint, format...) ({ \
|
||||
static bool __section(".data.once") __warned; \
|
||||
int __ret_warn_once = !!(condition); \
|
||||
\
|
||||
if (unlikely(__ret_warn_once && !__warned)) { \
|
||||
__warned = true; \
|
||||
WARN_TAINT(1, taint, format); \
|
||||
} \
|
||||
unlikely(__ret_warn_once); \
|
||||
})
|
||||
|
||||
#else /* !CONFIG_BUG */
|
||||
#ifndef HAVE_ARCH_BUG
|
||||
#define BUG() do {} while (1)
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ARCH_BUG_ON
|
||||
#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ARCH_WARN_ON
|
||||
#define WARN_ON(condition) ({ \
|
||||
int __ret_warn_on = !!(condition); \
|
||||
unlikely(__ret_warn_on); \
|
||||
})
|
||||
#endif
|
||||
|
||||
#ifndef WARN
|
||||
#define WARN(condition, format...) ({ \
|
||||
int __ret_warn_on = !!(condition); \
|
||||
no_printk(format); \
|
||||
unlikely(__ret_warn_on); \
|
||||
})
|
||||
#endif
|
||||
|
||||
#define WARN_ON_ONCE(condition) WARN_ON(condition)
|
||||
#define WARN_ONCE(condition, format...) WARN(condition, format)
|
||||
#define WARN_TAINT(condition, taint, format...) WARN(condition, format)
|
||||
#define WARN_TAINT_ONCE(condition, taint, format...) WARN(condition, format)
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* WARN_ON_SMP() is for cases that the warning is either
|
||||
* meaningless for !SMP or may even cause failures.
|
||||
* It can also be used with values that are only defined
|
||||
* on SMP:
|
||||
*
|
||||
* struct foo {
|
||||
* [...]
|
||||
* #ifdef CONFIG_SMP
|
||||
* int bar;
|
||||
* #endif
|
||||
* };
|
||||
*
|
||||
* void func(struct foo *zoot)
|
||||
* {
|
||||
* WARN_ON_SMP(!zoot->bar);
|
||||
*
|
||||
* For CONFIG_SMP, WARN_ON_SMP() should act the same as WARN_ON(),
|
||||
* and should be a nop and return false for uniprocessor.
|
||||
*
|
||||
* if (WARN_ON_SMP(x)) returns true only when CONFIG_SMP is set
|
||||
* and x is true.
|
||||
*/
|
||||
#ifdef CONFIG_SMP
|
||||
# define WARN_ON_SMP(x) WARN_ON(x)
|
||||
#else
|
||||
/*
|
||||
* Use of ({0;}) because WARN_ON_SMP(x) may be used either as
|
||||
* a stand alone line statement or as a condition in an if ()
|
||||
* statement.
|
||||
* A simple "0" would cause gcc to give a "statement has no effect"
|
||||
* warning.
|
||||
*/
|
||||
# define WARN_ON_SMP(x) ({0;})
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
#endif
|
|
@ -0,0 +1,13 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef __ASM_GENERIC_CACHE_H
|
||||
#define __ASM_GENERIC_CACHE_H
|
||||
/*
|
||||
* 32 bytes appears to be the most common cache line size,
|
||||
* so make that the default here. Architectures with larger
|
||||
* cache lines need to provide their own cache.h.
|
||||
*/
|
||||
|
||||
#define L1_CACHE_SHIFT 5
|
||||
#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
|
||||
|
||||
#endif /* __ASM_GENERIC_CACHE_H */
|
|
@ -0,0 +1,118 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_GENERIC_CACHEFLUSH_H
|
||||
#define _ASM_GENERIC_CACHEFLUSH_H
|
||||
|
||||
struct mm_struct;
|
||||
struct vm_area_struct;
|
||||
struct page;
|
||||
struct address_space;
|
||||
|
||||
/*
|
||||
* The cache doesn't need to be flushed when TLB entries change when
|
||||
* the cache is mapped to physical memory, not virtual memory
|
||||
*/
|
||||
#ifndef flush_cache_all
|
||||
static inline void flush_cache_all(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef flush_cache_mm
|
||||
static inline void flush_cache_mm(struct mm_struct *mm)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef flush_cache_dup_mm
|
||||
static inline void flush_cache_dup_mm(struct mm_struct *mm)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef flush_cache_range
|
||||
static inline void flush_cache_range(struct vm_area_struct *vma,
|
||||
unsigned long start,
|
||||
unsigned long end)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef flush_cache_page
|
||||
static inline void flush_cache_page(struct vm_area_struct *vma,
|
||||
unsigned long vmaddr,
|
||||
unsigned long pfn)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE
|
||||
static inline void flush_dcache_page(struct page *page)
|
||||
{
|
||||
}
|
||||
#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef flush_dcache_mmap_lock
|
||||
static inline void flush_dcache_mmap_lock(struct address_space *mapping)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef flush_dcache_mmap_unlock
|
||||
static inline void flush_dcache_mmap_unlock(struct address_space *mapping)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef flush_icache_range
|
||||
static inline void flush_icache_range(unsigned long start, unsigned long end)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef flush_icache_user_range
|
||||
#define flush_icache_user_range flush_icache_range
|
||||
#endif
|
||||
|
||||
#ifndef flush_icache_page
|
||||
static inline void flush_icache_page(struct vm_area_struct *vma,
|
||||
struct page *page)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef flush_icache_user_page
|
||||
static inline void flush_icache_user_page(struct vm_area_struct *vma,
|
||||
struct page *page,
|
||||
unsigned long addr, int len)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef flush_cache_vmap
|
||||
static inline void flush_cache_vmap(unsigned long start, unsigned long end)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef flush_cache_vunmap
|
||||
static inline void flush_cache_vunmap(unsigned long start, unsigned long end)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef copy_to_user_page
|
||||
#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
|
||||
do { \
|
||||
memcpy(dst, src, len); \
|
||||
flush_icache_user_page(vma, page, vaddr, len); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef copy_from_user_page
|
||||
#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
|
||||
memcpy(dst, src, len)
|
||||
#endif
|
||||
|
||||
#endif /* _ASM_GENERIC_CACHEFLUSH_H */
|
|
@ -0,0 +1,65 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef __ASM_GENERIC_CHECKSUM_H
|
||||
#define __ASM_GENERIC_CHECKSUM_H
|
||||
|
||||
/*
|
||||
* computes the checksum of a memory block at buff, length len,
|
||||
* and adds in "sum" (32-bit)
|
||||
*
|
||||
* returns a 32-bit number suitable for feeding into itself
|
||||
* or csum_tcpudp_magic
|
||||
*
|
||||
* this function must be called with even lengths, except
|
||||
* for the last fragment, which may be odd
|
||||
*
|
||||
* it's best to have buff aligned on a 32-bit boundary
|
||||
*/
|
||||
extern __wsum csum_partial(const void *buff, int len, __wsum sum);
|
||||
|
||||
#ifndef ip_fast_csum
|
||||
/*
|
||||
* This is a version of ip_compute_csum() optimized for IP headers,
|
||||
* which always checksum on 4 octet boundaries.
|
||||
*/
|
||||
extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);
|
||||
#endif
|
||||
|
||||
#ifndef csum_fold
|
||||
/*
|
||||
* Fold a partial checksum
|
||||
*/
|
||||
static inline __sum16 csum_fold(__wsum csum)
|
||||
{
|
||||
u32 sum = (__force u32)csum;
|
||||
sum = (sum & 0xffff) + (sum >> 16);
|
||||
sum = (sum & 0xffff) + (sum >> 16);
|
||||
return (__force __sum16)~sum;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef csum_tcpudp_nofold
|
||||
/*
|
||||
* computes the checksum of the TCP/UDP pseudo-header
|
||||
* returns a 16-bit checksum, already complemented
|
||||
*/
|
||||
extern __wsum
|
||||
csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len,
|
||||
__u8 proto, __wsum sum);
|
||||
#endif
|
||||
|
||||
#ifndef csum_tcpudp_magic
|
||||
static inline __sum16
|
||||
csum_tcpudp_magic(__be32 saddr, __be32 daddr, __u32 len,
|
||||
__u8 proto, __wsum sum)
|
||||
{
|
||||
return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* this routine is used for miscellaneous IP-like checksums, mainly
|
||||
* in icmp.c
|
||||
*/
|
||||
extern __sum16 ip_compute_csum(const void *buff, int len);
|
||||
|
||||
#endif /* __ASM_GENERIC_CHECKSUM_H */
|
|
@ -0,0 +1,68 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef __ASM_GENERIC_CMPXCHG_LOCAL_H
|
||||
#define __ASM_GENERIC_CMPXCHG_LOCAL_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/irqflags.h>
|
||||
|
||||
extern unsigned long wrong_size_cmpxchg(volatile void *ptr)
|
||||
__noreturn;
|
||||
|
||||
/*
|
||||
* Generic version of __cmpxchg_local (disables interrupts). Takes an unsigned
|
||||
* long parameter, supporting various types of architectures.
|
||||
*/
|
||||
static inline unsigned long __cmpxchg_local_generic(volatile void *ptr,
|
||||
unsigned long old, unsigned long new, int size)
|
||||
{
|
||||
unsigned long flags, prev;
|
||||
|
||||
/*
|
||||
* Sanity checking, compile-time.
|
||||
*/
|
||||
if (size == 8 && sizeof(unsigned long) != 8)
|
||||
wrong_size_cmpxchg(ptr);
|
||||
|
||||
raw_local_irq_save(flags);
|
||||
switch (size) {
|
||||
case 1: prev = *(u8 *)ptr;
|
||||
if (prev == old)
|
||||
*(u8 *)ptr = (u8)new;
|
||||
break;
|
||||
case 2: prev = *(u16 *)ptr;
|
||||
if (prev == old)
|
||||
*(u16 *)ptr = (u16)new;
|
||||
break;
|
||||
case 4: prev = *(u32 *)ptr;
|
||||
if (prev == old)
|
||||
*(u32 *)ptr = (u32)new;
|
||||
break;
|
||||
case 8: prev = *(u64 *)ptr;
|
||||
if (prev == old)
|
||||
*(u64 *)ptr = (u64)new;
|
||||
break;
|
||||
default:
|
||||
wrong_size_cmpxchg(ptr);
|
||||
}
|
||||
raw_local_irq_restore(flags);
|
||||
return prev;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generic version of __cmpxchg64_local. Takes an u64 parameter.
|
||||
*/
|
||||
static inline u64 __cmpxchg64_local_generic(volatile void *ptr,
|
||||
u64 old, u64 new)
|
||||
{
|
||||
u64 prev;
|
||||
unsigned long flags;
|
||||
|
||||
raw_local_irq_save(flags);
|
||||
prev = *(u64 *)ptr;
|
||||
if (prev == old)
|
||||
*(u64 *)ptr = new;
|
||||
raw_local_irq_restore(flags);
|
||||
return prev;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,109 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Generic UP xchg and cmpxchg using interrupt disablement. Does not
|
||||
* support SMP.
|
||||
*/
|
||||
|
||||
#ifndef __ASM_GENERIC_CMPXCHG_H
|
||||
#define __ASM_GENERIC_CMPXCHG_H
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
#error "Cannot use generic cmpxchg on SMP"
|
||||
#endif
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/irqflags.h>
|
||||
|
||||
#ifndef xchg
|
||||
|
||||
/*
|
||||
* This function doesn't exist, so you'll get a linker error if
|
||||
* something tries to do an invalidly-sized xchg().
|
||||
*/
|
||||
extern void __xchg_called_with_bad_pointer(void);
|
||||
|
||||
static inline
|
||||
unsigned long __xchg(unsigned long x, volatile void *ptr, int size)
|
||||
{
|
||||
unsigned long ret, flags;
|
||||
|
||||
switch (size) {
|
||||
case 1:
|
||||
#ifdef __xchg_u8
|
||||
return __xchg_u8(x, ptr);
|
||||
#else
|
||||
local_irq_save(flags);
|
||||
ret = *(volatile u8 *)ptr;
|
||||
*(volatile u8 *)ptr = x;
|
||||
local_irq_restore(flags);
|
||||
return ret;
|
||||
#endif /* __xchg_u8 */
|
||||
|
||||
case 2:
|
||||
#ifdef __xchg_u16
|
||||
return __xchg_u16(x, ptr);
|
||||
#else
|
||||
local_irq_save(flags);
|
||||
ret = *(volatile u16 *)ptr;
|
||||
*(volatile u16 *)ptr = x;
|
||||
local_irq_restore(flags);
|
||||
return ret;
|
||||
#endif /* __xchg_u16 */
|
||||
|
||||
case 4:
|
||||
#ifdef __xchg_u32
|
||||
return __xchg_u32(x, ptr);
|
||||
#else
|
||||
local_irq_save(flags);
|
||||
ret = *(volatile u32 *)ptr;
|
||||
*(volatile u32 *)ptr = x;
|
||||
local_irq_restore(flags);
|
||||
return ret;
|
||||
#endif /* __xchg_u32 */
|
||||
|
||||
#ifdef CONFIG_64BIT
|
||||
case 8:
|
||||
#ifdef __xchg_u64
|
||||
return __xchg_u64(x, ptr);
|
||||
#else
|
||||
local_irq_save(flags);
|
||||
ret = *(volatile u64 *)ptr;
|
||||
*(volatile u64 *)ptr = x;
|
||||
local_irq_restore(flags);
|
||||
return ret;
|
||||
#endif /* __xchg_u64 */
|
||||
#endif /* CONFIG_64BIT */
|
||||
|
||||
default:
|
||||
__xchg_called_with_bad_pointer();
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
#define xchg(ptr, x) ({ \
|
||||
((__typeof__(*(ptr))) \
|
||||
__xchg((unsigned long)(x), (ptr), sizeof(*(ptr)))); \
|
||||
})
|
||||
|
||||
#endif /* xchg */
|
||||
|
||||
/*
|
||||
* Atomic compare and exchange.
|
||||
*/
|
||||
#include <asm-generic/cmpxchg-local.h>
|
||||
|
||||
#ifndef cmpxchg_local
|
||||
#define cmpxchg_local(ptr, o, n) ({ \
|
||||
((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
|
||||
(unsigned long)(n), sizeof(*(ptr)))); \
|
||||
})
|
||||
#endif
|
||||
|
||||
#ifndef cmpxchg64_local
|
||||
#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
|
||||
#endif
|
||||
|
||||
#define cmpxchg(ptr, o, n) cmpxchg_local((ptr), (o), (n))
|
||||
#define cmpxchg64(ptr, o, n) cmpxchg64_local((ptr), (o), (n))
|
||||
|
||||
#endif /* __ASM_GENERIC_CMPXCHG_H */
|
|
@ -0,0 +1,33 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef __ASM_GENERIC_COMPAT_H
|
||||
#define __ASM_GENERIC_COMPAT_H
|
||||
|
||||
/* These types are common across all compat ABIs */
|
||||
typedef u32 compat_size_t;
|
||||
typedef s32 compat_ssize_t;
|
||||
typedef s32 compat_clock_t;
|
||||
typedef s32 compat_pid_t;
|
||||
typedef u32 compat_ino_t;
|
||||
typedef s32 compat_off_t;
|
||||
typedef s64 compat_loff_t;
|
||||
typedef s32 compat_daddr_t;
|
||||
typedef s32 compat_timer_t;
|
||||
typedef s32 compat_key_t;
|
||||
typedef s16 compat_short_t;
|
||||
typedef s32 compat_int_t;
|
||||
typedef s32 compat_long_t;
|
||||
typedef u16 compat_ushort_t;
|
||||
typedef u32 compat_uint_t;
|
||||
typedef u32 compat_ulong_t;
|
||||
typedef u32 compat_uptr_t;
|
||||
typedef u32 compat_aio_context_t;
|
||||
|
||||
#ifdef CONFIG_COMPAT_FOR_U64_ALIGNMENT
|
||||
typedef s64 __attribute__((aligned(4))) compat_s64;
|
||||
typedef u64 __attribute__((aligned(4))) compat_u64;
|
||||
#else
|
||||
typedef s64 compat_s64;
|
||||
typedef u64 compat_u64;
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,10 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef __ASM_GENERIC_CURRENT_H
|
||||
#define __ASM_GENERIC_CURRENT_H
|
||||
|
||||
#include <linux/thread_info.h>
|
||||
|
||||
#define get_current() (current_thread_info()->task)
|
||||
#define current get_current()
|
||||
|
||||
#endif /* __ASM_GENERIC_CURRENT_H */
|
|
@ -0,0 +1,45 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef __ASM_GENERIC_DELAY_H
|
||||
#define __ASM_GENERIC_DELAY_H
|
||||
|
||||
/* Undefined functions to get compile-time errors */
|
||||
extern void __bad_udelay(void);
|
||||
extern void __bad_ndelay(void);
|
||||
|
||||
extern void __udelay(unsigned long usecs);
|
||||
extern void __ndelay(unsigned long nsecs);
|
||||
extern void __const_udelay(unsigned long xloops);
|
||||
extern void __delay(unsigned long loops);
|
||||
|
||||
/*
|
||||
* The weird n/20000 thing suppresses a "comparison is always false due to
|
||||
* limited range of data type" warning with non-const 8-bit arguments.
|
||||
*/
|
||||
|
||||
/* 0x10c7 is 2**32 / 1000000 (rounded up) */
|
||||
#define udelay(n) \
|
||||
({ \
|
||||
if (__builtin_constant_p(n)) { \
|
||||
if ((n) / 20000 >= 1) \
|
||||
__bad_udelay(); \
|
||||
else \
|
||||
__const_udelay((n) * 0x10c7ul); \
|
||||
} else { \
|
||||
__udelay(n); \
|
||||
} \
|
||||
})
|
||||
|
||||
/* 0x5 is 2**32 / 1000000000 (rounded up) */
|
||||
#define ndelay(n) \
|
||||
({ \
|
||||
if (__builtin_constant_p(n)) { \
|
||||
if ((n) / 20000 >= 1) \
|
||||
__bad_ndelay(); \
|
||||
else \
|
||||
__const_udelay((n) * 5ul); \
|
||||
} else { \
|
||||
__ndelay(n); \
|
||||
} \
|
||||
})
|
||||
|
||||
#endif /* __ASM_GENERIC_DELAY_H */
|
|
@ -0,0 +1,14 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Arch specific extensions to struct device
|
||||
*/
|
||||
#ifndef _ASM_GENERIC_DEVICE_H
|
||||
#define _ASM_GENERIC_DEVICE_H
|
||||
|
||||
struct dev_archdata {
|
||||
};
|
||||
|
||||
struct pdev_archdata {
|
||||
};
|
||||
|
||||
#endif /* _ASM_GENERIC_DEVICE_H */
|
|
@ -0,0 +1,253 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_GENERIC_DIV64_H
|
||||
#define _ASM_GENERIC_DIV64_H
|
||||
/*
|
||||
* Copyright (C) 2003 Bernardo Innocenti <bernie@develer.com>
|
||||
* Based on former asm-ppc/div64.h and asm-m68knommu/div64.h
|
||||
*
|
||||
* Optimization for constant divisors on 32-bit machines:
|
||||
* Copyright (C) 2006-2015 Nicolas Pitre
|
||||
*
|
||||
* The semantics of do_div() are:
|
||||
*
|
||||
* uint32_t do_div(uint64_t *n, uint32_t base)
|
||||
* {
|
||||
* uint32_t remainder = *n % base;
|
||||
* *n = *n / base;
|
||||
* return remainder;
|
||||
* }
|
||||
*
|
||||
* NOTE: macro parameter n is evaluated multiple times,
|
||||
* beware of side effects!
|
||||
*/
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/compiler.h>
|
||||
|
||||
#if BITS_PER_LONG == 64
|
||||
|
||||
/**
|
||||
* do_div - returns 2 values: calculate remainder and update new dividend
|
||||
* @n: uint64_t dividend (will be updated)
|
||||
* @base: uint32_t divisor
|
||||
*
|
||||
* Summary:
|
||||
* ``uint32_t remainder = n % base;``
|
||||
* ``n = n / base;``
|
||||
*
|
||||
* Return: (uint32_t)remainder
|
||||
*
|
||||
* NOTE: macro parameter @n is evaluated multiple times,
|
||||
* beware of side effects!
|
||||
*/
|
||||
# define do_div(n,base) ({ \
|
||||
uint32_t __base = (base); \
|
||||
uint32_t __rem; \
|
||||
__rem = ((uint64_t)(n)) % __base; \
|
||||
(n) = ((uint64_t)(n)) / __base; \
|
||||
__rem; \
|
||||
})
|
||||
|
||||
#elif BITS_PER_LONG == 32
|
||||
|
||||
#include <linux/log2.h>
|
||||
|
||||
/*
|
||||
* If the divisor happens to be constant, we determine the appropriate
|
||||
* inverse at compile time to turn the division into a few inline
|
||||
* multiplications which ought to be much faster. And yet only if compiling
|
||||
* with a sufficiently recent gcc version to perform proper 64-bit constant
|
||||
* propagation.
|
||||
*
|
||||
* (It is unfortunate that gcc doesn't perform all this internally.)
|
||||
*/
|
||||
|
||||
#ifndef __div64_const32_is_OK
|
||||
#define __div64_const32_is_OK (__GNUC__ >= 4)
|
||||
#endif
|
||||
|
||||
#define __div64_const32(n, ___b) \
|
||||
({ \
|
||||
/* \
|
||||
* Multiplication by reciprocal of b: n / b = n * (p / b) / p \
|
||||
* \
|
||||
* We rely on the fact that most of this code gets optimized \
|
||||
* away at compile time due to constant propagation and only \
|
||||
* a few multiplication instructions should remain. \
|
||||
* Hence this monstrous macro (static inline doesn't always \
|
||||
* do the trick here). \
|
||||
*/ \
|
||||
uint64_t ___res, ___x, ___t, ___m, ___n = (n); \
|
||||
uint32_t ___p, ___bias; \
|
||||
\
|
||||
/* determine MSB of b */ \
|
||||
___p = 1 << ilog2(___b); \
|
||||
\
|
||||
/* compute m = ((p << 64) + b - 1) / b */ \
|
||||
___m = (~0ULL / ___b) * ___p; \
|
||||
___m += (((~0ULL % ___b + 1) * ___p) + ___b - 1) / ___b; \
|
||||
\
|
||||
/* one less than the dividend with highest result */ \
|
||||
___x = ~0ULL / ___b * ___b - 1; \
|
||||
\
|
||||
/* test our ___m with res = m * x / (p << 64) */ \
|
||||
___res = ((___m & 0xffffffff) * (___x & 0xffffffff)) >> 32; \
|
||||
___t = ___res += (___m & 0xffffffff) * (___x >> 32); \
|
||||
___res += (___x & 0xffffffff) * (___m >> 32); \
|
||||
___t = (___res < ___t) ? (1ULL << 32) : 0; \
|
||||
___res = (___res >> 32) + ___t; \
|
||||
___res += (___m >> 32) * (___x >> 32); \
|
||||
___res /= ___p; \
|
||||
\
|
||||
/* Now sanitize and optimize what we've got. */ \
|
||||
if (~0ULL % (___b / (___b & -___b)) == 0) { \
|
||||
/* special case, can be simplified to ... */ \
|
||||
___n /= (___b & -___b); \
|
||||
___m = ~0ULL / (___b / (___b & -___b)); \
|
||||
___p = 1; \
|
||||
___bias = 1; \
|
||||
} else if (___res != ___x / ___b) { \
|
||||
/* \
|
||||
* We can't get away without a bias to compensate \
|
||||
* for bit truncation errors. To avoid it we'd need an \
|
||||
* additional bit to represent m which would overflow \
|
||||
* a 64-bit variable. \
|
||||
* \
|
||||
* Instead we do m = p / b and n / b = (n * m + m) / p. \
|
||||
*/ \
|
||||
___bias = 1; \
|
||||
/* Compute m = (p << 64) / b */ \
|
||||
___m = (~0ULL / ___b) * ___p; \
|
||||
___m += ((~0ULL % ___b + 1) * ___p) / ___b; \
|
||||
} else { \
|
||||
/* \
|
||||
* Reduce m / p, and try to clear bit 31 of m when \
|
||||
* possible, otherwise that'll need extra overflow \
|
||||
* handling later. \
|
||||
*/ \
|
||||
uint32_t ___bits = -(___m & -___m); \
|
||||
___bits |= ___m >> 32; \
|
||||
___bits = (~___bits) << 1; \
|
||||
/* \
|
||||
* If ___bits == 0 then setting bit 31 is unavoidable. \
|
||||
* Simply apply the maximum possible reduction in that \
|
||||
* case. Otherwise the MSB of ___bits indicates the \
|
||||
* best reduction we should apply. \
|
||||
*/ \
|
||||
if (!___bits) { \
|
||||
___p /= (___m & -___m); \
|
||||
___m /= (___m & -___m); \
|
||||
} else { \
|
||||
___p >>= ilog2(___bits); \
|
||||
___m >>= ilog2(___bits); \
|
||||
} \
|
||||
/* No bias needed. */ \
|
||||
___bias = 0; \
|
||||
} \
|
||||
\
|
||||
/* \
|
||||
* Now we have a combination of 2 conditions: \
|
||||
* \
|
||||
* 1) whether or not we need to apply a bias, and \
|
||||
* \
|
||||
* 2) whether or not there might be an overflow in the cross \
|
||||
* product determined by (___m & ((1 << 63) | (1 << 31))). \
|
||||
* \
|
||||
* Select the best way to do (m_bias + m * n) / (1 << 64). \
|
||||
* From now on there will be actual runtime code generated. \
|
||||
*/ \
|
||||
___res = __arch_xprod_64(___m, ___n, ___bias); \
|
||||
\
|
||||
___res /= ___p; \
|
||||
})
|
||||
|
||||
#ifndef __arch_xprod_64
|
||||
/*
|
||||
* Default C implementation for __arch_xprod_64()
|
||||
*
|
||||
* Prototype: uint64_t __arch_xprod_64(const uint64_t m, uint64_t n, bool bias)
|
||||
* Semantic: retval = ((bias ? m : 0) + m * n) >> 64
|
||||
*
|
||||
* The product is a 128-bit value, scaled down to 64 bits.
|
||||
* Assuming constant propagation to optimize away unused conditional code.
|
||||
* Architectures may provide their own optimized assembly implementation.
|
||||
*/
|
||||
static inline uint64_t __arch_xprod_64(const uint64_t m, uint64_t n, bool bias)
|
||||
{
|
||||
uint32_t m_lo = m;
|
||||
uint32_t m_hi = m >> 32;
|
||||
uint32_t n_lo = n;
|
||||
uint32_t n_hi = n >> 32;
|
||||
uint64_t res;
|
||||
uint32_t res_lo, res_hi, tmp;
|
||||
|
||||
if (!bias) {
|
||||
res = ((uint64_t)m_lo * n_lo) >> 32;
|
||||
} else if (!(m & ((1ULL << 63) | (1ULL << 31)))) {
|
||||
/* there can't be any overflow here */
|
||||
res = (m + (uint64_t)m_lo * n_lo) >> 32;
|
||||
} else {
|
||||
res = m + (uint64_t)m_lo * n_lo;
|
||||
res_lo = res >> 32;
|
||||
res_hi = (res_lo < m_hi);
|
||||
res = res_lo | ((uint64_t)res_hi << 32);
|
||||
}
|
||||
|
||||
if (!(m & ((1ULL << 63) | (1ULL << 31)))) {
|
||||
/* there can't be any overflow here */
|
||||
res += (uint64_t)m_lo * n_hi;
|
||||
res += (uint64_t)m_hi * n_lo;
|
||||
res >>= 32;
|
||||
} else {
|
||||
res += (uint64_t)m_lo * n_hi;
|
||||
tmp = res >> 32;
|
||||
res += (uint64_t)m_hi * n_lo;
|
||||
res_lo = res >> 32;
|
||||
res_hi = (res_lo < tmp);
|
||||
res = res_lo | ((uint64_t)res_hi << 32);
|
||||
}
|
||||
|
||||
res += (uint64_t)m_hi * n_hi;
|
||||
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef __div64_32
|
||||
extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
|
||||
#endif
|
||||
|
||||
/* The unnecessary pointer compare is there
|
||||
* to check for type safety (n must be 64bit)
|
||||
*/
|
||||
# define do_div(n,base) ({ \
|
||||
uint32_t __base = (base); \
|
||||
uint32_t __rem; \
|
||||
(void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
|
||||
if (__builtin_constant_p(__base) && \
|
||||
is_power_of_2(__base)) { \
|
||||
__rem = (n) & (__base - 1); \
|
||||
(n) >>= ilog2(__base); \
|
||||
} else if (__div64_const32_is_OK && \
|
||||
__builtin_constant_p(__base) && \
|
||||
__base != 0) { \
|
||||
uint32_t __res_lo, __n_lo = (n); \
|
||||
(n) = __div64_const32(n, __base); \
|
||||
/* the remainder can be computed with 32-bit regs */ \
|
||||
__res_lo = (n); \
|
||||
__rem = __n_lo - __res_lo * __base; \
|
||||
} else if (likely(((n) >> 32) == 0)) { \
|
||||
__rem = (uint32_t)(n) % __base; \
|
||||
(n) = (uint32_t)(n) / __base; \
|
||||
} else \
|
||||
__rem = __div64_32(&(n), __base); \
|
||||
__rem; \
|
||||
})
|
||||
|
||||
#else /* BITS_PER_LONG == ?? */
|
||||
|
||||
# error do_div() does not yet support the C64
|
||||
|
||||
#endif /* BITS_PER_LONG */
|
||||
|
||||
#endif /* _ASM_GENERIC_DIV64_H */
|
|
@ -0,0 +1,10 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_GENERIC_DMA_MAPPING_H
|
||||
#define _ASM_GENERIC_DMA_MAPPING_H
|
||||
|
||||
static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* _ASM_GENERIC_DMA_MAPPING_H */
|
|
@ -0,0 +1,16 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef __ASM_GENERIC_DMA_H
|
||||
#define __ASM_GENERIC_DMA_H
|
||||
/*
|
||||
* This file traditionally describes the i8237 PC style DMA controller.
|
||||
* Most architectures don't have these any more and can get the minimal
|
||||
* implementation from kernel/dma.c by not defining MAX_DMA_CHANNELS.
|
||||
*
|
||||
* Some code relies on seeing MAX_DMA_ADDRESS though.
|
||||
*/
|
||||
#define MAX_DMA_ADDRESS PAGE_OFFSET
|
||||
|
||||
extern int request_dma(unsigned int dmanr, const char *device_id);
|
||||
extern void free_dma(unsigned int dmanr);
|
||||
|
||||
#endif /* __ASM_GENERIC_DMA_H */
|
|
@ -0,0 +1,53 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_EARLY_IOREMAP_H_
|
||||
#define _ASM_EARLY_IOREMAP_H_
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
/*
|
||||
* early_ioremap() and early_iounmap() are for temporary early boot-time
|
||||
* mappings, before the real ioremap() is functional.
|
||||
*/
|
||||
extern void __iomem *early_ioremap(resource_size_t phys_addr,
|
||||
unsigned long size);
|
||||
extern void *early_memremap(resource_size_t phys_addr,
|
||||
unsigned long size);
|
||||
extern void *early_memremap_ro(resource_size_t phys_addr,
|
||||
unsigned long size);
|
||||
extern void *early_memremap_prot(resource_size_t phys_addr,
|
||||
unsigned long size, unsigned long prot_val);
|
||||
extern void early_iounmap(void __iomem *addr, unsigned long size);
|
||||
extern void early_memunmap(void *addr, unsigned long size);
|
||||
|
||||
/*
|
||||
* Weak function called by early_ioremap_reset(). It does nothing, but
|
||||
* architectures may provide their own version to do any needed cleanups.
|
||||
*/
|
||||
extern void early_ioremap_shutdown(void);
|
||||
|
||||
#if defined(CONFIG_GENERIC_EARLY_IOREMAP) && defined(CONFIG_MMU)
|
||||
/* Arch-specific initialization */
|
||||
extern void early_ioremap_init(void);
|
||||
|
||||
/* Generic initialization called by architecture code */
|
||||
extern void early_ioremap_setup(void);
|
||||
|
||||
/*
|
||||
* Called as last step in paging_init() so library can act
|
||||
* accordingly for subsequent map/unmap requests.
|
||||
*/
|
||||
extern void early_ioremap_reset(void);
|
||||
|
||||
/*
|
||||
* Early copy from unmapped memory to kernel mapped memory.
|
||||
*/
|
||||
extern void copy_from_early_mem(void *dest, phys_addr_t src,
|
||||
unsigned long size);
|
||||
|
||||
#else
|
||||
static inline void early_ioremap_init(void) { }
|
||||
static inline void early_ioremap_setup(void) { }
|
||||
static inline void early_ioremap_reset(void) { }
|
||||
#endif
|
||||
|
||||
#endif /* _ASM_EARLY_IOREMAP_H_ */
|
|
@ -0,0 +1,10 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_GENERIC_EMERGENCY_RESTART_H
|
||||
#define _ASM_GENERIC_EMERGENCY_RESTART_H
|
||||
|
||||
static inline void machine_emergency_restart(void)
|
||||
{
|
||||
machine_restart(NULL);
|
||||
}
|
||||
|
||||
#endif /* _ASM_GENERIC_EMERGENCY_RESTART_H */
|
|
@ -0,0 +1,42 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_GENERIC_ERROR_INJECTION_H
|
||||
#define _ASM_GENERIC_ERROR_INJECTION_H
|
||||
|
||||
#if defined(__KERNEL__) && !defined(__ASSEMBLY__)
|
||||
enum {
|
||||
EI_ETYPE_NONE, /* Dummy value for undefined case */
|
||||
EI_ETYPE_NULL, /* Return NULL if failure */
|
||||
EI_ETYPE_ERRNO, /* Return -ERRNO if failure */
|
||||
EI_ETYPE_ERRNO_NULL, /* Return -ERRNO or NULL if failure */
|
||||
EI_ETYPE_TRUE, /* Return true if failure */
|
||||
};
|
||||
|
||||
struct error_injection_entry {
|
||||
unsigned long addr;
|
||||
int etype;
|
||||
};
|
||||
|
||||
struct pt_regs;
|
||||
|
||||
#ifdef CONFIG_FUNCTION_ERROR_INJECTION
|
||||
/*
|
||||
* Whitelist ganerating macro. Specify functions which can be
|
||||
* error-injectable using this macro.
|
||||
*/
|
||||
#define ALLOW_ERROR_INJECTION(fname, _etype) \
|
||||
static struct error_injection_entry __used \
|
||||
__section("_error_injection_whitelist") \
|
||||
_eil_addr_##fname = { \
|
||||
.addr = (unsigned long)fname, \
|
||||
.etype = EI_ETYPE_##_etype, \
|
||||
};
|
||||
|
||||
void override_function_with_return(struct pt_regs *regs);
|
||||
#else
|
||||
#define ALLOW_ERROR_INJECTION(fname, _etype)
|
||||
|
||||
static inline void override_function_with_return(struct pt_regs *regs) { }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* _ASM_GENERIC_ERROR_INJECTION_H */
|
|
@ -0,0 +1,15 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
/* Generic process execution definitions.
|
||||
*
|
||||
* It should be possible to use these on really simple architectures,
|
||||
* but it serves more as a starting point for new ports.
|
||||
*
|
||||
* Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
|
||||
* Written by David Howells (dhowells@redhat.com)
|
||||
*/
|
||||
#ifndef __ASM_GENERIC_EXEC_H
|
||||
#define __ASM_GENERIC_EXEC_H
|
||||
|
||||
#define arch_align_stack(x) (x)
|
||||
|
||||
#endif /* __ASM_GENERIC_EXEC_H */
|
|
@ -0,0 +1,94 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
#ifndef __ASM_GENERIC_EXPORT_H
|
||||
#define __ASM_GENERIC_EXPORT_H
|
||||
|
||||
#ifndef KSYM_FUNC
|
||||
#define KSYM_FUNC(x) x
|
||||
#endif
|
||||
#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
|
||||
#define KSYM_ALIGN 4
|
||||
#elif defined(CONFIG_64BIT)
|
||||
#define KSYM_ALIGN 8
|
||||
#else
|
||||
#define KSYM_ALIGN 4
|
||||
#endif
|
||||
#ifndef KCRC_ALIGN
|
||||
#define KCRC_ALIGN 4
|
||||
#endif
|
||||
|
||||
.macro __put, val, name
|
||||
#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
|
||||
.long \val - ., \name - ., 0
|
||||
#elif defined(CONFIG_64BIT)
|
||||
.quad \val, \name, 0
|
||||
#else
|
||||
.long \val, \name, 0
|
||||
#endif
|
||||
.endm
|
||||
|
||||
/*
|
||||
* note on .section use: we specify progbits since usage of the "M" (SHF_MERGE)
|
||||
* section flag requires it. Use '%progbits' instead of '@progbits' since the
|
||||
* former apparently works on all arches according to the binutils source.
|
||||
*/
|
||||
|
||||
.macro ___EXPORT_SYMBOL name,val,sec
|
||||
#ifdef CONFIG_MODULES
|
||||
.section ___ksymtab\sec+\name,"a"
|
||||
.balign KSYM_ALIGN
|
||||
__ksymtab_\name:
|
||||
__put \val, __kstrtab_\name
|
||||
.previous
|
||||
.section __ksymtab_strings,"aMS",%progbits,1
|
||||
__kstrtab_\name:
|
||||
.asciz "\name"
|
||||
.previous
|
||||
#ifdef CONFIG_MODVERSIONS
|
||||
.section ___kcrctab\sec+\name,"a"
|
||||
.balign KCRC_ALIGN
|
||||
#if defined(CONFIG_MODULE_REL_CRCS)
|
||||
.long __crc_\name - .
|
||||
#else
|
||||
.long __crc_\name
|
||||
#endif
|
||||
.weak __crc_\name
|
||||
.previous
|
||||
#endif
|
||||
#endif
|
||||
.endm
|
||||
|
||||
#if defined(CONFIG_TRIM_UNUSED_KSYMS)
|
||||
|
||||
#include <linux/kconfig.h>
|
||||
#include <generated/autoksyms.h>
|
||||
|
||||
.macro __ksym_marker sym
|
||||
.section ".discard.ksym","a"
|
||||
__ksym_marker_\sym:
|
||||
.previous
|
||||
.endm
|
||||
|
||||
#define __EXPORT_SYMBOL(sym, val, sec) \
|
||||
__ksym_marker sym; \
|
||||
__cond_export_sym(sym, val, sec, __is_defined(__KSYM_##sym))
|
||||
#define __cond_export_sym(sym, val, sec, conf) \
|
||||
___cond_export_sym(sym, val, sec, conf)
|
||||
#define ___cond_export_sym(sym, val, sec, enabled) \
|
||||
__cond_export_sym_##enabled(sym, val, sec)
|
||||
#define __cond_export_sym_1(sym, val, sec) ___EXPORT_SYMBOL sym, val, sec
|
||||
#define __cond_export_sym_0(sym, val, sec) /* nothing */
|
||||
|
||||
#else
|
||||
#define __EXPORT_SYMBOL(sym, val, sec) ___EXPORT_SYMBOL sym, val, sec
|
||||
#endif
|
||||
|
||||
#define EXPORT_SYMBOL(name) \
|
||||
__EXPORT_SYMBOL(name, KSYM_FUNC(name),)
|
||||
#define EXPORT_SYMBOL_GPL(name) \
|
||||
__EXPORT_SYMBOL(name, KSYM_FUNC(name), _gpl)
|
||||
#define EXPORT_DATA_SYMBOL(name) \
|
||||
__EXPORT_SYMBOL(name, name,)
|
||||
#define EXPORT_DATA_SYMBOL_GPL(name) \
|
||||
__EXPORT_SYMBOL(name, name,_gpl)
|
||||
|
||||
#endif
|
|
@ -0,0 +1,27 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef __ASM_GENERIC_EXTABLE_H
|
||||
#define __ASM_GENERIC_EXTABLE_H
|
||||
|
||||
/*
|
||||
* The exception table consists of pairs of addresses: the first is the
|
||||
* address of an instruction that is allowed to fault, and the second is
|
||||
* the address at which the program should continue. No registers are
|
||||
* modified, so it is entirely up to the continuation code to figure out
|
||||
* what to do.
|
||||
*
|
||||
* All the routines below use bits of fixup code that are out of line
|
||||
* with the main instruction path. This means when everything is well,
|
||||
* we don't even have to jump over them. Further, they do not intrude
|
||||
* on our cache or tlb entries.
|
||||
*/
|
||||
|
||||
struct exception_table_entry
|
||||
{
|
||||
unsigned long insn, fixup;
|
||||
};
|
||||
|
||||
|
||||
struct pt_regs;
|
||||
extern int fixup_exception(struct pt_regs *regs);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,13 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef __ASM_GENERIC_FB_H_
|
||||
#define __ASM_GENERIC_FB_H_
|
||||
#include <linux/fb.h>
|
||||
|
||||
#define fb_pgprotect(...) do {} while (0)
|
||||
|
||||
static inline int fb_is_primary_device(struct fb_info *info)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* __ASM_GENERIC_FB_H_ */
|
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
* 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>
|
||||
#include <linux/mm_types.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 */
|
|
@ -0,0 +1,26 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_GENERIC_FLAT_H
|
||||
#define _ASM_GENERIC_FLAT_H
|
||||
|
||||
#include <linux/uaccess.h>
|
||||
|
||||
static inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags,
|
||||
u32 *addr)
|
||||
{
|
||||
#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
|
||||
return copy_from_user(addr, rp, 4) ? -EFAULT : 0;
|
||||
#else
|
||||
return get_user(*addr, rp);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline int flat_put_addr_at_rp(u32 __user *rp, u32 addr, u32 rel)
|
||||
{
|
||||
#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
|
||||
return copy_to_user(rp, &addr, 4) ? -EFAULT : 0;
|
||||
#else
|
||||
return put_user(addr, rp);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* _ASM_GENERIC_FLAT_H */
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue