xref: /dragonfly/sys/dev/drm/amd/include/amd_acpi.h (revision ed183f8c)
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_FUNCTION_GET_SYSTEM_PARAMETERS                        0x1
150 /* ARG0: ATIF_FUNCTION_GET_SYSTEM_PARAMETERS
151  * ARG1: none
152  * OUTPUT:
153  * WORD  - structure size in bytes (includes size field)
154  * DWORD - valid flags mask
155  * DWORD - flags
156  *
157  * OR
158  *
159  * WORD  - structure size in bytes (includes size field)
160  * DWORD - valid flags mask
161  * DWORD - flags
162  * BYTE  - notify command code
163  *
164  * flags
165  * bits 1:0:
166  * 0 - Notify(VGA, 0x81) is not used for notification
167  * 1 - Notify(VGA, 0x81) is used for notification
168  * 2 - Notify(VGA, n) is used for notification where
169  * n (0xd0-0xd9) is specified in notify command code.
170  * bit 2:
171  * 1 - lid changes not reported though int10
172  */
173 #define ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS                     0x2
174 /* ARG0: ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS
175  * ARG1: none
176  * OUTPUT:
177  * WORD  - structure size in bytes (includes size field)
178  * DWORD - pending sbios requests
179  * BYTE  - panel expansion mode
180  * BYTE  - thermal state: target gfx controller
181  * BYTE  - thermal state: state id (0: exit state, non-0: state)
182  * BYTE  - forced power state: target gfx controller
183  * BYTE  - forced power state: state id
184  * BYTE  - system power source
185  * BYTE  - panel backlight level (0-255)
186  */
187 /* pending sbios requests */
188 #       define ATIF_DISPLAY_SWITCH_REQUEST                         (1 << 0)
189 #       define ATIF_EXPANSION_MODE_CHANGE_REQUEST                  (1 << 1)
190 #       define ATIF_THERMAL_STATE_CHANGE_REQUEST                   (1 << 2)
191 #       define ATIF_FORCED_POWER_STATE_CHANGE_REQUEST              (1 << 3)
192 #       define ATIF_SYSTEM_POWER_SOURCE_CHANGE_REQUEST             (1 << 4)
193 #       define ATIF_DISPLAY_CONF_CHANGE_REQUEST                    (1 << 5)
194 #       define ATIF_PX_GFX_SWITCH_REQUEST                          (1 << 6)
195 #       define ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST                (1 << 7)
196 #       define ATIF_DGPU_DISPLAY_EVENT                             (1 << 8)
197 /* panel expansion mode */
198 #       define ATIF_PANEL_EXPANSION_DISABLE                        0
199 #       define ATIF_PANEL_EXPANSION_FULL                           1
200 #       define ATIF_PANEL_EXPANSION_ASPECT                         2
201 /* target gfx controller */
202 #       define ATIF_TARGET_GFX_SINGLE                              0
203 #       define ATIF_TARGET_GFX_PX_IGPU                             1
204 #       define ATIF_TARGET_GFX_PX_DGPU                             2
205 /* system power source */
206 #       define ATIF_POWER_SOURCE_AC                                1
207 #       define ATIF_POWER_SOURCE_DC                                2
208 #       define ATIF_POWER_SOURCE_RESTRICTED_AC_1                   3
209 #       define ATIF_POWER_SOURCE_RESTRICTED_AC_2                   4
210 #define ATIF_FUNCTION_SELECT_ACTIVE_DISPLAYS                       0x3
211 /* ARG0: ATIF_FUNCTION_SELECT_ACTIVE_DISPLAYS
212  * ARG1:
213  * WORD  - structure size in bytes (includes size field)
214  * WORD  - selected displays
215  * WORD  - connected displays
216  * OUTPUT:
217  * WORD  - structure size in bytes (includes size field)
218  * WORD  - selected displays
219  */
220 #       define ATIF_LCD1                                           (1 << 0)
221 #       define ATIF_CRT1                                           (1 << 1)
222 #       define ATIF_TV                                             (1 << 2)
223 #       define ATIF_DFP1                                           (1 << 3)
224 #       define ATIF_CRT2                                           (1 << 4)
225 #       define ATIF_LCD2                                           (1 << 5)
226 #       define ATIF_DFP2                                           (1 << 7)
227 #       define ATIF_CV                                             (1 << 8)
228 #       define ATIF_DFP3                                           (1 << 9)
229 #       define ATIF_DFP4                                           (1 << 10)
230 #       define ATIF_DFP5                                           (1 << 11)
231 #       define ATIF_DFP6                                           (1 << 12)
232 #define ATIF_FUNCTION_GET_LID_STATE                                0x4
233 /* ARG0: ATIF_FUNCTION_GET_LID_STATE
234  * ARG1: none
235  * OUTPUT:
236  * WORD  - structure size in bytes (includes size field)
237  * BYTE  - lid state (0: open, 1: closed)
238  *
239  * GET_LID_STATE only works at boot and resume, for general lid
240  * status, use the kernel provided status
241  */
242 #define ATIF_FUNCTION_GET_TV_STANDARD_FROM_CMOS                    0x5
243 /* ARG0: ATIF_FUNCTION_GET_TV_STANDARD_FROM_CMOS
244  * ARG1: none
245  * OUTPUT:
246  * WORD  - structure size in bytes (includes size field)
247  * BYTE  - 0
248  * BYTE  - TV standard
249  */
250 #       define ATIF_TV_STD_NTSC                                    0
251 #       define ATIF_TV_STD_PAL                                     1
252 #       define ATIF_TV_STD_PALM                                    2
253 #       define ATIF_TV_STD_PAL60                                   3
254 #       define ATIF_TV_STD_NTSCJ                                   4
255 #       define ATIF_TV_STD_PALCN                                   5
256 #       define ATIF_TV_STD_PALN                                    6
257 #       define ATIF_TV_STD_SCART_RGB                               9
258 #define ATIF_FUNCTION_SET_TV_STANDARD_IN_CMOS                      0x6
259 /* ARG0: ATIF_FUNCTION_SET_TV_STANDARD_IN_CMOS
260  * ARG1:
261  * WORD  - structure size in bytes (includes size field)
262  * BYTE  - 0
263  * BYTE  - TV standard
264  * OUTPUT: none
265  */
266 #define ATIF_FUNCTION_GET_PANEL_EXPANSION_MODE_FROM_CMOS           0x7
267 /* ARG0: ATIF_FUNCTION_GET_PANEL_EXPANSION_MODE_FROM_CMOS
268  * ARG1: none
269  * OUTPUT:
270  * WORD  - structure size in bytes (includes size field)
271  * BYTE  - panel expansion mode
272  */
273 #define ATIF_FUNCTION_SET_PANEL_EXPANSION_MODE_IN_CMOS             0x8
274 /* ARG0: ATIF_FUNCTION_SET_PANEL_EXPANSION_MODE_IN_CMOS
275  * ARG1:
276  * WORD  - structure size in bytes (includes size field)
277  * BYTE  - panel expansion mode
278  * OUTPUT: none
279  */
280 #define ATIF_FUNCTION_TEMPERATURE_CHANGE_NOTIFICATION              0xD
281 /* ARG0: ATIF_FUNCTION_TEMPERATURE_CHANGE_NOTIFICATION
282  * ARG1:
283  * WORD  - structure size in bytes (includes size field)
284  * WORD  - gfx controller id
285  * BYTE  - current temperature (degress Celsius)
286  * OUTPUT: none
287  */
288 #define ATIF_FUNCTION_GET_GRAPHICS_DEVICE_TYPES                    0xF
289 /* ARG0: ATIF_FUNCTION_GET_GRAPHICS_DEVICE_TYPES
290  * ARG1: none
291  * OUTPUT:
292  * WORD  - number of gfx devices
293  * WORD  - device structure size in bytes (excludes device size field)
294  * DWORD - flags         \
295  * WORD  - bus number     } repeated structure
296  * WORD  - device number /
297  */
298 /* flags */
299 #       define ATIF_PX_REMOVABLE_GRAPHICS_DEVICE                   (1 << 0)
300 #       define ATIF_XGP_PORT                                       (1 << 1)
301 #       define ATIF_VGA_ENABLED_GRAPHICS_DEVICE                    (1 << 2)
302 #       define ATIF_XGP_PORT_IN_DOCK                               (1 << 3)
303 
304 /* ATPX */
305 #define ATPX_FUNCTION_VERIFY_INTERFACE                             0x0
306 /* ARG0: ATPX_FUNCTION_VERIFY_INTERFACE
307  * ARG1: none
308  * OUTPUT:
309  * WORD  - structure size in bytes (includes size field)
310  * WORD  - version
311  * DWORD - supported functions bit vector
312  */
313 /* supported functions vector */
314 #       define ATPX_GET_PX_PARAMETERS_SUPPORTED                    (1 << 0)
315 #       define ATPX_POWER_CONTROL_SUPPORTED                        (1 << 1)
316 #       define ATPX_DISPLAY_MUX_CONTROL_SUPPORTED                  (1 << 2)
317 #       define ATPX_I2C_MUX_CONTROL_SUPPORTED                      (1 << 3)
318 #       define ATPX_GRAPHICS_DEVICE_SWITCH_START_NOTIFICATION_SUPPORTED (1 << 4)
319 #       define ATPX_GRAPHICS_DEVICE_SWITCH_END_NOTIFICATION_SUPPORTED   (1 << 5)
320 #       define ATPX_GET_DISPLAY_CONNECTORS_MAPPING_SUPPORTED       (1 << 7)
321 #       define ATPX_GET_DISPLAY_DETECTION_PORTS_SUPPORTED          (1 << 8)
322 #define ATPX_FUNCTION_GET_PX_PARAMETERS                            0x1
323 /* ARG0: ATPX_FUNCTION_GET_PX_PARAMETERS
324  * ARG1: none
325  * OUTPUT:
326  * WORD  - structure size in bytes (includes size field)
327  * DWORD - valid flags mask
328  * DWORD - flags
329  */
330 /* flags */
331 #       define ATPX_LVDS_I2C_AVAILABLE_TO_BOTH_GPUS                (1 << 0)
332 #       define ATPX_CRT1_I2C_AVAILABLE_TO_BOTH_GPUS                (1 << 1)
333 #       define ATPX_DVI1_I2C_AVAILABLE_TO_BOTH_GPUS                (1 << 2)
334 #       define ATPX_CRT1_RGB_SIGNAL_MUXED                          (1 << 3)
335 #       define ATPX_TV_SIGNAL_MUXED                                (1 << 4)
336 #       define ATPX_DFP_SIGNAL_MUXED                               (1 << 5)
337 #       define ATPX_SEPARATE_MUX_FOR_I2C                           (1 << 6)
338 #       define ATPX_DYNAMIC_PX_SUPPORTED                           (1 << 7)
339 #       define ATPX_ACF_NOT_SUPPORTED                              (1 << 8)
340 #       define ATPX_FIXED_NOT_SUPPORTED                            (1 << 9)
341 #       define ATPX_DYNAMIC_DGPU_POWER_OFF_SUPPORTED               (1 << 10)
342 #       define ATPX_DGPU_REQ_POWER_FOR_DISPLAYS                    (1 << 11)
343 #       define ATPX_DGPU_CAN_DRIVE_DISPLAYS                        (1 << 12)
344 #       define ATPX_MS_HYBRID_GFX_SUPPORTED                        (1 << 14)
345 #define ATPX_FUNCTION_POWER_CONTROL                                0x2
346 /* ARG0: ATPX_FUNCTION_POWER_CONTROL
347  * ARG1:
348  * WORD  - structure size in bytes (includes size field)
349  * BYTE  - dGPU power state (0: power off, 1: power on)
350  * OUTPUT: none
351  */
352 #define ATPX_FUNCTION_DISPLAY_MUX_CONTROL                          0x3
353 /* ARG0: ATPX_FUNCTION_DISPLAY_MUX_CONTROL
354  * ARG1:
355  * WORD  - structure size in bytes (includes size field)
356  * WORD  - display mux control (0: iGPU, 1: dGPU)
357  * OUTPUT: none
358  */
359 #       define ATPX_INTEGRATED_GPU                                 0
360 #       define ATPX_DISCRETE_GPU                                   1
361 #define ATPX_FUNCTION_I2C_MUX_CONTROL                              0x4
362 /* ARG0: ATPX_FUNCTION_I2C_MUX_CONTROL
363  * ARG1:
364  * WORD  - structure size in bytes (includes size field)
365  * WORD  - i2c/aux/hpd mux control (0: iGPU, 1: dGPU)
366  * OUTPUT: none
367  */
368 #define ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_START_NOTIFICATION    0x5
369 /* ARG0: ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_START_NOTIFICATION
370  * ARG1:
371  * WORD  - structure size in bytes (includes size field)
372  * WORD  - target gpu (0: iGPU, 1: dGPU)
373  * OUTPUT: none
374  */
375 #define ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_END_NOTIFICATION      0x6
376 /* ARG0: ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_END_NOTIFICATION
377  * ARG1:
378  * WORD  - structure size in bytes (includes size field)
379  * WORD  - target gpu (0: iGPU, 1: dGPU)
380  * OUTPUT: none
381  */
382 #define ATPX_FUNCTION_GET_DISPLAY_CONNECTORS_MAPPING               0x8
383 /* ARG0: ATPX_FUNCTION_GET_DISPLAY_CONNECTORS_MAPPING
384  * ARG1: none
385  * OUTPUT:
386  * WORD  - number of display connectors
387  * WORD  - connector structure size in bytes (excludes connector size field)
388  * BYTE  - flags                                                     \
389  * BYTE  - ATIF display vector bit position                           } repeated
390  * BYTE  - adapter id (0: iGPU, 1-n: dGPU ordered by pcie bus number) } structure
391  * WORD  - connector ACPI id                                         /
392  */
393 /* flags */
394 #       define ATPX_DISPLAY_OUTPUT_SUPPORTED_BY_ADAPTER_ID_DEVICE  (1 << 0)
395 #       define ATPX_DISPLAY_HPD_SUPPORTED_BY_ADAPTER_ID_DEVICE     (1 << 1)
396 #       define ATPX_DISPLAY_I2C_SUPPORTED_BY_ADAPTER_ID_DEVICE     (1 << 2)
397 #define ATPX_FUNCTION_GET_DISPLAY_DETECTION_PORTS                  0x9
398 /* ARG0: ATPX_FUNCTION_GET_DISPLAY_DETECTION_PORTS
399  * ARG1: none
400  * OUTPUT:
401  * WORD  - number of HPD/DDC ports
402  * WORD  - port structure size in bytes (excludes port size field)
403  * BYTE  - ATIF display vector bit position \
404  * BYTE  - hpd id                            } reapeated structure
405  * BYTE  - ddc id                           /
406  *
407  * available on A+A systems only
408  */
409 /* hpd id */
410 #       define ATPX_HPD_NONE                                       0
411 #       define ATPX_HPD1                                           1
412 #       define ATPX_HPD2                                           2
413 #       define ATPX_HPD3                                           3
414 #       define ATPX_HPD4                                           4
415 #       define ATPX_HPD5                                           5
416 #       define ATPX_HPD6                                           6
417 /* ddc id */
418 #       define ATPX_DDC_NONE                                       0
419 #       define ATPX_DDC1                                           1
420 #       define ATPX_DDC2                                           2
421 #       define ATPX_DDC3                                           3
422 #       define ATPX_DDC4                                           4
423 #       define ATPX_DDC5                                           5
424 #       define ATPX_DDC6                                           6
425 #       define ATPX_DDC7                                           7
426 #       define ATPX_DDC8                                           8
427 
428 /* ATCS */
429 #define ATCS_FUNCTION_VERIFY_INTERFACE                             0x0
430 /* ARG0: ATCS_FUNCTION_VERIFY_INTERFACE
431  * ARG1: none
432  * OUTPUT:
433  * WORD  - structure size in bytes (includes size field)
434  * WORD  - version
435  * DWORD - supported functions bit vector
436  */
437 /* supported functions vector */
438 #       define ATCS_GET_EXTERNAL_STATE_SUPPORTED                   (1 << 0)
439 #       define ATCS_PCIE_PERFORMANCE_REQUEST_SUPPORTED             (1 << 1)
440 #       define ATCS_PCIE_DEVICE_READY_NOTIFICATION_SUPPORTED       (1 << 2)
441 #       define ATCS_SET_PCIE_BUS_WIDTH_SUPPORTED                   (1 << 3)
442 #define ATCS_FUNCTION_GET_EXTERNAL_STATE                           0x1
443 /* ARG0: ATCS_FUNCTION_GET_EXTERNAL_STATE
444  * ARG1: none
445  * OUTPUT:
446  * WORD  - structure size in bytes (includes size field)
447  * DWORD - valid flags mask
448  * DWORD - flags (0: undocked, 1: docked)
449  */
450 /* flags */
451 #       define ATCS_DOCKED                                         (1 << 0)
452 #define ATCS_FUNCTION_PCIE_PERFORMANCE_REQUEST                     0x2
453 /* ARG0: ATCS_FUNCTION_PCIE_PERFORMANCE_REQUEST
454  * ARG1:
455  * WORD  - structure size in bytes (includes size field)
456  * WORD  - client id (bit 2-0: func num, 7-3: dev num, 15-8: bus num)
457  * WORD  - valid flags mask
458  * WORD  - flags
459  * BYTE  - request type
460  * BYTE  - performance request
461  * OUTPUT:
462  * WORD  - structure size in bytes (includes size field)
463  * BYTE  - return value
464  */
465 /* flags */
466 #       define ATCS_ADVERTISE_CAPS                                 (1 << 0)
467 #       define ATCS_WAIT_FOR_COMPLETION                            (1 << 1)
468 /* request type */
469 #       define ATCS_PCIE_LINK_SPEED                                1
470 /* performance request */
471 #       define ATCS_REMOVE                                         0
472 #       define ATCS_FORCE_LOW_POWER                                1
473 #       define ATCS_PERF_LEVEL_1                                   2 /* PCIE Gen 1 */
474 #       define ATCS_PERF_LEVEL_2                                   3 /* PCIE Gen 2 */
475 #       define ATCS_PERF_LEVEL_3                                   4 /* PCIE Gen 3 */
476 /* return value */
477 #       define ATCS_REQUEST_REFUSED                                1
478 #       define ATCS_REQUEST_COMPLETE                               2
479 #       define ATCS_REQUEST_IN_PROGRESS                            3
480 #define ATCS_FUNCTION_PCIE_DEVICE_READY_NOTIFICATION               0x3
481 /* ARG0: ATCS_FUNCTION_PCIE_DEVICE_READY_NOTIFICATION
482  * ARG1: none
483  * OUTPUT: none
484  */
485 #define ATCS_FUNCTION_SET_PCIE_BUS_WIDTH                           0x4
486 /* ARG0: ATCS_FUNCTION_SET_PCIE_BUS_WIDTH
487  * ARG1:
488  * WORD  - structure size in bytes (includes size field)
489  * WORD  - client id (bit 2-0: func num, 7-3: dev num, 15-8: bus num)
490  * BYTE  - number of active lanes
491  * OUTPUT:
492  * WORD  - structure size in bytes (includes size field)
493  * BYTE  - number of active lanes
494  */
495 
496 #endif
497