2 * Copyright 2012 Advanced Micro Devices, Inc.
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:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
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.
28 struct acpi_bus_event;
30 int radeon_atif_handler(struct radeon_device *rdev,
31 struct acpi_bus_event *event);
33 /* AMD hw uses four ACPI control methods:
35 * ARG0: (ACPI_INTEGER) function code
36 * ARG1: (ACPI_BUFFER) parameter buffer, 256 bytes
37 * OUTPUT: (ACPI_BUFFER) output buffer, 256 bytes
38 * ATIF provides an entry point for the gfx driver to interact with the sbios.
39 * The AMD ACPI notification mechanism uses Notify (VGA, 0x81) or a custom
40 * notification. Which notification is used as indicated by the ATIF Control
41 * Method GET_SYSTEM_PARAMETERS. When the driver receives Notify (VGA, 0x81) or
42 * a custom notification it invokes ATIF Control Method GET_SYSTEM_BIOS_REQUESTS
43 * to identify pending System BIOS requests and associated parameters. For
44 * example, if one of the pending requests is DISPLAY_SWITCH_REQUEST, the driver
45 * will perform display device detection and invoke ATIF Control Method
46 * SELECT_ACTIVE_DISPLAYS.
49 * ARG0: (ACPI_INTEGER) function code
50 * ARG1: (ACPI_BUFFER) parameter buffer, 256 bytes
51 * OUTPUT: (ACPI_BUFFER) output buffer, 256 bytes
52 * ATPX methods are used on PowerXpress systems to handle mux switching and
53 * discrete GPU power control.
56 * ARG0: (ACPI_INTEGER) offset of vbios rom data
57 * ARG1: (ACPI_BUFFER) size of the buffer to fill (up to 4K).
58 * OUTPUT: (ACPI_BUFFER) output buffer
59 * ATRM provides an interfacess to access the discrete GPU vbios image on
60 * PowerXpress systems with multiple GPUs.
63 * ARG0: (ACPI_INTEGER) function code
64 * ARG1: (ACPI_BUFFER) parameter buffer, 256 bytes
65 * OUTPUT: (ACPI_BUFFER) output buffer, 256 bytes
66 * ATCS provides an interface to AMD chipset specific functionality.
70 #define ATIF_FUNCTION_VERIFY_INTERFACE 0x0
71 /* ARG0: ATIF_FUNCTION_VERIFY_INTERFACE
74 * WORD - structure size in bytes (includes size field)
76 * DWORD - supported notifications mask
77 * DWORD - supported functions bit vector
79 /* Notifications mask */
80 # define ATIF_DISPLAY_SWITCH_REQUEST_SUPPORTED (1 << 0)
81 # define ATIF_EXPANSION_MODE_CHANGE_REQUEST_SUPPORTED (1 << 1)
82 # define ATIF_THERMAL_STATE_CHANGE_REQUEST_SUPPORTED (1 << 2)
83 # define ATIF_FORCED_POWER_STATE_CHANGE_REQUEST_SUPPORTED (1 << 3)
84 # define ATIF_SYSTEM_POWER_SOURCE_CHANGE_REQUEST_SUPPORTED (1 << 4)
85 # define ATIF_DISPLAY_CONF_CHANGE_REQUEST_SUPPORTED (1 << 5)
86 # define ATIF_PX_GFX_SWITCH_REQUEST_SUPPORTED (1 << 6)
87 # define ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST_SUPPORTED (1 << 7)
88 # define ATIF_DGPU_DISPLAY_EVENT_SUPPORTED (1 << 8)
89 /* supported functions vector */
90 # define ATIF_GET_SYSTEM_PARAMETERS_SUPPORTED (1 << 0)
91 # define ATIF_GET_SYSTEM_BIOS_REQUESTS_SUPPORTED (1 << 1)
92 # define ATIF_SELECT_ACTIVE_DISPLAYS_SUPPORTED (1 << 2)
93 # define ATIF_GET_LID_STATE_SUPPORTED (1 << 3)
94 # define ATIF_GET_TV_STANDARD_FROM_CMOS_SUPPORTED (1 << 4)
95 # define ATIF_SET_TV_STANDARD_IN_CMOS_SUPPORTED (1 << 5)
96 # define ATIF_GET_PANEL_EXPANSION_MODE_FROM_CMOS_SUPPORTED (1 << 6)
97 # define ATIF_SET_PANEL_EXPANSION_MODE_IN_CMOS_SUPPORTED (1 << 7)
98 # define ATIF_TEMPERATURE_CHANGE_NOTIFICATION_SUPPORTED (1 << 12)
99 # define ATIF_GET_GRAPHICS_DEVICE_TYPES_SUPPORTED (1 << 14)
100 #define ATIF_FUNCTION_GET_SYSTEM_PARAMETERS 0x1
101 /* ARG0: ATIF_FUNCTION_GET_SYSTEM_PARAMETERS
104 * WORD - structure size in bytes (includes size field)
105 * DWORD - valid flags mask
110 * WORD - structure size in bytes (includes size field)
111 * DWORD - valid flags mask
113 * BYTE - notify command code
117 * 0 - Notify(VGA, 0x81) is not used for notification
118 * 1 - Notify(VGA, 0x81) is used for notification
119 * 2 - Notify(VGA, n) is used for notification where
120 * n (0xd0-0xd9) is specified in notify command code.
122 * 1 - lid changes not reported though int10
124 #define ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS 0x2
125 /* ARG0: ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS
128 * WORD - structure size in bytes (includes size field)
129 * DWORD - pending sbios requests
130 * BYTE - panel expansion mode
131 * BYTE - thermal state: target gfx controller
132 * BYTE - thermal state: state id (0: exit state, non-0: state)
133 * BYTE - forced power state: target gfx controller
134 * BYTE - forced power state: state id
135 * BYTE - system power source
136 * BYTE - panel backlight level (0-255)
138 /* pending sbios requests */
139 # define ATIF_DISPLAY_SWITCH_REQUEST (1 << 0)
140 # define ATIF_EXPANSION_MODE_CHANGE_REQUEST (1 << 1)
141 # define ATIF_THERMAL_STATE_CHANGE_REQUEST (1 << 2)
142 # define ATIF_FORCED_POWER_STATE_CHANGE_REQUEST (1 << 3)
143 # define ATIF_SYSTEM_POWER_SOURCE_CHANGE_REQUEST (1 << 4)
144 # define ATIF_DISPLAY_CONF_CHANGE_REQUEST (1 << 5)
145 # define ATIF_PX_GFX_SWITCH_REQUEST (1 << 6)
146 # define ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST (1 << 7)
147 # define ATIF_DGPU_DISPLAY_EVENT (1 << 8)
148 /* panel expansion mode */
149 # define ATIF_PANEL_EXPANSION_DISABLE 0
150 # define ATIF_PANEL_EXPANSION_FULL 1
151 # define ATIF_PANEL_EXPANSION_ASPECT 2
152 /* target gfx controller */
153 # define ATIF_TARGET_GFX_SINGLE 0
154 # define ATIF_TARGET_GFX_PX_IGPU 1
155 # define ATIF_TARGET_GFX_PX_DGPU 2
156 /* system power source */
157 # define ATIF_POWER_SOURCE_AC 1
158 # define ATIF_POWER_SOURCE_DC 2
159 # define ATIF_POWER_SOURCE_RESTRICTED_AC_1 3
160 # define ATIF_POWER_SOURCE_RESTRICTED_AC_2 4
161 #define ATIF_FUNCTION_SELECT_ACTIVE_DISPLAYS 0x3
162 /* ARG0: ATIF_FUNCTION_SELECT_ACTIVE_DISPLAYS
164 * WORD - structure size in bytes (includes size field)
165 * WORD - selected displays
166 * WORD - connected displays
168 * WORD - structure size in bytes (includes size field)
169 * WORD - selected displays
171 # define ATIF_LCD1 (1 << 0)
172 # define ATIF_CRT1 (1 << 1)
173 # define ATIF_TV (1 << 2)
174 # define ATIF_DFP1 (1 << 3)
175 # define ATIF_CRT2 (1 << 4)
176 # define ATIF_LCD2 (1 << 5)
177 # define ATIF_DFP2 (1 << 7)
178 # define ATIF_CV (1 << 8)
179 # define ATIF_DFP3 (1 << 9)
180 # define ATIF_DFP4 (1 << 10)
181 # define ATIF_DFP5 (1 << 11)
182 # define ATIF_DFP6 (1 << 12)
183 #define ATIF_FUNCTION_GET_LID_STATE 0x4
184 /* ARG0: ATIF_FUNCTION_GET_LID_STATE
187 * WORD - structure size in bytes (includes size field)
188 * BYTE - lid state (0: open, 1: closed)
190 * GET_LID_STATE only works at boot and resume, for general lid
191 * status, use the kernel provided status
193 #define ATIF_FUNCTION_GET_TV_STANDARD_FROM_CMOS 0x5
194 /* ARG0: ATIF_FUNCTION_GET_TV_STANDARD_FROM_CMOS
197 * WORD - structure size in bytes (includes size field)
201 # define ATIF_TV_STD_NTSC 0
202 # define ATIF_TV_STD_PAL 1
203 # define ATIF_TV_STD_PALM 2
204 # define ATIF_TV_STD_PAL60 3
205 # define ATIF_TV_STD_NTSCJ 4
206 # define ATIF_TV_STD_PALCN 5
207 # define ATIF_TV_STD_PALN 6
208 # define ATIF_TV_STD_SCART_RGB 9
209 #define ATIF_FUNCTION_SET_TV_STANDARD_IN_CMOS 0x6
210 /* ARG0: ATIF_FUNCTION_SET_TV_STANDARD_IN_CMOS
212 * WORD - structure size in bytes (includes size field)
217 #define ATIF_FUNCTION_GET_PANEL_EXPANSION_MODE_FROM_CMOS 0x7
218 /* ARG0: ATIF_FUNCTION_GET_PANEL_EXPANSION_MODE_FROM_CMOS
221 * WORD - structure size in bytes (includes size field)
222 * BYTE - panel expansion mode
224 #define ATIF_FUNCTION_SET_PANEL_EXPANSION_MODE_IN_CMOS 0x8
225 /* ARG0: ATIF_FUNCTION_SET_PANEL_EXPANSION_MODE_IN_CMOS
227 * WORD - structure size in bytes (includes size field)
228 * BYTE - panel expansion mode
231 #define ATIF_FUNCTION_TEMPERATURE_CHANGE_NOTIFICATION 0xD
232 /* ARG0: ATIF_FUNCTION_TEMPERATURE_CHANGE_NOTIFICATION
234 * WORD - structure size in bytes (includes size field)
235 * WORD - gfx controller id
236 * BYTE - current temperature (degress Celsius)
239 #define ATIF_FUNCTION_GET_GRAPHICS_DEVICE_TYPES 0xF
240 /* ARG0: ATIF_FUNCTION_GET_GRAPHICS_DEVICE_TYPES
243 * WORD - number of gfx devices
244 * WORD - device structure size in bytes (excludes device size field)
246 * WORD - bus number } repeated structure
247 * WORD - device number /
250 # define ATIF_PX_REMOVABLE_GRAPHICS_DEVICE (1 << 0)
251 # define ATIF_XGP_PORT (1 << 1)
252 # define ATIF_VGA_ENABLED_GRAPHICS_DEVICE (1 << 2)
253 # define ATIF_XGP_PORT_IN_DOCK (1 << 3)
256 #define ATPX_FUNCTION_VERIFY_INTERFACE 0x0
257 /* ARG0: ATPX_FUNCTION_VERIFY_INTERFACE
260 * WORD - structure size in bytes (includes size field)
262 * DWORD - supported functions bit vector
264 /* supported functions vector */
265 # define ATPX_GET_PX_PARAMETERS_SUPPORTED (1 << 0)
266 # define ATPX_POWER_CONTROL_SUPPORTED (1 << 1)
267 # define ATPX_DISPLAY_MUX_CONTROL_SUPPORTED (1 << 2)
268 # define ATPX_I2C_MUX_CONTROL_SUPPORTED (1 << 3)
269 # define ATPX_GRAPHICS_DEVICE_SWITCH_START_NOTIFICATION_SUPPORTED (1 << 4)
270 # define ATPX_GRAPHICS_DEVICE_SWITCH_END_NOTIFICATION_SUPPORTED (1 << 5)
271 # define ATPX_GET_DISPLAY_CONNECTORS_MAPPING_SUPPORTED (1 << 7)
272 # define ATPX_GET_DISPLAY_DETECTION_PORTS_SUPPORTED (1 << 8)
273 #define ATPX_FUNCTION_GET_PX_PARAMETERS 0x1
274 /* ARG0: ATPX_FUNCTION_GET_PX_PARAMETERS
277 * WORD - structure size in bytes (includes size field)
278 * DWORD - valid flags mask
282 # define ATPX_LVDS_I2C_AVAILABLE_TO_BOTH_GPUS (1 << 0)
283 # define ATPX_CRT1_I2C_AVAILABLE_TO_BOTH_GPUS (1 << 1)
284 # define ATPX_DVI1_I2C_AVAILABLE_TO_BOTH_GPUS (1 << 2)
285 # define ATPX_CRT1_RGB_SIGNAL_MUXED (1 << 3)
286 # define ATPX_TV_SIGNAL_MUXED (1 << 4)
287 # define ATPX_DFP_SIGNAL_MUXED (1 << 5)
288 # define ATPX_SEPARATE_MUX_FOR_I2C (1 << 6)
289 # define ATPX_DYNAMIC_PX_SUPPORTED (1 << 7)
290 # define ATPX_ACF_NOT_SUPPORTED (1 << 8)
291 # define ATPX_FIXED_NOT_SUPPORTED (1 << 9)
292 # define ATPX_DYNAMIC_DGPU_POWER_OFF_SUPPORTED (1 << 10)
293 # define ATPX_DGPU_REQ_POWER_FOR_DISPLAYS (1 << 11)
294 #define ATPX_FUNCTION_POWER_CONTROL 0x2
295 /* ARG0: ATPX_FUNCTION_POWER_CONTROL
297 * WORD - structure size in bytes (includes size field)
298 * BYTE - dGPU power state (0: power off, 1: power on)
301 #define ATPX_FUNCTION_DISPLAY_MUX_CONTROL 0x3
302 /* ARG0: ATPX_FUNCTION_DISPLAY_MUX_CONTROL
304 * WORD - structure size in bytes (includes size field)
305 * WORD - display mux control (0: iGPU, 1: dGPU)
308 # define ATPX_INTEGRATED_GPU 0
309 # define ATPX_DISCRETE_GPU 1
310 #define ATPX_FUNCTION_I2C_MUX_CONTROL 0x4
311 /* ARG0: ATPX_FUNCTION_I2C_MUX_CONTROL
313 * WORD - structure size in bytes (includes size field)
314 * WORD - i2c/aux/hpd mux control (0: iGPU, 1: dGPU)
317 #define ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_START_NOTIFICATION 0x5
318 /* ARG0: ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_START_NOTIFICATION
320 * WORD - structure size in bytes (includes size field)
321 * WORD - target gpu (0: iGPU, 1: dGPU)
324 #define ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_END_NOTIFICATION 0x6
325 /* ARG0: ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_END_NOTIFICATION
327 * WORD - structure size in bytes (includes size field)
328 * WORD - target gpu (0: iGPU, 1: dGPU)
331 #define ATPX_FUNCTION_GET_DISPLAY_CONNECTORS_MAPPING 0x8
332 /* ARG0: ATPX_FUNCTION_GET_DISPLAY_CONNECTORS_MAPPING
335 * WORD - number of display connectors
336 * WORD - connector structure size in bytes (excludes connector size field)
338 * BYTE - ATIF display vector bit position } repeated
339 * BYTE - adapter id (0: iGPU, 1-n: dGPU ordered by pcie bus number) } structure
340 * WORD - connector ACPI id /
343 # define ATPX_DISPLAY_OUTPUT_SUPPORTED_BY_ADAPTER_ID_DEVICE (1 << 0)
344 # define ATPX_DISPLAY_HPD_SUPPORTED_BY_ADAPTER_ID_DEVICE (1 << 1)
345 # define ATPX_DISPLAY_I2C_SUPPORTED_BY_ADAPTER_ID_DEVICE (1 << 2)
346 #define ATPX_FUNCTION_GET_DISPLAY_DETECTION_PORTS 0x9
347 /* ARG0: ATPX_FUNCTION_GET_DISPLAY_DETECTION_PORTS
350 * WORD - number of HPD/DDC ports
351 * WORD - port structure size in bytes (excludes port size field)
352 * BYTE - ATIF display vector bit position \
353 * BYTE - hpd id } reapeated structure
356 * available on A+A systems only
359 # define ATPX_HPD_NONE 0
367 # define ATPX_DDC_NONE 0
378 #define ATCS_FUNCTION_VERIFY_INTERFACE 0x0
379 /* ARG0: ATCS_FUNCTION_VERIFY_INTERFACE
382 * WORD - structure size in bytes (includes size field)
384 * DWORD - supported functions bit vector
386 /* supported functions vector */
387 # define ATCS_GET_EXTERNAL_STATE_SUPPORTED (1 << 0)
388 # define ATCS_PCIE_PERFORMANCE_REQUEST_SUPPORTED (1 << 1)
389 # define ATCS_PCIE_DEVICE_READY_NOTIFICATION_SUPPORTED (1 << 2)
390 # define ATCS_SET_PCIE_BUS_WIDTH_SUPPORTED (1 << 3)
391 #define ATCS_FUNCTION_GET_EXTERNAL_STATE 0x1
392 /* ARG0: ATCS_FUNCTION_GET_EXTERNAL_STATE
395 * WORD - structure size in bytes (includes size field)
396 * DWORD - valid flags mask
397 * DWORD - flags (0: undocked, 1: docked)
400 # define ATCS_DOCKED (1 << 0)
401 #define ATCS_FUNCTION_PCIE_PERFORMANCE_REQUEST 0x2
402 /* ARG0: ATCS_FUNCTION_PCIE_PERFORMANCE_REQUEST
404 * WORD - structure size in bytes (includes size field)
405 * WORD - client id (bit 2-0: func num, 7-3: dev num, 15-8: bus num)
406 * WORD - valid flags mask
408 * BYTE - request type
409 * BYTE - performance request
411 * WORD - structure size in bytes (includes size field)
412 * BYTE - return value
415 # define ATCS_ADVERTISE_CAPS (1 << 0)
416 # define ATCS_WAIT_FOR_COMPLETION (1 << 1)
418 # define ATCS_PCIE_LINK_SPEED 1
419 /* performance request */
420 # define ATCS_REMOVE 0
421 # define ATCS_FORCE_LOW_POWER 1
422 # define ATCS_PERF_LEVEL_1 2 /* PCIE Gen 1 */
423 # define ATCS_PERF_LEVEL_2 3 /* PCIE Gen 2 */
424 # define ATCS_PERF_LEVEL_3 4 /* PCIE Gen 3 */
426 # define ATCS_REQUEST_REFUSED 1
427 # define ATCS_REQUEST_COMPLETE 2
428 # define ATCS_REQUEST_IN_PROGRESS 3
429 #define ATCS_FUNCTION_PCIE_DEVICE_READY_NOTIFICATION 0x3
430 /* ARG0: ATCS_FUNCTION_PCIE_DEVICE_READY_NOTIFICATION
434 #define ATCS_FUNCTION_SET_PCIE_BUS_WIDTH 0x4
435 /* ARG0: ATCS_FUNCTION_SET_PCIE_BUS_WIDTH
437 * WORD - structure size in bytes (includes size field)
438 * WORD - client id (bit 2-0: func num, 7-3: dev num, 15-8: bus num)
439 * BYTE - number of active lanes
441 * WORD - structure size in bytes (includes size field)
442 * BYTE - number of active lanes