cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

utglobal.c (7836B)


      1// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
      2/******************************************************************************
      3 *
      4 * Module Name: utglobal - Global variables for the ACPI subsystem
      5 *
      6 * Copyright (C) 2000 - 2022, Intel Corp.
      7 *
      8 *****************************************************************************/
      9
     10#define EXPORT_ACPI_INTERFACES
     11#define DEFINE_ACPI_GLOBALS
     12
     13#include <acpi/acpi.h>
     14#include "accommon.h"
     15
     16#define _COMPONENT          ACPI_UTILITIES
     17ACPI_MODULE_NAME("utglobal")
     18
     19/*******************************************************************************
     20 *
     21 * Static global variable initialization.
     22 *
     23 ******************************************************************************/
     24/* Various state name strings */
     25const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT] = {
     26	"\\_S0_",
     27	"\\_S1_",
     28	"\\_S2_",
     29	"\\_S3_",
     30	"\\_S4_",
     31	"\\_S5_"
     32};
     33
     34const char *acpi_gbl_lowest_dstate_names[ACPI_NUM_sx_w_METHODS] = {
     35	"_S0W",
     36	"_S1W",
     37	"_S2W",
     38	"_S3W",
     39	"_S4W"
     40};
     41
     42const char *acpi_gbl_highest_dstate_names[ACPI_NUM_sx_d_METHODS] = {
     43	"_S1D",
     44	"_S2D",
     45	"_S3D",
     46	"_S4D"
     47};
     48
     49/* Hex-to-ascii */
     50
     51const char acpi_gbl_lower_hex_digits[] = "0123456789abcdef";
     52const char acpi_gbl_upper_hex_digits[] = "0123456789ABCDEF";
     53
     54/*******************************************************************************
     55 *
     56 * Namespace globals
     57 *
     58 ******************************************************************************/
     59/*
     60 * Predefined ACPI Names (Built-in to the Interpreter)
     61 *
     62 * NOTES:
     63 * 1) _SB_ is defined to be a device to allow \_SB_._INI to be run
     64 *    during the initialization sequence.
     65 * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to
     66 *    perform a Notify() operation on it. 09/2010: Changed to type Device.
     67 *    This still allows notifies, but does not confuse host code that
     68 *    searches for valid thermal_zone objects.
     69 */
     70const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = {
     71	{"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL},
     72	{"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL},
     73	{"_SB_", ACPI_TYPE_DEVICE, NULL},
     74	{"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL},
     75	{"_TZ_", ACPI_TYPE_DEVICE, NULL},
     76	/*
     77	 * March, 2015:
     78	 * The _REV object is in the process of being deprecated, because
     79	 * other ACPI implementations permanently return 2. Thus, it
     80	 * has little or no value. Return 2 for compatibility with
     81	 * other ACPI implementations.
     82	 */
     83	{"_REV", ACPI_TYPE_INTEGER, ACPI_CAST_PTR(char, 2)},
     84	{"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME},
     85	{"_GL_", ACPI_TYPE_MUTEX, ACPI_CAST_PTR(char, 1)},
     86	{"_OSI", ACPI_TYPE_METHOD, ACPI_CAST_PTR(char, 1)},
     87
     88	/* Table terminator */
     89
     90	{NULL, ACPI_TYPE_ANY, NULL}
     91};
     92
     93#if (!ACPI_REDUCED_HARDWARE)
     94/******************************************************************************
     95 *
     96 * Event and Hardware globals
     97 *
     98 ******************************************************************************/
     99
    100struct acpi_bit_register_info acpi_gbl_bit_register_info[ACPI_NUM_BITREG] = {
    101	/* Name                                     Parent Register             Register Bit Position                   Register Bit Mask       */
    102
    103	/* ACPI_BITREG_TIMER_STATUS         */ {ACPI_REGISTER_PM1_STATUS,
    104						ACPI_BITPOSITION_TIMER_STATUS,
    105						ACPI_BITMASK_TIMER_STATUS},
    106	/* ACPI_BITREG_BUS_MASTER_STATUS    */ {ACPI_REGISTER_PM1_STATUS,
    107						ACPI_BITPOSITION_BUS_MASTER_STATUS,
    108						ACPI_BITMASK_BUS_MASTER_STATUS},
    109	/* ACPI_BITREG_GLOBAL_LOCK_STATUS   */ {ACPI_REGISTER_PM1_STATUS,
    110						ACPI_BITPOSITION_GLOBAL_LOCK_STATUS,
    111						ACPI_BITMASK_GLOBAL_LOCK_STATUS},
    112	/* ACPI_BITREG_POWER_BUTTON_STATUS  */ {ACPI_REGISTER_PM1_STATUS,
    113						ACPI_BITPOSITION_POWER_BUTTON_STATUS,
    114						ACPI_BITMASK_POWER_BUTTON_STATUS},
    115	/* ACPI_BITREG_SLEEP_BUTTON_STATUS  */ {ACPI_REGISTER_PM1_STATUS,
    116						ACPI_BITPOSITION_SLEEP_BUTTON_STATUS,
    117						ACPI_BITMASK_SLEEP_BUTTON_STATUS},
    118	/* ACPI_BITREG_RT_CLOCK_STATUS      */ {ACPI_REGISTER_PM1_STATUS,
    119						ACPI_BITPOSITION_RT_CLOCK_STATUS,
    120						ACPI_BITMASK_RT_CLOCK_STATUS},
    121	/* ACPI_BITREG_WAKE_STATUS          */ {ACPI_REGISTER_PM1_STATUS,
    122						ACPI_BITPOSITION_WAKE_STATUS,
    123						ACPI_BITMASK_WAKE_STATUS},
    124	/* ACPI_BITREG_PCIEXP_WAKE_STATUS   */ {ACPI_REGISTER_PM1_STATUS,
    125						ACPI_BITPOSITION_PCIEXP_WAKE_STATUS,
    126						ACPI_BITMASK_PCIEXP_WAKE_STATUS},
    127
    128	/* ACPI_BITREG_TIMER_ENABLE         */ {ACPI_REGISTER_PM1_ENABLE,
    129						ACPI_BITPOSITION_TIMER_ENABLE,
    130						ACPI_BITMASK_TIMER_ENABLE},
    131	/* ACPI_BITREG_GLOBAL_LOCK_ENABLE   */ {ACPI_REGISTER_PM1_ENABLE,
    132						ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE,
    133						ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
    134	/* ACPI_BITREG_POWER_BUTTON_ENABLE  */ {ACPI_REGISTER_PM1_ENABLE,
    135						ACPI_BITPOSITION_POWER_BUTTON_ENABLE,
    136						ACPI_BITMASK_POWER_BUTTON_ENABLE},
    137	/* ACPI_BITREG_SLEEP_BUTTON_ENABLE  */ {ACPI_REGISTER_PM1_ENABLE,
    138						ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE,
    139						ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
    140	/* ACPI_BITREG_RT_CLOCK_ENABLE      */ {ACPI_REGISTER_PM1_ENABLE,
    141						ACPI_BITPOSITION_RT_CLOCK_ENABLE,
    142						ACPI_BITMASK_RT_CLOCK_ENABLE},
    143	/* ACPI_BITREG_PCIEXP_WAKE_DISABLE  */ {ACPI_REGISTER_PM1_ENABLE,
    144						ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE,
    145						ACPI_BITMASK_PCIEXP_WAKE_DISABLE},
    146
    147	/* ACPI_BITREG_SCI_ENABLE           */ {ACPI_REGISTER_PM1_CONTROL,
    148						ACPI_BITPOSITION_SCI_ENABLE,
    149						ACPI_BITMASK_SCI_ENABLE},
    150	/* ACPI_BITREG_BUS_MASTER_RLD       */ {ACPI_REGISTER_PM1_CONTROL,
    151						ACPI_BITPOSITION_BUS_MASTER_RLD,
    152						ACPI_BITMASK_BUS_MASTER_RLD},
    153	/* ACPI_BITREG_GLOBAL_LOCK_RELEASE  */ {ACPI_REGISTER_PM1_CONTROL,
    154						ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE,
    155						ACPI_BITMASK_GLOBAL_LOCK_RELEASE},
    156	/* ACPI_BITREG_SLEEP_TYPE           */ {ACPI_REGISTER_PM1_CONTROL,
    157						ACPI_BITPOSITION_SLEEP_TYPE,
    158						ACPI_BITMASK_SLEEP_TYPE},
    159	/* ACPI_BITREG_SLEEP_ENABLE         */ {ACPI_REGISTER_PM1_CONTROL,
    160						ACPI_BITPOSITION_SLEEP_ENABLE,
    161						ACPI_BITMASK_SLEEP_ENABLE},
    162
    163	/* ACPI_BITREG_ARB_DIS              */ {ACPI_REGISTER_PM2_CONTROL,
    164						ACPI_BITPOSITION_ARB_DISABLE,
    165						ACPI_BITMASK_ARB_DISABLE}
    166};
    167
    168struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] = {
    169	/* ACPI_EVENT_PMTIMER       */ {ACPI_BITREG_TIMER_STATUS,
    170					ACPI_BITREG_TIMER_ENABLE,
    171					ACPI_BITMASK_TIMER_STATUS,
    172					ACPI_BITMASK_TIMER_ENABLE},
    173	/* ACPI_EVENT_GLOBAL        */ {ACPI_BITREG_GLOBAL_LOCK_STATUS,
    174					ACPI_BITREG_GLOBAL_LOCK_ENABLE,
    175					ACPI_BITMASK_GLOBAL_LOCK_STATUS,
    176					ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
    177	/* ACPI_EVENT_POWER_BUTTON  */ {ACPI_BITREG_POWER_BUTTON_STATUS,
    178					ACPI_BITREG_POWER_BUTTON_ENABLE,
    179					ACPI_BITMASK_POWER_BUTTON_STATUS,
    180					ACPI_BITMASK_POWER_BUTTON_ENABLE},
    181	/* ACPI_EVENT_SLEEP_BUTTON  */ {ACPI_BITREG_SLEEP_BUTTON_STATUS,
    182					ACPI_BITREG_SLEEP_BUTTON_ENABLE,
    183					ACPI_BITMASK_SLEEP_BUTTON_STATUS,
    184					ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
    185	/* ACPI_EVENT_RTC           */ {ACPI_BITREG_RT_CLOCK_STATUS,
    186					ACPI_BITREG_RT_CLOCK_ENABLE,
    187					ACPI_BITMASK_RT_CLOCK_STATUS,
    188					ACPI_BITMASK_RT_CLOCK_ENABLE},
    189};
    190#endif				/* !ACPI_REDUCED_HARDWARE */
    191
    192#if defined (ACPI_DISASSEMBLER) || defined (ACPI_ASL_COMPILER)
    193
    194/* to_pld macro: compile/disassemble strings */
    195
    196const char *acpi_gbl_pld_panel_list[] = {
    197	"TOP",
    198	"BOTTOM",
    199	"LEFT",
    200	"RIGHT",
    201	"FRONT",
    202	"BACK",
    203	"UNKNOWN",
    204	NULL
    205};
    206
    207const char *acpi_gbl_pld_vertical_position_list[] = {
    208	"UPPER",
    209	"CENTER",
    210	"LOWER",
    211	NULL
    212};
    213
    214const char *acpi_gbl_pld_horizontal_position_list[] = {
    215	"LEFT",
    216	"CENTER",
    217	"RIGHT",
    218	NULL
    219};
    220
    221const char *acpi_gbl_pld_shape_list[] = {
    222	"ROUND",
    223	"OVAL",
    224	"SQUARE",
    225	"VERTICALRECTANGLE",
    226	"HORIZONTALRECTANGLE",
    227	"VERTICALTRAPEZOID",
    228	"HORIZONTALTRAPEZOID",
    229	"UNKNOWN",
    230	"CHAMFERED",
    231	NULL
    232};
    233#endif
    234
    235/* Public globals */
    236
    237ACPI_EXPORT_SYMBOL(acpi_gbl_FADT)
    238ACPI_EXPORT_SYMBOL(acpi_dbg_level)
    239ACPI_EXPORT_SYMBOL(acpi_dbg_layer)
    240ACPI_EXPORT_SYMBOL(acpi_gpe_count)
    241ACPI_EXPORT_SYMBOL(acpi_current_gpe_count)