cgs_common.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  1. /*
  2. * Copyright 2015 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 _CGS_COMMON_H
  25. #define _CGS_COMMON_H
  26. #include "amd_shared.h"
  27. struct cgs_device;
  28. /**
  29. * enum cgs_gpu_mem_type - GPU memory types
  30. */
  31. enum cgs_gpu_mem_type {
  32. CGS_GPU_MEM_TYPE__VISIBLE_FB,
  33. CGS_GPU_MEM_TYPE__INVISIBLE_FB,
  34. CGS_GPU_MEM_TYPE__VISIBLE_CONTIG_FB,
  35. CGS_GPU_MEM_TYPE__INVISIBLE_CONTIG_FB,
  36. CGS_GPU_MEM_TYPE__GART_CACHEABLE,
  37. CGS_GPU_MEM_TYPE__GART_WRITECOMBINE
  38. };
  39. /**
  40. * enum cgs_ind_reg - Indirect register spaces
  41. */
  42. enum cgs_ind_reg {
  43. CGS_IND_REG__MMIO,
  44. CGS_IND_REG__PCIE,
  45. CGS_IND_REG__SMC,
  46. CGS_IND_REG__UVD_CTX,
  47. CGS_IND_REG__DIDT,
  48. CGS_IND_REG_GC_CAC,
  49. CGS_IND_REG_SE_CAC,
  50. CGS_IND_REG__AUDIO_ENDPT
  51. };
  52. /**
  53. * enum cgs_engine - Engines that can be statically power-gated
  54. */
  55. enum cgs_engine {
  56. CGS_ENGINE__UVD,
  57. CGS_ENGINE__VCE,
  58. CGS_ENGINE__VP8,
  59. CGS_ENGINE__ACP_DMA,
  60. CGS_ENGINE__ACP_DSP0,
  61. CGS_ENGINE__ACP_DSP1,
  62. CGS_ENGINE__ISP,
  63. /* ... */
  64. };
  65. /*
  66. * enum cgs_ucode_id - Firmware types for different IPs
  67. */
  68. enum cgs_ucode_id {
  69. CGS_UCODE_ID_SMU = 0,
  70. CGS_UCODE_ID_SMU_SK,
  71. CGS_UCODE_ID_SDMA0,
  72. CGS_UCODE_ID_SDMA1,
  73. CGS_UCODE_ID_CP_CE,
  74. CGS_UCODE_ID_CP_PFP,
  75. CGS_UCODE_ID_CP_ME,
  76. CGS_UCODE_ID_CP_MEC,
  77. CGS_UCODE_ID_CP_MEC_JT1,
  78. CGS_UCODE_ID_CP_MEC_JT2,
  79. CGS_UCODE_ID_GMCON_RENG,
  80. CGS_UCODE_ID_RLC_G,
  81. CGS_UCODE_ID_STORAGE,
  82. CGS_UCODE_ID_MAXIMUM,
  83. };
  84. enum cgs_system_info_id {
  85. CGS_SYSTEM_INFO_ADAPTER_BDF_ID = 1,
  86. CGS_SYSTEM_INFO_PCIE_GEN_INFO,
  87. CGS_SYSTEM_INFO_PCIE_MLW,
  88. CGS_SYSTEM_INFO_PCIE_DEV,
  89. CGS_SYSTEM_INFO_PCIE_REV,
  90. CGS_SYSTEM_INFO_CG_FLAGS,
  91. CGS_SYSTEM_INFO_PG_FLAGS,
  92. CGS_SYSTEM_INFO_GFX_CU_INFO,
  93. CGS_SYSTEM_INFO_GFX_SE_INFO,
  94. CGS_SYSTEM_INFO_PCIE_SUB_SYS_ID,
  95. CGS_SYSTEM_INFO_PCIE_SUB_SYS_VENDOR_ID,
  96. CGS_SYSTEM_INFO_PCIE_BUS_DEVFN,
  97. CGS_SYSTEM_INFO_ID_MAXIMUM,
  98. };
  99. struct cgs_system_info {
  100. uint64_t size;
  101. enum cgs_system_info_id info_id;
  102. union {
  103. void *ptr;
  104. uint64_t value;
  105. };
  106. uint64_t padding[13];
  107. };
  108. /*
  109. * enum cgs_resource_type - GPU resource type
  110. */
  111. enum cgs_resource_type {
  112. CGS_RESOURCE_TYPE_MMIO = 0,
  113. CGS_RESOURCE_TYPE_FB,
  114. CGS_RESOURCE_TYPE_IO,
  115. CGS_RESOURCE_TYPE_DOORBELL,
  116. CGS_RESOURCE_TYPE_ROM,
  117. };
  118. /**
  119. * struct cgs_firmware_info - Firmware information
  120. */
  121. struct cgs_firmware_info {
  122. uint16_t version;
  123. uint16_t fw_version;
  124. uint16_t feature_version;
  125. uint32_t image_size;
  126. uint64_t mc_addr;
  127. /* only for smc firmware */
  128. uint32_t ucode_start_address;
  129. void *kptr;
  130. bool is_kicker;
  131. };
  132. struct cgs_mode_info {
  133. uint32_t refresh_rate;
  134. uint32_t ref_clock;
  135. uint32_t vblank_time_us;
  136. };
  137. struct cgs_display_info {
  138. uint32_t display_count;
  139. uint32_t active_display_mask;
  140. struct cgs_mode_info *mode_info;
  141. };
  142. typedef unsigned long cgs_handle_t;
  143. #define CGS_ACPI_METHOD_ATCS 0x53435441
  144. #define CGS_ACPI_METHOD_ATIF 0x46495441
  145. #define CGS_ACPI_METHOD_ATPX 0x58505441
  146. #define CGS_ACPI_FIELD_METHOD_NAME 0x00000001
  147. #define CGS_ACPI_FIELD_INPUT_ARGUMENT_COUNT 0x00000002
  148. #define CGS_ACPI_MAX_BUFFER_SIZE 256
  149. #define CGS_ACPI_TYPE_ANY 0x00
  150. #define CGS_ACPI_TYPE_INTEGER 0x01
  151. #define CGS_ACPI_TYPE_STRING 0x02
  152. #define CGS_ACPI_TYPE_BUFFER 0x03
  153. #define CGS_ACPI_TYPE_PACKAGE 0x04
  154. struct cgs_acpi_method_argument {
  155. uint32_t type;
  156. uint32_t data_length;
  157. union{
  158. uint32_t value;
  159. void *pointer;
  160. };
  161. };
  162. struct cgs_acpi_method_info {
  163. uint32_t size;
  164. uint32_t field;
  165. uint32_t input_count;
  166. uint32_t name;
  167. struct cgs_acpi_method_argument *pinput_argument;
  168. uint32_t output_count;
  169. struct cgs_acpi_method_argument *poutput_argument;
  170. uint32_t padding[9];
  171. };
  172. /**
  173. * cgs_alloc_gpu_mem() - Allocate GPU memory
  174. * @cgs_device: opaque device handle
  175. * @type: memory type
  176. * @size: size in bytes
  177. * @align: alignment in bytes
  178. * @handle: memory handle (output)
  179. *
  180. * The memory types CGS_GPU_MEM_TYPE_*_CONTIG_FB force contiguous
  181. * memory allocation. This guarantees that the MC address returned by
  182. * cgs_gmap_gpu_mem is not mapped through the GART. The non-contiguous
  183. * FB memory types may be GART mapped depending on memory
  184. * fragmentation and memory allocator policies.
  185. *
  186. * If min/max_offset are non-0, the allocation will be forced to
  187. * reside between these offsets in its respective memory heap. The
  188. * base address that the offset relates to, depends on the memory
  189. * type.
  190. *
  191. * - CGS_GPU_MEM_TYPE__*_CONTIG_FB: FB MC base address
  192. * - CGS_GPU_MEM_TYPE__GART_*: GART aperture base address
  193. * - others: undefined, don't use with max_offset
  194. *
  195. * Return: 0 on success, -errno otherwise
  196. */
  197. typedef int (*cgs_alloc_gpu_mem_t)(struct cgs_device *cgs_device, enum cgs_gpu_mem_type type,
  198. uint64_t size, uint64_t align,
  199. cgs_handle_t *handle);
  200. /**
  201. * cgs_free_gpu_mem() - Free GPU memory
  202. * @cgs_device: opaque device handle
  203. * @handle: memory handle returned by alloc or import
  204. *
  205. * Return: 0 on success, -errno otherwise
  206. */
  207. typedef int (*cgs_free_gpu_mem_t)(struct cgs_device *cgs_device, cgs_handle_t handle);
  208. /**
  209. * cgs_gmap_gpu_mem() - GPU-map GPU memory
  210. * @cgs_device: opaque device handle
  211. * @handle: memory handle returned by alloc or import
  212. * @mcaddr: MC address (output)
  213. *
  214. * Ensures that a buffer is GPU accessible and returns its MC address.
  215. *
  216. * Return: 0 on success, -errno otherwise
  217. */
  218. typedef int (*cgs_gmap_gpu_mem_t)(struct cgs_device *cgs_device, cgs_handle_t handle,
  219. uint64_t *mcaddr);
  220. /**
  221. * cgs_gunmap_gpu_mem() - GPU-unmap GPU memory
  222. * @cgs_device: opaque device handle
  223. * @handle: memory handle returned by alloc or import
  224. *
  225. * Allows the buffer to be migrated while it's not used by the GPU.
  226. *
  227. * Return: 0 on success, -errno otherwise
  228. */
  229. typedef int (*cgs_gunmap_gpu_mem_t)(struct cgs_device *cgs_device, cgs_handle_t handle);
  230. /**
  231. * cgs_kmap_gpu_mem() - Kernel-map GPU memory
  232. *
  233. * @cgs_device: opaque device handle
  234. * @handle: memory handle returned by alloc or import
  235. * @map: Kernel virtual address the memory was mapped to (output)
  236. *
  237. * Return: 0 on success, -errno otherwise
  238. */
  239. typedef int (*cgs_kmap_gpu_mem_t)(struct cgs_device *cgs_device, cgs_handle_t handle,
  240. void **map);
  241. /**
  242. * cgs_kunmap_gpu_mem() - Kernel-unmap GPU memory
  243. * @cgs_device: opaque device handle
  244. * @handle: memory handle returned by alloc or import
  245. *
  246. * Return: 0 on success, -errno otherwise
  247. */
  248. typedef int (*cgs_kunmap_gpu_mem_t)(struct cgs_device *cgs_device, cgs_handle_t handle);
  249. /**
  250. * cgs_read_register() - Read an MMIO register
  251. * @cgs_device: opaque device handle
  252. * @offset: register offset
  253. *
  254. * Return: register value
  255. */
  256. typedef uint32_t (*cgs_read_register_t)(struct cgs_device *cgs_device, unsigned offset);
  257. /**
  258. * cgs_write_register() - Write an MMIO register
  259. * @cgs_device: opaque device handle
  260. * @offset: register offset
  261. * @value: register value
  262. */
  263. typedef void (*cgs_write_register_t)(struct cgs_device *cgs_device, unsigned offset,
  264. uint32_t value);
  265. /**
  266. * cgs_read_ind_register() - Read an indirect register
  267. * @cgs_device: opaque device handle
  268. * @offset: register offset
  269. *
  270. * Return: register value
  271. */
  272. typedef uint32_t (*cgs_read_ind_register_t)(struct cgs_device *cgs_device, enum cgs_ind_reg space,
  273. unsigned index);
  274. /**
  275. * cgs_write_ind_register() - Write an indirect register
  276. * @cgs_device: opaque device handle
  277. * @offset: register offset
  278. * @value: register value
  279. */
  280. typedef void (*cgs_write_ind_register_t)(struct cgs_device *cgs_device, enum cgs_ind_reg space,
  281. unsigned index, uint32_t value);
  282. #define CGS_REG_FIELD_SHIFT(reg, field) reg##__##field##__SHIFT
  283. #define CGS_REG_FIELD_MASK(reg, field) reg##__##field##_MASK
  284. #define CGS_REG_SET_FIELD(orig_val, reg, field, field_val) \
  285. (((orig_val) & ~CGS_REG_FIELD_MASK(reg, field)) | \
  286. (CGS_REG_FIELD_MASK(reg, field) & ((field_val) << CGS_REG_FIELD_SHIFT(reg, field))))
  287. #define CGS_REG_GET_FIELD(value, reg, field) \
  288. (((value) & CGS_REG_FIELD_MASK(reg, field)) >> CGS_REG_FIELD_SHIFT(reg, field))
  289. #define CGS_WREG32_FIELD(device, reg, field, val) \
  290. cgs_write_register(device, mm##reg, (cgs_read_register(device, mm##reg) & ~CGS_REG_FIELD_MASK(reg, field)) | (val) << CGS_REG_FIELD_SHIFT(reg, field))
  291. #define CGS_WREG32_FIELD_IND(device, space, reg, field, val) \
  292. cgs_write_ind_register(device, space, ix##reg, (cgs_read_ind_register(device, space, ix##reg) & ~CGS_REG_FIELD_MASK(reg, field)) | (val) << CGS_REG_FIELD_SHIFT(reg, field))
  293. /**
  294. * cgs_get_pci_resource() - provide access to a device resource (PCI BAR)
  295. * @cgs_device: opaque device handle
  296. * @resource_type: Type of Resource (MMIO, IO, ROM, FB, DOORBELL)
  297. * @size: size of the region
  298. * @offset: offset from the start of the region
  299. * @resource_base: base address (not including offset) returned
  300. *
  301. * Return: 0 on success, -errno otherwise
  302. */
  303. typedef int (*cgs_get_pci_resource_t)(struct cgs_device *cgs_device,
  304. enum cgs_resource_type resource_type,
  305. uint64_t size,
  306. uint64_t offset,
  307. uint64_t *resource_base);
  308. /**
  309. * cgs_atom_get_data_table() - Get a pointer to an ATOM BIOS data table
  310. * @cgs_device: opaque device handle
  311. * @table: data table index
  312. * @size: size of the table (output, may be NULL)
  313. * @frev: table format revision (output, may be NULL)
  314. * @crev: table content revision (output, may be NULL)
  315. *
  316. * Return: Pointer to start of the table, or NULL on failure
  317. */
  318. typedef const void *(*cgs_atom_get_data_table_t)(
  319. struct cgs_device *cgs_device, unsigned table,
  320. uint16_t *size, uint8_t *frev, uint8_t *crev);
  321. /**
  322. * cgs_atom_get_cmd_table_revs() - Get ATOM BIOS command table revisions
  323. * @cgs_device: opaque device handle
  324. * @table: data table index
  325. * @frev: table format revision (output, may be NULL)
  326. * @crev: table content revision (output, may be NULL)
  327. *
  328. * Return: 0 on success, -errno otherwise
  329. */
  330. typedef int (*cgs_atom_get_cmd_table_revs_t)(struct cgs_device *cgs_device, unsigned table,
  331. uint8_t *frev, uint8_t *crev);
  332. /**
  333. * cgs_atom_exec_cmd_table() - Execute an ATOM BIOS command table
  334. * @cgs_device: opaque device handle
  335. * @table: command table index
  336. * @args: arguments
  337. *
  338. * Return: 0 on success, -errno otherwise
  339. */
  340. typedef int (*cgs_atom_exec_cmd_table_t)(struct cgs_device *cgs_device,
  341. unsigned table, void *args);
  342. /**
  343. * cgs_get_firmware_info - Get the firmware information from core driver
  344. * @cgs_device: opaque device handle
  345. * @type: the firmware type
  346. * @info: returend firmware information
  347. *
  348. * Return: 0 on success, -errno otherwise
  349. */
  350. typedef int (*cgs_get_firmware_info)(struct cgs_device *cgs_device,
  351. enum cgs_ucode_id type,
  352. struct cgs_firmware_info *info);
  353. typedef int (*cgs_rel_firmware)(struct cgs_device *cgs_device,
  354. enum cgs_ucode_id type);
  355. typedef int(*cgs_set_powergating_state)(struct cgs_device *cgs_device,
  356. enum amd_ip_block_type block_type,
  357. enum amd_powergating_state state);
  358. typedef int(*cgs_set_clockgating_state)(struct cgs_device *cgs_device,
  359. enum amd_ip_block_type block_type,
  360. enum amd_clockgating_state state);
  361. typedef int(*cgs_get_active_displays_info)(
  362. struct cgs_device *cgs_device,
  363. struct cgs_display_info *info);
  364. typedef int (*cgs_notify_dpm_enabled)(struct cgs_device *cgs_device, bool enabled);
  365. typedef int (*cgs_call_acpi_method)(struct cgs_device *cgs_device,
  366. uint32_t acpi_method,
  367. uint32_t acpi_function,
  368. void *pinput, void *poutput,
  369. uint32_t output_count,
  370. uint32_t input_size,
  371. uint32_t output_size);
  372. typedef int (*cgs_query_system_info)(struct cgs_device *cgs_device,
  373. struct cgs_system_info *sys_info);
  374. typedef int (*cgs_is_virtualization_enabled_t)(void *cgs_device);
  375. typedef int (*cgs_enter_safe_mode)(struct cgs_device *cgs_device, bool en);
  376. typedef void (*cgs_lock_grbm_idx)(struct cgs_device *cgs_device, bool lock);
  377. struct amd_pp_init;
  378. typedef void* (*cgs_register_pp_handle)(struct cgs_device *cgs_device,
  379. int (*call_back_func)(struct amd_pp_init *, void **));
  380. struct cgs_ops {
  381. /* memory management calls (similar to KFD interface) */
  382. cgs_alloc_gpu_mem_t alloc_gpu_mem;
  383. cgs_free_gpu_mem_t free_gpu_mem;
  384. cgs_gmap_gpu_mem_t gmap_gpu_mem;
  385. cgs_gunmap_gpu_mem_t gunmap_gpu_mem;
  386. cgs_kmap_gpu_mem_t kmap_gpu_mem;
  387. cgs_kunmap_gpu_mem_t kunmap_gpu_mem;
  388. /* MMIO access */
  389. cgs_read_register_t read_register;
  390. cgs_write_register_t write_register;
  391. cgs_read_ind_register_t read_ind_register;
  392. cgs_write_ind_register_t write_ind_register;
  393. /* PCI resources */
  394. cgs_get_pci_resource_t get_pci_resource;
  395. /* ATOM BIOS */
  396. cgs_atom_get_data_table_t atom_get_data_table;
  397. cgs_atom_get_cmd_table_revs_t atom_get_cmd_table_revs;
  398. cgs_atom_exec_cmd_table_t atom_exec_cmd_table;
  399. /* Firmware Info */
  400. cgs_get_firmware_info get_firmware_info;
  401. cgs_rel_firmware rel_firmware;
  402. /* cg pg interface*/
  403. cgs_set_powergating_state set_powergating_state;
  404. cgs_set_clockgating_state set_clockgating_state;
  405. /* display manager */
  406. cgs_get_active_displays_info get_active_displays_info;
  407. /* notify dpm enabled */
  408. cgs_notify_dpm_enabled notify_dpm_enabled;
  409. /* ACPI */
  410. cgs_call_acpi_method call_acpi_method;
  411. /* get system info */
  412. cgs_query_system_info query_system_info;
  413. cgs_is_virtualization_enabled_t is_virtualization_enabled;
  414. cgs_enter_safe_mode enter_safe_mode;
  415. cgs_lock_grbm_idx lock_grbm_idx;
  416. cgs_register_pp_handle register_pp_handle;
  417. };
  418. struct cgs_os_ops; /* To be define in OS-specific CGS header */
  419. struct cgs_device
  420. {
  421. const struct cgs_ops *ops;
  422. const struct cgs_os_ops *os_ops;
  423. /* to be embedded at the start of driver private structure */
  424. };
  425. /* Convenience macros that make CGS indirect function calls look like
  426. * normal function calls */
  427. #define CGS_CALL(func,dev,...) \
  428. (((struct cgs_device *)dev)->ops->func(dev, ##__VA_ARGS__))
  429. #define CGS_OS_CALL(func,dev,...) \
  430. (((struct cgs_device *)dev)->os_ops->func(dev, ##__VA_ARGS__))
  431. #define cgs_alloc_gpu_mem(dev,type,size,align,handle) \
  432. CGS_CALL(alloc_gpu_mem,dev,type,size,align,handle)
  433. #define cgs_free_gpu_mem(dev,handle) \
  434. CGS_CALL(free_gpu_mem,dev,handle)
  435. #define cgs_gmap_gpu_mem(dev,handle,mcaddr) \
  436. CGS_CALL(gmap_gpu_mem,dev,handle,mcaddr)
  437. #define cgs_gunmap_gpu_mem(dev,handle) \
  438. CGS_CALL(gunmap_gpu_mem,dev,handle)
  439. #define cgs_kmap_gpu_mem(dev,handle,map) \
  440. CGS_CALL(kmap_gpu_mem,dev,handle,map)
  441. #define cgs_kunmap_gpu_mem(dev,handle) \
  442. CGS_CALL(kunmap_gpu_mem,dev,handle)
  443. #define cgs_read_register(dev,offset) \
  444. CGS_CALL(read_register,dev,offset)
  445. #define cgs_write_register(dev,offset,value) \
  446. CGS_CALL(write_register,dev,offset,value)
  447. #define cgs_read_ind_register(dev,space,index) \
  448. CGS_CALL(read_ind_register,dev,space,index)
  449. #define cgs_write_ind_register(dev,space,index,value) \
  450. CGS_CALL(write_ind_register,dev,space,index,value)
  451. #define cgs_atom_get_data_table(dev,table,size,frev,crev) \
  452. CGS_CALL(atom_get_data_table,dev,table,size,frev,crev)
  453. #define cgs_atom_get_cmd_table_revs(dev,table,frev,crev) \
  454. CGS_CALL(atom_get_cmd_table_revs,dev,table,frev,crev)
  455. #define cgs_atom_exec_cmd_table(dev,table,args) \
  456. CGS_CALL(atom_exec_cmd_table,dev,table,args)
  457. #define cgs_get_firmware_info(dev, type, info) \
  458. CGS_CALL(get_firmware_info, dev, type, info)
  459. #define cgs_rel_firmware(dev, type) \
  460. CGS_CALL(rel_firmware, dev, type)
  461. #define cgs_set_powergating_state(dev, block_type, state) \
  462. CGS_CALL(set_powergating_state, dev, block_type, state)
  463. #define cgs_set_clockgating_state(dev, block_type, state) \
  464. CGS_CALL(set_clockgating_state, dev, block_type, state)
  465. #define cgs_notify_dpm_enabled(dev, enabled) \
  466. CGS_CALL(notify_dpm_enabled, dev, enabled)
  467. #define cgs_get_active_displays_info(dev, info) \
  468. CGS_CALL(get_active_displays_info, dev, info)
  469. #define cgs_call_acpi_method(dev, acpi_method, acpi_function, pintput, poutput, output_count, input_size, output_size) \
  470. CGS_CALL(call_acpi_method, dev, acpi_method, acpi_function, pintput, poutput, output_count, input_size, output_size)
  471. #define cgs_query_system_info(dev, sys_info) \
  472. CGS_CALL(query_system_info, dev, sys_info)
  473. #define cgs_get_pci_resource(cgs_device, resource_type, size, offset, \
  474. resource_base) \
  475. CGS_CALL(get_pci_resource, cgs_device, resource_type, size, offset, \
  476. resource_base)
  477. #define cgs_is_virtualization_enabled(cgs_device) \
  478. CGS_CALL(is_virtualization_enabled, cgs_device)
  479. #define cgs_enter_safe_mode(cgs_device, en) \
  480. CGS_CALL(enter_safe_mode, cgs_device, en)
  481. #define cgs_lock_grbm_idx(cgs_device, lock) \
  482. CGS_CALL(lock_grbm_idx, cgs_device, lock)
  483. #define cgs_register_pp_handle(cgs_device, call_back_func) \
  484. CGS_CALL(register_pp_handle, cgs_device, call_back_func)
  485. #endif /* _CGS_COMMON_H */