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