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