radeon_acpi.h revision 285830
1/* 2 * Copyright 2012 Advanced Micro Devices, Inc. 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice shall be included in 12 * all copies or substantial portions of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 * OTHER DEALINGS IN THE SOFTWARE. 21 * 22 */ 23 24#include <sys/cdefs.h> 25__FBSDID("$FreeBSD: releng/10.2/sys/dev/drm2/radeon/radeon_acpi.h 254885 2013-08-25 19:37:15Z dumbbell $"); 26 27#ifndef RADEON_ACPI_H 28#define RADEON_ACPI_H 29 30struct radeon_device; 31 32void radeon_atif_handler(struct radeon_device *rdev, UINT32 type); 33 34/* AMD hw uses four ACPI control methods: 35 * 1. ATIF 36 * ARG0: (ACPI_INTEGER) function code 37 * ARG1: (ACPI_BUFFER) parameter buffer, 256 bytes 38 * OUTPUT: (ACPI_BUFFER) output buffer, 256 bytes 39 * ATIF provides an entry point for the gfx driver to interact with the sbios. 40 * The AMD ACPI notification mechanism uses Notify (VGA, 0x81) or a custom 41 * notification. Which notification is used as indicated by the ATIF Control 42 * Method GET_SYSTEM_PARAMETERS. When the driver receives Notify (VGA, 0x81) or 43 * a custom notification it invokes ATIF Control Method GET_SYSTEM_BIOS_REQUESTS 44 * to identify pending System BIOS requests and associated parameters. For 45 * example, if one of the pending requests is DISPLAY_SWITCH_REQUEST, the driver 46 * will perform display device detection and invoke ATIF Control Method 47 * SELECT_ACTIVE_DISPLAYS. 48 * 49 * 2. ATPX 50 * ARG0: (ACPI_INTEGER) function code 51 * ARG1: (ACPI_BUFFER) parameter buffer, 256 bytes 52 * OUTPUT: (ACPI_BUFFER) output buffer, 256 bytes 53 * ATPX methods are used on PowerXpress systems to handle mux switching and 54 * discrete GPU power control. 55 * 56 * 3. ATRM 57 * ARG0: (ACPI_INTEGER) offset of vbios rom data 58 * ARG1: (ACPI_BUFFER) size of the buffer to fill (up to 4K). 59 * OUTPUT: (ACPI_BUFFER) output buffer 60 * ATRM provides an interfacess to access the discrete GPU vbios image on 61 * PowerXpress systems with multiple GPUs. 62 * 63 * 4. ATCS 64 * ARG0: (ACPI_INTEGER) function code 65 * ARG1: (ACPI_BUFFER) parameter buffer, 256 bytes 66 * OUTPUT: (ACPI_BUFFER) output buffer, 256 bytes 67 * ATCS provides an interface to AMD chipset specific functionality. 68 * 69 */ 70/* ATIF */ 71#define ATIF_FUNCTION_VERIFY_INTERFACE 0x0 72/* ARG0: ATIF_FUNCTION_VERIFY_INTERFACE 73 * ARG1: none 74 * OUTPUT: 75 * WORD - structure size in bytes (includes size field) 76 * WORD - version 77 * DWORD - supported notifications mask 78 * DWORD - supported functions bit vector 79 */ 80/* Notifications mask */ 81# define ATIF_DISPLAY_SWITCH_REQUEST_SUPPORTED (1 << 0) 82# define ATIF_EXPANSION_MODE_CHANGE_REQUEST_SUPPORTED (1 << 1) 83# define ATIF_THERMAL_STATE_CHANGE_REQUEST_SUPPORTED (1 << 2) 84# define ATIF_FORCED_POWER_STATE_CHANGE_REQUEST_SUPPORTED (1 << 3) 85# define ATIF_SYSTEM_POWER_SOURCE_CHANGE_REQUEST_SUPPORTED (1 << 4) 86# define ATIF_DISPLAY_CONF_CHANGE_REQUEST_SUPPORTED (1 << 5) 87# define ATIF_PX_GFX_SWITCH_REQUEST_SUPPORTED (1 << 6) 88# define ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST_SUPPORTED (1 << 7) 89# define ATIF_DGPU_DISPLAY_EVENT_SUPPORTED (1 << 8) 90/* supported functions vector */ 91# define ATIF_GET_SYSTEM_PARAMETERS_SUPPORTED (1 << 0) 92# define ATIF_GET_SYSTEM_BIOS_REQUESTS_SUPPORTED (1 << 1) 93# define ATIF_SELECT_ACTIVE_DISPLAYS_SUPPORTED (1 << 2) 94# define ATIF_GET_LID_STATE_SUPPORTED (1 << 3) 95# define ATIF_GET_TV_STANDARD_FROM_CMOS_SUPPORTED (1 << 4) 96# define ATIF_SET_TV_STANDARD_IN_CMOS_SUPPORTED (1 << 5) 97# define ATIF_GET_PANEL_EXPANSION_MODE_FROM_CMOS_SUPPORTED (1 << 6) 98# define ATIF_SET_PANEL_EXPANSION_MODE_IN_CMOS_SUPPORTED (1 << 7) 99# define ATIF_TEMPERATURE_CHANGE_NOTIFICATION_SUPPORTED (1 << 12) 100# define ATIF_GET_GRAPHICS_DEVICE_TYPES_SUPPORTED (1 << 14) 101#define ATIF_FUNCTION_GET_SYSTEM_PARAMETERS 0x1 102/* ARG0: ATIF_FUNCTION_GET_SYSTEM_PARAMETERS 103 * ARG1: none 104 * OUTPUT: 105 * WORD - structure size in bytes (includes size field) 106 * DWORD - valid flags mask 107 * DWORD - flags 108 * 109 * OR 110 * 111 * WORD - structure size in bytes (includes size field) 112 * DWORD - valid flags mask 113 * DWORD - flags 114 * BYTE - notify command code 115 * 116 * flags 117 * bits 1:0: 118 * 0 - Notify(VGA, 0x81) is not used for notification 119 * 1 - Notify(VGA, 0x81) is used for notification 120 * 2 - Notify(VGA, n) is used for notification where 121 * n (0xd0-0xd9) is specified in notify command code. 122 * bit 2: 123 * 1 - lid changes not reported though int10 124 */ 125#define ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS 0x2 126/* ARG0: ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS 127 * ARG1: none 128 * OUTPUT: 129 * WORD - structure size in bytes (includes size field) 130 * DWORD - pending sbios requests 131 * BYTE - panel expansion mode 132 * BYTE - thermal state: target gfx controller 133 * BYTE - thermal state: state id (0: exit state, non-0: state) 134 * BYTE - forced power state: target gfx controller 135 * BYTE - forced power state: state id 136 * BYTE - system power source 137 * BYTE - panel backlight level (0-255) 138 */ 139/* pending sbios requests */ 140# define ATIF_DISPLAY_SWITCH_REQUEST (1 << 0) 141# define ATIF_EXPANSION_MODE_CHANGE_REQUEST (1 << 1) 142# define ATIF_THERMAL_STATE_CHANGE_REQUEST (1 << 2) 143# define ATIF_FORCED_POWER_STATE_CHANGE_REQUEST (1 << 3) 144# define ATIF_SYSTEM_POWER_SOURCE_CHANGE_REQUEST (1 << 4) 145# define ATIF_DISPLAY_CONF_CHANGE_REQUEST (1 << 5) 146# define ATIF_PX_GFX_SWITCH_REQUEST (1 << 6) 147# define ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST (1 << 7) 148# define ATIF_DGPU_DISPLAY_EVENT (1 << 8) 149/* panel expansion mode */ 150# define ATIF_PANEL_EXPANSION_DISABLE 0 151# define ATIF_PANEL_EXPANSION_FULL 1 152# define ATIF_PANEL_EXPANSION_ASPECT 2 153/* target gfx controller */ 154# define ATIF_TARGET_GFX_SINGLE 0 155# define ATIF_TARGET_GFX_PX_IGPU 1 156# define ATIF_TARGET_GFX_PX_DGPU 2 157/* system power source */ 158# define ATIF_POWER_SOURCE_AC 1 159# define ATIF_POWER_SOURCE_DC 2 160# define ATIF_POWER_SOURCE_RESTRICTED_AC_1 3 161# define ATIF_POWER_SOURCE_RESTRICTED_AC_2 4 162#define ATIF_FUNCTION_SELECT_ACTIVE_DISPLAYS 0x3 163/* ARG0: ATIF_FUNCTION_SELECT_ACTIVE_DISPLAYS 164 * ARG1: 165 * WORD - structure size in bytes (includes size field) 166 * WORD - selected displays 167 * WORD - connected displays 168 * OUTPUT: 169 * WORD - structure size in bytes (includes size field) 170 * WORD - selected displays 171 */ 172# define ATIF_LCD1 (1 << 0) 173# define ATIF_CRT1 (1 << 1) 174# define ATIF_TV (1 << 2) 175# define ATIF_DFP1 (1 << 3) 176# define ATIF_CRT2 (1 << 4) 177# define ATIF_LCD2 (1 << 5) 178# define ATIF_DFP2 (1 << 7) 179# define ATIF_CV (1 << 8) 180# define ATIF_DFP3 (1 << 9) 181# define ATIF_DFP4 (1 << 10) 182# define ATIF_DFP5 (1 << 11) 183# define ATIF_DFP6 (1 << 12) 184#define ATIF_FUNCTION_GET_LID_STATE 0x4 185/* ARG0: ATIF_FUNCTION_GET_LID_STATE 186 * ARG1: none 187 * OUTPUT: 188 * WORD - structure size in bytes (includes size field) 189 * BYTE - lid state (0: open, 1: closed) 190 * 191 * GET_LID_STATE only works at boot and resume, for general lid 192 * status, use the kernel provided status 193 */ 194#define ATIF_FUNCTION_GET_TV_STANDARD_FROM_CMOS 0x5 195/* ARG0: ATIF_FUNCTION_GET_TV_STANDARD_FROM_CMOS 196 * ARG1: none 197 * OUTPUT: 198 * WORD - structure size in bytes (includes size field) 199 * BYTE - 0 200 * BYTE - TV standard 201 */ 202# define ATIF_TV_STD_NTSC 0 203# define ATIF_TV_STD_PAL 1 204# define ATIF_TV_STD_PALM 2 205# define ATIF_TV_STD_PAL60 3 206# define ATIF_TV_STD_NTSCJ 4 207# define ATIF_TV_STD_PALCN 5 208# define ATIF_TV_STD_PALN 6 209# define ATIF_TV_STD_SCART_RGB 9 210#define ATIF_FUNCTION_SET_TV_STANDARD_IN_CMOS 0x6 211/* ARG0: ATIF_FUNCTION_SET_TV_STANDARD_IN_CMOS 212 * ARG1: 213 * WORD - structure size in bytes (includes size field) 214 * BYTE - 0 215 * BYTE - TV standard 216 * OUTPUT: none 217 */ 218#define ATIF_FUNCTION_GET_PANEL_EXPANSION_MODE_FROM_CMOS 0x7 219/* ARG0: ATIF_FUNCTION_GET_PANEL_EXPANSION_MODE_FROM_CMOS 220 * ARG1: none 221 * OUTPUT: 222 * WORD - structure size in bytes (includes size field) 223 * BYTE - panel expansion mode 224 */ 225#define ATIF_FUNCTION_SET_PANEL_EXPANSION_MODE_IN_CMOS 0x8 226/* ARG0: ATIF_FUNCTION_SET_PANEL_EXPANSION_MODE_IN_CMOS 227 * ARG1: 228 * WORD - structure size in bytes (includes size field) 229 * BYTE - panel expansion mode 230 * OUTPUT: none 231 */ 232#define ATIF_FUNCTION_TEMPERATURE_CHANGE_NOTIFICATION 0xD 233/* ARG0: ATIF_FUNCTION_TEMPERATURE_CHANGE_NOTIFICATION 234 * ARG1: 235 * WORD - structure size in bytes (includes size field) 236 * WORD - gfx controller id 237 * BYTE - current temperature (degress Celsius) 238 * OUTPUT: none 239 */ 240#define ATIF_FUNCTION_GET_GRAPHICS_DEVICE_TYPES 0xF 241/* ARG0: ATIF_FUNCTION_GET_GRAPHICS_DEVICE_TYPES 242 * ARG1: none 243 * OUTPUT: 244 * WORD - number of gfx devices 245 * WORD - device structure size in bytes (excludes device size field) 246 * DWORD - flags \ 247 * WORD - bus number } repeated structure 248 * WORD - device number / 249 */ 250/* flags */ 251# define ATIF_PX_REMOVABLE_GRAPHICS_DEVICE (1 << 0) 252# define ATIF_XGP_PORT (1 << 1) 253# define ATIF_VGA_ENABLED_GRAPHICS_DEVICE (1 << 2) 254# define ATIF_XGP_PORT_IN_DOCK (1 << 3) 255 256/* ATPX */ 257#define ATPX_FUNCTION_VERIFY_INTERFACE 0x0 258/* ARG0: ATPX_FUNCTION_VERIFY_INTERFACE 259 * ARG1: none 260 * OUTPUT: 261 * WORD - structure size in bytes (includes size field) 262 * WORD - version 263 * DWORD - supported functions bit vector 264 */ 265/* supported functions vector */ 266# define ATPX_GET_PX_PARAMETERS_SUPPORTED (1 << 0) 267# define ATPX_POWER_CONTROL_SUPPORTED (1 << 1) 268# define ATPX_DISPLAY_MUX_CONTROL_SUPPORTED (1 << 2) 269# define ATPX_I2C_MUX_CONTROL_SUPPORTED (1 << 3) 270# define ATPX_GRAPHICS_DEVICE_SWITCH_START_NOTIFICATION_SUPPORTED (1 << 4) 271# define ATPX_GRAPHICS_DEVICE_SWITCH_END_NOTIFICATION_SUPPORTED (1 << 5) 272# define ATPX_GET_DISPLAY_CONNECTORS_MAPPING_SUPPORTED (1 << 7) 273# define ATPX_GET_DISPLAY_DETECTION_PORTS_SUPPORTED (1 << 8) 274#define ATPX_FUNCTION_GET_PX_PARAMETERS 0x1 275/* ARG0: ATPX_FUNCTION_GET_PX_PARAMETERS 276 * ARG1: none 277 * OUTPUT: 278 * WORD - structure size in bytes (includes size field) 279 * DWORD - valid flags mask 280 * DWORD - flags 281 */ 282/* flags */ 283# define ATPX_LVDS_I2C_AVAILABLE_TO_BOTH_GPUS (1 << 0) 284# define ATPX_CRT1_I2C_AVAILABLE_TO_BOTH_GPUS (1 << 1) 285# define ATPX_DVI1_I2C_AVAILABLE_TO_BOTH_GPUS (1 << 2) 286# define ATPX_CRT1_RGB_SIGNAL_MUXED (1 << 3) 287# define ATPX_TV_SIGNAL_MUXED (1 << 4) 288# define ATPX_DFP_SIGNAL_MUXED (1 << 5) 289# define ATPX_SEPARATE_MUX_FOR_I2C (1 << 6) 290# define ATPX_DYNAMIC_PX_SUPPORTED (1 << 7) 291# define ATPX_ACF_NOT_SUPPORTED (1 << 8) 292# define ATPX_FIXED_NOT_SUPPORTED (1 << 9) 293# define ATPX_DYNAMIC_DGPU_POWER_OFF_SUPPORTED (1 << 10) 294# define ATPX_DGPU_REQ_POWER_FOR_DISPLAYS (1 << 11) 295#define ATPX_FUNCTION_POWER_CONTROL 0x2 296/* ARG0: ATPX_FUNCTION_POWER_CONTROL 297 * ARG1: 298 * WORD - structure size in bytes (includes size field) 299 * BYTE - dGPU power state (0: power off, 1: power on) 300 * OUTPUT: none 301 */ 302#define ATPX_FUNCTION_DISPLAY_MUX_CONTROL 0x3 303/* ARG0: ATPX_FUNCTION_DISPLAY_MUX_CONTROL 304 * ARG1: 305 * WORD - structure size in bytes (includes size field) 306 * WORD - display mux control (0: iGPU, 1: dGPU) 307 * OUTPUT: none 308 */ 309# define ATPX_INTEGRATED_GPU 0 310# define ATPX_DISCRETE_GPU 1 311#define ATPX_FUNCTION_I2C_MUX_CONTROL 0x4 312/* ARG0: ATPX_FUNCTION_I2C_MUX_CONTROL 313 * ARG1: 314 * WORD - structure size in bytes (includes size field) 315 * WORD - i2c/aux/hpd mux control (0: iGPU, 1: dGPU) 316 * OUTPUT: none 317 */ 318#define ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_START_NOTIFICATION 0x5 319/* ARG0: ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_START_NOTIFICATION 320 * ARG1: 321 * WORD - structure size in bytes (includes size field) 322 * WORD - target gpu (0: iGPU, 1: dGPU) 323 * OUTPUT: none 324 */ 325#define ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_END_NOTIFICATION 0x6 326/* ARG0: ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_END_NOTIFICATION 327 * ARG1: 328 * WORD - structure size in bytes (includes size field) 329 * WORD - target gpu (0: iGPU, 1: dGPU) 330 * OUTPUT: none 331 */ 332#define ATPX_FUNCTION_GET_DISPLAY_CONNECTORS_MAPPING 0x8 333/* ARG0: ATPX_FUNCTION_GET_DISPLAY_CONNECTORS_MAPPING 334 * ARG1: none 335 * OUTPUT: 336 * WORD - number of display connectors 337 * WORD - connector structure size in bytes (excludes connector size field) 338 * BYTE - flags \ 339 * BYTE - ATIF display vector bit position } repeated 340 * BYTE - adapter id (0: iGPU, 1-n: dGPU ordered by pcie bus number) } structure 341 * WORD - connector ACPI id / 342 */ 343/* flags */ 344# define ATPX_DISPLAY_OUTPUT_SUPPORTED_BY_ADAPTER_ID_DEVICE (1 << 0) 345# define ATPX_DISPLAY_HPD_SUPPORTED_BY_ADAPTER_ID_DEVICE (1 << 1) 346# define ATPX_DISPLAY_I2C_SUPPORTED_BY_ADAPTER_ID_DEVICE (1 << 2) 347#define ATPX_FUNCTION_GET_DISPLAY_DETECTION_PORTS 0x9 348/* ARG0: ATPX_FUNCTION_GET_DISPLAY_DETECTION_PORTS 349 * ARG1: none 350 * OUTPUT: 351 * WORD - number of HPD/DDC ports 352 * WORD - port structure size in bytes (excludes port size field) 353 * BYTE - ATIF display vector bit position \ 354 * BYTE - hpd id } reapeated structure 355 * BYTE - ddc id / 356 * 357 * available on A+A systems only 358 */ 359/* hpd id */ 360# define ATPX_HPD_NONE 0 361# define ATPX_HPD1 1 362# define ATPX_HPD2 2 363# define ATPX_HPD3 3 364# define ATPX_HPD4 4 365# define ATPX_HPD5 5 366# define ATPX_HPD6 6 367/* ddc id */ 368# define ATPX_DDC_NONE 0 369# define ATPX_DDC1 1 370# define ATPX_DDC2 2 371# define ATPX_DDC3 3 372# define ATPX_DDC4 4 373# define ATPX_DDC5 5 374# define ATPX_DDC6 6 375# define ATPX_DDC7 7 376# define ATPX_DDC8 8 377 378/* ATCS */ 379#define ATCS_FUNCTION_VERIFY_INTERFACE 0x0 380/* ARG0: ATCS_FUNCTION_VERIFY_INTERFACE 381 * ARG1: none 382 * OUTPUT: 383 * WORD - structure size in bytes (includes size field) 384 * WORD - version 385 * DWORD - supported functions bit vector 386 */ 387/* supported functions vector */ 388# define ATCS_GET_EXTERNAL_STATE_SUPPORTED (1 << 0) 389# define ATCS_PCIE_PERFORMANCE_REQUEST_SUPPORTED (1 << 1) 390# define ATCS_PCIE_DEVICE_READY_NOTIFICATION_SUPPORTED (1 << 2) 391# define ATCS_SET_PCIE_BUS_WIDTH_SUPPORTED (1 << 3) 392#define ATCS_FUNCTION_GET_EXTERNAL_STATE 0x1 393/* ARG0: ATCS_FUNCTION_GET_EXTERNAL_STATE 394 * ARG1: none 395 * OUTPUT: 396 * WORD - structure size in bytes (includes size field) 397 * DWORD - valid flags mask 398 * DWORD - flags (0: undocked, 1: docked) 399 */ 400/* flags */ 401# define ATCS_DOCKED (1 << 0) 402#define ATCS_FUNCTION_PCIE_PERFORMANCE_REQUEST 0x2 403/* ARG0: ATCS_FUNCTION_PCIE_PERFORMANCE_REQUEST 404 * ARG1: 405 * WORD - structure size in bytes (includes size field) 406 * WORD - client id (bit 2-0: func num, 7-3: dev num, 15-8: bus num) 407 * WORD - valid flags mask 408 * WORD - flags 409 * BYTE - request type 410 * BYTE - performance request 411 * OUTPUT: 412 * WORD - structure size in bytes (includes size field) 413 * BYTE - return value 414 */ 415/* flags */ 416# define ATCS_ADVERTISE_CAPS (1 << 0) 417# define ATCS_WAIT_FOR_COMPLETION (1 << 1) 418/* request type */ 419# define ATCS_PCIE_LINK_SPEED 1 420/* performance request */ 421# define ATCS_REMOVE 0 422# define ATCS_FORCE_LOW_POWER 1 423# define ATCS_PERF_LEVEL_1 2 /* PCIE Gen 1 */ 424# define ATCS_PERF_LEVEL_2 3 /* PCIE Gen 2 */ 425# define ATCS_PERF_LEVEL_3 4 /* PCIE Gen 3 */ 426/* return value */ 427# define ATCS_REQUEST_REFUSED 1 428# define ATCS_REQUEST_COMPLETE 2 429# define ATCS_REQUEST_IN_PROGRESS 3 430#define ATCS_FUNCTION_PCIE_DEVICE_READY_NOTIFICATION 0x3 431/* ARG0: ATCS_FUNCTION_PCIE_DEVICE_READY_NOTIFICATION 432 * ARG1: none 433 * OUTPUT: none 434 */ 435#define ATCS_FUNCTION_SET_PCIE_BUS_WIDTH 0x4 436/* ARG0: ATCS_FUNCTION_SET_PCIE_BUS_WIDTH 437 * ARG1: 438 * WORD - structure size in bytes (includes size field) 439 * WORD - client id (bit 2-0: func num, 7-3: dev num, 15-8: bus num) 440 * BYTE - number of active lanes 441 * OUTPUT: 442 * WORD - structure size in bytes (includes size field) 443 * BYTE - number of active lanes 444 */ 445 446#endif 447