radeon_asic.h 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985
  1. /*
  2. * Copyright 2008 Advanced Micro Devices, Inc.
  3. * Copyright 2008 Red Hat Inc.
  4. * Copyright 2009 Jerome Glisse.
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining a
  7. * copy of this software and associated documentation files (the "Software"),
  8. * to deal in the Software without restriction, including without limitation
  9. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  10. * and/or sell copies of the Software, and to permit persons to whom the
  11. * Software is furnished to do so, subject to the following conditions:
  12. *
  13. * The above copyright notice and this permission notice shall be included in
  14. * all copies or substantial portions of the Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  19. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  20. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  21. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  22. * OTHER DEALINGS IN THE SOFTWARE.
  23. *
  24. * Authors: Dave Airlie
  25. * Alex Deucher
  26. * Jerome Glisse
  27. */
  28. #ifndef __RADEON_ASIC_H__
  29. #define __RADEON_ASIC_H__
  30. /*
  31. * common functions
  32. */
  33. uint32_t radeon_legacy_get_engine_clock(struct radeon_device *rdev);
  34. void radeon_legacy_set_engine_clock(struct radeon_device *rdev, uint32_t eng_clock);
  35. uint32_t radeon_legacy_get_memory_clock(struct radeon_device *rdev);
  36. void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable);
  37. uint32_t radeon_atom_get_engine_clock(struct radeon_device *rdev);
  38. void radeon_atom_set_engine_clock(struct radeon_device *rdev, uint32_t eng_clock);
  39. uint32_t radeon_atom_get_memory_clock(struct radeon_device *rdev);
  40. void radeon_atom_set_memory_clock(struct radeon_device *rdev, uint32_t mem_clock);
  41. void radeon_atom_set_clock_gating(struct radeon_device *rdev, int enable);
  42. void atombios_set_backlight_level(struct radeon_encoder *radeon_encoder, u8 level);
  43. u8 atombios_get_backlight_level(struct radeon_encoder *radeon_encoder);
  44. void radeon_legacy_set_backlight_level(struct radeon_encoder *radeon_encoder, u8 level);
  45. u8 radeon_legacy_get_backlight_level(struct radeon_encoder *radeon_encoder);
  46. /*
  47. * r100,rv100,rs100,rv200,rs200
  48. */
  49. struct r100_mc_save {
  50. u32 GENMO_WT;
  51. u32 CRTC_EXT_CNTL;
  52. u32 CRTC_GEN_CNTL;
  53. u32 CRTC2_GEN_CNTL;
  54. u32 CUR_OFFSET;
  55. u32 CUR2_OFFSET;
  56. };
  57. int r100_init(struct radeon_device *rdev);
  58. void r100_fini(struct radeon_device *rdev);
  59. int r100_suspend(struct radeon_device *rdev);
  60. int r100_resume(struct radeon_device *rdev);
  61. void r100_vga_set_state(struct radeon_device *rdev, bool state);
  62. bool r100_gpu_is_lockup(struct radeon_device *rdev, struct radeon_ring *cp);
  63. int r100_asic_reset(struct radeon_device *rdev);
  64. u32 r100_get_vblank_counter(struct radeon_device *rdev, int crtc);
  65. void r100_pci_gart_tlb_flush(struct radeon_device *rdev);
  66. uint64_t r100_pci_gart_get_page_entry(uint64_t addr, uint32_t flags);
  67. void r100_pci_gart_set_page(struct radeon_device *rdev, unsigned i,
  68. uint64_t entry);
  69. void r100_ring_start(struct radeon_device *rdev, struct radeon_ring *ring);
  70. int r100_irq_set(struct radeon_device *rdev);
  71. int r100_irq_process(struct radeon_device *rdev);
  72. void r100_fence_ring_emit(struct radeon_device *rdev,
  73. struct radeon_fence *fence);
  74. bool r100_semaphore_ring_emit(struct radeon_device *rdev,
  75. struct radeon_ring *cp,
  76. struct radeon_semaphore *semaphore,
  77. bool emit_wait);
  78. int r100_cs_parse(struct radeon_cs_parser *p);
  79. void r100_pll_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v);
  80. uint32_t r100_pll_rreg(struct radeon_device *rdev, uint32_t reg);
  81. struct radeon_fence *r100_copy_blit(struct radeon_device *rdev,
  82. uint64_t src_offset,
  83. uint64_t dst_offset,
  84. unsigned num_gpu_pages,
  85. struct reservation_object *resv);
  86. int r100_set_surface_reg(struct radeon_device *rdev, int reg,
  87. uint32_t tiling_flags, uint32_t pitch,
  88. uint32_t offset, uint32_t obj_size);
  89. void r100_clear_surface_reg(struct radeon_device *rdev, int reg);
  90. void r100_bandwidth_update(struct radeon_device *rdev);
  91. void r100_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib);
  92. int r100_ring_test(struct radeon_device *rdev, struct radeon_ring *cp);
  93. void r100_hpd_init(struct radeon_device *rdev);
  94. void r100_hpd_fini(struct radeon_device *rdev);
  95. bool r100_hpd_sense(struct radeon_device *rdev, enum radeon_hpd_id hpd);
  96. void r100_hpd_set_polarity(struct radeon_device *rdev,
  97. enum radeon_hpd_id hpd);
  98. int r100_debugfs_rbbm_init(struct radeon_device *rdev);
  99. int r100_debugfs_cp_init(struct radeon_device *rdev);
  100. void r100_cp_disable(struct radeon_device *rdev);
  101. int r100_cp_init(struct radeon_device *rdev, unsigned ring_size);
  102. void r100_cp_fini(struct radeon_device *rdev);
  103. int r100_pci_gart_init(struct radeon_device *rdev);
  104. void r100_pci_gart_fini(struct radeon_device *rdev);
  105. int r100_pci_gart_enable(struct radeon_device *rdev);
  106. void r100_pci_gart_disable(struct radeon_device *rdev);
  107. int r100_debugfs_mc_info_init(struct radeon_device *rdev);
  108. int r100_gui_wait_for_idle(struct radeon_device *rdev);
  109. int r100_ib_test(struct radeon_device *rdev, struct radeon_ring *ring);
  110. void r100_irq_disable(struct radeon_device *rdev);
  111. void r100_mc_stop(struct radeon_device *rdev, struct r100_mc_save *save);
  112. void r100_mc_resume(struct radeon_device *rdev, struct r100_mc_save *save);
  113. void r100_vram_init_sizes(struct radeon_device *rdev);
  114. int r100_cp_reset(struct radeon_device *rdev);
  115. void r100_vga_render_disable(struct radeon_device *rdev);
  116. void r100_restore_sanity(struct radeon_device *rdev);
  117. int r100_cs_track_check_pkt3_indx_buffer(struct radeon_cs_parser *p,
  118. struct radeon_cs_packet *pkt,
  119. struct radeon_bo *robj);
  120. int r100_cs_parse_packet0(struct radeon_cs_parser *p,
  121. struct radeon_cs_packet *pkt,
  122. const unsigned *auth, unsigned n,
  123. radeon_packet0_check_t check);
  124. int r100_cs_packet_parse(struct radeon_cs_parser *p,
  125. struct radeon_cs_packet *pkt,
  126. unsigned idx);
  127. void r100_enable_bm(struct radeon_device *rdev);
  128. void r100_set_common_regs(struct radeon_device *rdev);
  129. void r100_bm_disable(struct radeon_device *rdev);
  130. extern bool r100_gui_idle(struct radeon_device *rdev);
  131. extern void r100_pm_misc(struct radeon_device *rdev);
  132. extern void r100_pm_prepare(struct radeon_device *rdev);
  133. extern void r100_pm_finish(struct radeon_device *rdev);
  134. extern void r100_pm_init_profile(struct radeon_device *rdev);
  135. extern void r100_pm_get_dynpm_state(struct radeon_device *rdev);
  136. extern void r100_page_flip(struct radeon_device *rdev, int crtc,
  137. u64 crtc_base);
  138. extern bool r100_page_flip_pending(struct radeon_device *rdev, int crtc);
  139. extern void r100_wait_for_vblank(struct radeon_device *rdev, int crtc);
  140. extern int r100_mc_wait_for_idle(struct radeon_device *rdev);
  141. u32 r100_gfx_get_rptr(struct radeon_device *rdev,
  142. struct radeon_ring *ring);
  143. u32 r100_gfx_get_wptr(struct radeon_device *rdev,
  144. struct radeon_ring *ring);
  145. void r100_gfx_set_wptr(struct radeon_device *rdev,
  146. struct radeon_ring *ring);
  147. /*
  148. * r200,rv250,rs300,rv280
  149. */
  150. struct radeon_fence *r200_copy_dma(struct radeon_device *rdev,
  151. uint64_t src_offset,
  152. uint64_t dst_offset,
  153. unsigned num_gpu_pages,
  154. struct reservation_object *resv);
  155. void r200_set_safe_registers(struct radeon_device *rdev);
  156. /*
  157. * r300,r350,rv350,rv380
  158. */
  159. extern int r300_init(struct radeon_device *rdev);
  160. extern void r300_fini(struct radeon_device *rdev);
  161. extern int r300_suspend(struct radeon_device *rdev);
  162. extern int r300_resume(struct radeon_device *rdev);
  163. extern int r300_asic_reset(struct radeon_device *rdev);
  164. extern void r300_ring_start(struct radeon_device *rdev, struct radeon_ring *ring);
  165. extern void r300_fence_ring_emit(struct radeon_device *rdev,
  166. struct radeon_fence *fence);
  167. extern int r300_cs_parse(struct radeon_cs_parser *p);
  168. extern void rv370_pcie_gart_tlb_flush(struct radeon_device *rdev);
  169. extern uint64_t rv370_pcie_gart_get_page_entry(uint64_t addr, uint32_t flags);
  170. extern void rv370_pcie_gart_set_page(struct radeon_device *rdev, unsigned i,
  171. uint64_t entry);
  172. extern void rv370_set_pcie_lanes(struct radeon_device *rdev, int lanes);
  173. extern int rv370_get_pcie_lanes(struct radeon_device *rdev);
  174. extern void r300_set_reg_safe(struct radeon_device *rdev);
  175. extern void r300_mc_program(struct radeon_device *rdev);
  176. extern void r300_mc_init(struct radeon_device *rdev);
  177. extern void r300_clock_startup(struct radeon_device *rdev);
  178. extern int r300_mc_wait_for_idle(struct radeon_device *rdev);
  179. extern int rv370_pcie_gart_init(struct radeon_device *rdev);
  180. extern void rv370_pcie_gart_fini(struct radeon_device *rdev);
  181. extern int rv370_pcie_gart_enable(struct radeon_device *rdev);
  182. extern void rv370_pcie_gart_disable(struct radeon_device *rdev);
  183. extern int r300_mc_wait_for_idle(struct radeon_device *rdev);
  184. /*
  185. * r420,r423,rv410
  186. */
  187. extern int r420_init(struct radeon_device *rdev);
  188. extern void r420_fini(struct radeon_device *rdev);
  189. extern int r420_suspend(struct radeon_device *rdev);
  190. extern int r420_resume(struct radeon_device *rdev);
  191. extern void r420_pm_init_profile(struct radeon_device *rdev);
  192. extern u32 r420_mc_rreg(struct radeon_device *rdev, u32 reg);
  193. extern void r420_mc_wreg(struct radeon_device *rdev, u32 reg, u32 v);
  194. extern int r420_debugfs_pipes_info_init(struct radeon_device *rdev);
  195. extern void r420_pipes_init(struct radeon_device *rdev);
  196. /*
  197. * rs400,rs480
  198. */
  199. extern int rs400_init(struct radeon_device *rdev);
  200. extern void rs400_fini(struct radeon_device *rdev);
  201. extern int rs400_suspend(struct radeon_device *rdev);
  202. extern int rs400_resume(struct radeon_device *rdev);
  203. void rs400_gart_tlb_flush(struct radeon_device *rdev);
  204. uint64_t rs400_gart_get_page_entry(uint64_t addr, uint32_t flags);
  205. void rs400_gart_set_page(struct radeon_device *rdev, unsigned i,
  206. uint64_t entry);
  207. uint32_t rs400_mc_rreg(struct radeon_device *rdev, uint32_t reg);
  208. void rs400_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v);
  209. int rs400_gart_init(struct radeon_device *rdev);
  210. int rs400_gart_enable(struct radeon_device *rdev);
  211. void rs400_gart_adjust_size(struct radeon_device *rdev);
  212. void rs400_gart_disable(struct radeon_device *rdev);
  213. void rs400_gart_fini(struct radeon_device *rdev);
  214. extern int rs400_mc_wait_for_idle(struct radeon_device *rdev);
  215. /*
  216. * rs600.
  217. */
  218. extern int rs600_asic_reset(struct radeon_device *rdev);
  219. extern int rs600_init(struct radeon_device *rdev);
  220. extern void rs600_fini(struct radeon_device *rdev);
  221. extern int rs600_suspend(struct radeon_device *rdev);
  222. extern int rs600_resume(struct radeon_device *rdev);
  223. int rs600_irq_set(struct radeon_device *rdev);
  224. int rs600_irq_process(struct radeon_device *rdev);
  225. void rs600_irq_disable(struct radeon_device *rdev);
  226. u32 rs600_get_vblank_counter(struct radeon_device *rdev, int crtc);
  227. void rs600_gart_tlb_flush(struct radeon_device *rdev);
  228. uint64_t rs600_gart_get_page_entry(uint64_t addr, uint32_t flags);
  229. void rs600_gart_set_page(struct radeon_device *rdev, unsigned i,
  230. uint64_t entry);
  231. uint32_t rs600_mc_rreg(struct radeon_device *rdev, uint32_t reg);
  232. void rs600_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v);
  233. void rs600_bandwidth_update(struct radeon_device *rdev);
  234. void rs600_hpd_init(struct radeon_device *rdev);
  235. void rs600_hpd_fini(struct radeon_device *rdev);
  236. bool rs600_hpd_sense(struct radeon_device *rdev, enum radeon_hpd_id hpd);
  237. void rs600_hpd_set_polarity(struct radeon_device *rdev,
  238. enum radeon_hpd_id hpd);
  239. extern void rs600_pm_misc(struct radeon_device *rdev);
  240. extern void rs600_pm_prepare(struct radeon_device *rdev);
  241. extern void rs600_pm_finish(struct radeon_device *rdev);
  242. extern void rs600_page_flip(struct radeon_device *rdev, int crtc,
  243. u64 crtc_base);
  244. extern bool rs600_page_flip_pending(struct radeon_device *rdev, int crtc);
  245. void rs600_set_safe_registers(struct radeon_device *rdev);
  246. extern void avivo_wait_for_vblank(struct radeon_device *rdev, int crtc);
  247. extern int rs600_mc_wait_for_idle(struct radeon_device *rdev);
  248. /*
  249. * rs690,rs740
  250. */
  251. int rs690_init(struct radeon_device *rdev);
  252. void rs690_fini(struct radeon_device *rdev);
  253. int rs690_resume(struct radeon_device *rdev);
  254. int rs690_suspend(struct radeon_device *rdev);
  255. uint32_t rs690_mc_rreg(struct radeon_device *rdev, uint32_t reg);
  256. void rs690_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v);
  257. void rs690_bandwidth_update(struct radeon_device *rdev);
  258. void rs690_line_buffer_adjust(struct radeon_device *rdev,
  259. struct drm_display_mode *mode1,
  260. struct drm_display_mode *mode2);
  261. extern int rs690_mc_wait_for_idle(struct radeon_device *rdev);
  262. /*
  263. * rv515
  264. */
  265. struct rv515_mc_save {
  266. u32 vga_render_control;
  267. u32 vga_hdp_control;
  268. bool crtc_enabled[2];
  269. };
  270. int rv515_init(struct radeon_device *rdev);
  271. void rv515_fini(struct radeon_device *rdev);
  272. uint32_t rv515_mc_rreg(struct radeon_device *rdev, uint32_t reg);
  273. void rv515_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v);
  274. void rv515_ring_start(struct radeon_device *rdev, struct radeon_ring *ring);
  275. void rv515_bandwidth_update(struct radeon_device *rdev);
  276. int rv515_resume(struct radeon_device *rdev);
  277. int rv515_suspend(struct radeon_device *rdev);
  278. void rv515_bandwidth_avivo_update(struct radeon_device *rdev);
  279. void rv515_vga_render_disable(struct radeon_device *rdev);
  280. void rv515_set_safe_registers(struct radeon_device *rdev);
  281. void rv515_mc_stop(struct radeon_device *rdev, struct rv515_mc_save *save);
  282. void rv515_mc_resume(struct radeon_device *rdev, struct rv515_mc_save *save);
  283. void rv515_clock_startup(struct radeon_device *rdev);
  284. void rv515_debugfs(struct radeon_device *rdev);
  285. int rv515_mc_wait_for_idle(struct radeon_device *rdev);
  286. /*
  287. * r520,rv530,rv560,rv570,r580
  288. */
  289. int r520_init(struct radeon_device *rdev);
  290. int r520_resume(struct radeon_device *rdev);
  291. int r520_mc_wait_for_idle(struct radeon_device *rdev);
  292. /*
  293. * r600,rv610,rv630,rv620,rv635,rv670,rs780,rs880
  294. */
  295. int r600_init(struct radeon_device *rdev);
  296. void r600_fini(struct radeon_device *rdev);
  297. int r600_suspend(struct radeon_device *rdev);
  298. int r600_resume(struct radeon_device *rdev);
  299. void r600_vga_set_state(struct radeon_device *rdev, bool state);
  300. int r600_wb_init(struct radeon_device *rdev);
  301. void r600_wb_fini(struct radeon_device *rdev);
  302. void r600_pcie_gart_tlb_flush(struct radeon_device *rdev);
  303. uint32_t r600_pciep_rreg(struct radeon_device *rdev, uint32_t reg);
  304. void r600_pciep_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v);
  305. int r600_cs_parse(struct radeon_cs_parser *p);
  306. int r600_dma_cs_parse(struct radeon_cs_parser *p);
  307. void r600_fence_ring_emit(struct radeon_device *rdev,
  308. struct radeon_fence *fence);
  309. bool r600_semaphore_ring_emit(struct radeon_device *rdev,
  310. struct radeon_ring *cp,
  311. struct radeon_semaphore *semaphore,
  312. bool emit_wait);
  313. void r600_dma_fence_ring_emit(struct radeon_device *rdev,
  314. struct radeon_fence *fence);
  315. bool r600_dma_semaphore_ring_emit(struct radeon_device *rdev,
  316. struct radeon_ring *ring,
  317. struct radeon_semaphore *semaphore,
  318. bool emit_wait);
  319. void r600_dma_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib);
  320. bool r600_dma_is_lockup(struct radeon_device *rdev, struct radeon_ring *ring);
  321. bool r600_gfx_is_lockup(struct radeon_device *rdev, struct radeon_ring *cp);
  322. int r600_asic_reset(struct radeon_device *rdev);
  323. int r600_set_surface_reg(struct radeon_device *rdev, int reg,
  324. uint32_t tiling_flags, uint32_t pitch,
  325. uint32_t offset, uint32_t obj_size);
  326. void r600_clear_surface_reg(struct radeon_device *rdev, int reg);
  327. int r600_ib_test(struct radeon_device *rdev, struct radeon_ring *ring);
  328. int r600_dma_ib_test(struct radeon_device *rdev, struct radeon_ring *ring);
  329. void r600_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib);
  330. int r600_ring_test(struct radeon_device *rdev, struct radeon_ring *cp);
  331. int r600_dma_ring_test(struct radeon_device *rdev, struct radeon_ring *cp);
  332. struct radeon_fence *r600_copy_cpdma(struct radeon_device *rdev,
  333. uint64_t src_offset, uint64_t dst_offset,
  334. unsigned num_gpu_pages,
  335. struct reservation_object *resv);
  336. struct radeon_fence *r600_copy_dma(struct radeon_device *rdev,
  337. uint64_t src_offset, uint64_t dst_offset,
  338. unsigned num_gpu_pages,
  339. struct reservation_object *resv);
  340. void r600_hpd_init(struct radeon_device *rdev);
  341. void r600_hpd_fini(struct radeon_device *rdev);
  342. bool r600_hpd_sense(struct radeon_device *rdev, enum radeon_hpd_id hpd);
  343. void r600_hpd_set_polarity(struct radeon_device *rdev,
  344. enum radeon_hpd_id hpd);
  345. extern void r600_mmio_hdp_flush(struct radeon_device *rdev);
  346. extern bool r600_gui_idle(struct radeon_device *rdev);
  347. extern void r600_pm_misc(struct radeon_device *rdev);
  348. extern void r600_pm_init_profile(struct radeon_device *rdev);
  349. extern void rs780_pm_init_profile(struct radeon_device *rdev);
  350. extern uint32_t rs780_mc_rreg(struct radeon_device *rdev, uint32_t reg);
  351. extern void rs780_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v);
  352. extern void r600_pm_get_dynpm_state(struct radeon_device *rdev);
  353. extern void r600_set_pcie_lanes(struct radeon_device *rdev, int lanes);
  354. extern int r600_get_pcie_lanes(struct radeon_device *rdev);
  355. bool r600_card_posted(struct radeon_device *rdev);
  356. void r600_cp_stop(struct radeon_device *rdev);
  357. int r600_cp_start(struct radeon_device *rdev);
  358. void r600_ring_init(struct radeon_device *rdev, struct radeon_ring *cp, unsigned ring_size);
  359. int r600_cp_resume(struct radeon_device *rdev);
  360. void r600_cp_fini(struct radeon_device *rdev);
  361. int r600_count_pipe_bits(uint32_t val);
  362. int r600_mc_wait_for_idle(struct radeon_device *rdev);
  363. int r600_pcie_gart_init(struct radeon_device *rdev);
  364. void r600_scratch_init(struct radeon_device *rdev);
  365. int r600_init_microcode(struct radeon_device *rdev);
  366. u32 r600_gfx_get_rptr(struct radeon_device *rdev,
  367. struct radeon_ring *ring);
  368. u32 r600_gfx_get_wptr(struct radeon_device *rdev,
  369. struct radeon_ring *ring);
  370. void r600_gfx_set_wptr(struct radeon_device *rdev,
  371. struct radeon_ring *ring);
  372. int r600_get_allowed_info_register(struct radeon_device *rdev,
  373. u32 reg, u32 *val);
  374. /* r600 irq */
  375. int r600_irq_process(struct radeon_device *rdev);
  376. int r600_irq_init(struct radeon_device *rdev);
  377. void r600_irq_fini(struct radeon_device *rdev);
  378. void r600_ih_ring_init(struct radeon_device *rdev, unsigned ring_size);
  379. int r600_irq_set(struct radeon_device *rdev);
  380. void r600_irq_suspend(struct radeon_device *rdev);
  381. void r600_disable_interrupts(struct radeon_device *rdev);
  382. void r600_rlc_stop(struct radeon_device *rdev);
  383. /* r600 audio */
  384. void r600_audio_fini(struct radeon_device *rdev);
  385. void r600_audio_set_dto(struct drm_encoder *encoder, u32 clock);
  386. void r600_hdmi_update_avi_infoframe(struct drm_encoder *encoder, void *buffer,
  387. size_t size);
  388. void r600_hdmi_update_ACR(struct drm_encoder *encoder, uint32_t clock);
  389. void r600_hdmi_audio_workaround(struct drm_encoder *encoder);
  390. int r600_hdmi_buffer_status_changed(struct drm_encoder *encoder);
  391. void r600_hdmi_update_audio_settings(struct drm_encoder *encoder);
  392. int r600_mc_wait_for_idle(struct radeon_device *rdev);
  393. u32 r600_get_xclk(struct radeon_device *rdev);
  394. uint64_t r600_get_gpu_clock_counter(struct radeon_device *rdev);
  395. int rv6xx_get_temp(struct radeon_device *rdev);
  396. int r600_set_uvd_clocks(struct radeon_device *rdev, u32 vclk, u32 dclk);
  397. int r600_dpm_pre_set_power_state(struct radeon_device *rdev);
  398. void r600_dpm_post_set_power_state(struct radeon_device *rdev);
  399. int r600_dpm_late_enable(struct radeon_device *rdev);
  400. /* r600 dma */
  401. uint32_t r600_dma_get_rptr(struct radeon_device *rdev,
  402. struct radeon_ring *ring);
  403. uint32_t r600_dma_get_wptr(struct radeon_device *rdev,
  404. struct radeon_ring *ring);
  405. void r600_dma_set_wptr(struct radeon_device *rdev,
  406. struct radeon_ring *ring);
  407. /* rv6xx dpm */
  408. int rv6xx_dpm_init(struct radeon_device *rdev);
  409. int rv6xx_dpm_enable(struct radeon_device *rdev);
  410. void rv6xx_dpm_disable(struct radeon_device *rdev);
  411. int rv6xx_dpm_set_power_state(struct radeon_device *rdev);
  412. void rv6xx_setup_asic(struct radeon_device *rdev);
  413. void rv6xx_dpm_display_configuration_changed(struct radeon_device *rdev);
  414. void rv6xx_dpm_fini(struct radeon_device *rdev);
  415. u32 rv6xx_dpm_get_sclk(struct radeon_device *rdev, bool low);
  416. u32 rv6xx_dpm_get_mclk(struct radeon_device *rdev, bool low);
  417. void rv6xx_dpm_print_power_state(struct radeon_device *rdev,
  418. struct radeon_ps *ps);
  419. void rv6xx_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev,
  420. struct seq_file *m);
  421. int rv6xx_dpm_force_performance_level(struct radeon_device *rdev,
  422. enum radeon_dpm_forced_level level);
  423. u32 rv6xx_dpm_get_current_sclk(struct radeon_device *rdev);
  424. u32 rv6xx_dpm_get_current_mclk(struct radeon_device *rdev);
  425. /* rs780 dpm */
  426. int rs780_dpm_init(struct radeon_device *rdev);
  427. int rs780_dpm_enable(struct radeon_device *rdev);
  428. void rs780_dpm_disable(struct radeon_device *rdev);
  429. int rs780_dpm_set_power_state(struct radeon_device *rdev);
  430. void rs780_dpm_setup_asic(struct radeon_device *rdev);
  431. void rs780_dpm_display_configuration_changed(struct radeon_device *rdev);
  432. void rs780_dpm_fini(struct radeon_device *rdev);
  433. u32 rs780_dpm_get_sclk(struct radeon_device *rdev, bool low);
  434. u32 rs780_dpm_get_mclk(struct radeon_device *rdev, bool low);
  435. void rs780_dpm_print_power_state(struct radeon_device *rdev,
  436. struct radeon_ps *ps);
  437. void rs780_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev,
  438. struct seq_file *m);
  439. int rs780_dpm_force_performance_level(struct radeon_device *rdev,
  440. enum radeon_dpm_forced_level level);
  441. u32 rs780_dpm_get_current_sclk(struct radeon_device *rdev);
  442. u32 rs780_dpm_get_current_mclk(struct radeon_device *rdev);
  443. /*
  444. * rv770,rv730,rv710,rv740
  445. */
  446. int rv770_init(struct radeon_device *rdev);
  447. void rv770_fini(struct radeon_device *rdev);
  448. int rv770_suspend(struct radeon_device *rdev);
  449. int rv770_resume(struct radeon_device *rdev);
  450. void rv770_pm_misc(struct radeon_device *rdev);
  451. void rv770_page_flip(struct radeon_device *rdev, int crtc, u64 crtc_base);
  452. bool rv770_page_flip_pending(struct radeon_device *rdev, int crtc);
  453. void r700_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc);
  454. void r700_cp_stop(struct radeon_device *rdev);
  455. void r700_cp_fini(struct radeon_device *rdev);
  456. struct radeon_fence *rv770_copy_dma(struct radeon_device *rdev,
  457. uint64_t src_offset, uint64_t dst_offset,
  458. unsigned num_gpu_pages,
  459. struct reservation_object *resv);
  460. u32 rv770_get_xclk(struct radeon_device *rdev);
  461. int rv770_set_uvd_clocks(struct radeon_device *rdev, u32 vclk, u32 dclk);
  462. int rv770_get_temp(struct radeon_device *rdev);
  463. /* rv7xx pm */
  464. int rv770_dpm_init(struct radeon_device *rdev);
  465. int rv770_dpm_enable(struct radeon_device *rdev);
  466. int rv770_dpm_late_enable(struct radeon_device *rdev);
  467. void rv770_dpm_disable(struct radeon_device *rdev);
  468. int rv770_dpm_set_power_state(struct radeon_device *rdev);
  469. void rv770_dpm_setup_asic(struct radeon_device *rdev);
  470. void rv770_dpm_display_configuration_changed(struct radeon_device *rdev);
  471. void rv770_dpm_fini(struct radeon_device *rdev);
  472. u32 rv770_dpm_get_sclk(struct radeon_device *rdev, bool low);
  473. u32 rv770_dpm_get_mclk(struct radeon_device *rdev, bool low);
  474. void rv770_dpm_print_power_state(struct radeon_device *rdev,
  475. struct radeon_ps *ps);
  476. void rv770_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev,
  477. struct seq_file *m);
  478. int rv770_dpm_force_performance_level(struct radeon_device *rdev,
  479. enum radeon_dpm_forced_level level);
  480. bool rv770_dpm_vblank_too_short(struct radeon_device *rdev);
  481. u32 rv770_dpm_get_current_sclk(struct radeon_device *rdev);
  482. u32 rv770_dpm_get_current_mclk(struct radeon_device *rdev);
  483. /*
  484. * evergreen
  485. */
  486. struct evergreen_mc_save {
  487. u32 vga_render_control;
  488. u32 vga_hdp_control;
  489. bool crtc_enabled[RADEON_MAX_CRTCS];
  490. };
  491. void evergreen_pcie_gart_tlb_flush(struct radeon_device *rdev);
  492. int evergreen_init(struct radeon_device *rdev);
  493. void evergreen_fini(struct radeon_device *rdev);
  494. int evergreen_suspend(struct radeon_device *rdev);
  495. int evergreen_resume(struct radeon_device *rdev);
  496. bool evergreen_gfx_is_lockup(struct radeon_device *rdev, struct radeon_ring *cp);
  497. bool evergreen_dma_is_lockup(struct radeon_device *rdev, struct radeon_ring *cp);
  498. int evergreen_asic_reset(struct radeon_device *rdev);
  499. void evergreen_bandwidth_update(struct radeon_device *rdev);
  500. void evergreen_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib);
  501. void evergreen_hpd_init(struct radeon_device *rdev);
  502. void evergreen_hpd_fini(struct radeon_device *rdev);
  503. bool evergreen_hpd_sense(struct radeon_device *rdev, enum radeon_hpd_id hpd);
  504. void evergreen_hpd_set_polarity(struct radeon_device *rdev,
  505. enum radeon_hpd_id hpd);
  506. u32 evergreen_get_vblank_counter(struct radeon_device *rdev, int crtc);
  507. int evergreen_irq_set(struct radeon_device *rdev);
  508. int evergreen_irq_process(struct radeon_device *rdev);
  509. extern int evergreen_cs_parse(struct radeon_cs_parser *p);
  510. extern int evergreen_dma_cs_parse(struct radeon_cs_parser *p);
  511. extern void evergreen_pm_misc(struct radeon_device *rdev);
  512. extern void evergreen_pm_prepare(struct radeon_device *rdev);
  513. extern void evergreen_pm_finish(struct radeon_device *rdev);
  514. extern void sumo_pm_init_profile(struct radeon_device *rdev);
  515. extern void btc_pm_init_profile(struct radeon_device *rdev);
  516. int sumo_set_uvd_clocks(struct radeon_device *rdev, u32 vclk, u32 dclk);
  517. int evergreen_set_uvd_clocks(struct radeon_device *rdev, u32 vclk, u32 dclk);
  518. extern void evergreen_page_flip(struct radeon_device *rdev, int crtc,
  519. u64 crtc_base);
  520. extern bool evergreen_page_flip_pending(struct radeon_device *rdev, int crtc);
  521. extern void dce4_wait_for_vblank(struct radeon_device *rdev, int crtc);
  522. void evergreen_disable_interrupt_state(struct radeon_device *rdev);
  523. int evergreen_mc_wait_for_idle(struct radeon_device *rdev);
  524. void evergreen_dma_fence_ring_emit(struct radeon_device *rdev,
  525. struct radeon_fence *fence);
  526. void evergreen_dma_ring_ib_execute(struct radeon_device *rdev,
  527. struct radeon_ib *ib);
  528. struct radeon_fence *evergreen_copy_dma(struct radeon_device *rdev,
  529. uint64_t src_offset, uint64_t dst_offset,
  530. unsigned num_gpu_pages,
  531. struct reservation_object *resv);
  532. int evergreen_get_temp(struct radeon_device *rdev);
  533. int evergreen_get_allowed_info_register(struct radeon_device *rdev,
  534. u32 reg, u32 *val);
  535. int sumo_get_temp(struct radeon_device *rdev);
  536. int tn_get_temp(struct radeon_device *rdev);
  537. int cypress_dpm_init(struct radeon_device *rdev);
  538. void cypress_dpm_setup_asic(struct radeon_device *rdev);
  539. int cypress_dpm_enable(struct radeon_device *rdev);
  540. void cypress_dpm_disable(struct radeon_device *rdev);
  541. int cypress_dpm_set_power_state(struct radeon_device *rdev);
  542. void cypress_dpm_display_configuration_changed(struct radeon_device *rdev);
  543. void cypress_dpm_fini(struct radeon_device *rdev);
  544. bool cypress_dpm_vblank_too_short(struct radeon_device *rdev);
  545. int btc_dpm_init(struct radeon_device *rdev);
  546. void btc_dpm_setup_asic(struct radeon_device *rdev);
  547. int btc_dpm_enable(struct radeon_device *rdev);
  548. void btc_dpm_disable(struct radeon_device *rdev);
  549. int btc_dpm_pre_set_power_state(struct radeon_device *rdev);
  550. int btc_dpm_set_power_state(struct radeon_device *rdev);
  551. void btc_dpm_post_set_power_state(struct radeon_device *rdev);
  552. void btc_dpm_fini(struct radeon_device *rdev);
  553. u32 btc_dpm_get_sclk(struct radeon_device *rdev, bool low);
  554. u32 btc_dpm_get_mclk(struct radeon_device *rdev, bool low);
  555. bool btc_dpm_vblank_too_short(struct radeon_device *rdev);
  556. void btc_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev,
  557. struct seq_file *m);
  558. u32 btc_dpm_get_current_sclk(struct radeon_device *rdev);
  559. u32 btc_dpm_get_current_mclk(struct radeon_device *rdev);
  560. int sumo_dpm_init(struct radeon_device *rdev);
  561. int sumo_dpm_enable(struct radeon_device *rdev);
  562. int sumo_dpm_late_enable(struct radeon_device *rdev);
  563. void sumo_dpm_disable(struct radeon_device *rdev);
  564. int sumo_dpm_pre_set_power_state(struct radeon_device *rdev);
  565. int sumo_dpm_set_power_state(struct radeon_device *rdev);
  566. void sumo_dpm_post_set_power_state(struct radeon_device *rdev);
  567. void sumo_dpm_setup_asic(struct radeon_device *rdev);
  568. void sumo_dpm_display_configuration_changed(struct radeon_device *rdev);
  569. void sumo_dpm_fini(struct radeon_device *rdev);
  570. u32 sumo_dpm_get_sclk(struct radeon_device *rdev, bool low);
  571. u32 sumo_dpm_get_mclk(struct radeon_device *rdev, bool low);
  572. void sumo_dpm_print_power_state(struct radeon_device *rdev,
  573. struct radeon_ps *ps);
  574. void sumo_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev,
  575. struct seq_file *m);
  576. int sumo_dpm_force_performance_level(struct radeon_device *rdev,
  577. enum radeon_dpm_forced_level level);
  578. u32 sumo_dpm_get_current_sclk(struct radeon_device *rdev);
  579. u32 sumo_dpm_get_current_mclk(struct radeon_device *rdev);
  580. /*
  581. * cayman
  582. */
  583. void cayman_fence_ring_emit(struct radeon_device *rdev,
  584. struct radeon_fence *fence);
  585. void cayman_pcie_gart_tlb_flush(struct radeon_device *rdev);
  586. int cayman_init(struct radeon_device *rdev);
  587. void cayman_fini(struct radeon_device *rdev);
  588. int cayman_suspend(struct radeon_device *rdev);
  589. int cayman_resume(struct radeon_device *rdev);
  590. int cayman_asic_reset(struct radeon_device *rdev);
  591. void cayman_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib);
  592. int cayman_vm_init(struct radeon_device *rdev);
  593. void cayman_vm_fini(struct radeon_device *rdev);
  594. void cayman_vm_flush(struct radeon_device *rdev, struct radeon_ring *ring,
  595. unsigned vm_id, uint64_t pd_addr);
  596. uint32_t cayman_vm_page_flags(struct radeon_device *rdev, uint32_t flags);
  597. int evergreen_ib_parse(struct radeon_device *rdev, struct radeon_ib *ib);
  598. int evergreen_dma_ib_parse(struct radeon_device *rdev, struct radeon_ib *ib);
  599. void cayman_dma_ring_ib_execute(struct radeon_device *rdev,
  600. struct radeon_ib *ib);
  601. bool cayman_gfx_is_lockup(struct radeon_device *rdev, struct radeon_ring *ring);
  602. bool cayman_dma_is_lockup(struct radeon_device *rdev, struct radeon_ring *ring);
  603. void cayman_dma_vm_copy_pages(struct radeon_device *rdev,
  604. struct radeon_ib *ib,
  605. uint64_t pe, uint64_t src,
  606. unsigned count);
  607. void cayman_dma_vm_write_pages(struct radeon_device *rdev,
  608. struct radeon_ib *ib,
  609. uint64_t pe,
  610. uint64_t addr, unsigned count,
  611. uint32_t incr, uint32_t flags);
  612. void cayman_dma_vm_set_pages(struct radeon_device *rdev,
  613. struct radeon_ib *ib,
  614. uint64_t pe,
  615. uint64_t addr, unsigned count,
  616. uint32_t incr, uint32_t flags);
  617. void cayman_dma_vm_pad_ib(struct radeon_ib *ib);
  618. void cayman_dma_vm_flush(struct radeon_device *rdev, struct radeon_ring *ring,
  619. unsigned vm_id, uint64_t pd_addr);
  620. u32 cayman_gfx_get_rptr(struct radeon_device *rdev,
  621. struct radeon_ring *ring);
  622. u32 cayman_gfx_get_wptr(struct radeon_device *rdev,
  623. struct radeon_ring *ring);
  624. void cayman_gfx_set_wptr(struct radeon_device *rdev,
  625. struct radeon_ring *ring);
  626. uint32_t cayman_dma_get_rptr(struct radeon_device *rdev,
  627. struct radeon_ring *ring);
  628. uint32_t cayman_dma_get_wptr(struct radeon_device *rdev,
  629. struct radeon_ring *ring);
  630. void cayman_dma_set_wptr(struct radeon_device *rdev,
  631. struct radeon_ring *ring);
  632. int cayman_get_allowed_info_register(struct radeon_device *rdev,
  633. u32 reg, u32 *val);
  634. int ni_dpm_init(struct radeon_device *rdev);
  635. void ni_dpm_setup_asic(struct radeon_device *rdev);
  636. int ni_dpm_enable(struct radeon_device *rdev);
  637. void ni_dpm_disable(struct radeon_device *rdev);
  638. int ni_dpm_pre_set_power_state(struct radeon_device *rdev);
  639. int ni_dpm_set_power_state(struct radeon_device *rdev);
  640. void ni_dpm_post_set_power_state(struct radeon_device *rdev);
  641. void ni_dpm_fini(struct radeon_device *rdev);
  642. u32 ni_dpm_get_sclk(struct radeon_device *rdev, bool low);
  643. u32 ni_dpm_get_mclk(struct radeon_device *rdev, bool low);
  644. void ni_dpm_print_power_state(struct radeon_device *rdev,
  645. struct radeon_ps *ps);
  646. void ni_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev,
  647. struct seq_file *m);
  648. int ni_dpm_force_performance_level(struct radeon_device *rdev,
  649. enum radeon_dpm_forced_level level);
  650. bool ni_dpm_vblank_too_short(struct radeon_device *rdev);
  651. u32 ni_dpm_get_current_sclk(struct radeon_device *rdev);
  652. u32 ni_dpm_get_current_mclk(struct radeon_device *rdev);
  653. int trinity_dpm_init(struct radeon_device *rdev);
  654. int trinity_dpm_enable(struct radeon_device *rdev);
  655. int trinity_dpm_late_enable(struct radeon_device *rdev);
  656. void trinity_dpm_disable(struct radeon_device *rdev);
  657. int trinity_dpm_pre_set_power_state(struct radeon_device *rdev);
  658. int trinity_dpm_set_power_state(struct radeon_device *rdev);
  659. void trinity_dpm_post_set_power_state(struct radeon_device *rdev);
  660. void trinity_dpm_setup_asic(struct radeon_device *rdev);
  661. void trinity_dpm_display_configuration_changed(struct radeon_device *rdev);
  662. void trinity_dpm_fini(struct radeon_device *rdev);
  663. u32 trinity_dpm_get_sclk(struct radeon_device *rdev, bool low);
  664. u32 trinity_dpm_get_mclk(struct radeon_device *rdev, bool low);
  665. void trinity_dpm_print_power_state(struct radeon_device *rdev,
  666. struct radeon_ps *ps);
  667. void trinity_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev,
  668. struct seq_file *m);
  669. int trinity_dpm_force_performance_level(struct radeon_device *rdev,
  670. enum radeon_dpm_forced_level level);
  671. void trinity_dpm_enable_bapm(struct radeon_device *rdev, bool enable);
  672. u32 trinity_dpm_get_current_sclk(struct radeon_device *rdev);
  673. u32 trinity_dpm_get_current_mclk(struct radeon_device *rdev);
  674. int tn_set_vce_clocks(struct radeon_device *rdev, u32 evclk, u32 ecclk);
  675. /* DCE6 - SI */
  676. void dce6_bandwidth_update(struct radeon_device *rdev);
  677. void dce6_audio_fini(struct radeon_device *rdev);
  678. /*
  679. * si
  680. */
  681. void si_fence_ring_emit(struct radeon_device *rdev,
  682. struct radeon_fence *fence);
  683. void si_pcie_gart_tlb_flush(struct radeon_device *rdev);
  684. int si_init(struct radeon_device *rdev);
  685. void si_fini(struct radeon_device *rdev);
  686. int si_suspend(struct radeon_device *rdev);
  687. int si_resume(struct radeon_device *rdev);
  688. bool si_gfx_is_lockup(struct radeon_device *rdev, struct radeon_ring *cp);
  689. bool si_dma_is_lockup(struct radeon_device *rdev, struct radeon_ring *cp);
  690. int si_asic_reset(struct radeon_device *rdev);
  691. void si_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib);
  692. int si_irq_set(struct radeon_device *rdev);
  693. int si_irq_process(struct radeon_device *rdev);
  694. int si_vm_init(struct radeon_device *rdev);
  695. void si_vm_fini(struct radeon_device *rdev);
  696. void si_vm_flush(struct radeon_device *rdev, struct radeon_ring *ring,
  697. unsigned vm_id, uint64_t pd_addr);
  698. int si_ib_parse(struct radeon_device *rdev, struct radeon_ib *ib);
  699. struct radeon_fence *si_copy_dma(struct radeon_device *rdev,
  700. uint64_t src_offset, uint64_t dst_offset,
  701. unsigned num_gpu_pages,
  702. struct reservation_object *resv);
  703. void si_dma_vm_copy_pages(struct radeon_device *rdev,
  704. struct radeon_ib *ib,
  705. uint64_t pe, uint64_t src,
  706. unsigned count);
  707. void si_dma_vm_write_pages(struct radeon_device *rdev,
  708. struct radeon_ib *ib,
  709. uint64_t pe,
  710. uint64_t addr, unsigned count,
  711. uint32_t incr, uint32_t flags);
  712. void si_dma_vm_set_pages(struct radeon_device *rdev,
  713. struct radeon_ib *ib,
  714. uint64_t pe,
  715. uint64_t addr, unsigned count,
  716. uint32_t incr, uint32_t flags);
  717. void si_dma_vm_flush(struct radeon_device *rdev, struct radeon_ring *ring,
  718. unsigned vm_id, uint64_t pd_addr);
  719. u32 si_get_xclk(struct radeon_device *rdev);
  720. uint64_t si_get_gpu_clock_counter(struct radeon_device *rdev);
  721. int si_set_uvd_clocks(struct radeon_device *rdev, u32 vclk, u32 dclk);
  722. int si_set_vce_clocks(struct radeon_device *rdev, u32 evclk, u32 ecclk);
  723. int si_get_temp(struct radeon_device *rdev);
  724. int si_get_allowed_info_register(struct radeon_device *rdev,
  725. u32 reg, u32 *val);
  726. int si_dpm_init(struct radeon_device *rdev);
  727. void si_dpm_setup_asic(struct radeon_device *rdev);
  728. int si_dpm_enable(struct radeon_device *rdev);
  729. int si_dpm_late_enable(struct radeon_device *rdev);
  730. void si_dpm_disable(struct radeon_device *rdev);
  731. int si_dpm_pre_set_power_state(struct radeon_device *rdev);
  732. int si_dpm_set_power_state(struct radeon_device *rdev);
  733. void si_dpm_post_set_power_state(struct radeon_device *rdev);
  734. void si_dpm_fini(struct radeon_device *rdev);
  735. void si_dpm_display_configuration_changed(struct radeon_device *rdev);
  736. void si_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev,
  737. struct seq_file *m);
  738. int si_dpm_force_performance_level(struct radeon_device *rdev,
  739. enum radeon_dpm_forced_level level);
  740. int si_fan_ctrl_get_fan_speed_percent(struct radeon_device *rdev,
  741. u32 *speed);
  742. int si_fan_ctrl_set_fan_speed_percent(struct radeon_device *rdev,
  743. u32 speed);
  744. u32 si_fan_ctrl_get_mode(struct radeon_device *rdev);
  745. void si_fan_ctrl_set_mode(struct radeon_device *rdev, u32 mode);
  746. u32 si_dpm_get_current_sclk(struct radeon_device *rdev);
  747. u32 si_dpm_get_current_mclk(struct radeon_device *rdev);
  748. /* DCE8 - CIK */
  749. void dce8_bandwidth_update(struct radeon_device *rdev);
  750. /*
  751. * cik
  752. */
  753. uint64_t cik_get_gpu_clock_counter(struct radeon_device *rdev);
  754. u32 cik_get_xclk(struct radeon_device *rdev);
  755. uint32_t cik_pciep_rreg(struct radeon_device *rdev, uint32_t reg);
  756. void cik_pciep_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v);
  757. int cik_set_uvd_clocks(struct radeon_device *rdev, u32 vclk, u32 dclk);
  758. int cik_set_vce_clocks(struct radeon_device *rdev, u32 evclk, u32 ecclk);
  759. void cik_sdma_fence_ring_emit(struct radeon_device *rdev,
  760. struct radeon_fence *fence);
  761. bool cik_sdma_semaphore_ring_emit(struct radeon_device *rdev,
  762. struct radeon_ring *ring,
  763. struct radeon_semaphore *semaphore,
  764. bool emit_wait);
  765. void cik_sdma_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib);
  766. struct radeon_fence *cik_copy_dma(struct radeon_device *rdev,
  767. uint64_t src_offset, uint64_t dst_offset,
  768. unsigned num_gpu_pages,
  769. struct reservation_object *resv);
  770. struct radeon_fence *cik_copy_cpdma(struct radeon_device *rdev,
  771. uint64_t src_offset, uint64_t dst_offset,
  772. unsigned num_gpu_pages,
  773. struct reservation_object *resv);
  774. int cik_sdma_ring_test(struct radeon_device *rdev, struct radeon_ring *ring);
  775. int cik_sdma_ib_test(struct radeon_device *rdev, struct radeon_ring *ring);
  776. bool cik_sdma_is_lockup(struct radeon_device *rdev, struct radeon_ring *ring);
  777. void cik_fence_gfx_ring_emit(struct radeon_device *rdev,
  778. struct radeon_fence *fence);
  779. void cik_fence_compute_ring_emit(struct radeon_device *rdev,
  780. struct radeon_fence *fence);
  781. bool cik_semaphore_ring_emit(struct radeon_device *rdev,
  782. struct radeon_ring *cp,
  783. struct radeon_semaphore *semaphore,
  784. bool emit_wait);
  785. void cik_pcie_gart_tlb_flush(struct radeon_device *rdev);
  786. int cik_init(struct radeon_device *rdev);
  787. void cik_fini(struct radeon_device *rdev);
  788. int cik_suspend(struct radeon_device *rdev);
  789. int cik_resume(struct radeon_device *rdev);
  790. bool cik_gfx_is_lockup(struct radeon_device *rdev, struct radeon_ring *cp);
  791. int cik_asic_reset(struct radeon_device *rdev);
  792. void cik_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib);
  793. int cik_ring_test(struct radeon_device *rdev, struct radeon_ring *ring);
  794. int cik_ib_test(struct radeon_device *rdev, struct radeon_ring *ring);
  795. int cik_irq_set(struct radeon_device *rdev);
  796. int cik_irq_process(struct radeon_device *rdev);
  797. int cik_vm_init(struct radeon_device *rdev);
  798. void cik_vm_fini(struct radeon_device *rdev);
  799. void cik_vm_flush(struct radeon_device *rdev, struct radeon_ring *ring,
  800. unsigned vm_id, uint64_t pd_addr);
  801. void cik_sdma_vm_copy_pages(struct radeon_device *rdev,
  802. struct radeon_ib *ib,
  803. uint64_t pe, uint64_t src,
  804. unsigned count);
  805. void cik_sdma_vm_write_pages(struct radeon_device *rdev,
  806. struct radeon_ib *ib,
  807. uint64_t pe,
  808. uint64_t addr, unsigned count,
  809. uint32_t incr, uint32_t flags);
  810. void cik_sdma_vm_set_pages(struct radeon_device *rdev,
  811. struct radeon_ib *ib,
  812. uint64_t pe,
  813. uint64_t addr, unsigned count,
  814. uint32_t incr, uint32_t flags);
  815. void cik_sdma_vm_pad_ib(struct radeon_ib *ib);
  816. void cik_dma_vm_flush(struct radeon_device *rdev, struct radeon_ring *ring,
  817. unsigned vm_id, uint64_t pd_addr);
  818. int cik_ib_parse(struct radeon_device *rdev, struct radeon_ib *ib);
  819. u32 cik_gfx_get_rptr(struct radeon_device *rdev,
  820. struct radeon_ring *ring);
  821. u32 cik_gfx_get_wptr(struct radeon_device *rdev,
  822. struct radeon_ring *ring);
  823. void cik_gfx_set_wptr(struct radeon_device *rdev,
  824. struct radeon_ring *ring);
  825. u32 cik_compute_get_rptr(struct radeon_device *rdev,
  826. struct radeon_ring *ring);
  827. u32 cik_compute_get_wptr(struct radeon_device *rdev,
  828. struct radeon_ring *ring);
  829. void cik_compute_set_wptr(struct radeon_device *rdev,
  830. struct radeon_ring *ring);
  831. u32 cik_sdma_get_rptr(struct radeon_device *rdev,
  832. struct radeon_ring *ring);
  833. u32 cik_sdma_get_wptr(struct radeon_device *rdev,
  834. struct radeon_ring *ring);
  835. void cik_sdma_set_wptr(struct radeon_device *rdev,
  836. struct radeon_ring *ring);
  837. int ci_get_temp(struct radeon_device *rdev);
  838. int kv_get_temp(struct radeon_device *rdev);
  839. int cik_get_allowed_info_register(struct radeon_device *rdev,
  840. u32 reg, u32 *val);
  841. int ci_dpm_init(struct radeon_device *rdev);
  842. int ci_dpm_enable(struct radeon_device *rdev);
  843. int ci_dpm_late_enable(struct radeon_device *rdev);
  844. void ci_dpm_disable(struct radeon_device *rdev);
  845. int ci_dpm_pre_set_power_state(struct radeon_device *rdev);
  846. int ci_dpm_set_power_state(struct radeon_device *rdev);
  847. void ci_dpm_post_set_power_state(struct radeon_device *rdev);
  848. void ci_dpm_setup_asic(struct radeon_device *rdev);
  849. void ci_dpm_display_configuration_changed(struct radeon_device *rdev);
  850. void ci_dpm_fini(struct radeon_device *rdev);
  851. u32 ci_dpm_get_sclk(struct radeon_device *rdev, bool low);
  852. u32 ci_dpm_get_mclk(struct radeon_device *rdev, bool low);
  853. void ci_dpm_print_power_state(struct radeon_device *rdev,
  854. struct radeon_ps *ps);
  855. void ci_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev,
  856. struct seq_file *m);
  857. int ci_dpm_force_performance_level(struct radeon_device *rdev,
  858. enum radeon_dpm_forced_level level);
  859. bool ci_dpm_vblank_too_short(struct radeon_device *rdev);
  860. void ci_dpm_powergate_uvd(struct radeon_device *rdev, bool gate);
  861. u32 ci_dpm_get_current_sclk(struct radeon_device *rdev);
  862. u32 ci_dpm_get_current_mclk(struct radeon_device *rdev);
  863. int ci_fan_ctrl_get_fan_speed_percent(struct radeon_device *rdev,
  864. u32 *speed);
  865. int ci_fan_ctrl_set_fan_speed_percent(struct radeon_device *rdev,
  866. u32 speed);
  867. u32 ci_fan_ctrl_get_mode(struct radeon_device *rdev);
  868. void ci_fan_ctrl_set_mode(struct radeon_device *rdev, u32 mode);
  869. int kv_dpm_init(struct radeon_device *rdev);
  870. int kv_dpm_enable(struct radeon_device *rdev);
  871. int kv_dpm_late_enable(struct radeon_device *rdev);
  872. void kv_dpm_disable(struct radeon_device *rdev);
  873. int kv_dpm_pre_set_power_state(struct radeon_device *rdev);
  874. int kv_dpm_set_power_state(struct radeon_device *rdev);
  875. void kv_dpm_post_set_power_state(struct radeon_device *rdev);
  876. void kv_dpm_setup_asic(struct radeon_device *rdev);
  877. void kv_dpm_display_configuration_changed(struct radeon_device *rdev);
  878. void kv_dpm_fini(struct radeon_device *rdev);
  879. u32 kv_dpm_get_sclk(struct radeon_device *rdev, bool low);
  880. u32 kv_dpm_get_mclk(struct radeon_device *rdev, bool low);
  881. void kv_dpm_print_power_state(struct radeon_device *rdev,
  882. struct radeon_ps *ps);
  883. void kv_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev,
  884. struct seq_file *m);
  885. int kv_dpm_force_performance_level(struct radeon_device *rdev,
  886. enum radeon_dpm_forced_level level);
  887. void kv_dpm_powergate_uvd(struct radeon_device *rdev, bool gate);
  888. void kv_dpm_enable_bapm(struct radeon_device *rdev, bool enable);
  889. u32 kv_dpm_get_current_sclk(struct radeon_device *rdev);
  890. u32 kv_dpm_get_current_mclk(struct radeon_device *rdev);
  891. /* uvd v1.0 */
  892. uint32_t uvd_v1_0_get_rptr(struct radeon_device *rdev,
  893. struct radeon_ring *ring);
  894. uint32_t uvd_v1_0_get_wptr(struct radeon_device *rdev,
  895. struct radeon_ring *ring);
  896. void uvd_v1_0_set_wptr(struct radeon_device *rdev,
  897. struct radeon_ring *ring);
  898. int uvd_v1_0_resume(struct radeon_device *rdev);
  899. int uvd_v1_0_init(struct radeon_device *rdev);
  900. void uvd_v1_0_fini(struct radeon_device *rdev);
  901. int uvd_v1_0_start(struct radeon_device *rdev);
  902. void uvd_v1_0_stop(struct radeon_device *rdev);
  903. int uvd_v1_0_ring_test(struct radeon_device *rdev, struct radeon_ring *ring);
  904. void uvd_v1_0_fence_emit(struct radeon_device *rdev,
  905. struct radeon_fence *fence);
  906. int uvd_v1_0_ib_test(struct radeon_device *rdev, struct radeon_ring *ring);
  907. bool uvd_v1_0_semaphore_emit(struct radeon_device *rdev,
  908. struct radeon_ring *ring,
  909. struct radeon_semaphore *semaphore,
  910. bool emit_wait);
  911. void uvd_v1_0_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib);
  912. /* uvd v2.2 */
  913. int uvd_v2_2_resume(struct radeon_device *rdev);
  914. void uvd_v2_2_fence_emit(struct radeon_device *rdev,
  915. struct radeon_fence *fence);
  916. bool uvd_v2_2_semaphore_emit(struct radeon_device *rdev,
  917. struct radeon_ring *ring,
  918. struct radeon_semaphore *semaphore,
  919. bool emit_wait);
  920. /* uvd v3.1 */
  921. bool uvd_v3_1_semaphore_emit(struct radeon_device *rdev,
  922. struct radeon_ring *ring,
  923. struct radeon_semaphore *semaphore,
  924. bool emit_wait);
  925. /* uvd v4.2 */
  926. int uvd_v4_2_resume(struct radeon_device *rdev);
  927. /* vce v1.0 */
  928. uint32_t vce_v1_0_get_rptr(struct radeon_device *rdev,
  929. struct radeon_ring *ring);
  930. uint32_t vce_v1_0_get_wptr(struct radeon_device *rdev,
  931. struct radeon_ring *ring);
  932. void vce_v1_0_set_wptr(struct radeon_device *rdev,
  933. struct radeon_ring *ring);
  934. int vce_v1_0_load_fw(struct radeon_device *rdev, uint32_t *data);
  935. unsigned vce_v1_0_bo_size(struct radeon_device *rdev);
  936. int vce_v1_0_resume(struct radeon_device *rdev);
  937. int vce_v1_0_init(struct radeon_device *rdev);
  938. int vce_v1_0_start(struct radeon_device *rdev);
  939. /* vce v2.0 */
  940. unsigned vce_v2_0_bo_size(struct radeon_device *rdev);
  941. int vce_v2_0_resume(struct radeon_device *rdev);
  942. #endif