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 /* AMD hw uses four ACPI control methods:
32 * ARG0: (ACPI_INTEGER) function code
33 * ARG1: (ACPI_BUFFER) parameter buffer, 256 bytes
34 * OUTPUT: (ACPI_BUFFER) output buffer, 256 bytes
35 * ATIF provides an entry point for the gfx driver to interact with the sbios.
36 * The AMD ACPI notification mechanism uses Notify (VGA, 0x81) or a custom
37 * notification. Which notification is used as indicated by the ATIF Control
38 * Method GET_SYSTEM_PARAMETERS. When the driver receives Notify (VGA, 0x81) or
39 * a custom notification it invokes ATIF Control Method GET_SYSTEM_BIOS_REQUESTS
40 * to identify pending System BIOS requests and associated parameters. For
41 * example, if one of the pending requests is DISPLAY_SWITCH_REQUEST, the driver
42 * will perform display device detection and invoke ATIF Control Method
43 * SELECT_ACTIVE_DISPLAYS.
46 * ARG0: (ACPI_INTEGER) function code
47 * ARG1: (ACPI_BUFFER) parameter buffer, 256 bytes
48 * OUTPUT: (ACPI_BUFFER) output buffer, 256 bytes
49 * ATPX methods are used on PowerXpress systems to handle mux switching and
50 * discrete GPU power control.
53 * ARG0: (ACPI_INTEGER) offset of vbios rom data
54 * ARG1: (ACPI_BUFFER) size of the buffer to fill (up to 4K).
55 * OUTPUT: (ACPI_BUFFER) output buffer
56 * ATRM provides an interfacess to access the discrete GPU vbios image on
57 * PowerXpress systems with multiple GPUs.
60 * ARG0: (ACPI_INTEGER) function code
61 * ARG1: (ACPI_BUFFER) parameter buffer, 256 bytes
62 * OUTPUT: (ACPI_BUFFER) output buffer, 256 bytes
63 * ATCS provides an interface to AMD chipset specific functionality.
67 #define ATIF_FUNCTION_VERIFY_INTERFACE 0x0
68 /* ARG0: ATIF_FUNCTION_VERIFY_INTERFACE
71 * WORD - structure size in bytes (includes size field)
73 * DWORD - supported notifications mask
74 * DWORD - supported functions bit vector
76 /* Notifications mask */
77 # define ATIF_DISPLAY_SWITCH_REQUEST_SUPPORTED (1 << 0)
78 # define ATIF_EXPANSION_MODE_CHANGE_REQUEST_SUPPORTED (1 << 1)
79 # define ATIF_THERMAL_STATE_CHANGE_REQUEST_SUPPORTED (1 << 2)
80 # define ATIF_FORCED_POWER_STATE_CHANGE_REQUEST_SUPPORTED (1 << 3)
81 # define ATIF_SYSTEM_POWER_SOURCE_CHANGE_REQUEST_SUPPORTED (1 << 4)
82 # define ATIF_DISPLAY_CONF_CHANGE_REQUEST_SUPPORTED (1 << 5)
83 # define ATIF_PX_GFX_SWITCH_REQUEST_SUPPORTED (1 << 6)
84 # define ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST_SUPPORTED (1 << 7)
85 # define ATIF_DGPU_DISPLAY_EVENT_SUPPORTED (1 << 8)
86 /* supported functions vector */
87 # define ATIF_GET_SYSTEM_PARAMETERS_SUPPORTED (1 << 0)
88 # define ATIF_GET_SYSTEM_BIOS_REQUESTS_SUPPORTED (1 << 1)
89 # define ATIF_SELECT_ACTIVE_DISPLAYS_SUPPORTED (1 << 2)
90 # define ATIF_GET_LID_STATE_SUPPORTED (1 << 3)
91 # define ATIF_GET_TV_STANDARD_FROM_CMOS_SUPPORTED (1 << 4)
92 # define ATIF_SET_TV_STANDARD_IN_CMOS_SUPPORTED (1 << 5)
93 # define ATIF_GET_PANEL_EXPANSION_MODE_FROM_CMOS_SUPPORTED (1 << 6)
94 # define ATIF_SET_PANEL_EXPANSION_MODE_IN_CMOS_SUPPORTED (1 << 7)
95 # define ATIF_TEMPERATURE_CHANGE_NOTIFICATION_SUPPORTED (1 << 12)
96 # define ATIF_GET_GRAPHICS_DEVICE_TYPES_SUPPORTED (1 << 14)
97 # define ATIF_GET_EXTERNAL_GPU_INFORMATION_SUPPORTED (1 << 20)
98 #define ATIF_FUNCTION_GET_SYSTEM_PARAMETERS 0x1
99 /* ARG0: ATIF_FUNCTION_GET_SYSTEM_PARAMETERS
102 * WORD - structure size in bytes (includes size field)
103 * DWORD - valid flags mask
108 * WORD - structure size in bytes (includes size field)
109 * DWORD - valid flags mask
111 * BYTE - notify command code
115 * 0 - Notify(VGA, 0x81) is not used for notification
116 * 1 - Notify(VGA, 0x81) is used for notification
117 * 2 - Notify(VGA, n) is used for notification where
118 * n (0xd0-0xd9) is specified in notify command code.
120 * 1 - lid changes not reported though int10
122 #define ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS 0x2
123 /* ARG0: ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS
126 * WORD - structure size in bytes (includes size field)
127 * DWORD - pending sbios requests
128 * BYTE - panel expansion mode
129 * BYTE - thermal state: target gfx controller
130 * BYTE - thermal state: state id (0: exit state, non-0: state)
131 * BYTE - forced power state: target gfx controller
132 * BYTE - forced power state: state id
133 * BYTE - system power source
134 * BYTE - panel backlight level (0-255)
136 /* pending sbios requests */
137 # define ATIF_DISPLAY_SWITCH_REQUEST (1 << 0)
138 # define ATIF_EXPANSION_MODE_CHANGE_REQUEST (1 << 1)
139 # define ATIF_THERMAL_STATE_CHANGE_REQUEST (1 << 2)
140 # define ATIF_FORCED_POWER_STATE_CHANGE_REQUEST (1 << 3)
141 # define ATIF_SYSTEM_POWER_SOURCE_CHANGE_REQUEST (1 << 4)
142 # define ATIF_DISPLAY_CONF_CHANGE_REQUEST (1 << 5)
143 # define ATIF_PX_GFX_SWITCH_REQUEST (1 << 6)
144 # define ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST (1 << 7)
145 # define ATIF_DGPU_DISPLAY_EVENT (1 << 8)
146 /* panel expansion mode */
147 # define ATIF_PANEL_EXPANSION_DISABLE 0
148 # define ATIF_PANEL_EXPANSION_FULL 1
149 # define ATIF_PANEL_EXPANSION_ASPECT 2
150 /* target gfx controller */
151 # define ATIF_TARGET_GFX_SINGLE 0
152 # define ATIF_TARGET_GFX_PX_IGPU 1
153 # define ATIF_TARGET_GFX_PX_DGPU 2
154 /* system power source */
155 # define ATIF_POWER_SOURCE_AC 1
156 # define ATIF_POWER_SOURCE_DC 2
157 # define ATIF_POWER_SOURCE_RESTRICTED_AC_1 3
158 # define ATIF_POWER_SOURCE_RESTRICTED_AC_2 4
159 #define ATIF_FUNCTION_SELECT_ACTIVE_DISPLAYS 0x3
160 /* ARG0: ATIF_FUNCTION_SELECT_ACTIVE_DISPLAYS
162 * WORD - structure size in bytes (includes size field)
163 * WORD - selected displays
164 * WORD - connected displays
166 * WORD - structure size in bytes (includes size field)
167 * WORD - selected displays
169 # define ATIF_LCD1 (1 << 0)
170 # define ATIF_CRT1 (1 << 1)
171 # define ATIF_TV (1 << 2)
172 # define ATIF_DFP1 (1 << 3)
173 # define ATIF_CRT2 (1 << 4)
174 # define ATIF_LCD2 (1 << 5)
175 # define ATIF_DFP2 (1 << 7)
176 # define ATIF_CV (1 << 8)
177 # define ATIF_DFP3 (1 << 9)
178 # define ATIF_DFP4 (1 << 10)
179 # define ATIF_DFP5 (1 << 11)
180 # define ATIF_DFP6 (1 << 12)
181 #define ATIF_FUNCTION_GET_LID_STATE 0x4
182 /* ARG0: ATIF_FUNCTION_GET_LID_STATE
185 * WORD - structure size in bytes (includes size field)
186 * BYTE - lid state (0: open, 1: closed)
188 * GET_LID_STATE only works at boot and resume, for general lid
189 * status, use the kernel provided status
191 #define ATIF_FUNCTION_GET_TV_STANDARD_FROM_CMOS 0x5
192 /* ARG0: ATIF_FUNCTION_GET_TV_STANDARD_FROM_CMOS
195 * WORD - structure size in bytes (includes size field)
199 # define ATIF_TV_STD_NTSC 0
200 # define ATIF_TV_STD_PAL 1
201 # define ATIF_TV_STD_PALM 2
202 # define ATIF_TV_STD_PAL60 3
203 # define ATIF_TV_STD_NTSCJ 4
204 # define ATIF_TV_STD_PALCN 5
205 # define ATIF_TV_STD_PALN 6
206 # define ATIF_TV_STD_SCART_RGB 9
207 #define ATIF_FUNCTION_SET_TV_STANDARD_IN_CMOS 0x6
208 /* ARG0: ATIF_FUNCTION_SET_TV_STANDARD_IN_CMOS
210 * WORD - structure size in bytes (includes size field)
215 #define ATIF_FUNCTION_GET_PANEL_EXPANSION_MODE_FROM_CMOS 0x7
216 /* ARG0: ATIF_FUNCTION_GET_PANEL_EXPANSION_MODE_FROM_CMOS
219 * WORD - structure size in bytes (includes size field)
220 * BYTE - panel expansion mode
222 #define ATIF_FUNCTION_SET_PANEL_EXPANSION_MODE_IN_CMOS 0x8
223 /* ARG0: ATIF_FUNCTION_SET_PANEL_EXPANSION_MODE_IN_CMOS
225 * WORD - structure size in bytes (includes size field)
226 * BYTE - panel expansion mode
229 #define ATIF_FUNCTION_TEMPERATURE_CHANGE_NOTIFICATION 0xD
230 /* ARG0: ATIF_FUNCTION_TEMPERATURE_CHANGE_NOTIFICATION
232 * WORD - structure size in bytes (includes size field)
233 * WORD - gfx controller id
234 * BYTE - current temperature (degress Celsius)
237 #define ATIF_FUNCTION_GET_GRAPHICS_DEVICE_TYPES 0xF
238 /* ARG0: ATIF_FUNCTION_GET_GRAPHICS_DEVICE_TYPES
241 * WORD - number of gfx devices
242 * WORD - device structure size in bytes (excludes device size field)
244 * WORD - bus number } repeated structure
245 * WORD - device number /
248 # define ATIF_PX_REMOVABLE_GRAPHICS_DEVICE (1 << 0)
249 # define ATIF_XGP_PORT (1 << 1)
250 # define ATIF_VGA_ENABLED_GRAPHICS_DEVICE (1 << 2)
251 # define ATIF_XGP_PORT_IN_DOCK (1 << 3)
252 #define ATIF_FUNCTION_GET_EXTERNAL_GPU_INFORMATION 0x15
253 /* ARG0: ATIF_FUNCTION_GET_EXTERNAL_GPU_INFORMATION
256 * WORD - number of reported external gfx devices
257 * WORD - device structure size in bytes (excludes device size field)
259 * WORD - bus number / repeated structure
262 # define ATIF_EXTERNAL_GRAPHICS_PORT (1 << 0)
265 #define ATPX_FUNCTION_VERIFY_INTERFACE 0x0
266 /* ARG0: ATPX_FUNCTION_VERIFY_INTERFACE
269 * WORD - structure size in bytes (includes size field)
271 * DWORD - supported functions bit vector
273 /* supported functions vector */
274 # define ATPX_GET_PX_PARAMETERS_SUPPORTED (1 << 0)
275 # define ATPX_POWER_CONTROL_SUPPORTED (1 << 1)
276 # define ATPX_DISPLAY_MUX_CONTROL_SUPPORTED (1 << 2)
277 # define ATPX_I2C_MUX_CONTROL_SUPPORTED (1 << 3)
278 # define ATPX_GRAPHICS_DEVICE_SWITCH_START_NOTIFICATION_SUPPORTED (1 << 4)
279 # define ATPX_GRAPHICS_DEVICE_SWITCH_END_NOTIFICATION_SUPPORTED (1 << 5)
280 # define ATPX_GET_DISPLAY_CONNECTORS_MAPPING_SUPPORTED (1 << 7)
281 # define ATPX_GET_DISPLAY_DETECTION_PORTS_SUPPORTED (1 << 8)
282 #define ATPX_FUNCTION_GET_PX_PARAMETERS 0x1
283 /* ARG0: ATPX_FUNCTION_GET_PX_PARAMETERS
286 * WORD - structure size in bytes (includes size field)
287 * DWORD - valid flags mask
291 # define ATPX_LVDS_I2C_AVAILABLE_TO_BOTH_GPUS (1 << 0)
292 # define ATPX_CRT1_I2C_AVAILABLE_TO_BOTH_GPUS (1 << 1)
293 # define ATPX_DVI1_I2C_AVAILABLE_TO_BOTH_GPUS (1 << 2)
294 # define ATPX_CRT1_RGB_SIGNAL_MUXED (1 << 3)
295 # define ATPX_TV_SIGNAL_MUXED (1 << 4)
296 # define ATPX_DFP_SIGNAL_MUXED (1 << 5)
297 # define ATPX_SEPARATE_MUX_FOR_I2C (1 << 6)
298 # define ATPX_DYNAMIC_PX_SUPPORTED (1 << 7)
299 # define ATPX_ACF_NOT_SUPPORTED (1 << 8)
300 # define ATPX_FIXED_NOT_SUPPORTED (1 << 9)
301 # define ATPX_DYNAMIC_DGPU_POWER_OFF_SUPPORTED (1 << 10)
302 # define ATPX_DGPU_REQ_POWER_FOR_DISPLAYS (1 << 11)
303 # define ATPX_DGPU_CAN_DRIVE_DISPLAYS (1 << 12)
304 # define ATPX_MS_HYBRID_GFX_SUPPORTED (1 << 14)
305 #define ATPX_FUNCTION_POWER_CONTROL 0x2
306 /* ARG0: ATPX_FUNCTION_POWER_CONTROL
308 * WORD - structure size in bytes (includes size field)
309 * BYTE - dGPU power state (0: power off, 1: power on)
312 #define ATPX_FUNCTION_DISPLAY_MUX_CONTROL 0x3
313 /* ARG0: ATPX_FUNCTION_DISPLAY_MUX_CONTROL
315 * WORD - structure size in bytes (includes size field)
316 * WORD - display mux control (0: iGPU, 1: dGPU)
319 # define ATPX_INTEGRATED_GPU 0
320 # define ATPX_DISCRETE_GPU 1
321 #define ATPX_FUNCTION_I2C_MUX_CONTROL 0x4
322 /* ARG0: ATPX_FUNCTION_I2C_MUX_CONTROL
324 * WORD - structure size in bytes (includes size field)
325 * WORD - i2c/aux/hpd mux control (0: iGPU, 1: dGPU)
328 #define ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_START_NOTIFICATION 0x5
329 /* ARG0: ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_START_NOTIFICATION
331 * WORD - structure size in bytes (includes size field)
332 * WORD - target gpu (0: iGPU, 1: dGPU)
335 #define ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_END_NOTIFICATION 0x6
336 /* ARG0: ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_END_NOTIFICATION
338 * WORD - structure size in bytes (includes size field)
339 * WORD - target gpu (0: iGPU, 1: dGPU)
342 #define ATPX_FUNCTION_GET_DISPLAY_CONNECTORS_MAPPING 0x8
343 /* ARG0: ATPX_FUNCTION_GET_DISPLAY_CONNECTORS_MAPPING
346 * WORD - number of display connectors
347 * WORD - connector structure size in bytes (excludes connector size field)
349 * BYTE - ATIF display vector bit position } repeated
350 * BYTE - adapter id (0: iGPU, 1-n: dGPU ordered by pcie bus number) } structure
351 * WORD - connector ACPI id /
354 # define ATPX_DISPLAY_OUTPUT_SUPPORTED_BY_ADAPTER_ID_DEVICE (1 << 0)
355 # define ATPX_DISPLAY_HPD_SUPPORTED_BY_ADAPTER_ID_DEVICE (1 << 1)
356 # define ATPX_DISPLAY_I2C_SUPPORTED_BY_ADAPTER_ID_DEVICE (1 << 2)
357 #define ATPX_FUNCTION_GET_DISPLAY_DETECTION_PORTS 0x9
358 /* ARG0: ATPX_FUNCTION_GET_DISPLAY_DETECTION_PORTS
361 * WORD - number of HPD/DDC ports
362 * WORD - port structure size in bytes (excludes port size field)
363 * BYTE - ATIF display vector bit position \
364 * BYTE - hpd id } reapeated structure
367 * available on A+A systems only
370 # define ATPX_HPD_NONE 0
378 # define ATPX_DDC_NONE 0
389 #define ATCS_FUNCTION_VERIFY_INTERFACE 0x0
390 /* ARG0: ATCS_FUNCTION_VERIFY_INTERFACE
393 * WORD - structure size in bytes (includes size field)
395 * DWORD - supported functions bit vector
397 /* supported functions vector */
398 # define ATCS_GET_EXTERNAL_STATE_SUPPORTED (1 << 0)
399 # define ATCS_PCIE_PERFORMANCE_REQUEST_SUPPORTED (1 << 1)
400 # define ATCS_PCIE_DEVICE_READY_NOTIFICATION_SUPPORTED (1 << 2)
401 # define ATCS_SET_PCIE_BUS_WIDTH_SUPPORTED (1 << 3)
402 #define ATCS_FUNCTION_GET_EXTERNAL_STATE 0x1
403 /* ARG0: ATCS_FUNCTION_GET_EXTERNAL_STATE
406 * WORD - structure size in bytes (includes size field)
407 * DWORD - valid flags mask
408 * DWORD - flags (0: undocked, 1: docked)
411 # define ATCS_DOCKED (1 << 0)
412 #define ATCS_FUNCTION_PCIE_PERFORMANCE_REQUEST 0x2
413 /* ARG0: ATCS_FUNCTION_PCIE_PERFORMANCE_REQUEST
415 * WORD - structure size in bytes (includes size field)
416 * WORD - client id (bit 2-0: func num, 7-3: dev num, 15-8: bus num)
417 * WORD - valid flags mask
419 * BYTE - request type
420 * BYTE - performance request
422 * WORD - structure size in bytes (includes size field)
423 * BYTE - return value
426 # define ATCS_ADVERTISE_CAPS (1 << 0)
427 # define ATCS_WAIT_FOR_COMPLETION (1 << 1)
429 # define ATCS_PCIE_LINK_SPEED 1
430 /* performance request */
431 # define ATCS_REMOVE 0
432 # define ATCS_FORCE_LOW_POWER 1
433 # define ATCS_PERF_LEVEL_1 2 /* PCIE Gen 1 */
434 # define ATCS_PERF_LEVEL_2 3 /* PCIE Gen 2 */
435 # define ATCS_PERF_LEVEL_3 4 /* PCIE Gen 3 */
437 # define ATCS_REQUEST_REFUSED 1
438 # define ATCS_REQUEST_COMPLETE 2
439 # define ATCS_REQUEST_IN_PROGRESS 3
440 #define ATCS_FUNCTION_PCIE_DEVICE_READY_NOTIFICATION 0x3
441 /* ARG0: ATCS_FUNCTION_PCIE_DEVICE_READY_NOTIFICATION
445 #define ATCS_FUNCTION_SET_PCIE_BUS_WIDTH 0x4
446 /* ARG0: ATCS_FUNCTION_SET_PCIE_BUS_WIDTH
448 * WORD - structure size in bytes (includes size field)
449 * WORD - client id (bit 2-0: func num, 7-3: dev num, 15-8: bus num)
450 * BYTE - number of active lanes
452 * WORD - structure size in bytes (includes size field)
453 * BYTE - number of active lanes