Home | History | Annotate | Line # | Download | only in include
      1  1.1  riastrad /*	$NetBSD: amd_acpi.h,v 1.2 2021/12/18 23:45:08 riastradh Exp $	*/
      2  1.1  riastrad 
      3  1.1  riastrad /*
      4  1.1  riastrad  * Copyright 2012 Advanced Micro Devices, Inc.
      5  1.1  riastrad  *
      6  1.1  riastrad  * Permission is hereby granted, free of charge, to any person obtaining a
      7  1.1  riastrad  * copy of this software and associated documentation files (the "Software"),
      8  1.1  riastrad  * to deal in the Software without restriction, including without limitation
      9  1.1  riastrad  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
     10  1.1  riastrad  * and/or sell copies of the Software, and to permit persons to whom the
     11  1.1  riastrad  * Software is furnished to do so, subject to the following conditions:
     12  1.1  riastrad  *
     13  1.1  riastrad  * The above copyright notice and this permission notice shall be included in
     14  1.1  riastrad  * all copies or substantial portions of the Software.
     15  1.1  riastrad  *
     16  1.1  riastrad  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     17  1.1  riastrad  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     18  1.1  riastrad  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
     19  1.1  riastrad  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
     20  1.1  riastrad  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
     21  1.1  riastrad  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
     22  1.1  riastrad  * OTHER DEALINGS IN THE SOFTWARE.
     23  1.1  riastrad  *
     24  1.1  riastrad  */
     25  1.1  riastrad 
     26  1.1  riastrad #ifndef AMD_ACPI_H
     27  1.1  riastrad #define AMD_ACPI_H
     28  1.1  riastrad 
     29  1.1  riastrad #define ACPI_AC_CLASS           "ac_adapter"
     30  1.1  riastrad 
     31  1.1  riastrad struct atif_verify_interface {
     32  1.1  riastrad 	u16 size;		/* structure size in bytes (includes size field) */
     33  1.1  riastrad 	u16 version;		/* version */
     34  1.1  riastrad 	u32 notification_mask;	/* supported notifications mask */
     35  1.1  riastrad 	u32 function_bits;	/* supported functions bit vector */
     36  1.1  riastrad } __packed;
     37  1.1  riastrad 
     38  1.1  riastrad struct atif_system_params {
     39  1.1  riastrad 	u16 size;		/* structure size in bytes (includes size field) */
     40  1.1  riastrad 	u32 valid_mask;		/* valid flags mask */
     41  1.1  riastrad 	u32 flags;		/* flags */
     42  1.1  riastrad 	u8 command_code;	/* notify command code */
     43  1.1  riastrad } __packed;
     44  1.1  riastrad 
     45  1.1  riastrad struct atif_sbios_requests {
     46  1.1  riastrad 	u16 size;		/* structure size in bytes (includes size field) */
     47  1.1  riastrad 	u32 pending;		/* pending sbios requests */
     48  1.1  riastrad 	u8 panel_exp_mode;	/* panel expansion mode */
     49  1.1  riastrad 	u8 thermal_gfx;		/* thermal state: target gfx controller */
     50  1.1  riastrad 	u8 thermal_state;	/* thermal state: state id (0: exit state, non-0: state) */
     51  1.1  riastrad 	u8 forced_power_gfx;	/* forced power state: target gfx controller */
     52  1.1  riastrad 	u8 forced_power_state;	/* forced power state: state id */
     53  1.1  riastrad 	u8 system_power_src;	/* system power source */
     54  1.1  riastrad 	u8 backlight_level;	/* panel backlight level (0-255) */
     55  1.1  riastrad } __packed;
     56  1.1  riastrad 
     57  1.1  riastrad struct atif_qbtc_arguments {
     58  1.1  riastrad 	u16 size;		/* structure size in bytes (includes size field) */
     59  1.1  riastrad 	u8 requested_display;	/* which display is requested */
     60  1.1  riastrad } __packed;
     61  1.1  riastrad 
     62  1.1  riastrad #define ATIF_QBTC_MAX_DATA_POINTS 99
     63  1.1  riastrad 
     64  1.1  riastrad struct atif_qbtc_data_point {
     65  1.1  riastrad 	u8 luminance;		/* luminance in percent */
     66  1.1  riastrad 	u8 ipnut_signal;	/* input signal in range 0-255 */
     67  1.1  riastrad } __packed;
     68  1.1  riastrad 
     69  1.1  riastrad struct atif_qbtc_output {
     70  1.1  riastrad 	u16 size;		/* structure size in bytes (includes size field) */
     71  1.1  riastrad 	u16 flags;		/* all zeroes */
     72  1.1  riastrad 	u8 error_code;		/* error code */
     73  1.1  riastrad 	u8 ac_level;		/* default brightness on AC power */
     74  1.1  riastrad 	u8 dc_level;		/* default brightness on DC power */
     75  1.1  riastrad 	u8 min_input_signal;	/* max input signal in range 0-255 */
     76  1.1  riastrad 	u8 max_input_signal;	/* min input signal in range 0-255 */
     77  1.1  riastrad 	u8 number_of_points;	/* number of data points */
     78  1.1  riastrad 	struct atif_qbtc_data_point data_points[ATIF_QBTC_MAX_DATA_POINTS];
     79  1.1  riastrad } __packed;
     80  1.1  riastrad 
     81  1.1  riastrad #define ATIF_NOTIFY_MASK	0x3
     82  1.1  riastrad #define ATIF_NOTIFY_NONE	0
     83  1.1  riastrad #define ATIF_NOTIFY_81		1
     84  1.1  riastrad #define ATIF_NOTIFY_N		2
     85  1.1  riastrad 
     86  1.1  riastrad struct atcs_verify_interface {
     87  1.1  riastrad 	u16 size;		/* structure size in bytes (includes size field) */
     88  1.1  riastrad 	u16 version;		/* version */
     89  1.1  riastrad 	u32 function_bits;	/* supported functions bit vector */
     90  1.1  riastrad } __packed;
     91  1.1  riastrad 
     92  1.1  riastrad #define ATCS_VALID_FLAGS_MASK	0x3
     93  1.1  riastrad 
     94  1.1  riastrad struct atcs_pref_req_input {
     95  1.1  riastrad 	u16 size;		/* structure size in bytes (includes size field) */
     96  1.1  riastrad 	u16 client_id;		/* client id (bit 2-0: func num, 7-3: dev num, 15-8: bus num) */
     97  1.1  riastrad 	u16 valid_flags_mask;	/* valid flags mask */
     98  1.1  riastrad 	u16 flags;		/* flags */
     99  1.1  riastrad 	u8 req_type;		/* request type */
    100  1.1  riastrad 	u8 perf_req;		/* performance request */
    101  1.1  riastrad } __packed;
    102  1.1  riastrad 
    103  1.1  riastrad struct atcs_pref_req_output {
    104  1.1  riastrad 	u16 size;		/* structure size in bytes (includes size field) */
    105  1.1  riastrad 	u8 ret_val;		/* return value */
    106  1.1  riastrad } __packed;
    107  1.1  riastrad 
    108  1.1  riastrad /* AMD hw uses four ACPI control methods:
    109  1.1  riastrad  * 1. ATIF
    110  1.1  riastrad  * ARG0: (ACPI_INTEGER) function code
    111  1.1  riastrad  * ARG1: (ACPI_BUFFER) parameter buffer, 256 bytes
    112  1.1  riastrad  * OUTPUT: (ACPI_BUFFER) output buffer, 256 bytes
    113  1.1  riastrad  * ATIF provides an entry point for the gfx driver to interact with the sbios.
    114  1.1  riastrad  * The AMD ACPI notification mechanism uses Notify (VGA, 0x81) or a custom
    115  1.1  riastrad  * notification. Which notification is used as indicated by the ATIF Control
    116  1.1  riastrad  * Method GET_SYSTEM_PARAMETERS. When the driver receives Notify (VGA, 0x81) or
    117  1.1  riastrad  * a custom notification it invokes ATIF Control Method GET_SYSTEM_BIOS_REQUESTS
    118  1.1  riastrad  * to identify pending System BIOS requests and associated parameters. For
    119  1.1  riastrad  * example, if one of the pending requests is DISPLAY_SWITCH_REQUEST, the driver
    120  1.1  riastrad  * will perform display device detection and invoke ATIF Control Method
    121  1.1  riastrad  * SELECT_ACTIVE_DISPLAYS.
    122  1.1  riastrad  *
    123  1.1  riastrad  * 2. ATPX
    124  1.1  riastrad  * ARG0: (ACPI_INTEGER) function code
    125  1.1  riastrad  * ARG1: (ACPI_BUFFER) parameter buffer, 256 bytes
    126  1.1  riastrad  * OUTPUT: (ACPI_BUFFER) output buffer, 256 bytes
    127  1.1  riastrad  * ATPX methods are used on PowerXpress systems to handle mux switching and
    128  1.1  riastrad  * discrete GPU power control.
    129  1.1  riastrad  *
    130  1.1  riastrad  * 3. ATRM
    131  1.1  riastrad  * ARG0: (ACPI_INTEGER) offset of vbios rom data
    132  1.1  riastrad  * ARG1: (ACPI_BUFFER) size of the buffer to fill (up to 4K).
    133  1.1  riastrad  * OUTPUT: (ACPI_BUFFER) output buffer
    134  1.1  riastrad  * ATRM provides an interfacess to access the discrete GPU vbios image on
    135  1.1  riastrad  * PowerXpress systems with multiple GPUs.
    136  1.1  riastrad  *
    137  1.1  riastrad  * 4. ATCS
    138  1.1  riastrad  * ARG0: (ACPI_INTEGER) function code
    139  1.1  riastrad  * ARG1: (ACPI_BUFFER) parameter buffer, 256 bytes
    140  1.1  riastrad  * OUTPUT: (ACPI_BUFFER) output buffer, 256 bytes
    141  1.1  riastrad  * ATCS provides an interface to AMD chipset specific functionality.
    142  1.1  riastrad  *
    143  1.1  riastrad  */
    144  1.1  riastrad /* ATIF */
    145  1.1  riastrad #define ATIF_FUNCTION_VERIFY_INTERFACE                             0x0
    146  1.1  riastrad /* ARG0: ATIF_FUNCTION_VERIFY_INTERFACE
    147  1.1  riastrad  * ARG1: none
    148  1.1  riastrad  * OUTPUT:
    149  1.1  riastrad  * WORD  - structure size in bytes (includes size field)
    150  1.1  riastrad  * WORD  - version
    151  1.1  riastrad  * DWORD - supported notifications mask
    152  1.1  riastrad  * DWORD - supported functions bit vector
    153  1.1  riastrad  */
    154  1.1  riastrad /* Notifications mask */
    155  1.1  riastrad #       define ATIF_THERMAL_STATE_CHANGE_REQUEST_SUPPORTED         (1 << 2)
    156  1.1  riastrad #       define ATIF_FORCED_POWER_STATE_CHANGE_REQUEST_SUPPORTED    (1 << 3)
    157  1.1  riastrad #       define ATIF_SYSTEM_POWER_SOURCE_CHANGE_REQUEST_SUPPORTED   (1 << 4)
    158  1.1  riastrad #       define ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST_SUPPORTED      (1 << 7)
    159  1.1  riastrad #       define ATIF_DGPU_DISPLAY_EVENT_SUPPORTED                   (1 << 8)
    160  1.1  riastrad #       define ATIF_GPU_PACKAGE_POWER_LIMIT_REQUEST_SUPPORTED      (1 << 12)
    161  1.1  riastrad /* supported functions vector */
    162  1.1  riastrad #       define ATIF_GET_SYSTEM_PARAMETERS_SUPPORTED               (1 << 0)
    163  1.1  riastrad #       define ATIF_GET_SYSTEM_BIOS_REQUESTS_SUPPORTED            (1 << 1)
    164  1.1  riastrad #       define ATIF_TEMPERATURE_CHANGE_NOTIFICATION_SUPPORTED     (1 << 12)
    165  1.1  riastrad #       define ATIF_QUERY_BACKLIGHT_TRANSFER_CHARACTERISTICS_SUPPORTED (1 << 15)
    166  1.1  riastrad #       define ATIF_READY_TO_UNDOCK_NOTIFICATION_SUPPORTED        (1 << 16)
    167  1.1  riastrad #       define ATIF_GET_EXTERNAL_GPU_INFORMATION_SUPPORTED        (1 << 20)
    168  1.1  riastrad #define ATIF_FUNCTION_GET_SYSTEM_PARAMETERS                        0x1
    169  1.1  riastrad /* ARG0: ATIF_FUNCTION_GET_SYSTEM_PARAMETERS
    170  1.1  riastrad  * ARG1: none
    171  1.1  riastrad  * OUTPUT:
    172  1.1  riastrad  * WORD  - structure size in bytes (includes size field)
    173  1.1  riastrad  * DWORD - valid flags mask
    174  1.1  riastrad  * DWORD - flags
    175  1.1  riastrad  *
    176  1.1  riastrad  * OR
    177  1.1  riastrad  *
    178  1.1  riastrad  * WORD  - structure size in bytes (includes size field)
    179  1.1  riastrad  * DWORD - valid flags mask
    180  1.1  riastrad  * DWORD - flags
    181  1.1  riastrad  * BYTE  - notify command code
    182  1.1  riastrad  *
    183  1.1  riastrad  * flags
    184  1.1  riastrad  * bits 1:0:
    185  1.1  riastrad  * 0 - Notify(VGA, 0x81) is not used for notification
    186  1.1  riastrad  * 1 - Notify(VGA, 0x81) is used for notification
    187  1.1  riastrad  * 2 - Notify(VGA, n) is used for notification where
    188  1.1  riastrad  * n (0xd0-0xd9) is specified in notify command code.
    189  1.1  riastrad  * bit 2:
    190  1.1  riastrad  * 1 - lid changes not reported though int10
    191  1.1  riastrad  * bit 3:
    192  1.1  riastrad  * 1 - system bios controls overclocking
    193  1.1  riastrad  * bit 4:
    194  1.1  riastrad  * 1 - enable overclocking
    195  1.1  riastrad  */
    196  1.1  riastrad #define ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS                     0x2
    197  1.1  riastrad /* ARG0: ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS
    198  1.1  riastrad  * ARG1: none
    199  1.1  riastrad  * OUTPUT:
    200  1.1  riastrad  * WORD  - structure size in bytes (includes size field)
    201  1.1  riastrad  * DWORD - pending sbios requests
    202  1.1  riastrad  * BYTE  - reserved (all zeroes)
    203  1.1  riastrad  * BYTE  - thermal state: target gfx controller
    204  1.1  riastrad  * BYTE  - thermal state: state id (0: exit state, non-0: state)
    205  1.1  riastrad  * BYTE  - forced power state: target gfx controller
    206  1.1  riastrad  * BYTE  - forced power state: state id (0: forced state, non-0: state)
    207  1.1  riastrad  * BYTE  - system power source
    208  1.1  riastrad  * BYTE  - panel backlight level (0-255)
    209  1.1  riastrad  * BYTE  - GPU package power limit: target gfx controller
    210  1.1  riastrad  * DWORD - GPU package power limit: value (24:8 fractional format, Watts)
    211  1.1  riastrad  */
    212  1.1  riastrad /* pending sbios requests */
    213  1.1  riastrad #       define ATIF_THERMAL_STATE_CHANGE_REQUEST                   (1 << 2)
    214  1.1  riastrad #       define ATIF_FORCED_POWER_STATE_CHANGE_REQUEST              (1 << 3)
    215  1.1  riastrad #       define ATIF_SYSTEM_POWER_SOURCE_CHANGE_REQUEST             (1 << 4)
    216  1.1  riastrad #       define ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST                (1 << 7)
    217  1.1  riastrad #       define ATIF_DGPU_DISPLAY_EVENT                             (1 << 8)
    218  1.1  riastrad #       define ATIF_GPU_PACKAGE_POWER_LIMIT_REQUEST                (1 << 12)
    219  1.1  riastrad /* target gfx controller */
    220  1.1  riastrad #       define ATIF_TARGET_GFX_SINGLE                              0
    221  1.1  riastrad #       define ATIF_TARGET_GFX_PX_IGPU                             1
    222  1.1  riastrad #       define ATIF_TARGET_GFX_PX_DGPU                             2
    223  1.1  riastrad /* system power source */
    224  1.1  riastrad #       define ATIF_POWER_SOURCE_AC                                1
    225  1.1  riastrad #       define ATIF_POWER_SOURCE_DC                                2
    226  1.1  riastrad #       define ATIF_POWER_SOURCE_RESTRICTED_AC_1                   3
    227  1.1  riastrad #       define ATIF_POWER_SOURCE_RESTRICTED_AC_2                   4
    228  1.1  riastrad #define ATIF_FUNCTION_TEMPERATURE_CHANGE_NOTIFICATION              0xD
    229  1.1  riastrad /* ARG0: ATIF_FUNCTION_TEMPERATURE_CHANGE_NOTIFICATION
    230  1.1  riastrad  * ARG1:
    231  1.1  riastrad  * WORD  - structure size in bytes (includes size field)
    232  1.1  riastrad  * WORD  - gfx controller id
    233  1.1  riastrad  * BYTE  - current temperature (degress Celsius)
    234  1.1  riastrad  * OUTPUT: none
    235  1.1  riastrad  */
    236  1.1  riastrad #define ATIF_FUNCTION_QUERY_BRIGHTNESS_TRANSFER_CHARACTERISTICS    0x10
    237  1.1  riastrad /* ARG0: ATIF_FUNCTION_QUERY_BRIGHTNESS_TRANSFER_CHARACTERISTICS
    238  1.1  riastrad  * ARG1:
    239  1.1  riastrad  * WORD  - structure size in bytes (includes size field)
    240  1.1  riastrad  * BYTE  - requested display
    241  1.1  riastrad  * OUTPUT:
    242  1.1  riastrad  * WORD  - structure size in bytes (includes size field)
    243  1.1  riastrad  * WORD  - flags (currently all 16 bits are reserved)
    244  1.1  riastrad  * BYTE  - error code (on failure, disregard all below fields)
    245  1.1  riastrad  * BYTE  - AC level (default brightness in percent when machine has full power)
    246  1.1  riastrad  * BYTE  - DC level (default brightness in percent when machine is on battery)
    247  1.1  riastrad  * BYTE  - min input signal, in range 0-255, corresponding to 0% backlight
    248  1.1  riastrad  * BYTE  - max input signal, in range 0-255, corresponding to 100% backlight
    249  1.1  riastrad  * BYTE  - number of reported data points
    250  1.1  riastrad  * BYTE  - luminance level in percent  \ repeated structure
    251  1.1  riastrad  * BYTE  - input signal in range 0-255 / does not have entries for 0% and 100%
    252  1.1  riastrad  */
    253  1.1  riastrad /* requested display */
    254  1.1  riastrad #       define ATIF_QBTC_REQUEST_LCD1                              0
    255  1.1  riastrad #       define ATIF_QBTC_REQUEST_CRT1                              1
    256  1.1  riastrad #       define ATIF_QBTC_REQUEST_DFP1                              3
    257  1.1  riastrad #       define ATIF_QBTC_REQUEST_CRT2                              4
    258  1.1  riastrad #       define ATIF_QBTC_REQUEST_LCD2                              5
    259  1.1  riastrad #       define ATIF_QBTC_REQUEST_DFP2                              7
    260  1.1  riastrad #       define ATIF_QBTC_REQUEST_DFP3                              9
    261  1.1  riastrad #       define ATIF_QBTC_REQUEST_DFP4                              10
    262  1.1  riastrad #       define ATIF_QBTC_REQUEST_DFP5                              11
    263  1.1  riastrad #       define ATIF_QBTC_REQUEST_DFP6                              12
    264  1.1  riastrad /* error code */
    265  1.1  riastrad #       define ATIF_QBTC_ERROR_CODE_SUCCESS                        0
    266  1.1  riastrad #       define ATIF_QBTC_ERROR_CODE_FAILURE                        1
    267  1.1  riastrad #       define ATIF_QBTC_ERROR_CODE_DEVICE_NOT_SUPPORTED           2
    268  1.1  riastrad #define ATIF_FUNCTION_READY_TO_UNDOCK_NOTIFICATION                 0x11
    269  1.1  riastrad /* ARG0: ATIF_FUNCTION_READY_TO_UNDOCK_NOTIFICATION
    270  1.1  riastrad  * ARG1: none
    271  1.1  riastrad  * OUTPUT: none
    272  1.1  riastrad  */
    273  1.1  riastrad #define ATIF_FUNCTION_GET_EXTERNAL_GPU_INFORMATION                 0x15
    274  1.1  riastrad /* ARG0: ATIF_FUNCTION_GET_EXTERNAL_GPU_INFORMATION
    275  1.1  riastrad  * ARG1: none
    276  1.1  riastrad  * OUTPUT:
    277  1.1  riastrad  * WORD  - number of reported external gfx devices
    278  1.1  riastrad  * WORD  - device structure size in bytes (excludes device size field)
    279  1.1  riastrad  * WORD  - flags         \
    280  1.1  riastrad  * WORD  - bus number    / repeated structure
    281  1.1  riastrad  */
    282  1.1  riastrad /* flags */
    283  1.1  riastrad #       define ATIF_EXTERNAL_GRAPHICS_PORT                         (1 << 0)
    284  1.1  riastrad 
    285  1.1  riastrad /* ATPX */
    286  1.1  riastrad #define ATPX_FUNCTION_VERIFY_INTERFACE                             0x0
    287  1.1  riastrad /* ARG0: ATPX_FUNCTION_VERIFY_INTERFACE
    288  1.1  riastrad  * ARG1: none
    289  1.1  riastrad  * OUTPUT:
    290  1.1  riastrad  * WORD  - structure size in bytes (includes size field)
    291  1.1  riastrad  * WORD  - version
    292  1.1  riastrad  * DWORD - supported functions bit vector
    293  1.1  riastrad  */
    294  1.1  riastrad /* supported functions vector */
    295  1.1  riastrad #       define ATPX_GET_PX_PARAMETERS_SUPPORTED                    (1 << 0)
    296  1.1  riastrad #       define ATPX_POWER_CONTROL_SUPPORTED                        (1 << 1)
    297  1.1  riastrad #       define ATPX_DISPLAY_MUX_CONTROL_SUPPORTED                  (1 << 2)
    298  1.1  riastrad #       define ATPX_I2C_MUX_CONTROL_SUPPORTED                      (1 << 3)
    299  1.1  riastrad #       define ATPX_GRAPHICS_DEVICE_SWITCH_START_NOTIFICATION_SUPPORTED (1 << 4)
    300  1.1  riastrad #       define ATPX_GRAPHICS_DEVICE_SWITCH_END_NOTIFICATION_SUPPORTED   (1 << 5)
    301  1.1  riastrad #       define ATPX_GET_DISPLAY_CONNECTORS_MAPPING_SUPPORTED       (1 << 7)
    302  1.1  riastrad #       define ATPX_GET_DISPLAY_DETECTION_PORTS_SUPPORTED          (1 << 8)
    303  1.1  riastrad #define ATPX_FUNCTION_GET_PX_PARAMETERS                            0x1
    304  1.1  riastrad /* ARG0: ATPX_FUNCTION_GET_PX_PARAMETERS
    305  1.1  riastrad  * ARG1: none
    306  1.1  riastrad  * OUTPUT:
    307  1.1  riastrad  * WORD  - structure size in bytes (includes size field)
    308  1.1  riastrad  * DWORD - valid flags mask
    309  1.1  riastrad  * DWORD - flags
    310  1.1  riastrad  */
    311  1.1  riastrad /* flags */
    312  1.1  riastrad #       define ATPX_LVDS_I2C_AVAILABLE_TO_BOTH_GPUS                (1 << 0)
    313  1.1  riastrad #       define ATPX_CRT1_I2C_AVAILABLE_TO_BOTH_GPUS                (1 << 1)
    314  1.1  riastrad #       define ATPX_DVI1_I2C_AVAILABLE_TO_BOTH_GPUS                (1 << 2)
    315  1.1  riastrad #       define ATPX_CRT1_RGB_SIGNAL_MUXED                          (1 << 3)
    316  1.1  riastrad #       define ATPX_TV_SIGNAL_MUXED                                (1 << 4)
    317  1.1  riastrad #       define ATPX_DFP_SIGNAL_MUXED                               (1 << 5)
    318  1.1  riastrad #       define ATPX_SEPARATE_MUX_FOR_I2C                           (1 << 6)
    319  1.1  riastrad #       define ATPX_DYNAMIC_PX_SUPPORTED                           (1 << 7)
    320  1.1  riastrad #       define ATPX_ACF_NOT_SUPPORTED                              (1 << 8)
    321  1.1  riastrad #       define ATPX_FIXED_NOT_SUPPORTED                            (1 << 9)
    322  1.1  riastrad #       define ATPX_DYNAMIC_DGPU_POWER_OFF_SUPPORTED               (1 << 10)
    323  1.1  riastrad #       define ATPX_DGPU_REQ_POWER_FOR_DISPLAYS                    (1 << 11)
    324  1.1  riastrad #       define ATPX_DGPU_CAN_DRIVE_DISPLAYS                        (1 << 12)
    325  1.1  riastrad #       define ATPX_MS_HYBRID_GFX_SUPPORTED                        (1 << 14)
    326  1.1  riastrad #define ATPX_FUNCTION_POWER_CONTROL                                0x2
    327  1.1  riastrad /* ARG0: ATPX_FUNCTION_POWER_CONTROL
    328  1.1  riastrad  * ARG1:
    329  1.1  riastrad  * WORD  - structure size in bytes (includes size field)
    330  1.1  riastrad  * BYTE  - dGPU power state (0: power off, 1: power on)
    331  1.1  riastrad  * OUTPUT: none
    332  1.1  riastrad  */
    333  1.1  riastrad #define ATPX_FUNCTION_DISPLAY_MUX_CONTROL                          0x3
    334  1.1  riastrad /* ARG0: ATPX_FUNCTION_DISPLAY_MUX_CONTROL
    335  1.1  riastrad  * ARG1:
    336  1.1  riastrad  * WORD  - structure size in bytes (includes size field)
    337  1.1  riastrad  * WORD  - display mux control (0: iGPU, 1: dGPU)
    338  1.1  riastrad  * OUTPUT: none
    339  1.1  riastrad  */
    340  1.1  riastrad #       define ATPX_INTEGRATED_GPU                                 0
    341  1.1  riastrad #       define ATPX_DISCRETE_GPU                                   1
    342  1.1  riastrad #define ATPX_FUNCTION_I2C_MUX_CONTROL                              0x4
    343  1.1  riastrad /* ARG0: ATPX_FUNCTION_I2C_MUX_CONTROL
    344  1.1  riastrad  * ARG1:
    345  1.1  riastrad  * WORD  - structure size in bytes (includes size field)
    346  1.1  riastrad  * WORD  - i2c/aux/hpd mux control (0: iGPU, 1: dGPU)
    347  1.1  riastrad  * OUTPUT: none
    348  1.1  riastrad  */
    349  1.1  riastrad #define ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_START_NOTIFICATION    0x5
    350  1.1  riastrad /* ARG0: ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_START_NOTIFICATION
    351  1.1  riastrad  * ARG1:
    352  1.1  riastrad  * WORD  - structure size in bytes (includes size field)
    353  1.1  riastrad  * WORD  - target gpu (0: iGPU, 1: dGPU)
    354  1.1  riastrad  * OUTPUT: none
    355  1.1  riastrad  */
    356  1.1  riastrad #define ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_END_NOTIFICATION      0x6
    357  1.1  riastrad /* ARG0: ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_END_NOTIFICATION
    358  1.1  riastrad  * ARG1:
    359  1.1  riastrad  * WORD  - structure size in bytes (includes size field)
    360  1.1  riastrad  * WORD  - target gpu (0: iGPU, 1: dGPU)
    361  1.1  riastrad  * OUTPUT: none
    362  1.1  riastrad  */
    363  1.1  riastrad #define ATPX_FUNCTION_GET_DISPLAY_CONNECTORS_MAPPING               0x8
    364  1.1  riastrad /* ARG0: ATPX_FUNCTION_GET_DISPLAY_CONNECTORS_MAPPING
    365  1.1  riastrad  * ARG1: none
    366  1.1  riastrad  * OUTPUT:
    367  1.1  riastrad  * WORD  - number of display connectors
    368  1.1  riastrad  * WORD  - connector structure size in bytes (excludes connector size field)
    369  1.1  riastrad  * BYTE  - flags                                                     \
    370  1.1  riastrad  * BYTE  - ATIF display vector bit position                           } repeated
    371  1.1  riastrad  * BYTE  - adapter id (0: iGPU, 1-n: dGPU ordered by pcie bus number) } structure
    372  1.1  riastrad  * WORD  - connector ACPI id                                         /
    373  1.1  riastrad  */
    374  1.1  riastrad /* flags */
    375  1.1  riastrad #       define ATPX_DISPLAY_OUTPUT_SUPPORTED_BY_ADAPTER_ID_DEVICE  (1 << 0)
    376  1.1  riastrad #       define ATPX_DISPLAY_HPD_SUPPORTED_BY_ADAPTER_ID_DEVICE     (1 << 1)
    377  1.1  riastrad #       define ATPX_DISPLAY_I2C_SUPPORTED_BY_ADAPTER_ID_DEVICE     (1 << 2)
    378  1.1  riastrad #define ATPX_FUNCTION_GET_DISPLAY_DETECTION_PORTS                  0x9
    379  1.1  riastrad /* ARG0: ATPX_FUNCTION_GET_DISPLAY_DETECTION_PORTS
    380  1.1  riastrad  * ARG1: none
    381  1.1  riastrad  * OUTPUT:
    382  1.1  riastrad  * WORD  - number of HPD/DDC ports
    383  1.1  riastrad  * WORD  - port structure size in bytes (excludes port size field)
    384  1.1  riastrad  * BYTE  - ATIF display vector bit position \
    385  1.1  riastrad  * BYTE  - hpd id                            } reapeated structure
    386  1.1  riastrad  * BYTE  - ddc id                           /
    387  1.1  riastrad  *
    388  1.1  riastrad  * available on A+A systems only
    389  1.1  riastrad  */
    390  1.1  riastrad /* hpd id */
    391  1.1  riastrad #       define ATPX_HPD_NONE                                       0
    392  1.1  riastrad #       define ATPX_HPD1                                           1
    393  1.1  riastrad #       define ATPX_HPD2                                           2
    394  1.1  riastrad #       define ATPX_HPD3                                           3
    395  1.1  riastrad #       define ATPX_HPD4                                           4
    396  1.1  riastrad #       define ATPX_HPD5                                           5
    397  1.1  riastrad #       define ATPX_HPD6                                           6
    398  1.1  riastrad /* ddc id */
    399  1.1  riastrad #       define ATPX_DDC_NONE                                       0
    400  1.1  riastrad #       define ATPX_DDC1                                           1
    401  1.1  riastrad #       define ATPX_DDC2                                           2
    402  1.1  riastrad #       define ATPX_DDC3                                           3
    403  1.1  riastrad #       define ATPX_DDC4                                           4
    404  1.1  riastrad #       define ATPX_DDC5                                           5
    405  1.1  riastrad #       define ATPX_DDC6                                           6
    406  1.1  riastrad #       define ATPX_DDC7                                           7
    407  1.1  riastrad #       define ATPX_DDC8                                           8
    408  1.1  riastrad 
    409  1.1  riastrad /* ATCS */
    410  1.1  riastrad #define ATCS_FUNCTION_VERIFY_INTERFACE                             0x0
    411  1.1  riastrad /* ARG0: ATCS_FUNCTION_VERIFY_INTERFACE
    412  1.1  riastrad  * ARG1: none
    413  1.1  riastrad  * OUTPUT:
    414  1.1  riastrad  * WORD  - structure size in bytes (includes size field)
    415  1.1  riastrad  * WORD  - version
    416  1.1  riastrad  * DWORD - supported functions bit vector
    417  1.1  riastrad  */
    418  1.1  riastrad /* supported functions vector */
    419  1.1  riastrad #       define ATCS_GET_EXTERNAL_STATE_SUPPORTED                   (1 << 0)
    420  1.1  riastrad #       define ATCS_PCIE_PERFORMANCE_REQUEST_SUPPORTED             (1 << 1)
    421  1.1  riastrad #       define ATCS_PCIE_DEVICE_READY_NOTIFICATION_SUPPORTED       (1 << 2)
    422  1.1  riastrad #       define ATCS_SET_PCIE_BUS_WIDTH_SUPPORTED                   (1 << 3)
    423  1.1  riastrad #define ATCS_FUNCTION_GET_EXTERNAL_STATE                           0x1
    424  1.1  riastrad /* ARG0: ATCS_FUNCTION_GET_EXTERNAL_STATE
    425  1.1  riastrad  * ARG1: none
    426  1.1  riastrad  * OUTPUT:
    427  1.1  riastrad  * WORD  - structure size in bytes (includes size field)
    428  1.1  riastrad  * DWORD - valid flags mask
    429  1.1  riastrad  * DWORD - flags (0: undocked, 1: docked)
    430  1.1  riastrad  */
    431  1.1  riastrad /* flags */
    432  1.1  riastrad #       define ATCS_DOCKED                                         (1 << 0)
    433  1.1  riastrad #define ATCS_FUNCTION_PCIE_PERFORMANCE_REQUEST                     0x2
    434  1.1  riastrad /* ARG0: ATCS_FUNCTION_PCIE_PERFORMANCE_REQUEST
    435  1.1  riastrad  * ARG1:
    436  1.1  riastrad  * WORD  - structure size in bytes (includes size field)
    437  1.1  riastrad  * WORD  - client id (bit 2-0: func num, 7-3: dev num, 15-8: bus num)
    438  1.1  riastrad  * WORD  - valid flags mask
    439  1.1  riastrad  * WORD  - flags
    440  1.1  riastrad  * BYTE  - request type
    441  1.1  riastrad  * BYTE  - performance request
    442  1.1  riastrad  * OUTPUT:
    443  1.1  riastrad  * WORD  - structure size in bytes (includes size field)
    444  1.1  riastrad  * BYTE  - return value
    445  1.1  riastrad  */
    446  1.1  riastrad /* flags */
    447  1.1  riastrad #       define ATCS_ADVERTISE_CAPS                                 (1 << 0)
    448  1.1  riastrad #       define ATCS_WAIT_FOR_COMPLETION                            (1 << 1)
    449  1.1  riastrad /* request type */
    450  1.1  riastrad #       define ATCS_PCIE_LINK_SPEED                                1
    451  1.1  riastrad /* performance request */
    452  1.1  riastrad #       define ATCS_REMOVE                                         0
    453  1.1  riastrad #       define ATCS_FORCE_LOW_POWER                                1
    454  1.1  riastrad #       define ATCS_PERF_LEVEL_1                                   2 /* PCIE Gen 1 */
    455  1.1  riastrad #       define ATCS_PERF_LEVEL_2                                   3 /* PCIE Gen 2 */
    456  1.1  riastrad #       define ATCS_PERF_LEVEL_3                                   4 /* PCIE Gen 3 */
    457  1.1  riastrad /* return value */
    458  1.1  riastrad #       define ATCS_REQUEST_REFUSED                                1
    459  1.1  riastrad #       define ATCS_REQUEST_COMPLETE                               2
    460  1.1  riastrad #       define ATCS_REQUEST_IN_PROGRESS                            3
    461  1.1  riastrad #define ATCS_FUNCTION_PCIE_DEVICE_READY_NOTIFICATION               0x3
    462  1.1  riastrad /* ARG0: ATCS_FUNCTION_PCIE_DEVICE_READY_NOTIFICATION
    463  1.1  riastrad  * ARG1: none
    464  1.1  riastrad  * OUTPUT: none
    465  1.1  riastrad  */
    466  1.1  riastrad #define ATCS_FUNCTION_SET_PCIE_BUS_WIDTH                           0x4
    467  1.1  riastrad /* ARG0: ATCS_FUNCTION_SET_PCIE_BUS_WIDTH
    468  1.1  riastrad  * ARG1:
    469  1.1  riastrad  * WORD  - structure size in bytes (includes size field)
    470  1.1  riastrad  * WORD  - client id (bit 2-0: func num, 7-3: dev num, 15-8: bus num)
    471  1.1  riastrad  * BYTE  - number of active lanes
    472  1.1  riastrad  * OUTPUT:
    473  1.1  riastrad  * WORD  - structure size in bytes (includes size field)
    474  1.1  riastrad  * BYTE  - number of active lanes
    475  1.1  riastrad  */
    476  1.1  riastrad 
    477  1.1  riastrad #endif
    478