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 struct atif_qbtc_arguments {
56 	u16 size;		/* structure size in bytes (includes size field) */
57 	u8 requested_display;	/* which display is requested */
58 } __packed;
59 
60 #define ATIF_QBTC_MAX_DATA_POINTS 99
61 
62 struct atif_qbtc_data_point {
63 	u8 luminance;		/* luminance in percent */
64 	u8 ipnut_signal;	/* input signal in range 0-255 */
65 } __packed;
66 
67 struct atif_qbtc_output {
68 	u16 size;		/* structure size in bytes (includes size field) */
69 	u16 flags;		/* all zeroes */
70 	u8 error_code;		/* error code */
71 	u8 ac_level;		/* default brightness on AC power */
72 	u8 dc_level;		/* default brightness on DC power */
73 	u8 min_input_signal;	/* max input signal in range 0-255 */
74 	u8 max_input_signal;	/* min input signal in range 0-255 */
75 	u8 number_of_points;	/* number of data points */
76 	struct atif_qbtc_data_point data_points[ATIF_QBTC_MAX_DATA_POINTS];
77 } __packed;
78 
79 #define ATIF_NOTIFY_MASK	0x3
80 #define ATIF_NOTIFY_NONE	0
81 #define ATIF_NOTIFY_81		1
82 #define ATIF_NOTIFY_N		2
83 
84 struct atcs_verify_interface {
85 	u16 size;		/* structure size in bytes (includes size field) */
86 	u16 version;		/* version */
87 	u32 function_bits;	/* supported functions bit vector */
88 } __packed;
89 
90 #define ATCS_VALID_FLAGS_MASK	0x3
91 
92 struct atcs_pref_req_input {
93 	u16 size;		/* structure size in bytes (includes size field) */
94 	u16 client_id;		/* client id (bit 2-0: func num, 7-3: dev num, 15-8: bus num) */
95 	u16 valid_flags_mask;	/* valid flags mask */
96 	u16 flags;		/* flags */
97 	u8 req_type;		/* request type */
98 	u8 perf_req;		/* performance request */
99 } __packed;
100 
101 struct atcs_pref_req_output {
102 	u16 size;		/* structure size in bytes (includes size field) */
103 	u8 ret_val;		/* return value */
104 } __packed;
105 
106 /* AMD hw uses four ACPI control methods:
107  * 1. ATIF
108  * ARG0: (ACPI_INTEGER) function code
109  * ARG1: (ACPI_BUFFER) parameter buffer, 256 bytes
110  * OUTPUT: (ACPI_BUFFER) output buffer, 256 bytes
111  * ATIF provides an entry point for the gfx driver to interact with the sbios.
112  * The AMD ACPI notification mechanism uses Notify (VGA, 0x81) or a custom
113  * notification. Which notification is used as indicated by the ATIF Control
114  * Method GET_SYSTEM_PARAMETERS. When the driver receives Notify (VGA, 0x81) or
115  * a custom notification it invokes ATIF Control Method GET_SYSTEM_BIOS_REQUESTS
116  * to identify pending System BIOS requests and associated parameters. For
117  * example, if one of the pending requests is DISPLAY_SWITCH_REQUEST, the driver
118  * will perform display device detection and invoke ATIF Control Method
119  * SELECT_ACTIVE_DISPLAYS.
120  *
121  * 2. ATPX
122  * ARG0: (ACPI_INTEGER) function code
123  * ARG1: (ACPI_BUFFER) parameter buffer, 256 bytes
124  * OUTPUT: (ACPI_BUFFER) output buffer, 256 bytes
125  * ATPX methods are used on PowerXpress systems to handle mux switching and
126  * discrete GPU power control.
127  *
128  * 3. ATRM
129  * ARG0: (ACPI_INTEGER) offset of vbios rom data
130  * ARG1: (ACPI_BUFFER) size of the buffer to fill (up to 4K).
131  * OUTPUT: (ACPI_BUFFER) output buffer
132  * ATRM provides an interfacess to access the discrete GPU vbios image on
133  * PowerXpress systems with multiple GPUs.
134  *
135  * 4. ATCS
136  * ARG0: (ACPI_INTEGER) function code
137  * ARG1: (ACPI_BUFFER) parameter buffer, 256 bytes
138  * OUTPUT: (ACPI_BUFFER) output buffer, 256 bytes
139  * ATCS provides an interface to AMD chipset specific functionality.
140  *
141  */
142 /* ATIF */
143 #define ATIF_FUNCTION_VERIFY_INTERFACE                             0x0
144 /* ARG0: ATIF_FUNCTION_VERIFY_INTERFACE
145  * ARG1: none
146  * OUTPUT:
147  * WORD  - structure size in bytes (includes size field)
148  * WORD  - version
149  * DWORD - supported notifications mask
150  * DWORD - supported functions bit vector
151  */
152 /* Notifications mask */
153 #       define ATIF_THERMAL_STATE_CHANGE_REQUEST_SUPPORTED         (1 << 2)
154 #       define ATIF_FORCED_POWER_STATE_CHANGE_REQUEST_SUPPORTED    (1 << 3)
155 #       define ATIF_SYSTEM_POWER_SOURCE_CHANGE_REQUEST_SUPPORTED   (1 << 4)
156 #       define ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST_SUPPORTED      (1 << 7)
157 #       define ATIF_DGPU_DISPLAY_EVENT_SUPPORTED                   (1 << 8)
158 #       define ATIF_GPU_PACKAGE_POWER_LIMIT_REQUEST_SUPPORTED      (1 << 12)
159 /* supported functions vector */
160 #       define ATIF_GET_SYSTEM_PARAMETERS_SUPPORTED               (1 << 0)
161 #       define ATIF_GET_SYSTEM_BIOS_REQUESTS_SUPPORTED            (1 << 1)
162 #       define ATIF_TEMPERATURE_CHANGE_NOTIFICATION_SUPPORTED     (1 << 12)
163 #       define ATIF_QUERY_BACKLIGHT_TRANSFER_CHARACTERISTICS_SUPPORTED (1 << 15)
164 #       define ATIF_READY_TO_UNDOCK_NOTIFICATION_SUPPORTED        (1 << 16)
165 #       define ATIF_GET_EXTERNAL_GPU_INFORMATION_SUPPORTED        (1 << 20)
166 #define ATIF_FUNCTION_GET_SYSTEM_PARAMETERS                        0x1
167 /* ARG0: ATIF_FUNCTION_GET_SYSTEM_PARAMETERS
168  * ARG1: none
169  * OUTPUT:
170  * WORD  - structure size in bytes (includes size field)
171  * DWORD - valid flags mask
172  * DWORD - flags
173  *
174  * OR
175  *
176  * WORD  - structure size in bytes (includes size field)
177  * DWORD - valid flags mask
178  * DWORD - flags
179  * BYTE  - notify command code
180  *
181  * flags
182  * bits 1:0:
183  * 0 - Notify(VGA, 0x81) is not used for notification
184  * 1 - Notify(VGA, 0x81) is used for notification
185  * 2 - Notify(VGA, n) is used for notification where
186  * n (0xd0-0xd9) is specified in notify command code.
187  * bit 2:
188  * 1 - lid changes not reported though int10
189  * bit 3:
190  * 1 - system bios controls overclocking
191  * bit 4:
192  * 1 - enable overclocking
193  */
194 #define ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS                     0x2
195 /* ARG0: ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS
196  * ARG1: none
197  * OUTPUT:
198  * WORD  - structure size in bytes (includes size field)
199  * DWORD - pending sbios requests
200  * BYTE  - reserved (all zeroes)
201  * BYTE  - thermal state: target gfx controller
202  * BYTE  - thermal state: state id (0: exit state, non-0: state)
203  * BYTE  - forced power state: target gfx controller
204  * BYTE  - forced power state: state id (0: forced state, non-0: state)
205  * BYTE  - system power source
206  * BYTE  - panel backlight level (0-255)
207  * BYTE  - GPU package power limit: target gfx controller
208  * DWORD - GPU package power limit: value (24:8 fractional format, Watts)
209  */
210 /* pending sbios requests */
211 #       define ATIF_THERMAL_STATE_CHANGE_REQUEST                   (1 << 2)
212 #       define ATIF_FORCED_POWER_STATE_CHANGE_REQUEST              (1 << 3)
213 #       define ATIF_SYSTEM_POWER_SOURCE_CHANGE_REQUEST             (1 << 4)
214 #       define ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST                (1 << 7)
215 #       define ATIF_DGPU_DISPLAY_EVENT                             (1 << 8)
216 #       define ATIF_GPU_PACKAGE_POWER_LIMIT_REQUEST                (1 << 12)
217 /* target gfx controller */
218 #       define ATIF_TARGET_GFX_SINGLE                              0
219 #       define ATIF_TARGET_GFX_PX_IGPU                             1
220 #       define ATIF_TARGET_GFX_PX_DGPU                             2
221 /* system power source */
222 #       define ATIF_POWER_SOURCE_AC                                1
223 #       define ATIF_POWER_SOURCE_DC                                2
224 #       define ATIF_POWER_SOURCE_RESTRICTED_AC_1                   3
225 #       define ATIF_POWER_SOURCE_RESTRICTED_AC_2                   4
226 #define ATIF_FUNCTION_TEMPERATURE_CHANGE_NOTIFICATION              0xD
227 /* ARG0: ATIF_FUNCTION_TEMPERATURE_CHANGE_NOTIFICATION
228  * ARG1:
229  * WORD  - structure size in bytes (includes size field)
230  * WORD  - gfx controller id
231  * BYTE  - current temperature (degress Celsius)
232  * OUTPUT: none
233  */
234 #define ATIF_FUNCTION_QUERY_BRIGHTNESS_TRANSFER_CHARACTERISTICS    0x10
235 /* ARG0: ATIF_FUNCTION_QUERY_BRIGHTNESS_TRANSFER_CHARACTERISTICS
236  * ARG1:
237  * WORD  - structure size in bytes (includes size field)
238  * BYTE  - requested display
239  * OUTPUT:
240  * WORD  - structure size in bytes (includes size field)
241  * WORD  - flags (currently all 16 bits are reserved)
242  * BYTE  - error code (on failure, disregard all below fields)
243  * BYTE  - AC level (default brightness in percent when machine has full power)
244  * BYTE  - DC level (default brightness in percent when machine is on battery)
245  * BYTE  - min input signal, in range 0-255, corresponding to 0% backlight
246  * BYTE  - max input signal, in range 0-255, corresponding to 100% backlight
247  * BYTE  - number of reported data points
248  * BYTE  - luminance level in percent  \ repeated structure
249  * BYTE  - input signal in range 0-255 / does not have entries for 0% and 100%
250  */
251 /* requested display */
252 #       define ATIF_QBTC_REQUEST_LCD1                              0
253 #       define ATIF_QBTC_REQUEST_CRT1                              1
254 #       define ATIF_QBTC_REQUEST_DFP1                              3
255 #       define ATIF_QBTC_REQUEST_CRT2                              4
256 #       define ATIF_QBTC_REQUEST_LCD2                              5
257 #       define ATIF_QBTC_REQUEST_DFP2                              7
258 #       define ATIF_QBTC_REQUEST_DFP3                              9
259 #       define ATIF_QBTC_REQUEST_DFP4                              10
260 #       define ATIF_QBTC_REQUEST_DFP5                              11
261 #       define ATIF_QBTC_REQUEST_DFP6                              12
262 /* error code */
263 #       define ATIF_QBTC_ERROR_CODE_SUCCESS                        0
264 #       define ATIF_QBTC_ERROR_CODE_FAILURE                        1
265 #       define ATIF_QBTC_ERROR_CODE_DEVICE_NOT_SUPPORTED           2
266 #define ATIF_FUNCTION_READY_TO_UNDOCK_NOTIFICATION                 0x11
267 /* ARG0: ATIF_FUNCTION_READY_TO_UNDOCK_NOTIFICATION
268  * ARG1: none
269  * OUTPUT: none
270  */
271 #define ATIF_FUNCTION_GET_EXTERNAL_GPU_INFORMATION                 0x15
272 /* ARG0: ATIF_FUNCTION_GET_EXTERNAL_GPU_INFORMATION
273  * ARG1: none
274  * OUTPUT:
275  * WORD  - number of reported external gfx devices
276  * WORD  - device structure size in bytes (excludes device size field)
277  * WORD  - flags         \
278  * WORD  - bus number    / repeated structure
279  */
280 /* flags */
281 #       define ATIF_EXTERNAL_GRAPHICS_PORT                         (1 << 0)
282 
283 /* ATPX */
284 #define ATPX_FUNCTION_VERIFY_INTERFACE                             0x0
285 /* ARG0: ATPX_FUNCTION_VERIFY_INTERFACE
286  * ARG1: none
287  * OUTPUT:
288  * WORD  - structure size in bytes (includes size field)
289  * WORD  - version
290  * DWORD - supported functions bit vector
291  */
292 /* supported functions vector */
293 #       define ATPX_GET_PX_PARAMETERS_SUPPORTED                    (1 << 0)
294 #       define ATPX_POWER_CONTROL_SUPPORTED                        (1 << 1)
295 #       define ATPX_DISPLAY_MUX_CONTROL_SUPPORTED                  (1 << 2)
296 #       define ATPX_I2C_MUX_CONTROL_SUPPORTED                      (1 << 3)
297 #       define ATPX_GRAPHICS_DEVICE_SWITCH_START_NOTIFICATION_SUPPORTED (1 << 4)
298 #       define ATPX_GRAPHICS_DEVICE_SWITCH_END_NOTIFICATION_SUPPORTED   (1 << 5)
299 #       define ATPX_GET_DISPLAY_CONNECTORS_MAPPING_SUPPORTED       (1 << 7)
300 #       define ATPX_GET_DISPLAY_DETECTION_PORTS_SUPPORTED          (1 << 8)
301 #define ATPX_FUNCTION_GET_PX_PARAMETERS                            0x1
302 /* ARG0: ATPX_FUNCTION_GET_PX_PARAMETERS
303  * ARG1: none
304  * OUTPUT:
305  * WORD  - structure size in bytes (includes size field)
306  * DWORD - valid flags mask
307  * DWORD - flags
308  */
309 /* flags */
310 #       define ATPX_LVDS_I2C_AVAILABLE_TO_BOTH_GPUS                (1 << 0)
311 #       define ATPX_CRT1_I2C_AVAILABLE_TO_BOTH_GPUS                (1 << 1)
312 #       define ATPX_DVI1_I2C_AVAILABLE_TO_BOTH_GPUS                (1 << 2)
313 #       define ATPX_CRT1_RGB_SIGNAL_MUXED                          (1 << 3)
314 #       define ATPX_TV_SIGNAL_MUXED                                (1 << 4)
315 #       define ATPX_DFP_SIGNAL_MUXED                               (1 << 5)
316 #       define ATPX_SEPARATE_MUX_FOR_I2C                           (1 << 6)
317 #       define ATPX_DYNAMIC_PX_SUPPORTED                           (1 << 7)
318 #       define ATPX_ACF_NOT_SUPPORTED                              (1 << 8)
319 #       define ATPX_FIXED_NOT_SUPPORTED                            (1 << 9)
320 #       define ATPX_DYNAMIC_DGPU_POWER_OFF_SUPPORTED               (1 << 10)
321 #       define ATPX_DGPU_REQ_POWER_FOR_DISPLAYS                    (1 << 11)
322 #       define ATPX_DGPU_CAN_DRIVE_DISPLAYS                        (1 << 12)
323 #       define ATPX_MS_HYBRID_GFX_SUPPORTED                        (1 << 14)
324 #define ATPX_FUNCTION_POWER_CONTROL                                0x2
325 /* ARG0: ATPX_FUNCTION_POWER_CONTROL
326  * ARG1:
327  * WORD  - structure size in bytes (includes size field)
328  * BYTE  - dGPU power state (0: power off, 1: power on)
329  * OUTPUT: none
330  */
331 #define ATPX_FUNCTION_DISPLAY_MUX_CONTROL                          0x3
332 /* ARG0: ATPX_FUNCTION_DISPLAY_MUX_CONTROL
333  * ARG1:
334  * WORD  - structure size in bytes (includes size field)
335  * WORD  - display mux control (0: iGPU, 1: dGPU)
336  * OUTPUT: none
337  */
338 #       define ATPX_INTEGRATED_GPU                                 0
339 #       define ATPX_DISCRETE_GPU                                   1
340 #define ATPX_FUNCTION_I2C_MUX_CONTROL                              0x4
341 /* ARG0: ATPX_FUNCTION_I2C_MUX_CONTROL
342  * ARG1:
343  * WORD  - structure size in bytes (includes size field)
344  * WORD  - i2c/aux/hpd mux control (0: iGPU, 1: dGPU)
345  * OUTPUT: none
346  */
347 #define ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_START_NOTIFICATION    0x5
348 /* ARG0: ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_START_NOTIFICATION
349  * ARG1:
350  * WORD  - structure size in bytes (includes size field)
351  * WORD  - target gpu (0: iGPU, 1: dGPU)
352  * OUTPUT: none
353  */
354 #define ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_END_NOTIFICATION      0x6
355 /* ARG0: ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_END_NOTIFICATION
356  * ARG1:
357  * WORD  - structure size in bytes (includes size field)
358  * WORD  - target gpu (0: iGPU, 1: dGPU)
359  * OUTPUT: none
360  */
361 #define ATPX_FUNCTION_GET_DISPLAY_CONNECTORS_MAPPING               0x8
362 /* ARG0: ATPX_FUNCTION_GET_DISPLAY_CONNECTORS_MAPPING
363  * ARG1: none
364  * OUTPUT:
365  * WORD  - number of display connectors
366  * WORD  - connector structure size in bytes (excludes connector size field)
367  * BYTE  - flags                                                     \
368  * BYTE  - ATIF display vector bit position                           } repeated
369  * BYTE  - adapter id (0: iGPU, 1-n: dGPU ordered by pcie bus number) } structure
370  * WORD  - connector ACPI id                                         /
371  */
372 /* flags */
373 #       define ATPX_DISPLAY_OUTPUT_SUPPORTED_BY_ADAPTER_ID_DEVICE  (1 << 0)
374 #       define ATPX_DISPLAY_HPD_SUPPORTED_BY_ADAPTER_ID_DEVICE     (1 << 1)
375 #       define ATPX_DISPLAY_I2C_SUPPORTED_BY_ADAPTER_ID_DEVICE     (1 << 2)
376 #define ATPX_FUNCTION_GET_DISPLAY_DETECTION_PORTS                  0x9
377 /* ARG0: ATPX_FUNCTION_GET_DISPLAY_DETECTION_PORTS
378  * ARG1: none
379  * OUTPUT:
380  * WORD  - number of HPD/DDC ports
381  * WORD  - port structure size in bytes (excludes port size field)
382  * BYTE  - ATIF display vector bit position \
383  * BYTE  - hpd id                            } reapeated structure
384  * BYTE  - ddc id                           /
385  *
386  * available on A+A systems only
387  */
388 /* hpd id */
389 #       define ATPX_HPD_NONE                                       0
390 #       define ATPX_HPD1                                           1
391 #       define ATPX_HPD2                                           2
392 #       define ATPX_HPD3                                           3
393 #       define ATPX_HPD4                                           4
394 #       define ATPX_HPD5                                           5
395 #       define ATPX_HPD6                                           6
396 /* ddc id */
397 #       define ATPX_DDC_NONE                                       0
398 #       define ATPX_DDC1                                           1
399 #       define ATPX_DDC2                                           2
400 #       define ATPX_DDC3                                           3
401 #       define ATPX_DDC4                                           4
402 #       define ATPX_DDC5                                           5
403 #       define ATPX_DDC6                                           6
404 #       define ATPX_DDC7                                           7
405 #       define ATPX_DDC8                                           8
406 
407 /* ATCS */
408 #define ATCS_FUNCTION_VERIFY_INTERFACE                             0x0
409 /* ARG0: ATCS_FUNCTION_VERIFY_INTERFACE
410  * ARG1: none
411  * OUTPUT:
412  * WORD  - structure size in bytes (includes size field)
413  * WORD  - version
414  * DWORD - supported functions bit vector
415  */
416 /* supported functions vector */
417 #       define ATCS_GET_EXTERNAL_STATE_SUPPORTED                   (1 << 0)
418 #       define ATCS_PCIE_PERFORMANCE_REQUEST_SUPPORTED             (1 << 1)
419 #       define ATCS_PCIE_DEVICE_READY_NOTIFICATION_SUPPORTED       (1 << 2)
420 #       define ATCS_SET_PCIE_BUS_WIDTH_SUPPORTED                   (1 << 3)
421 #define ATCS_FUNCTION_GET_EXTERNAL_STATE                           0x1
422 /* ARG0: ATCS_FUNCTION_GET_EXTERNAL_STATE
423  * ARG1: none
424  * OUTPUT:
425  * WORD  - structure size in bytes (includes size field)
426  * DWORD - valid flags mask
427  * DWORD - flags (0: undocked, 1: docked)
428  */
429 /* flags */
430 #       define ATCS_DOCKED                                         (1 << 0)
431 #define ATCS_FUNCTION_PCIE_PERFORMANCE_REQUEST                     0x2
432 /* ARG0: ATCS_FUNCTION_PCIE_PERFORMANCE_REQUEST
433  * ARG1:
434  * WORD  - structure size in bytes (includes size field)
435  * WORD  - client id (bit 2-0: func num, 7-3: dev num, 15-8: bus num)
436  * WORD  - valid flags mask
437  * WORD  - flags
438  * BYTE  - request type
439  * BYTE  - performance request
440  * OUTPUT:
441  * WORD  - structure size in bytes (includes size field)
442  * BYTE  - return value
443  */
444 /* flags */
445 #       define ATCS_ADVERTISE_CAPS                                 (1 << 0)
446 #       define ATCS_WAIT_FOR_COMPLETION                            (1 << 1)
447 /* request type */
448 #       define ATCS_PCIE_LINK_SPEED                                1
449 /* performance request */
450 #       define ATCS_REMOVE                                         0
451 #       define ATCS_FORCE_LOW_POWER                                1
452 #       define ATCS_PERF_LEVEL_1                                   2 /* PCIE Gen 1 */
453 #       define ATCS_PERF_LEVEL_2                                   3 /* PCIE Gen 2 */
454 #       define ATCS_PERF_LEVEL_3                                   4 /* PCIE Gen 3 */
455 /* return value */
456 #       define ATCS_REQUEST_REFUSED                                1
457 #       define ATCS_REQUEST_COMPLETE                               2
458 #       define ATCS_REQUEST_IN_PROGRESS                            3
459 #define ATCS_FUNCTION_PCIE_DEVICE_READY_NOTIFICATION               0x3
460 /* ARG0: ATCS_FUNCTION_PCIE_DEVICE_READY_NOTIFICATION
461  * ARG1: none
462  * OUTPUT: none
463  */
464 #define ATCS_FUNCTION_SET_PCIE_BUS_WIDTH                           0x4
465 /* ARG0: ATCS_FUNCTION_SET_PCIE_BUS_WIDTH
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  * BYTE  - number of active lanes
470  * OUTPUT:
471  * WORD  - structure size in bytes (includes size field)
472  * BYTE  - number of active lanes
473  */
474 
475 #endif
476