amdgpu_acpi.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  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. #ifndef AMDGPU_ACPI_H
  24. #define AMDGPU_ACPI_H
  25. struct amdgpu_device;
  26. struct acpi_bus_event;
  27. int amdgpu_atif_handler(struct amdgpu_device *adev,
  28. struct acpi_bus_event *event);
  29. /* AMD hw uses four ACPI control methods:
  30. * 1. ATIF
  31. * ARG0: (ACPI_INTEGER) function code
  32. * ARG1: (ACPI_BUFFER) parameter buffer, 256 bytes
  33. * OUTPUT: (ACPI_BUFFER) output buffer, 256 bytes
  34. * ATIF provides an entry point for the gfx driver to interact with the sbios.
  35. * The AMD ACPI notification mechanism uses Notify (VGA, 0x81) or a custom
  36. * notification. Which notification is used as indicated by the ATIF Control
  37. * Method GET_SYSTEM_PARAMETERS. When the driver receives Notify (VGA, 0x81) or
  38. * a custom notification it invokes ATIF Control Method GET_SYSTEM_BIOS_REQUESTS
  39. * to identify pending System BIOS requests and associated parameters. For
  40. * example, if one of the pending requests is DISPLAY_SWITCH_REQUEST, the driver
  41. * will perform display device detection and invoke ATIF Control Method
  42. * SELECT_ACTIVE_DISPLAYS.
  43. *
  44. * 2. ATPX
  45. * ARG0: (ACPI_INTEGER) function code
  46. * ARG1: (ACPI_BUFFER) parameter buffer, 256 bytes
  47. * OUTPUT: (ACPI_BUFFER) output buffer, 256 bytes
  48. * ATPX methods are used on PowerXpress systems to handle mux switching and
  49. * discrete GPU power control.
  50. *
  51. * 3. ATRM
  52. * ARG0: (ACPI_INTEGER) offset of vbios rom data
  53. * ARG1: (ACPI_BUFFER) size of the buffer to fill (up to 4K).
  54. * OUTPUT: (ACPI_BUFFER) output buffer
  55. * ATRM provides an interfacess to access the discrete GPU vbios image on
  56. * PowerXpress systems with multiple GPUs.
  57. *
  58. * 4. ATCS
  59. * ARG0: (ACPI_INTEGER) function code
  60. * ARG1: (ACPI_BUFFER) parameter buffer, 256 bytes
  61. * OUTPUT: (ACPI_BUFFER) output buffer, 256 bytes
  62. * ATCS provides an interface to AMD chipset specific functionality.
  63. *
  64. */
  65. /* ATIF */
  66. #define ATIF_FUNCTION_VERIFY_INTERFACE 0x0
  67. /* ARG0: ATIF_FUNCTION_VERIFY_INTERFACE
  68. * ARG1: none
  69. * OUTPUT:
  70. * WORD - structure size in bytes (includes size field)
  71. * WORD - version
  72. * DWORD - supported notifications mask
  73. * DWORD - supported functions bit vector
  74. */
  75. /* Notifications mask */
  76. # define ATIF_DISPLAY_SWITCH_REQUEST_SUPPORTED (1 << 0)
  77. # define ATIF_EXPANSION_MODE_CHANGE_REQUEST_SUPPORTED (1 << 1)
  78. # define ATIF_THERMAL_STATE_CHANGE_REQUEST_SUPPORTED (1 << 2)
  79. # define ATIF_FORCED_POWER_STATE_CHANGE_REQUEST_SUPPORTED (1 << 3)
  80. # define ATIF_SYSTEM_POWER_SOURCE_CHANGE_REQUEST_SUPPORTED (1 << 4)
  81. # define ATIF_DISPLAY_CONF_CHANGE_REQUEST_SUPPORTED (1 << 5)
  82. # define ATIF_PX_GFX_SWITCH_REQUEST_SUPPORTED (1 << 6)
  83. # define ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST_SUPPORTED (1 << 7)
  84. # define ATIF_DGPU_DISPLAY_EVENT_SUPPORTED (1 << 8)
  85. /* supported functions vector */
  86. # define ATIF_GET_SYSTEM_PARAMETERS_SUPPORTED (1 << 0)
  87. # define ATIF_GET_SYSTEM_BIOS_REQUESTS_SUPPORTED (1 << 1)
  88. # define ATIF_SELECT_ACTIVE_DISPLAYS_SUPPORTED (1 << 2)
  89. # define ATIF_GET_LID_STATE_SUPPORTED (1 << 3)
  90. # define ATIF_GET_TV_STANDARD_FROM_CMOS_SUPPORTED (1 << 4)
  91. # define ATIF_SET_TV_STANDARD_IN_CMOS_SUPPORTED (1 << 5)
  92. # define ATIF_GET_PANEL_EXPANSION_MODE_FROM_CMOS_SUPPORTED (1 << 6)
  93. # define ATIF_SET_PANEL_EXPANSION_MODE_IN_CMOS_SUPPORTED (1 << 7)
  94. # define ATIF_TEMPERATURE_CHANGE_NOTIFICATION_SUPPORTED (1 << 12)
  95. # define ATIF_GET_GRAPHICS_DEVICE_TYPES_SUPPORTED (1 << 14)
  96. #define ATIF_FUNCTION_GET_SYSTEM_PARAMETERS 0x1
  97. /* ARG0: ATIF_FUNCTION_GET_SYSTEM_PARAMETERS
  98. * ARG1: none
  99. * OUTPUT:
  100. * WORD - structure size in bytes (includes size field)
  101. * DWORD - valid flags mask
  102. * DWORD - flags
  103. *
  104. * OR
  105. *
  106. * WORD - structure size in bytes (includes size field)
  107. * DWORD - valid flags mask
  108. * DWORD - flags
  109. * BYTE - notify command code
  110. *
  111. * flags
  112. * bits 1:0:
  113. * 0 - Notify(VGA, 0x81) is not used for notification
  114. * 1 - Notify(VGA, 0x81) is used for notification
  115. * 2 - Notify(VGA, n) is used for notification where
  116. * n (0xd0-0xd9) is specified in notify command code.
  117. * bit 2:
  118. * 1 - lid changes not reported though int10
  119. */
  120. #define ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS 0x2
  121. /* ARG0: ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS
  122. * ARG1: none
  123. * OUTPUT:
  124. * WORD - structure size in bytes (includes size field)
  125. * DWORD - pending sbios requests
  126. * BYTE - panel expansion mode
  127. * BYTE - thermal state: target gfx controller
  128. * BYTE - thermal state: state id (0: exit state, non-0: state)
  129. * BYTE - forced power state: target gfx controller
  130. * BYTE - forced power state: state id
  131. * BYTE - system power source
  132. * BYTE - panel backlight level (0-255)
  133. */
  134. /* pending sbios requests */
  135. # define ATIF_DISPLAY_SWITCH_REQUEST (1 << 0)
  136. # define ATIF_EXPANSION_MODE_CHANGE_REQUEST (1 << 1)
  137. # define ATIF_THERMAL_STATE_CHANGE_REQUEST (1 << 2)
  138. # define ATIF_FORCED_POWER_STATE_CHANGE_REQUEST (1 << 3)
  139. # define ATIF_SYSTEM_POWER_SOURCE_CHANGE_REQUEST (1 << 4)
  140. # define ATIF_DISPLAY_CONF_CHANGE_REQUEST (1 << 5)
  141. # define ATIF_PX_GFX_SWITCH_REQUEST (1 << 6)
  142. # define ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST (1 << 7)
  143. # define ATIF_DGPU_DISPLAY_EVENT (1 << 8)
  144. /* panel expansion mode */
  145. # define ATIF_PANEL_EXPANSION_DISABLE 0
  146. # define ATIF_PANEL_EXPANSION_FULL 1
  147. # define ATIF_PANEL_EXPANSION_ASPECT 2
  148. /* target gfx controller */
  149. # define ATIF_TARGET_GFX_SINGLE 0
  150. # define ATIF_TARGET_GFX_PX_IGPU 1
  151. # define ATIF_TARGET_GFX_PX_DGPU 2
  152. /* system power source */
  153. # define ATIF_POWER_SOURCE_AC 1
  154. # define ATIF_POWER_SOURCE_DC 2
  155. # define ATIF_POWER_SOURCE_RESTRICTED_AC_1 3
  156. # define ATIF_POWER_SOURCE_RESTRICTED_AC_2 4
  157. #define ATIF_FUNCTION_SELECT_ACTIVE_DISPLAYS 0x3
  158. /* ARG0: ATIF_FUNCTION_SELECT_ACTIVE_DISPLAYS
  159. * ARG1:
  160. * WORD - structure size in bytes (includes size field)
  161. * WORD - selected displays
  162. * WORD - connected displays
  163. * OUTPUT:
  164. * WORD - structure size in bytes (includes size field)
  165. * WORD - selected displays
  166. */
  167. # define ATIF_LCD1 (1 << 0)
  168. # define ATIF_CRT1 (1 << 1)
  169. # define ATIF_TV (1 << 2)
  170. # define ATIF_DFP1 (1 << 3)
  171. # define ATIF_CRT2 (1 << 4)
  172. # define ATIF_LCD2 (1 << 5)
  173. # define ATIF_DFP2 (1 << 7)
  174. # define ATIF_CV (1 << 8)
  175. # define ATIF_DFP3 (1 << 9)
  176. # define ATIF_DFP4 (1 << 10)
  177. # define ATIF_DFP5 (1 << 11)
  178. # define ATIF_DFP6 (1 << 12)
  179. #define ATIF_FUNCTION_GET_LID_STATE 0x4
  180. /* ARG0: ATIF_FUNCTION_GET_LID_STATE
  181. * ARG1: none
  182. * OUTPUT:
  183. * WORD - structure size in bytes (includes size field)
  184. * BYTE - lid state (0: open, 1: closed)
  185. *
  186. * GET_LID_STATE only works at boot and resume, for general lid
  187. * status, use the kernel provided status
  188. */
  189. #define ATIF_FUNCTION_GET_TV_STANDARD_FROM_CMOS 0x5
  190. /* ARG0: ATIF_FUNCTION_GET_TV_STANDARD_FROM_CMOS
  191. * ARG1: none
  192. * OUTPUT:
  193. * WORD - structure size in bytes (includes size field)
  194. * BYTE - 0
  195. * BYTE - TV standard
  196. */
  197. # define ATIF_TV_STD_NTSC 0
  198. # define ATIF_TV_STD_PAL 1
  199. # define ATIF_TV_STD_PALM 2
  200. # define ATIF_TV_STD_PAL60 3
  201. # define ATIF_TV_STD_NTSCJ 4
  202. # define ATIF_TV_STD_PALCN 5
  203. # define ATIF_TV_STD_PALN 6
  204. # define ATIF_TV_STD_SCART_RGB 9
  205. #define ATIF_FUNCTION_SET_TV_STANDARD_IN_CMOS 0x6
  206. /* ARG0: ATIF_FUNCTION_SET_TV_STANDARD_IN_CMOS
  207. * ARG1:
  208. * WORD - structure size in bytes (includes size field)
  209. * BYTE - 0
  210. * BYTE - TV standard
  211. * OUTPUT: none
  212. */
  213. #define ATIF_FUNCTION_GET_PANEL_EXPANSION_MODE_FROM_CMOS 0x7
  214. /* ARG0: ATIF_FUNCTION_GET_PANEL_EXPANSION_MODE_FROM_CMOS
  215. * ARG1: none
  216. * OUTPUT:
  217. * WORD - structure size in bytes (includes size field)
  218. * BYTE - panel expansion mode
  219. */
  220. #define ATIF_FUNCTION_SET_PANEL_EXPANSION_MODE_IN_CMOS 0x8
  221. /* ARG0: ATIF_FUNCTION_SET_PANEL_EXPANSION_MODE_IN_CMOS
  222. * ARG1:
  223. * WORD - structure size in bytes (includes size field)
  224. * BYTE - panel expansion mode
  225. * OUTPUT: none
  226. */
  227. #define ATIF_FUNCTION_TEMPERATURE_CHANGE_NOTIFICATION 0xD
  228. /* ARG0: ATIF_FUNCTION_TEMPERATURE_CHANGE_NOTIFICATION
  229. * ARG1:
  230. * WORD - structure size in bytes (includes size field)
  231. * WORD - gfx controller id
  232. * BYTE - current temperature (degress Celsius)
  233. * OUTPUT: none
  234. */
  235. #define ATIF_FUNCTION_GET_GRAPHICS_DEVICE_TYPES 0xF
  236. /* ARG0: ATIF_FUNCTION_GET_GRAPHICS_DEVICE_TYPES
  237. * ARG1: none
  238. * OUTPUT:
  239. * WORD - number of gfx devices
  240. * WORD - device structure size in bytes (excludes device size field)
  241. * DWORD - flags \
  242. * WORD - bus number } repeated structure
  243. * WORD - device number /
  244. */
  245. /* flags */
  246. # define ATIF_PX_REMOVABLE_GRAPHICS_DEVICE (1 << 0)
  247. # define ATIF_XGP_PORT (1 << 1)
  248. # define ATIF_VGA_ENABLED_GRAPHICS_DEVICE (1 << 2)
  249. # define ATIF_XGP_PORT_IN_DOCK (1 << 3)
  250. /* ATPX */
  251. #define ATPX_FUNCTION_VERIFY_INTERFACE 0x0
  252. /* ARG0: ATPX_FUNCTION_VERIFY_INTERFACE
  253. * ARG1: none
  254. * OUTPUT:
  255. * WORD - structure size in bytes (includes size field)
  256. * WORD - version
  257. * DWORD - supported functions bit vector
  258. */
  259. /* supported functions vector */
  260. # define ATPX_GET_PX_PARAMETERS_SUPPORTED (1 << 0)
  261. # define ATPX_POWER_CONTROL_SUPPORTED (1 << 1)
  262. # define ATPX_DISPLAY_MUX_CONTROL_SUPPORTED (1 << 2)
  263. # define ATPX_I2C_MUX_CONTROL_SUPPORTED (1 << 3)
  264. # define ATPX_GRAPHICS_DEVICE_SWITCH_START_NOTIFICATION_SUPPORTED (1 << 4)
  265. # define ATPX_GRAPHICS_DEVICE_SWITCH_END_NOTIFICATION_SUPPORTED (1 << 5)
  266. # define ATPX_GET_DISPLAY_CONNECTORS_MAPPING_SUPPORTED (1 << 7)
  267. # define ATPX_GET_DISPLAY_DETECTION_PORTS_SUPPORTED (1 << 8)
  268. #define ATPX_FUNCTION_GET_PX_PARAMETERS 0x1
  269. /* ARG0: ATPX_FUNCTION_GET_PX_PARAMETERS
  270. * ARG1: none
  271. * OUTPUT:
  272. * WORD - structure size in bytes (includes size field)
  273. * DWORD - valid flags mask
  274. * DWORD - flags
  275. */
  276. /* flags */
  277. # define ATPX_LVDS_I2C_AVAILABLE_TO_BOTH_GPUS (1 << 0)
  278. # define ATPX_CRT1_I2C_AVAILABLE_TO_BOTH_GPUS (1 << 1)
  279. # define ATPX_DVI1_I2C_AVAILABLE_TO_BOTH_GPUS (1 << 2)
  280. # define ATPX_CRT1_RGB_SIGNAL_MUXED (1 << 3)
  281. # define ATPX_TV_SIGNAL_MUXED (1 << 4)
  282. # define ATPX_DFP_SIGNAL_MUXED (1 << 5)
  283. # define ATPX_SEPARATE_MUX_FOR_I2C (1 << 6)
  284. # define ATPX_DYNAMIC_PX_SUPPORTED (1 << 7)
  285. # define ATPX_ACF_NOT_SUPPORTED (1 << 8)
  286. # define ATPX_FIXED_NOT_SUPPORTED (1 << 9)
  287. # define ATPX_DYNAMIC_DGPU_POWER_OFF_SUPPORTED (1 << 10)
  288. # define ATPX_DGPU_REQ_POWER_FOR_DISPLAYS (1 << 11)
  289. #define ATPX_FUNCTION_POWER_CONTROL 0x2
  290. /* ARG0: ATPX_FUNCTION_POWER_CONTROL
  291. * ARG1:
  292. * WORD - structure size in bytes (includes size field)
  293. * BYTE - dGPU power state (0: power off, 1: power on)
  294. * OUTPUT: none
  295. */
  296. #define ATPX_FUNCTION_DISPLAY_MUX_CONTROL 0x3
  297. /* ARG0: ATPX_FUNCTION_DISPLAY_MUX_CONTROL
  298. * ARG1:
  299. * WORD - structure size in bytes (includes size field)
  300. * WORD - display mux control (0: iGPU, 1: dGPU)
  301. * OUTPUT: none
  302. */
  303. # define ATPX_INTEGRATED_GPU 0
  304. # define ATPX_DISCRETE_GPU 1
  305. #define ATPX_FUNCTION_I2C_MUX_CONTROL 0x4
  306. /* ARG0: ATPX_FUNCTION_I2C_MUX_CONTROL
  307. * ARG1:
  308. * WORD - structure size in bytes (includes size field)
  309. * WORD - i2c/aux/hpd mux control (0: iGPU, 1: dGPU)
  310. * OUTPUT: none
  311. */
  312. #define ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_START_NOTIFICATION 0x5
  313. /* ARG0: ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_START_NOTIFICATION
  314. * ARG1:
  315. * WORD - structure size in bytes (includes size field)
  316. * WORD - target gpu (0: iGPU, 1: dGPU)
  317. * OUTPUT: none
  318. */
  319. #define ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_END_NOTIFICATION 0x6
  320. /* ARG0: ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_END_NOTIFICATION
  321. * ARG1:
  322. * WORD - structure size in bytes (includes size field)
  323. * WORD - target gpu (0: iGPU, 1: dGPU)
  324. * OUTPUT: none
  325. */
  326. #define ATPX_FUNCTION_GET_DISPLAY_CONNECTORS_MAPPING 0x8
  327. /* ARG0: ATPX_FUNCTION_GET_DISPLAY_CONNECTORS_MAPPING
  328. * ARG1: none
  329. * OUTPUT:
  330. * WORD - number of display connectors
  331. * WORD - connector structure size in bytes (excludes connector size field)
  332. * BYTE - flags \
  333. * BYTE - ATIF display vector bit position } repeated
  334. * BYTE - adapter id (0: iGPU, 1-n: dGPU ordered by pcie bus number) } structure
  335. * WORD - connector ACPI id /
  336. */
  337. /* flags */
  338. # define ATPX_DISPLAY_OUTPUT_SUPPORTED_BY_ADAPTER_ID_DEVICE (1 << 0)
  339. # define ATPX_DISPLAY_HPD_SUPPORTED_BY_ADAPTER_ID_DEVICE (1 << 1)
  340. # define ATPX_DISPLAY_I2C_SUPPORTED_BY_ADAPTER_ID_DEVICE (1 << 2)
  341. #define ATPX_FUNCTION_GET_DISPLAY_DETECTION_PORTS 0x9
  342. /* ARG0: ATPX_FUNCTION_GET_DISPLAY_DETECTION_PORTS
  343. * ARG1: none
  344. * OUTPUT:
  345. * WORD - number of HPD/DDC ports
  346. * WORD - port structure size in bytes (excludes port size field)
  347. * BYTE - ATIF display vector bit position \
  348. * BYTE - hpd id } reapeated structure
  349. * BYTE - ddc id /
  350. *
  351. * available on A+A systems only
  352. */
  353. /* hpd id */
  354. # define ATPX_HPD_NONE 0
  355. # define ATPX_HPD1 1
  356. # define ATPX_HPD2 2
  357. # define ATPX_HPD3 3
  358. # define ATPX_HPD4 4
  359. # define ATPX_HPD5 5
  360. # define ATPX_HPD6 6
  361. /* ddc id */
  362. # define ATPX_DDC_NONE 0
  363. # define ATPX_DDC1 1
  364. # define ATPX_DDC2 2
  365. # define ATPX_DDC3 3
  366. # define ATPX_DDC4 4
  367. # define ATPX_DDC5 5
  368. # define ATPX_DDC6 6
  369. # define ATPX_DDC7 7
  370. # define ATPX_DDC8 8
  371. /* ATCS */
  372. #define ATCS_FUNCTION_VERIFY_INTERFACE 0x0
  373. /* ARG0: ATCS_FUNCTION_VERIFY_INTERFACE
  374. * ARG1: none
  375. * OUTPUT:
  376. * WORD - structure size in bytes (includes size field)
  377. * WORD - version
  378. * DWORD - supported functions bit vector
  379. */
  380. /* supported functions vector */
  381. # define ATCS_GET_EXTERNAL_STATE_SUPPORTED (1 << 0)
  382. # define ATCS_PCIE_PERFORMANCE_REQUEST_SUPPORTED (1 << 1)
  383. # define ATCS_PCIE_DEVICE_READY_NOTIFICATION_SUPPORTED (1 << 2)
  384. # define ATCS_SET_PCIE_BUS_WIDTH_SUPPORTED (1 << 3)
  385. #define ATCS_FUNCTION_GET_EXTERNAL_STATE 0x1
  386. /* ARG0: ATCS_FUNCTION_GET_EXTERNAL_STATE
  387. * ARG1: none
  388. * OUTPUT:
  389. * WORD - structure size in bytes (includes size field)
  390. * DWORD - valid flags mask
  391. * DWORD - flags (0: undocked, 1: docked)
  392. */
  393. /* flags */
  394. # define ATCS_DOCKED (1 << 0)
  395. #define ATCS_FUNCTION_PCIE_PERFORMANCE_REQUEST 0x2
  396. /* ARG0: ATCS_FUNCTION_PCIE_PERFORMANCE_REQUEST
  397. * ARG1:
  398. * WORD - structure size in bytes (includes size field)
  399. * WORD - client id (bit 2-0: func num, 7-3: dev num, 15-8: bus num)
  400. * WORD - valid flags mask
  401. * WORD - flags
  402. * BYTE - request type
  403. * BYTE - performance request
  404. * OUTPUT:
  405. * WORD - structure size in bytes (includes size field)
  406. * BYTE - return value
  407. */
  408. /* flags */
  409. # define ATCS_ADVERTISE_CAPS (1 << 0)
  410. # define ATCS_WAIT_FOR_COMPLETION (1 << 1)
  411. /* request type */
  412. # define ATCS_PCIE_LINK_SPEED 1
  413. /* performance request */
  414. # define ATCS_REMOVE 0
  415. # define ATCS_FORCE_LOW_POWER 1
  416. # define ATCS_PERF_LEVEL_1 2 /* PCIE Gen 1 */
  417. # define ATCS_PERF_LEVEL_2 3 /* PCIE Gen 2 */
  418. # define ATCS_PERF_LEVEL_3 4 /* PCIE Gen 3 */
  419. /* return value */
  420. # define ATCS_REQUEST_REFUSED 1
  421. # define ATCS_REQUEST_COMPLETE 2
  422. # define ATCS_REQUEST_IN_PROGRESS 3
  423. #define ATCS_FUNCTION_PCIE_DEVICE_READY_NOTIFICATION 0x3
  424. /* ARG0: ATCS_FUNCTION_PCIE_DEVICE_READY_NOTIFICATION
  425. * ARG1: none
  426. * OUTPUT: none
  427. */
  428. #define ATCS_FUNCTION_SET_PCIE_BUS_WIDTH 0x4
  429. /* ARG0: ATCS_FUNCTION_SET_PCIE_BUS_WIDTH
  430. * ARG1:
  431. * WORD - structure size in bytes (includes size field)
  432. * WORD - client id (bit 2-0: func num, 7-3: dev num, 15-8: bus num)
  433. * BYTE - number of active lanes
  434. * OUTPUT:
  435. * WORD - structure size in bytes (includes size field)
  436. * BYTE - number of active lanes
  437. */
  438. #endif