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