cgs_common.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  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. /**
  28. * enum cgs_gpu_mem_type - GPU memory types
  29. */
  30. enum cgs_gpu_mem_type {
  31. CGS_GPU_MEM_TYPE__VISIBLE_FB,
  32. CGS_GPU_MEM_TYPE__INVISIBLE_FB,
  33. CGS_GPU_MEM_TYPE__VISIBLE_CONTIG_FB,
  34. CGS_GPU_MEM_TYPE__INVISIBLE_CONTIG_FB,
  35. CGS_GPU_MEM_TYPE__GART_CACHEABLE,
  36. CGS_GPU_MEM_TYPE__GART_WRITECOMBINE
  37. };
  38. /**
  39. * enum cgs_ind_reg - Indirect register spaces
  40. */
  41. enum cgs_ind_reg {
  42. CGS_IND_REG__MMIO,
  43. CGS_IND_REG__PCIE,
  44. CGS_IND_REG__SMC,
  45. CGS_IND_REG__UVD_CTX,
  46. CGS_IND_REG__DIDT,
  47. CGS_IND_REG__AUDIO_ENDPT
  48. };
  49. /**
  50. * enum cgs_clock - Clocks controlled by the SMU
  51. */
  52. enum cgs_clock {
  53. CGS_CLOCK__SCLK,
  54. CGS_CLOCK__MCLK,
  55. CGS_CLOCK__VCLK,
  56. CGS_CLOCK__DCLK,
  57. CGS_CLOCK__ECLK,
  58. CGS_CLOCK__ACLK,
  59. CGS_CLOCK__ICLK,
  60. /* ... */
  61. };
  62. /**
  63. * enum cgs_engine - Engines that can be statically power-gated
  64. */
  65. enum cgs_engine {
  66. CGS_ENGINE__UVD,
  67. CGS_ENGINE__VCE,
  68. CGS_ENGINE__VP8,
  69. CGS_ENGINE__ACP_DMA,
  70. CGS_ENGINE__ACP_DSP0,
  71. CGS_ENGINE__ACP_DSP1,
  72. CGS_ENGINE__ISP,
  73. /* ... */
  74. };
  75. /**
  76. * enum cgs_voltage_planes - Voltage planes for external camera HW
  77. */
  78. enum cgs_voltage_planes {
  79. CGS_VOLTAGE_PLANE__SENSOR0,
  80. CGS_VOLTAGE_PLANE__SENSOR1,
  81. /* ... */
  82. };
  83. /*
  84. * enum cgs_ucode_id - Firmware types for different IPs
  85. */
  86. enum cgs_ucode_id {
  87. CGS_UCODE_ID_SMU = 0,
  88. CGS_UCODE_ID_SDMA0,
  89. CGS_UCODE_ID_SDMA1,
  90. CGS_UCODE_ID_CP_CE,
  91. CGS_UCODE_ID_CP_PFP,
  92. CGS_UCODE_ID_CP_ME,
  93. CGS_UCODE_ID_CP_MEC,
  94. CGS_UCODE_ID_CP_MEC_JT1,
  95. CGS_UCODE_ID_CP_MEC_JT2,
  96. CGS_UCODE_ID_GMCON_RENG,
  97. CGS_UCODE_ID_RLC_G,
  98. CGS_UCODE_ID_MAXIMUM,
  99. };
  100. /**
  101. * struct cgs_clock_limits - Clock limits
  102. *
  103. * Clocks are specified in 10KHz units.
  104. */
  105. struct cgs_clock_limits {
  106. unsigned min; /**< Minimum supported frequency */
  107. unsigned max; /**< Maxumim supported frequency */
  108. unsigned sustainable; /**< Thermally sustainable frequency */
  109. };
  110. /**
  111. * struct cgs_firmware_info - Firmware information
  112. */
  113. struct cgs_firmware_info {
  114. uint16_t version;
  115. uint16_t feature_version;
  116. uint32_t image_size;
  117. uint64_t mc_addr;
  118. void *kptr;
  119. };
  120. typedef unsigned long cgs_handle_t;
  121. /**
  122. * cgs_gpu_mem_info() - Return information about memory heaps
  123. * @cgs_device: opaque device handle
  124. * @type: memory type
  125. * @mc_start: Start MC address of the heap (output)
  126. * @mc_size: MC address space size (output)
  127. * @mem_size: maximum amount of memory available for allocation (output)
  128. *
  129. * This function returns information about memory heaps. The type
  130. * parameter is used to select the memory heap. The mc_start and
  131. * mc_size for GART heaps may be bigger than the memory available for
  132. * allocation.
  133. *
  134. * mc_start and mc_size are undefined for non-contiguous FB memory
  135. * types, since buffers allocated with these types may or may not be
  136. * GART mapped.
  137. *
  138. * Return: 0 on success, -errno otherwise
  139. */
  140. typedef int (*cgs_gpu_mem_info_t)(void *cgs_device, enum cgs_gpu_mem_type type,
  141. uint64_t *mc_start, uint64_t *mc_size,
  142. uint64_t *mem_size);
  143. /**
  144. * cgs_gmap_kmem() - map kernel memory to GART aperture
  145. * @cgs_device: opaque device handle
  146. * @kmem: pointer to kernel memory
  147. * @size: size to map
  148. * @min_offset: minimum offset from start of GART aperture
  149. * @max_offset: maximum offset from start of GART aperture
  150. * @kmem_handle: kernel memory handle (output)
  151. * @mcaddr: MC address (output)
  152. *
  153. * Return: 0 on success, -errno otherwise
  154. */
  155. typedef int (*cgs_gmap_kmem_t)(void *cgs_device, void *kmem, uint64_t size,
  156. uint64_t min_offset, uint64_t max_offset,
  157. cgs_handle_t *kmem_handle, uint64_t *mcaddr);
  158. /**
  159. * cgs_gunmap_kmem() - unmap kernel memory
  160. * @cgs_device: opaque device handle
  161. * @kmem_handle: kernel memory handle returned by gmap_kmem
  162. *
  163. * Return: 0 on success, -errno otherwise
  164. */
  165. typedef int (*cgs_gunmap_kmem_t)(void *cgs_device, cgs_handle_t kmem_handle);
  166. /**
  167. * cgs_alloc_gpu_mem() - Allocate GPU memory
  168. * @cgs_device: opaque device handle
  169. * @type: memory type
  170. * @size: size in bytes
  171. * @align: alignment in bytes
  172. * @min_offset: minimum offset from start of heap
  173. * @max_offset: maximum offset from start of heap
  174. * @handle: memory handle (output)
  175. *
  176. * The memory types CGS_GPU_MEM_TYPE_*_CONTIG_FB force contiguous
  177. * memory allocation. This guarantees that the MC address returned by
  178. * cgs_gmap_gpu_mem is not mapped through the GART. The non-contiguous
  179. * FB memory types may be GART mapped depending on memory
  180. * fragmentation and memory allocator policies.
  181. *
  182. * If min/max_offset are non-0, the allocation will be forced to
  183. * reside between these offsets in its respective memory heap. The
  184. * base address that the offset relates to, depends on the memory
  185. * type.
  186. *
  187. * - CGS_GPU_MEM_TYPE__*_CONTIG_FB: FB MC base address
  188. * - CGS_GPU_MEM_TYPE__GART_*: GART aperture base address
  189. * - others: undefined, don't use with max_offset
  190. *
  191. * Return: 0 on success, -errno otherwise
  192. */
  193. typedef int (*cgs_alloc_gpu_mem_t)(void *cgs_device, enum cgs_gpu_mem_type type,
  194. uint64_t size, uint64_t align,
  195. uint64_t min_offset, uint64_t max_offset,
  196. cgs_handle_t *handle);
  197. /**
  198. * cgs_free_gpu_mem() - Free GPU memory
  199. * @cgs_device: opaque device handle
  200. * @handle: memory handle returned by alloc or import
  201. *
  202. * Return: 0 on success, -errno otherwise
  203. */
  204. typedef int (*cgs_free_gpu_mem_t)(void *cgs_device, cgs_handle_t handle);
  205. /**
  206. * cgs_gmap_gpu_mem() - GPU-map GPU memory
  207. * @cgs_device: opaque device handle
  208. * @handle: memory handle returned by alloc or import
  209. * @mcaddr: MC address (output)
  210. *
  211. * Ensures that a buffer is GPU accessible and returns its MC address.
  212. *
  213. * Return: 0 on success, -errno otherwise
  214. */
  215. typedef int (*cgs_gmap_gpu_mem_t)(void *cgs_device, cgs_handle_t handle,
  216. uint64_t *mcaddr);
  217. /**
  218. * cgs_gunmap_gpu_mem() - GPU-unmap GPU memory
  219. * @cgs_device: opaque device handle
  220. * @handle: memory handle returned by alloc or import
  221. *
  222. * Allows the buffer to be migrated while it's not used by the GPU.
  223. *
  224. * Return: 0 on success, -errno otherwise
  225. */
  226. typedef int (*cgs_gunmap_gpu_mem_t)(void *cgs_device, cgs_handle_t handle);
  227. /**
  228. * cgs_kmap_gpu_mem() - Kernel-map GPU memory
  229. *
  230. * @cgs_device: opaque device handle
  231. * @handle: memory handle returned by alloc or import
  232. * @map: Kernel virtual address the memory was mapped to (output)
  233. *
  234. * Return: 0 on success, -errno otherwise
  235. */
  236. typedef int (*cgs_kmap_gpu_mem_t)(void *cgs_device, cgs_handle_t handle,
  237. void **map);
  238. /**
  239. * cgs_kunmap_gpu_mem() - Kernel-unmap GPU memory
  240. * @cgs_device: opaque device handle
  241. * @handle: memory handle returned by alloc or import
  242. *
  243. * Return: 0 on success, -errno otherwise
  244. */
  245. typedef int (*cgs_kunmap_gpu_mem_t)(void *cgs_device, cgs_handle_t handle);
  246. /**
  247. * cgs_read_register() - Read an MMIO register
  248. * @cgs_device: opaque device handle
  249. * @offset: register offset
  250. *
  251. * Return: register value
  252. */
  253. typedef uint32_t (*cgs_read_register_t)(void *cgs_device, unsigned offset);
  254. /**
  255. * cgs_write_register() - Write an MMIO register
  256. * @cgs_device: opaque device handle
  257. * @offset: register offset
  258. * @value: register value
  259. */
  260. typedef void (*cgs_write_register_t)(void *cgs_device, unsigned offset,
  261. uint32_t value);
  262. /**
  263. * cgs_read_ind_register() - Read an indirect register
  264. * @cgs_device: opaque device handle
  265. * @offset: register offset
  266. *
  267. * Return: register value
  268. */
  269. typedef uint32_t (*cgs_read_ind_register_t)(void *cgs_device, enum cgs_ind_reg space,
  270. unsigned index);
  271. /**
  272. * cgs_write_ind_register() - Write an indirect register
  273. * @cgs_device: opaque device handle
  274. * @offset: register offset
  275. * @value: register value
  276. */
  277. typedef void (*cgs_write_ind_register_t)(void *cgs_device, enum cgs_ind_reg space,
  278. unsigned index, uint32_t value);
  279. /**
  280. * cgs_read_pci_config_byte() - Read byte from PCI configuration space
  281. * @cgs_device: opaque device handle
  282. * @addr: address
  283. *
  284. * Return: Value read
  285. */
  286. typedef uint8_t (*cgs_read_pci_config_byte_t)(void *cgs_device, unsigned addr);
  287. /**
  288. * cgs_read_pci_config_word() - Read word from PCI configuration space
  289. * @cgs_device: opaque device handle
  290. * @addr: address, must be word-aligned
  291. *
  292. * Return: Value read
  293. */
  294. typedef uint16_t (*cgs_read_pci_config_word_t)(void *cgs_device, unsigned addr);
  295. /**
  296. * cgs_read_pci_config_dword() - Read dword from PCI configuration space
  297. * @cgs_device: opaque device handle
  298. * @addr: address, must be dword-aligned
  299. *
  300. * Return: Value read
  301. */
  302. typedef uint32_t (*cgs_read_pci_config_dword_t)(void *cgs_device,
  303. unsigned addr);
  304. /**
  305. * cgs_write_pci_config_byte() - Write byte to PCI configuration space
  306. * @cgs_device: opaque device handle
  307. * @addr: address
  308. * @value: value to write
  309. */
  310. typedef void (*cgs_write_pci_config_byte_t)(void *cgs_device, unsigned addr,
  311. uint8_t value);
  312. /**
  313. * cgs_write_pci_config_word() - Write byte to PCI configuration space
  314. * @cgs_device: opaque device handle
  315. * @addr: address, must be word-aligned
  316. * @value: value to write
  317. */
  318. typedef void (*cgs_write_pci_config_word_t)(void *cgs_device, unsigned addr,
  319. uint16_t value);
  320. /**
  321. * cgs_write_pci_config_dword() - Write byte to PCI configuration space
  322. * @cgs_device: opaque device handle
  323. * @addr: address, must be dword-aligned
  324. * @value: value to write
  325. */
  326. typedef void (*cgs_write_pci_config_dword_t)(void *cgs_device, unsigned addr,
  327. uint32_t value);
  328. /**
  329. * cgs_atom_get_data_table() - Get a pointer to an ATOM BIOS data table
  330. * @cgs_device: opaque device handle
  331. * @table: data table index
  332. * @size: size of the table (output, may be NULL)
  333. * @frev: table format revision (output, may be NULL)
  334. * @crev: table content revision (output, may be NULL)
  335. *
  336. * Return: Pointer to start of the table, or NULL on failure
  337. */
  338. typedef const void *(*cgs_atom_get_data_table_t)(
  339. void *cgs_device, unsigned table,
  340. uint16_t *size, uint8_t *frev, uint8_t *crev);
  341. /**
  342. * cgs_atom_get_cmd_table_revs() - Get ATOM BIOS command table revisions
  343. * @cgs_device: opaque device handle
  344. * @table: data table index
  345. * @frev: table format revision (output, may be NULL)
  346. * @crev: table content revision (output, may be NULL)
  347. *
  348. * Return: 0 on success, -errno otherwise
  349. */
  350. typedef int (*cgs_atom_get_cmd_table_revs_t)(void *cgs_device, unsigned table,
  351. uint8_t *frev, uint8_t *crev);
  352. /**
  353. * cgs_atom_exec_cmd_table() - Execute an ATOM BIOS command table
  354. * @cgs_device: opaque device handle
  355. * @table: command table index
  356. * @args: arguments
  357. *
  358. * Return: 0 on success, -errno otherwise
  359. */
  360. typedef int (*cgs_atom_exec_cmd_table_t)(void *cgs_device,
  361. unsigned table, void *args);
  362. /**
  363. * cgs_create_pm_request() - Create a power management request
  364. * @cgs_device: opaque device handle
  365. * @request: handle of created PM request (output)
  366. *
  367. * Return: 0 on success, -errno otherwise
  368. */
  369. typedef int (*cgs_create_pm_request_t)(void *cgs_device, cgs_handle_t *request);
  370. /**
  371. * cgs_destroy_pm_request() - Destroy a power management request
  372. * @cgs_device: opaque device handle
  373. * @request: handle of created PM request
  374. *
  375. * Return: 0 on success, -errno otherwise
  376. */
  377. typedef int (*cgs_destroy_pm_request_t)(void *cgs_device, cgs_handle_t request);
  378. /**
  379. * cgs_set_pm_request() - Activate or deactiveate a PM request
  380. * @cgs_device: opaque device handle
  381. * @request: PM request handle
  382. * @active: 0 = deactivate, non-0 = activate
  383. *
  384. * While a PM request is active, its minimum clock requests are taken
  385. * into account as the requested engines are powered up. When the
  386. * request is inactive, the engines may be powered down and clocks may
  387. * be lower, depending on other PM requests by other driver
  388. * components.
  389. *
  390. * Return: 0 on success, -errno otherwise
  391. */
  392. typedef int (*cgs_set_pm_request_t)(void *cgs_device, cgs_handle_t request,
  393. int active);
  394. /**
  395. * cgs_pm_request_clock() - Request a minimum frequency for a specific clock
  396. * @cgs_device: opaque device handle
  397. * @request: PM request handle
  398. * @clock: which clock?
  399. * @freq: requested min. frequency in 10KHz units (0 to clear request)
  400. *
  401. * Return: 0 on success, -errno otherwise
  402. */
  403. typedef int (*cgs_pm_request_clock_t)(void *cgs_device, cgs_handle_t request,
  404. enum cgs_clock clock, unsigned freq);
  405. /**
  406. * cgs_pm_request_engine() - Request an engine to be powered up
  407. * @cgs_device: opaque device handle
  408. * @request: PM request handle
  409. * @engine: which engine?
  410. * @powered: 0 = powered down, non-0 = powered up
  411. *
  412. * Return: 0 on success, -errno otherwise
  413. */
  414. typedef int (*cgs_pm_request_engine_t)(void *cgs_device, cgs_handle_t request,
  415. enum cgs_engine engine, int powered);
  416. /**
  417. * cgs_pm_query_clock_limits() - Query clock frequency limits
  418. * @cgs_device: opaque device handle
  419. * @clock: which clock?
  420. * @limits: clock limits
  421. *
  422. * Return: 0 on success, -errno otherwise
  423. */
  424. typedef int (*cgs_pm_query_clock_limits_t)(void *cgs_device,
  425. enum cgs_clock clock,
  426. struct cgs_clock_limits *limits);
  427. /**
  428. * cgs_set_camera_voltages() - Apply specific voltages to PMIC voltage planes
  429. * @cgs_device: opaque device handle
  430. * @mask: bitmask of voltages to change (1<<CGS_VOLTAGE_PLANE__xyz|...)
  431. * @voltages: pointer to array of voltage values in 1mV units
  432. *
  433. * Return: 0 on success, -errno otherwise
  434. */
  435. typedef int (*cgs_set_camera_voltages_t)(void *cgs_device, uint32_t mask,
  436. const uint32_t *voltages);
  437. /**
  438. * cgs_get_firmware_info - Get the firmware information from core driver
  439. * @cgs_device: opaque device handle
  440. * @type: the firmware type
  441. * @info: returend firmware information
  442. *
  443. * Return: 0 on success, -errno otherwise
  444. */
  445. typedef int (*cgs_get_firmware_info)(void *cgs_device,
  446. enum cgs_ucode_id type,
  447. struct cgs_firmware_info *info);
  448. typedef int(*cgs_set_powergating_state)(void *cgs_device,
  449. enum amd_ip_block_type block_type,
  450. enum amd_powergating_state state);
  451. typedef int(*cgs_set_clockgating_state)(void *cgs_device,
  452. enum amd_ip_block_type block_type,
  453. enum amd_clockgating_state state);
  454. struct cgs_ops {
  455. /* memory management calls (similar to KFD interface) */
  456. cgs_gpu_mem_info_t gpu_mem_info;
  457. cgs_gmap_kmem_t gmap_kmem;
  458. cgs_gunmap_kmem_t gunmap_kmem;
  459. cgs_alloc_gpu_mem_t alloc_gpu_mem;
  460. cgs_free_gpu_mem_t free_gpu_mem;
  461. cgs_gmap_gpu_mem_t gmap_gpu_mem;
  462. cgs_gunmap_gpu_mem_t gunmap_gpu_mem;
  463. cgs_kmap_gpu_mem_t kmap_gpu_mem;
  464. cgs_kunmap_gpu_mem_t kunmap_gpu_mem;
  465. /* MMIO access */
  466. cgs_read_register_t read_register;
  467. cgs_write_register_t write_register;
  468. cgs_read_ind_register_t read_ind_register;
  469. cgs_write_ind_register_t write_ind_register;
  470. /* PCI configuration space access */
  471. cgs_read_pci_config_byte_t read_pci_config_byte;
  472. cgs_read_pci_config_word_t read_pci_config_word;
  473. cgs_read_pci_config_dword_t read_pci_config_dword;
  474. cgs_write_pci_config_byte_t write_pci_config_byte;
  475. cgs_write_pci_config_word_t write_pci_config_word;
  476. cgs_write_pci_config_dword_t write_pci_config_dword;
  477. /* ATOM BIOS */
  478. cgs_atom_get_data_table_t atom_get_data_table;
  479. cgs_atom_get_cmd_table_revs_t atom_get_cmd_table_revs;
  480. cgs_atom_exec_cmd_table_t atom_exec_cmd_table;
  481. /* Power management */
  482. cgs_create_pm_request_t create_pm_request;
  483. cgs_destroy_pm_request_t destroy_pm_request;
  484. cgs_set_pm_request_t set_pm_request;
  485. cgs_pm_request_clock_t pm_request_clock;
  486. cgs_pm_request_engine_t pm_request_engine;
  487. cgs_pm_query_clock_limits_t pm_query_clock_limits;
  488. cgs_set_camera_voltages_t set_camera_voltages;
  489. /* Firmware Info */
  490. cgs_get_firmware_info get_firmware_info;
  491. /* cg pg interface*/
  492. cgs_set_powergating_state set_powergating_state;
  493. cgs_set_clockgating_state set_clockgating_state;
  494. /* ACPI (TODO) */
  495. };
  496. struct cgs_os_ops; /* To be define in OS-specific CGS header */
  497. struct cgs_device
  498. {
  499. const struct cgs_ops *ops;
  500. const struct cgs_os_ops *os_ops;
  501. /* to be embedded at the start of driver private structure */
  502. };
  503. /* Convenience macros that make CGS indirect function calls look like
  504. * normal function calls */
  505. #define CGS_CALL(func,dev,...) \
  506. (((struct cgs_device *)dev)->ops->func(dev, ##__VA_ARGS__))
  507. #define CGS_OS_CALL(func,dev,...) \
  508. (((struct cgs_device *)dev)->os_ops->func(dev, ##__VA_ARGS__))
  509. #define cgs_gpu_mem_info(dev,type,mc_start,mc_size,mem_size) \
  510. CGS_CALL(gpu_mem_info,dev,type,mc_start,mc_size,mem_size)
  511. #define cgs_gmap_kmem(dev,kmem,size,min_off,max_off,kmem_handle,mcaddr) \
  512. CGS_CALL(gmap_kmem,dev,kmem,size,min_off,max_off,kmem_handle,mcaddr)
  513. #define cgs_gunmap_kmem(dev,kmem_handle) \
  514. CGS_CALL(gunmap_kmem,dev,keme_handle)
  515. #define cgs_alloc_gpu_mem(dev,type,size,align,min_off,max_off,handle) \
  516. CGS_CALL(alloc_gpu_mem,dev,type,size,align,min_off,max_off,handle)
  517. #define cgs_free_gpu_mem(dev,handle) \
  518. CGS_CALL(free_gpu_mem,dev,handle)
  519. #define cgs_gmap_gpu_mem(dev,handle,mcaddr) \
  520. CGS_CALL(gmap_gpu_mem,dev,handle,mcaddr)
  521. #define cgs_gunmap_gpu_mem(dev,handle) \
  522. CGS_CALL(gunmap_gpu_mem,dev,handle)
  523. #define cgs_kmap_gpu_mem(dev,handle,map) \
  524. CGS_CALL(kmap_gpu_mem,dev,handle,map)
  525. #define cgs_kunmap_gpu_mem(dev,handle) \
  526. CGS_CALL(kunmap_gpu_mem,dev,handle)
  527. #define cgs_read_register(dev,offset) \
  528. CGS_CALL(read_register,dev,offset)
  529. #define cgs_write_register(dev,offset,value) \
  530. CGS_CALL(write_register,dev,offset,value)
  531. #define cgs_read_ind_register(dev,space,index) \
  532. CGS_CALL(read_ind_register,dev,space,index)
  533. #define cgs_write_ind_register(dev,space,index,value) \
  534. CGS_CALL(write_ind_register,dev,space,index,value)
  535. #define cgs_read_pci_config_byte(dev,addr) \
  536. CGS_CALL(read_pci_config_byte,dev,addr)
  537. #define cgs_read_pci_config_word(dev,addr) \
  538. CGS_CALL(read_pci_config_word,dev,addr)
  539. #define cgs_read_pci_config_dword(dev,addr) \
  540. CGS_CALL(read_pci_config_dword,dev,addr)
  541. #define cgs_write_pci_config_byte(dev,addr,value) \
  542. CGS_CALL(write_pci_config_byte,dev,addr,value)
  543. #define cgs_write_pci_config_word(dev,addr,value) \
  544. CGS_CALL(write_pci_config_word,dev,addr,value)
  545. #define cgs_write_pci_config_dword(dev,addr,value) \
  546. CGS_CALL(write_pci_config_dword,dev,addr,value)
  547. #define cgs_atom_get_data_table(dev,table,size,frev,crev) \
  548. CGS_CALL(atom_get_data_table,dev,table,size,frev,crev)
  549. #define cgs_atom_get_cmd_table_revs(dev,table,frev,crev) \
  550. CGS_CALL(atom_get_cmd_table_revs,dev,table,frev,crev)
  551. #define cgs_atom_exec_cmd_table(dev,table,args) \
  552. CGS_CALL(atom_exec_cmd_table,dev,table,args)
  553. #define cgs_create_pm_request(dev,request) \
  554. CGS_CALL(create_pm_request,dev,request)
  555. #define cgs_destroy_pm_request(dev,request) \
  556. CGS_CALL(destroy_pm_request,dev,request)
  557. #define cgs_set_pm_request(dev,request,active) \
  558. CGS_CALL(set_pm_request,dev,request,active)
  559. #define cgs_pm_request_clock(dev,request,clock,freq) \
  560. CGS_CALL(pm_request_clock,dev,request,clock,freq)
  561. #define cgs_pm_request_engine(dev,request,engine,powered) \
  562. CGS_CALL(pm_request_engine,dev,request,engine,powered)
  563. #define cgs_pm_query_clock_limits(dev,clock,limits) \
  564. CGS_CALL(pm_query_clock_limits,dev,clock,limits)
  565. #define cgs_set_camera_voltages(dev,mask,voltages) \
  566. CGS_CALL(set_camera_voltages,dev,mask,voltages)
  567. #define cgs_get_firmware_info(dev, type, info) \
  568. CGS_CALL(get_firmware_info, dev, type, info)
  569. #define cgs_set_powergating_state(dev, block_type, state) \
  570. CGS_CALL(set_powergating_state, dev, block_type, state)
  571. #define cgs_set_clockgating_state(dev, block_type, state) \
  572. CGS_CALL(set_clockgating_state, dev, block_type, state)
  573. #endif /* _CGS_COMMON_H */