1254885Sdumbbell/*
2254885Sdumbbell * Copyright 2012 Advanced Micro Devices, Inc.
3254885Sdumbbell *
4254885Sdumbbell * Permission is hereby granted, free of charge, to any person obtaining a
5254885Sdumbbell * copy of this software and associated documentation files (the "Software"),
6254885Sdumbbell * to deal in the Software without restriction, including without limitation
7254885Sdumbbell * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8254885Sdumbbell * and/or sell copies of the Software, and to permit persons to whom the
9254885Sdumbbell * Software is furnished to do so, subject to the following conditions:
10254885Sdumbbell *
11254885Sdumbbell * The above copyright notice and this permission notice shall be included in
12254885Sdumbbell * all copies or substantial portions of the Software.
13254885Sdumbbell *
14254885Sdumbbell * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15254885Sdumbbell * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16254885Sdumbbell * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17254885Sdumbbell * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18254885Sdumbbell * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19254885Sdumbbell * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20254885Sdumbbell * OTHER DEALINGS IN THE SOFTWARE.
21254885Sdumbbell *
22254885Sdumbbell */
23254885Sdumbbell
24254885Sdumbbell#include <sys/cdefs.h>
25254885Sdumbbell__FBSDID("$FreeBSD$");
26254885Sdumbbell
27254885Sdumbbell#ifndef RADEON_ACPI_H
28254885Sdumbbell#define RADEON_ACPI_H
29254885Sdumbbell
30254885Sdumbbellstruct radeon_device;
31254885Sdumbbell
32254885Sdumbbellvoid radeon_atif_handler(struct radeon_device *rdev, UINT32 type);
33254885Sdumbbell
34254885Sdumbbell/* AMD hw uses four ACPI control methods:
35254885Sdumbbell * 1. ATIF
36254885Sdumbbell * ARG0: (ACPI_INTEGER) function code
37254885Sdumbbell * ARG1: (ACPI_BUFFER) parameter buffer, 256 bytes
38254885Sdumbbell * OUTPUT: (ACPI_BUFFER) output buffer, 256 bytes
39254885Sdumbbell * ATIF provides an entry point for the gfx driver to interact with the sbios.
40254885Sdumbbell * The AMD ACPI notification mechanism uses Notify (VGA, 0x81) or a custom
41254885Sdumbbell * notification. Which notification is used as indicated by the ATIF Control
42254885Sdumbbell * Method GET_SYSTEM_PARAMETERS. When the driver receives Notify (VGA, 0x81) or
43254885Sdumbbell * a custom notification it invokes ATIF Control Method GET_SYSTEM_BIOS_REQUESTS
44254885Sdumbbell * to identify pending System BIOS requests and associated parameters. For
45254885Sdumbbell * example, if one of the pending requests is DISPLAY_SWITCH_REQUEST, the driver
46254885Sdumbbell * will perform display device detection and invoke ATIF Control Method
47254885Sdumbbell * SELECT_ACTIVE_DISPLAYS.
48254885Sdumbbell *
49254885Sdumbbell * 2. ATPX
50254885Sdumbbell * ARG0: (ACPI_INTEGER) function code
51254885Sdumbbell * ARG1: (ACPI_BUFFER) parameter buffer, 256 bytes
52254885Sdumbbell * OUTPUT: (ACPI_BUFFER) output buffer, 256 bytes
53254885Sdumbbell * ATPX methods are used on PowerXpress systems to handle mux switching and
54254885Sdumbbell * discrete GPU power control.
55254885Sdumbbell *
56254885Sdumbbell * 3. ATRM
57254885Sdumbbell * ARG0: (ACPI_INTEGER) offset of vbios rom data
58254885Sdumbbell * ARG1: (ACPI_BUFFER) size of the buffer to fill (up to 4K).
59254885Sdumbbell * OUTPUT: (ACPI_BUFFER) output buffer
60254885Sdumbbell * ATRM provides an interfacess to access the discrete GPU vbios image on
61254885Sdumbbell * PowerXpress systems with multiple GPUs.
62254885Sdumbbell *
63254885Sdumbbell * 4. ATCS
64254885Sdumbbell * ARG0: (ACPI_INTEGER) function code
65254885Sdumbbell * ARG1: (ACPI_BUFFER) parameter buffer, 256 bytes
66254885Sdumbbell * OUTPUT: (ACPI_BUFFER) output buffer, 256 bytes
67254885Sdumbbell * ATCS provides an interface to AMD chipset specific functionality.
68254885Sdumbbell *
69254885Sdumbbell */
70254885Sdumbbell/* ATIF */
71254885Sdumbbell#define ATIF_FUNCTION_VERIFY_INTERFACE                             0x0
72254885Sdumbbell/* ARG0: ATIF_FUNCTION_VERIFY_INTERFACE
73254885Sdumbbell * ARG1: none
74254885Sdumbbell * OUTPUT:
75254885Sdumbbell * WORD  - structure size in bytes (includes size field)
76254885Sdumbbell * WORD  - version
77254885Sdumbbell * DWORD - supported notifications mask
78254885Sdumbbell * DWORD - supported functions bit vector
79254885Sdumbbell */
80254885Sdumbbell/* Notifications mask */
81254885Sdumbbell#       define ATIF_DISPLAY_SWITCH_REQUEST_SUPPORTED               (1 << 0)
82254885Sdumbbell#       define ATIF_EXPANSION_MODE_CHANGE_REQUEST_SUPPORTED        (1 << 1)
83254885Sdumbbell#       define ATIF_THERMAL_STATE_CHANGE_REQUEST_SUPPORTED         (1 << 2)
84254885Sdumbbell#       define ATIF_FORCED_POWER_STATE_CHANGE_REQUEST_SUPPORTED    (1 << 3)
85254885Sdumbbell#       define ATIF_SYSTEM_POWER_SOURCE_CHANGE_REQUEST_SUPPORTED   (1 << 4)
86254885Sdumbbell#       define ATIF_DISPLAY_CONF_CHANGE_REQUEST_SUPPORTED          (1 << 5)
87254885Sdumbbell#       define ATIF_PX_GFX_SWITCH_REQUEST_SUPPORTED                (1 << 6)
88254885Sdumbbell#       define ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST_SUPPORTED      (1 << 7)
89254885Sdumbbell#       define ATIF_DGPU_DISPLAY_EVENT_SUPPORTED                   (1 << 8)
90254885Sdumbbell/* supported functions vector */
91254885Sdumbbell#       define ATIF_GET_SYSTEM_PARAMETERS_SUPPORTED               (1 << 0)
92254885Sdumbbell#       define ATIF_GET_SYSTEM_BIOS_REQUESTS_SUPPORTED            (1 << 1)
93254885Sdumbbell#       define ATIF_SELECT_ACTIVE_DISPLAYS_SUPPORTED              (1 << 2)
94254885Sdumbbell#       define ATIF_GET_LID_STATE_SUPPORTED                       (1 << 3)
95254885Sdumbbell#       define ATIF_GET_TV_STANDARD_FROM_CMOS_SUPPORTED           (1 << 4)
96254885Sdumbbell#       define ATIF_SET_TV_STANDARD_IN_CMOS_SUPPORTED             (1 << 5)
97254885Sdumbbell#       define ATIF_GET_PANEL_EXPANSION_MODE_FROM_CMOS_SUPPORTED  (1 << 6)
98254885Sdumbbell#       define ATIF_SET_PANEL_EXPANSION_MODE_IN_CMOS_SUPPORTED    (1 << 7)
99254885Sdumbbell#       define ATIF_TEMPERATURE_CHANGE_NOTIFICATION_SUPPORTED     (1 << 12)
100254885Sdumbbell#       define ATIF_GET_GRAPHICS_DEVICE_TYPES_SUPPORTED           (1 << 14)
101254885Sdumbbell#define ATIF_FUNCTION_GET_SYSTEM_PARAMETERS                        0x1
102254885Sdumbbell/* ARG0: ATIF_FUNCTION_GET_SYSTEM_PARAMETERS
103254885Sdumbbell * ARG1: none
104254885Sdumbbell * OUTPUT:
105254885Sdumbbell * WORD  - structure size in bytes (includes size field)
106254885Sdumbbell * DWORD - valid flags mask
107254885Sdumbbell * DWORD - flags
108254885Sdumbbell *
109254885Sdumbbell * OR
110254885Sdumbbell *
111254885Sdumbbell * WORD  - structure size in bytes (includes size field)
112254885Sdumbbell * DWORD - valid flags mask
113254885Sdumbbell * DWORD - flags
114254885Sdumbbell * BYTE  - notify command code
115254885Sdumbbell *
116254885Sdumbbell * flags
117254885Sdumbbell * bits 1:0:
118254885Sdumbbell * 0 - Notify(VGA, 0x81) is not used for notification
119254885Sdumbbell * 1 - Notify(VGA, 0x81) is used for notification
120254885Sdumbbell * 2 - Notify(VGA, n) is used for notification where
121254885Sdumbbell * n (0xd0-0xd9) is specified in notify command code.
122254885Sdumbbell * bit 2:
123254885Sdumbbell * 1 - lid changes not reported though int10
124254885Sdumbbell */
125254885Sdumbbell#define ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS                     0x2
126254885Sdumbbell/* ARG0: ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS
127254885Sdumbbell * ARG1: none
128254885Sdumbbell * OUTPUT:
129254885Sdumbbell * WORD  - structure size in bytes (includes size field)
130254885Sdumbbell * DWORD - pending sbios requests
131254885Sdumbbell * BYTE  - panel expansion mode
132254885Sdumbbell * BYTE  - thermal state: target gfx controller
133254885Sdumbbell * BYTE  - thermal state: state id (0: exit state, non-0: state)
134254885Sdumbbell * BYTE  - forced power state: target gfx controller
135254885Sdumbbell * BYTE  - forced power state: state id
136254885Sdumbbell * BYTE  - system power source
137254885Sdumbbell * BYTE  - panel backlight level (0-255)
138254885Sdumbbell */
139254885Sdumbbell/* pending sbios requests */
140254885Sdumbbell#       define ATIF_DISPLAY_SWITCH_REQUEST                         (1 << 0)
141254885Sdumbbell#       define ATIF_EXPANSION_MODE_CHANGE_REQUEST                  (1 << 1)
142254885Sdumbbell#       define ATIF_THERMAL_STATE_CHANGE_REQUEST                   (1 << 2)
143254885Sdumbbell#       define ATIF_FORCED_POWER_STATE_CHANGE_REQUEST              (1 << 3)
144254885Sdumbbell#       define ATIF_SYSTEM_POWER_SOURCE_CHANGE_REQUEST             (1 << 4)
145254885Sdumbbell#       define ATIF_DISPLAY_CONF_CHANGE_REQUEST                    (1 << 5)
146254885Sdumbbell#       define ATIF_PX_GFX_SWITCH_REQUEST                          (1 << 6)
147254885Sdumbbell#       define ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST                (1 << 7)
148254885Sdumbbell#       define ATIF_DGPU_DISPLAY_EVENT                             (1 << 8)
149254885Sdumbbell/* panel expansion mode */
150254885Sdumbbell#       define ATIF_PANEL_EXPANSION_DISABLE                        0
151254885Sdumbbell#       define ATIF_PANEL_EXPANSION_FULL                           1
152254885Sdumbbell#       define ATIF_PANEL_EXPANSION_ASPECT                         2
153254885Sdumbbell/* target gfx controller */
154254885Sdumbbell#       define ATIF_TARGET_GFX_SINGLE                              0
155254885Sdumbbell#       define ATIF_TARGET_GFX_PX_IGPU                             1
156254885Sdumbbell#       define ATIF_TARGET_GFX_PX_DGPU                             2
157254885Sdumbbell/* system power source */
158254885Sdumbbell#       define ATIF_POWER_SOURCE_AC                                1
159254885Sdumbbell#       define ATIF_POWER_SOURCE_DC                                2
160254885Sdumbbell#       define ATIF_POWER_SOURCE_RESTRICTED_AC_1                   3
161254885Sdumbbell#       define ATIF_POWER_SOURCE_RESTRICTED_AC_2                   4
162254885Sdumbbell#define ATIF_FUNCTION_SELECT_ACTIVE_DISPLAYS                       0x3
163254885Sdumbbell/* ARG0: ATIF_FUNCTION_SELECT_ACTIVE_DISPLAYS
164254885Sdumbbell * ARG1:
165254885Sdumbbell * WORD  - structure size in bytes (includes size field)
166254885Sdumbbell * WORD  - selected displays
167254885Sdumbbell * WORD  - connected displays
168254885Sdumbbell * OUTPUT:
169254885Sdumbbell * WORD  - structure size in bytes (includes size field)
170254885Sdumbbell * WORD  - selected displays
171254885Sdumbbell */
172254885Sdumbbell#       define ATIF_LCD1                                           (1 << 0)
173254885Sdumbbell#       define ATIF_CRT1                                           (1 << 1)
174254885Sdumbbell#       define ATIF_TV                                             (1 << 2)
175254885Sdumbbell#       define ATIF_DFP1                                           (1 << 3)
176254885Sdumbbell#       define ATIF_CRT2                                           (1 << 4)
177254885Sdumbbell#       define ATIF_LCD2                                           (1 << 5)
178254885Sdumbbell#       define ATIF_DFP2                                           (1 << 7)
179254885Sdumbbell#       define ATIF_CV                                             (1 << 8)
180254885Sdumbbell#       define ATIF_DFP3                                           (1 << 9)
181254885Sdumbbell#       define ATIF_DFP4                                           (1 << 10)
182254885Sdumbbell#       define ATIF_DFP5                                           (1 << 11)
183254885Sdumbbell#       define ATIF_DFP6                                           (1 << 12)
184254885Sdumbbell#define ATIF_FUNCTION_GET_LID_STATE                                0x4
185254885Sdumbbell/* ARG0: ATIF_FUNCTION_GET_LID_STATE
186254885Sdumbbell * ARG1: none
187254885Sdumbbell * OUTPUT:
188254885Sdumbbell * WORD  - structure size in bytes (includes size field)
189254885Sdumbbell * BYTE  - lid state (0: open, 1: closed)
190254885Sdumbbell *
191254885Sdumbbell * GET_LID_STATE only works at boot and resume, for general lid
192254885Sdumbbell * status, use the kernel provided status
193254885Sdumbbell */
194254885Sdumbbell#define ATIF_FUNCTION_GET_TV_STANDARD_FROM_CMOS                    0x5
195254885Sdumbbell/* ARG0: ATIF_FUNCTION_GET_TV_STANDARD_FROM_CMOS
196254885Sdumbbell * ARG1: none
197254885Sdumbbell * OUTPUT:
198254885Sdumbbell * WORD  - structure size in bytes (includes size field)
199254885Sdumbbell * BYTE  - 0
200254885Sdumbbell * BYTE  - TV standard
201254885Sdumbbell */
202254885Sdumbbell#       define ATIF_TV_STD_NTSC                                    0
203254885Sdumbbell#       define ATIF_TV_STD_PAL                                     1
204254885Sdumbbell#       define ATIF_TV_STD_PALM                                    2
205254885Sdumbbell#       define ATIF_TV_STD_PAL60                                   3
206254885Sdumbbell#       define ATIF_TV_STD_NTSCJ                                   4
207254885Sdumbbell#       define ATIF_TV_STD_PALCN                                   5
208254885Sdumbbell#       define ATIF_TV_STD_PALN                                    6
209254885Sdumbbell#       define ATIF_TV_STD_SCART_RGB                               9
210254885Sdumbbell#define ATIF_FUNCTION_SET_TV_STANDARD_IN_CMOS                      0x6
211254885Sdumbbell/* ARG0: ATIF_FUNCTION_SET_TV_STANDARD_IN_CMOS
212254885Sdumbbell * ARG1:
213254885Sdumbbell * WORD  - structure size in bytes (includes size field)
214254885Sdumbbell * BYTE  - 0
215254885Sdumbbell * BYTE  - TV standard
216254885Sdumbbell * OUTPUT: none
217254885Sdumbbell */
218254885Sdumbbell#define ATIF_FUNCTION_GET_PANEL_EXPANSION_MODE_FROM_CMOS           0x7
219254885Sdumbbell/* ARG0: ATIF_FUNCTION_GET_PANEL_EXPANSION_MODE_FROM_CMOS
220254885Sdumbbell * ARG1: none
221254885Sdumbbell * OUTPUT:
222254885Sdumbbell * WORD  - structure size in bytes (includes size field)
223254885Sdumbbell * BYTE  - panel expansion mode
224254885Sdumbbell */
225254885Sdumbbell#define ATIF_FUNCTION_SET_PANEL_EXPANSION_MODE_IN_CMOS             0x8
226254885Sdumbbell/* ARG0: ATIF_FUNCTION_SET_PANEL_EXPANSION_MODE_IN_CMOS
227254885Sdumbbell * ARG1:
228254885Sdumbbell * WORD  - structure size in bytes (includes size field)
229254885Sdumbbell * BYTE  - panel expansion mode
230254885Sdumbbell * OUTPUT: none
231254885Sdumbbell */
232254885Sdumbbell#define ATIF_FUNCTION_TEMPERATURE_CHANGE_NOTIFICATION              0xD
233254885Sdumbbell/* ARG0: ATIF_FUNCTION_TEMPERATURE_CHANGE_NOTIFICATION
234254885Sdumbbell * ARG1:
235254885Sdumbbell * WORD  - structure size in bytes (includes size field)
236254885Sdumbbell * WORD  - gfx controller id
237254885Sdumbbell * BYTE  - current temperature (degress Celsius)
238254885Sdumbbell * OUTPUT: none
239254885Sdumbbell */
240254885Sdumbbell#define ATIF_FUNCTION_GET_GRAPHICS_DEVICE_TYPES                    0xF
241254885Sdumbbell/* ARG0: ATIF_FUNCTION_GET_GRAPHICS_DEVICE_TYPES
242254885Sdumbbell * ARG1: none
243254885Sdumbbell * OUTPUT:
244254885Sdumbbell * WORD  - number of gfx devices
245254885Sdumbbell * WORD  - device structure size in bytes (excludes device size field)
246254885Sdumbbell * DWORD - flags         \
247254885Sdumbbell * WORD  - bus number     } repeated structure
248254885Sdumbbell * WORD  - device number /
249254885Sdumbbell */
250254885Sdumbbell/* flags */
251254885Sdumbbell#       define ATIF_PX_REMOVABLE_GRAPHICS_DEVICE                   (1 << 0)
252254885Sdumbbell#       define ATIF_XGP_PORT                                       (1 << 1)
253254885Sdumbbell#       define ATIF_VGA_ENABLED_GRAPHICS_DEVICE                    (1 << 2)
254254885Sdumbbell#       define ATIF_XGP_PORT_IN_DOCK                               (1 << 3)
255254885Sdumbbell
256254885Sdumbbell/* ATPX */
257254885Sdumbbell#define ATPX_FUNCTION_VERIFY_INTERFACE                             0x0
258254885Sdumbbell/* ARG0: ATPX_FUNCTION_VERIFY_INTERFACE
259254885Sdumbbell * ARG1: none
260254885Sdumbbell * OUTPUT:
261254885Sdumbbell * WORD  - structure size in bytes (includes size field)
262254885Sdumbbell * WORD  - version
263254885Sdumbbell * DWORD - supported functions bit vector
264254885Sdumbbell */
265254885Sdumbbell/* supported functions vector */
266254885Sdumbbell#       define ATPX_GET_PX_PARAMETERS_SUPPORTED                    (1 << 0)
267254885Sdumbbell#       define ATPX_POWER_CONTROL_SUPPORTED                        (1 << 1)
268254885Sdumbbell#       define ATPX_DISPLAY_MUX_CONTROL_SUPPORTED                  (1 << 2)
269254885Sdumbbell#       define ATPX_I2C_MUX_CONTROL_SUPPORTED                      (1 << 3)
270254885Sdumbbell#       define ATPX_GRAPHICS_DEVICE_SWITCH_START_NOTIFICATION_SUPPORTED (1 << 4)
271254885Sdumbbell#       define ATPX_GRAPHICS_DEVICE_SWITCH_END_NOTIFICATION_SUPPORTED   (1 << 5)
272254885Sdumbbell#       define ATPX_GET_DISPLAY_CONNECTORS_MAPPING_SUPPORTED       (1 << 7)
273254885Sdumbbell#       define ATPX_GET_DISPLAY_DETECTION_PORTS_SUPPORTED          (1 << 8)
274254885Sdumbbell#define ATPX_FUNCTION_GET_PX_PARAMETERS                            0x1
275254885Sdumbbell/* ARG0: ATPX_FUNCTION_GET_PX_PARAMETERS
276254885Sdumbbell * ARG1: none
277254885Sdumbbell * OUTPUT:
278254885Sdumbbell * WORD  - structure size in bytes (includes size field)
279254885Sdumbbell * DWORD - valid flags mask
280254885Sdumbbell * DWORD - flags
281254885Sdumbbell */
282254885Sdumbbell/* flags */
283254885Sdumbbell#       define ATPX_LVDS_I2C_AVAILABLE_TO_BOTH_GPUS                (1 << 0)
284254885Sdumbbell#       define ATPX_CRT1_I2C_AVAILABLE_TO_BOTH_GPUS                (1 << 1)
285254885Sdumbbell#       define ATPX_DVI1_I2C_AVAILABLE_TO_BOTH_GPUS                (1 << 2)
286254885Sdumbbell#       define ATPX_CRT1_RGB_SIGNAL_MUXED                          (1 << 3)
287254885Sdumbbell#       define ATPX_TV_SIGNAL_MUXED                                (1 << 4)
288254885Sdumbbell#       define ATPX_DFP_SIGNAL_MUXED                               (1 << 5)
289254885Sdumbbell#       define ATPX_SEPARATE_MUX_FOR_I2C                           (1 << 6)
290254885Sdumbbell#       define ATPX_DYNAMIC_PX_SUPPORTED                           (1 << 7)
291254885Sdumbbell#       define ATPX_ACF_NOT_SUPPORTED                              (1 << 8)
292254885Sdumbbell#       define ATPX_FIXED_NOT_SUPPORTED                            (1 << 9)
293254885Sdumbbell#       define ATPX_DYNAMIC_DGPU_POWER_OFF_SUPPORTED               (1 << 10)
294254885Sdumbbell#       define ATPX_DGPU_REQ_POWER_FOR_DISPLAYS                    (1 << 11)
295254885Sdumbbell#define ATPX_FUNCTION_POWER_CONTROL                                0x2
296254885Sdumbbell/* ARG0: ATPX_FUNCTION_POWER_CONTROL
297254885Sdumbbell * ARG1:
298254885Sdumbbell * WORD  - structure size in bytes (includes size field)
299254885Sdumbbell * BYTE  - dGPU power state (0: power off, 1: power on)
300254885Sdumbbell * OUTPUT: none
301254885Sdumbbell */
302254885Sdumbbell#define ATPX_FUNCTION_DISPLAY_MUX_CONTROL                          0x3
303254885Sdumbbell/* ARG0: ATPX_FUNCTION_DISPLAY_MUX_CONTROL
304254885Sdumbbell * ARG1:
305254885Sdumbbell * WORD  - structure size in bytes (includes size field)
306254885Sdumbbell * WORD  - display mux control (0: iGPU, 1: dGPU)
307254885Sdumbbell * OUTPUT: none
308254885Sdumbbell */
309254885Sdumbbell#       define ATPX_INTEGRATED_GPU                                 0
310254885Sdumbbell#       define ATPX_DISCRETE_GPU                                   1
311254885Sdumbbell#define ATPX_FUNCTION_I2C_MUX_CONTROL                              0x4
312254885Sdumbbell/* ARG0: ATPX_FUNCTION_I2C_MUX_CONTROL
313254885Sdumbbell * ARG1:
314254885Sdumbbell * WORD  - structure size in bytes (includes size field)
315254885Sdumbbell * WORD  - i2c/aux/hpd mux control (0: iGPU, 1: dGPU)
316254885Sdumbbell * OUTPUT: none
317254885Sdumbbell */
318254885Sdumbbell#define ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_START_NOTIFICATION    0x5
319254885Sdumbbell/* ARG0: ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_START_NOTIFICATION
320254885Sdumbbell * ARG1:
321254885Sdumbbell * WORD  - structure size in bytes (includes size field)
322254885Sdumbbell * WORD  - target gpu (0: iGPU, 1: dGPU)
323254885Sdumbbell * OUTPUT: none
324254885Sdumbbell */
325254885Sdumbbell#define ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_END_NOTIFICATION      0x6
326254885Sdumbbell/* ARG0: ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_END_NOTIFICATION
327254885Sdumbbell * ARG1:
328254885Sdumbbell * WORD  - structure size in bytes (includes size field)
329254885Sdumbbell * WORD  - target gpu (0: iGPU, 1: dGPU)
330254885Sdumbbell * OUTPUT: none
331254885Sdumbbell */
332254885Sdumbbell#define ATPX_FUNCTION_GET_DISPLAY_CONNECTORS_MAPPING               0x8
333254885Sdumbbell/* ARG0: ATPX_FUNCTION_GET_DISPLAY_CONNECTORS_MAPPING
334254885Sdumbbell * ARG1: none
335254885Sdumbbell * OUTPUT:
336254885Sdumbbell * WORD  - number of display connectors
337254885Sdumbbell * WORD  - connector structure size in bytes (excludes connector size field)
338254885Sdumbbell * BYTE  - flags                                                     \
339254885Sdumbbell * BYTE  - ATIF display vector bit position                           } repeated
340254885Sdumbbell * BYTE  - adapter id (0: iGPU, 1-n: dGPU ordered by pcie bus number) } structure
341254885Sdumbbell * WORD  - connector ACPI id                                         /
342254885Sdumbbell */
343254885Sdumbbell/* flags */
344254885Sdumbbell#       define ATPX_DISPLAY_OUTPUT_SUPPORTED_BY_ADAPTER_ID_DEVICE  (1 << 0)
345254885Sdumbbell#       define ATPX_DISPLAY_HPD_SUPPORTED_BY_ADAPTER_ID_DEVICE     (1 << 1)
346254885Sdumbbell#       define ATPX_DISPLAY_I2C_SUPPORTED_BY_ADAPTER_ID_DEVICE     (1 << 2)
347254885Sdumbbell#define ATPX_FUNCTION_GET_DISPLAY_DETECTION_PORTS                  0x9
348254885Sdumbbell/* ARG0: ATPX_FUNCTION_GET_DISPLAY_DETECTION_PORTS
349254885Sdumbbell * ARG1: none
350254885Sdumbbell * OUTPUT:
351254885Sdumbbell * WORD  - number of HPD/DDC ports
352254885Sdumbbell * WORD  - port structure size in bytes (excludes port size field)
353254885Sdumbbell * BYTE  - ATIF display vector bit position \
354254885Sdumbbell * BYTE  - hpd id                            } reapeated structure
355254885Sdumbbell * BYTE  - ddc id                           /
356254885Sdumbbell *
357254885Sdumbbell * available on A+A systems only
358254885Sdumbbell */
359254885Sdumbbell/* hpd id */
360254885Sdumbbell#       define ATPX_HPD_NONE                                       0
361254885Sdumbbell#       define ATPX_HPD1                                           1
362254885Sdumbbell#       define ATPX_HPD2                                           2
363254885Sdumbbell#       define ATPX_HPD3                                           3
364254885Sdumbbell#       define ATPX_HPD4                                           4
365254885Sdumbbell#       define ATPX_HPD5                                           5
366254885Sdumbbell#       define ATPX_HPD6                                           6
367254885Sdumbbell/* ddc id */
368254885Sdumbbell#       define ATPX_DDC_NONE                                       0
369254885Sdumbbell#       define ATPX_DDC1                                           1
370254885Sdumbbell#       define ATPX_DDC2                                           2
371254885Sdumbbell#       define ATPX_DDC3                                           3
372254885Sdumbbell#       define ATPX_DDC4                                           4
373254885Sdumbbell#       define ATPX_DDC5                                           5
374254885Sdumbbell#       define ATPX_DDC6                                           6
375254885Sdumbbell#       define ATPX_DDC7                                           7
376254885Sdumbbell#       define ATPX_DDC8                                           8
377254885Sdumbbell
378254885Sdumbbell/* ATCS */
379254885Sdumbbell#define ATCS_FUNCTION_VERIFY_INTERFACE                             0x0
380254885Sdumbbell/* ARG0: ATCS_FUNCTION_VERIFY_INTERFACE
381254885Sdumbbell * ARG1: none
382254885Sdumbbell * OUTPUT:
383254885Sdumbbell * WORD  - structure size in bytes (includes size field)
384254885Sdumbbell * WORD  - version
385254885Sdumbbell * DWORD - supported functions bit vector
386254885Sdumbbell */
387254885Sdumbbell/* supported functions vector */
388254885Sdumbbell#       define ATCS_GET_EXTERNAL_STATE_SUPPORTED                   (1 << 0)
389254885Sdumbbell#       define ATCS_PCIE_PERFORMANCE_REQUEST_SUPPORTED             (1 << 1)
390254885Sdumbbell#       define ATCS_PCIE_DEVICE_READY_NOTIFICATION_SUPPORTED       (1 << 2)
391254885Sdumbbell#       define ATCS_SET_PCIE_BUS_WIDTH_SUPPORTED                   (1 << 3)
392254885Sdumbbell#define ATCS_FUNCTION_GET_EXTERNAL_STATE                           0x1
393254885Sdumbbell/* ARG0: ATCS_FUNCTION_GET_EXTERNAL_STATE
394254885Sdumbbell * ARG1: none
395254885Sdumbbell * OUTPUT:
396254885Sdumbbell * WORD  - structure size in bytes (includes size field)
397254885Sdumbbell * DWORD - valid flags mask
398254885Sdumbbell * DWORD - flags (0: undocked, 1: docked)
399254885Sdumbbell */
400254885Sdumbbell/* flags */
401254885Sdumbbell#       define ATCS_DOCKED                                         (1 << 0)
402254885Sdumbbell#define ATCS_FUNCTION_PCIE_PERFORMANCE_REQUEST                     0x2
403254885Sdumbbell/* ARG0: ATCS_FUNCTION_PCIE_PERFORMANCE_REQUEST
404254885Sdumbbell * ARG1:
405254885Sdumbbell * WORD  - structure size in bytes (includes size field)
406254885Sdumbbell * WORD  - client id (bit 2-0: func num, 7-3: dev num, 15-8: bus num)
407254885Sdumbbell * WORD  - valid flags mask
408254885Sdumbbell * WORD  - flags
409254885Sdumbbell * BYTE  - request type
410254885Sdumbbell * BYTE  - performance request
411254885Sdumbbell * OUTPUT:
412254885Sdumbbell * WORD  - structure size in bytes (includes size field)
413254885Sdumbbell * BYTE  - return value
414254885Sdumbbell */
415254885Sdumbbell/* flags */
416254885Sdumbbell#       define ATCS_ADVERTISE_CAPS                                 (1 << 0)
417254885Sdumbbell#       define ATCS_WAIT_FOR_COMPLETION                            (1 << 1)
418254885Sdumbbell/* request type */
419254885Sdumbbell#       define ATCS_PCIE_LINK_SPEED                                1
420254885Sdumbbell/* performance request */
421254885Sdumbbell#       define ATCS_REMOVE                                         0
422254885Sdumbbell#       define ATCS_FORCE_LOW_POWER                                1
423254885Sdumbbell#       define ATCS_PERF_LEVEL_1                                   2 /* PCIE Gen 1 */
424254885Sdumbbell#       define ATCS_PERF_LEVEL_2                                   3 /* PCIE Gen 2 */
425254885Sdumbbell#       define ATCS_PERF_LEVEL_3                                   4 /* PCIE Gen 3 */
426254885Sdumbbell/* return value */
427254885Sdumbbell#       define ATCS_REQUEST_REFUSED                                1
428254885Sdumbbell#       define ATCS_REQUEST_COMPLETE                               2
429254885Sdumbbell#       define ATCS_REQUEST_IN_PROGRESS                            3
430254885Sdumbbell#define ATCS_FUNCTION_PCIE_DEVICE_READY_NOTIFICATION               0x3
431254885Sdumbbell/* ARG0: ATCS_FUNCTION_PCIE_DEVICE_READY_NOTIFICATION
432254885Sdumbbell * ARG1: none
433254885Sdumbbell * OUTPUT: none
434254885Sdumbbell */
435254885Sdumbbell#define ATCS_FUNCTION_SET_PCIE_BUS_WIDTH                           0x4
436254885Sdumbbell/* ARG0: ATCS_FUNCTION_SET_PCIE_BUS_WIDTH
437254885Sdumbbell * ARG1:
438254885Sdumbbell * WORD  - structure size in bytes (includes size field)
439254885Sdumbbell * WORD  - client id (bit 2-0: func num, 7-3: dev num, 15-8: bus num)
440254885Sdumbbell * BYTE  - number of active lanes
441254885Sdumbbell * OUTPUT:
442254885Sdumbbell * WORD  - structure size in bytes (includes size field)
443254885Sdumbbell * BYTE  - number of active lanes
444254885Sdumbbell */
445254885Sdumbbell
446254885Sdumbbell#endif
447