aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/radeon.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon.h')
-rw-r--r--drivers/gpu/drm/radeon/radeon.h148
1 files changed, 140 insertions, 8 deletions
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index c0356bb193e5..2434d553bbbc 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -89,6 +89,7 @@ extern int radeon_testing;
89extern int radeon_connector_table; 89extern int radeon_connector_table;
90extern int radeon_tv; 90extern int radeon_tv;
91extern int radeon_new_pll; 91extern int radeon_new_pll;
92extern int radeon_dynpm;
92extern int radeon_audio; 93extern int radeon_audio;
93 94
94/* 95/*
@@ -138,17 +139,23 @@ void radeon_dummy_page_fini(struct radeon_device *rdev);
138struct radeon_clock { 139struct radeon_clock {
139 struct radeon_pll p1pll; 140 struct radeon_pll p1pll;
140 struct radeon_pll p2pll; 141 struct radeon_pll p2pll;
142 struct radeon_pll dcpll;
141 struct radeon_pll spll; 143 struct radeon_pll spll;
142 struct radeon_pll mpll; 144 struct radeon_pll mpll;
143 /* 10 Khz units */ 145 /* 10 Khz units */
144 uint32_t default_mclk; 146 uint32_t default_mclk;
145 uint32_t default_sclk; 147 uint32_t default_sclk;
148 uint32_t default_dispclk;
149 uint32_t dp_extclk;
146}; 150};
147 151
148/* 152/*
149 * Power management 153 * Power management
150 */ 154 */
151int radeon_pm_init(struct radeon_device *rdev); 155int radeon_pm_init(struct radeon_device *rdev);
156void radeon_pm_compute_clocks(struct radeon_device *rdev);
157void radeon_combios_get_power_modes(struct radeon_device *rdev);
158void radeon_atombios_get_power_modes(struct radeon_device *rdev);
152 159
153/* 160/*
154 * Fences. 161 * Fences.
@@ -275,6 +282,7 @@ union radeon_gart_table {
275}; 282};
276 283
277#define RADEON_GPU_PAGE_SIZE 4096 284#define RADEON_GPU_PAGE_SIZE 4096
285#define RADEON_GPU_PAGE_MASK (RADEON_GPU_PAGE_SIZE - 1)
278 286
279struct radeon_gart { 287struct radeon_gart {
280 dma_addr_t table_addr; 288 dma_addr_t table_addr;
@@ -309,21 +317,19 @@ struct radeon_mc {
309 /* for some chips with <= 32MB we need to lie 317 /* for some chips with <= 32MB we need to lie
310 * about vram size near mc fb location */ 318 * about vram size near mc fb location */
311 u64 mc_vram_size; 319 u64 mc_vram_size;
312 u64 gtt_location; 320 u64 visible_vram_size;
313 u64 gtt_size; 321 u64 gtt_size;
314 u64 gtt_start; 322 u64 gtt_start;
315 u64 gtt_end; 323 u64 gtt_end;
316 u64 vram_location;
317 u64 vram_start; 324 u64 vram_start;
318 u64 vram_end; 325 u64 vram_end;
319 unsigned vram_width; 326 unsigned vram_width;
320 u64 real_vram_size; 327 u64 real_vram_size;
321 int vram_mtrr; 328 int vram_mtrr;
322 bool vram_is_ddr; 329 bool vram_is_ddr;
323 bool igp_sideport_enabled; 330 bool igp_sideport_enabled;
324}; 331};
325 332
326int radeon_mc_setup(struct radeon_device *rdev);
327bool radeon_combios_sideport_present(struct radeon_device *rdev); 333bool radeon_combios_sideport_present(struct radeon_device *rdev);
328bool radeon_atombios_sideport_present(struct radeon_device *rdev); 334bool radeon_atombios_sideport_present(struct radeon_device *rdev);
329 335
@@ -348,6 +354,7 @@ struct radeon_irq {
348 bool sw_int; 354 bool sw_int;
349 /* FIXME: use a define max crtc rather than hardcode it */ 355 /* FIXME: use a define max crtc rather than hardcode it */
350 bool crtc_vblank_int[2]; 356 bool crtc_vblank_int[2];
357 wait_queue_head_t vblank_queue;
351 /* FIXME: use defines for max hpd/dacs */ 358 /* FIXME: use defines for max hpd/dacs */
352 bool hpd[6]; 359 bool hpd[6];
353 spinlock_t sw_lock; 360 spinlock_t sw_lock;
@@ -379,6 +386,7 @@ struct radeon_ib {
379struct radeon_ib_pool { 386struct radeon_ib_pool {
380 struct mutex mutex; 387 struct mutex mutex;
381 struct radeon_bo *robj; 388 struct radeon_bo *robj;
389 struct list_head bogus_ib;
382 struct radeon_ib ibs[RADEON_IB_POOL_SIZE]; 390 struct radeon_ib ibs[RADEON_IB_POOL_SIZE];
383 bool ready; 391 bool ready;
384 unsigned head_id; 392 unsigned head_id;
@@ -433,6 +441,7 @@ int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib);
433int radeon_ib_pool_init(struct radeon_device *rdev); 441int radeon_ib_pool_init(struct radeon_device *rdev);
434void radeon_ib_pool_fini(struct radeon_device *rdev); 442void radeon_ib_pool_fini(struct radeon_device *rdev);
435int radeon_ib_test(struct radeon_device *rdev); 443int radeon_ib_test(struct radeon_device *rdev);
444extern void radeon_ib_bogus_add(struct radeon_device *rdev, struct radeon_ib *ib);
436/* Ring access between begin & end cannot sleep */ 445/* Ring access between begin & end cannot sleep */
437void radeon_ring_free_size(struct radeon_device *rdev); 446void radeon_ring_free_size(struct radeon_device *rdev);
438int radeon_ring_lock(struct radeon_device *rdev, unsigned ndw); 447int radeon_ring_lock(struct radeon_device *rdev, unsigned ndw);
@@ -570,7 +579,99 @@ struct radeon_wb {
570 * Equation between gpu/memory clock and available bandwidth is hw dependent 579 * Equation between gpu/memory clock and available bandwidth is hw dependent
571 * (type of memory, bus size, efficiency, ...) 580 * (type of memory, bus size, efficiency, ...)
572 */ 581 */
582enum radeon_pm_state {
583 PM_STATE_DISABLED,
584 PM_STATE_MINIMUM,
585 PM_STATE_PAUSED,
586 PM_STATE_ACTIVE
587};
588enum radeon_pm_action {
589 PM_ACTION_NONE,
590 PM_ACTION_MINIMUM,
591 PM_ACTION_DOWNCLOCK,
592 PM_ACTION_UPCLOCK
593};
594
595enum radeon_voltage_type {
596 VOLTAGE_NONE = 0,
597 VOLTAGE_GPIO,
598 VOLTAGE_VDDC,
599 VOLTAGE_SW
600};
601
602enum radeon_pm_state_type {
603 POWER_STATE_TYPE_DEFAULT,
604 POWER_STATE_TYPE_POWERSAVE,
605 POWER_STATE_TYPE_BATTERY,
606 POWER_STATE_TYPE_BALANCED,
607 POWER_STATE_TYPE_PERFORMANCE,
608};
609
610enum radeon_pm_clock_mode_type {
611 POWER_MODE_TYPE_DEFAULT,
612 POWER_MODE_TYPE_LOW,
613 POWER_MODE_TYPE_MID,
614 POWER_MODE_TYPE_HIGH,
615};
616
617struct radeon_voltage {
618 enum radeon_voltage_type type;
619 /* gpio voltage */
620 struct radeon_gpio_rec gpio;
621 u32 delay; /* delay in usec from voltage drop to sclk change */
622 bool active_high; /* voltage drop is active when bit is high */
623 /* VDDC voltage */
624 u8 vddc_id; /* index into vddc voltage table */
625 u8 vddci_id; /* index into vddci voltage table */
626 bool vddci_enabled;
627 /* r6xx+ sw */
628 u32 voltage;
629};
630
631struct radeon_pm_non_clock_info {
632 /* pcie lanes */
633 int pcie_lanes;
634 /* standardized non-clock flags */
635 u32 flags;
636};
637
638struct radeon_pm_clock_info {
639 /* memory clock */
640 u32 mclk;
641 /* engine clock */
642 u32 sclk;
643 /* voltage info */
644 struct radeon_voltage voltage;
645 /* standardized clock flags - not sure we'll need these */
646 u32 flags;
647};
648
649struct radeon_power_state {
650 enum radeon_pm_state_type type;
651 /* XXX: use a define for num clock modes */
652 struct radeon_pm_clock_info clock_info[8];
653 /* number of valid clock modes in this power state */
654 int num_clock_modes;
655 struct radeon_pm_clock_info *default_clock_mode;
656 /* non clock info about this state */
657 struct radeon_pm_non_clock_info non_clock_info;
658 bool voltage_drop_active;
659};
660
661/*
662 * Some modes are overclocked by very low value, accept them
663 */
664#define RADEON_MODE_OVERCLOCK_MARGIN 500 /* 5 MHz */
665
573struct radeon_pm { 666struct radeon_pm {
667 struct mutex mutex;
668 struct delayed_work idle_work;
669 enum radeon_pm_state state;
670 enum radeon_pm_action planned_action;
671 unsigned long action_timeout;
672 bool downclocked;
673 int active_crtcs;
674 int req_vblank;
574 fixed20_12 max_bandwidth; 675 fixed20_12 max_bandwidth;
575 fixed20_12 igp_sideport_mclk; 676 fixed20_12 igp_sideport_mclk;
576 fixed20_12 igp_system_mclk; 677 fixed20_12 igp_system_mclk;
@@ -582,6 +683,15 @@ struct radeon_pm {
582 fixed20_12 core_bandwidth; 683 fixed20_12 core_bandwidth;
583 fixed20_12 sclk; 684 fixed20_12 sclk;
584 fixed20_12 needed_bandwidth; 685 fixed20_12 needed_bandwidth;
686 /* XXX: use a define for num power modes */
687 struct radeon_power_state power_state[8];
688 /* number of valid power states */
689 int num_power_states;
690 struct radeon_power_state *current_power_state;
691 struct radeon_pm_clock_info *current_clock_mode;
692 struct radeon_power_state *requested_power_state;
693 struct radeon_pm_clock_info *requested_clock_mode;
694 struct radeon_power_state *default_power_state;
585}; 695};
586 696
587 697
@@ -651,6 +761,7 @@ struct radeon_asic {
651 void (*set_engine_clock)(struct radeon_device *rdev, uint32_t eng_clock); 761 void (*set_engine_clock)(struct radeon_device *rdev, uint32_t eng_clock);
652 uint32_t (*get_memory_clock)(struct radeon_device *rdev); 762 uint32_t (*get_memory_clock)(struct radeon_device *rdev);
653 void (*set_memory_clock)(struct radeon_device *rdev, uint32_t mem_clock); 763 void (*set_memory_clock)(struct radeon_device *rdev, uint32_t mem_clock);
764 int (*get_pcie_lanes)(struct radeon_device *rdev);
654 void (*set_pcie_lanes)(struct radeon_device *rdev, int lanes); 765 void (*set_pcie_lanes)(struct radeon_device *rdev, int lanes);
655 void (*set_clock_gating)(struct radeon_device *rdev, int enable); 766 void (*set_clock_gating)(struct radeon_device *rdev, int enable);
656 int (*set_surface_reg)(struct radeon_device *rdev, int reg, 767 int (*set_surface_reg)(struct radeon_device *rdev, int reg,
@@ -701,6 +812,9 @@ struct r600_asic {
701 unsigned sx_max_export_pos_size; 812 unsigned sx_max_export_pos_size;
702 unsigned sx_max_export_smx_size; 813 unsigned sx_max_export_smx_size;
703 unsigned sq_num_cf_insts; 814 unsigned sq_num_cf_insts;
815 unsigned tiling_nbanks;
816 unsigned tiling_npipes;
817 unsigned tiling_group_size;
704}; 818};
705 819
706struct rv770_asic { 820struct rv770_asic {
@@ -721,6 +835,9 @@ struct rv770_asic {
721 unsigned sc_prim_fifo_size; 835 unsigned sc_prim_fifo_size;
722 unsigned sc_hiz_tile_fifo_size; 836 unsigned sc_hiz_tile_fifo_size;
723 unsigned sc_earlyz_tile_fifo_fize; 837 unsigned sc_earlyz_tile_fifo_fize;
838 unsigned tiling_nbanks;
839 unsigned tiling_npipes;
840 unsigned tiling_group_size;
724}; 841};
725 842
726union radeon_asic_config { 843union radeon_asic_config {
@@ -830,6 +947,8 @@ struct radeon_device {
830 struct r600_ih ih; /* r6/700 interrupt ring */ 947 struct r600_ih ih; /* r6/700 interrupt ring */
831 struct workqueue_struct *wq; 948 struct workqueue_struct *wq;
832 struct work_struct hotplug_work; 949 struct work_struct hotplug_work;
950 int num_crtc; /* number of crtcs */
951 struct mutex dc_hw_i2c_mutex; /* display controller hw i2c mutex */
833 952
834 /* audio stuff */ 953 /* audio stuff */
835 struct timer_list audio_timer; 954 struct timer_list audio_timer;
@@ -895,6 +1014,8 @@ static inline void r100_mm_wreg(struct radeon_device *rdev, uint32_t reg, uint32
895#define WREG32_MC(reg, v) rdev->mc_wreg(rdev, (reg), (v)) 1014#define WREG32_MC(reg, v) rdev->mc_wreg(rdev, (reg), (v))
896#define RREG32_PCIE(reg) rv370_pcie_rreg(rdev, (reg)) 1015#define RREG32_PCIE(reg) rv370_pcie_rreg(rdev, (reg))
897#define WREG32_PCIE(reg, v) rv370_pcie_wreg(rdev, (reg), (v)) 1016#define WREG32_PCIE(reg, v) rv370_pcie_wreg(rdev, (reg), (v))
1017#define RREG32_PCIE_P(reg) rdev->pciep_rreg(rdev, (reg))
1018#define WREG32_PCIE_P(reg, v) rdev->pciep_wreg(rdev, (reg), (v))
898#define WREG32_P(reg, val, mask) \ 1019#define WREG32_P(reg, val, mask) \
899 do { \ 1020 do { \
900 uint32_t tmp_ = RREG32(reg); \ 1021 uint32_t tmp_ = RREG32(reg); \
@@ -956,7 +1077,7 @@ void r100_pll_errata_after_index(struct radeon_device *rdev);
956#define ASIC_IS_AVIVO(rdev) ((rdev->family >= CHIP_RS600)) 1077#define ASIC_IS_AVIVO(rdev) ((rdev->family >= CHIP_RS600))
957#define ASIC_IS_DCE3(rdev) ((rdev->family >= CHIP_RV620)) 1078#define ASIC_IS_DCE3(rdev) ((rdev->family >= CHIP_RV620))
958#define ASIC_IS_DCE32(rdev) ((rdev->family >= CHIP_RV730)) 1079#define ASIC_IS_DCE32(rdev) ((rdev->family >= CHIP_RV730))
959 1080#define ASIC_IS_DCE4(rdev) ((rdev->family >= CHIP_CEDAR))
960 1081
961/* 1082/*
962 * BIOS helpers. 1083 * BIOS helpers.
@@ -1015,6 +1136,7 @@ static inline void radeon_ring_write(struct radeon_device *rdev, uint32_t v)
1015#define radeon_set_engine_clock(rdev, e) (rdev)->asic->set_engine_clock((rdev), (e)) 1136#define radeon_set_engine_clock(rdev, e) (rdev)->asic->set_engine_clock((rdev), (e))
1016#define radeon_get_memory_clock(rdev) (rdev)->asic->get_memory_clock((rdev)) 1137#define radeon_get_memory_clock(rdev) (rdev)->asic->get_memory_clock((rdev))
1017#define radeon_set_memory_clock(rdev, e) (rdev)->asic->set_memory_clock((rdev), (e)) 1138#define radeon_set_memory_clock(rdev, e) (rdev)->asic->set_memory_clock((rdev), (e))
1139#define radeon_get_pcie_lanes(rdev) (rdev)->asic->get_pcie_lanes((rdev))
1018#define radeon_set_pcie_lanes(rdev, l) (rdev)->asic->set_pcie_lanes((rdev), (l)) 1140#define radeon_set_pcie_lanes(rdev, l) (rdev)->asic->set_pcie_lanes((rdev), (l))
1019#define radeon_set_clock_gating(rdev, e) (rdev)->asic->set_clock_gating((rdev), (e)) 1141#define radeon_set_clock_gating(rdev, e) (rdev)->asic->set_clock_gating((rdev), (e))
1020#define radeon_set_surface_reg(rdev, r, f, p, o, s) ((rdev)->asic->set_surface_reg((rdev), (r), (f), (p), (o), (s))) 1142#define radeon_set_surface_reg(rdev, r, f, p, o, s) ((rdev)->asic->set_surface_reg((rdev), (r), (f), (p), (o), (s)))
@@ -1029,6 +1151,7 @@ static inline void radeon_ring_write(struct radeon_device *rdev, uint32_t v)
1029/* AGP */ 1151/* AGP */
1030extern void radeon_agp_disable(struct radeon_device *rdev); 1152extern void radeon_agp_disable(struct radeon_device *rdev);
1031extern int radeon_gart_table_vram_pin(struct radeon_device *rdev); 1153extern int radeon_gart_table_vram_pin(struct radeon_device *rdev);
1154extern void radeon_gart_restore(struct radeon_device *rdev);
1032extern int radeon_modeset_init(struct radeon_device *rdev); 1155extern int radeon_modeset_init(struct radeon_device *rdev);
1033extern void radeon_modeset_fini(struct radeon_device *rdev); 1156extern void radeon_modeset_fini(struct radeon_device *rdev);
1034extern bool radeon_card_posted(struct radeon_device *rdev); 1157extern bool radeon_card_posted(struct radeon_device *rdev);
@@ -1042,6 +1165,8 @@ extern void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enabl
1042extern void radeon_atom_set_clock_gating(struct radeon_device *rdev, int enable); 1165extern void radeon_atom_set_clock_gating(struct radeon_device *rdev, int enable);
1043extern void radeon_ttm_placement_from_domain(struct radeon_bo *rbo, u32 domain); 1166extern void radeon_ttm_placement_from_domain(struct radeon_bo *rbo, u32 domain);
1044extern bool radeon_ttm_bo_is_radeon_bo(struct ttm_buffer_object *bo); 1167extern bool radeon_ttm_bo_is_radeon_bo(struct ttm_buffer_object *bo);
1168extern void radeon_vram_location(struct radeon_device *rdev, struct radeon_mc *mc, u64 base);
1169extern void radeon_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc);
1045 1170
1046/* r100,rv100,rs100,rv200,rs200,r200,rv250,rs300,rv280 */ 1171/* r100,rv100,rs100,rv200,rs200,r200,rv250,rs300,rv280 */
1047struct r100_mc_save { 1172struct r100_mc_save {
@@ -1096,7 +1221,7 @@ extern void r200_set_safe_registers(struct radeon_device *rdev);
1096/* r300,r350,rv350,rv370,rv380 */ 1221/* r300,r350,rv350,rv370,rv380 */
1097extern void r300_set_reg_safe(struct radeon_device *rdev); 1222extern void r300_set_reg_safe(struct radeon_device *rdev);
1098extern void r300_mc_program(struct radeon_device *rdev); 1223extern void r300_mc_program(struct radeon_device *rdev);
1099extern void r300_vram_info(struct radeon_device *rdev); 1224extern void r300_mc_init(struct radeon_device *rdev);
1100extern void r300_clock_startup(struct radeon_device *rdev); 1225extern void r300_clock_startup(struct radeon_device *rdev);
1101extern int r300_mc_wait_for_idle(struct radeon_device *rdev); 1226extern int r300_mc_wait_for_idle(struct radeon_device *rdev);
1102extern int rv370_pcie_gart_init(struct radeon_device *rdev); 1227extern int rv370_pcie_gart_init(struct radeon_device *rdev);
@@ -1105,7 +1230,6 @@ extern int rv370_pcie_gart_enable(struct radeon_device *rdev);
1105extern void rv370_pcie_gart_disable(struct radeon_device *rdev); 1230extern void rv370_pcie_gart_disable(struct radeon_device *rdev);
1106 1231
1107/* r420,r423,rv410 */ 1232/* r420,r423,rv410 */
1108extern int r420_mc_init(struct radeon_device *rdev);
1109extern u32 r420_mc_rreg(struct radeon_device *rdev, u32 reg); 1233extern u32 r420_mc_rreg(struct radeon_device *rdev, u32 reg);
1110extern void r420_mc_wreg(struct radeon_device *rdev, u32 reg, u32 v); 1234extern void r420_mc_wreg(struct radeon_device *rdev, u32 reg, u32 v);
1111extern int r420_debugfs_pipes_info_init(struct radeon_device *rdev); 1235extern int r420_debugfs_pipes_info_init(struct radeon_device *rdev);
@@ -1147,13 +1271,13 @@ extern void rs690_line_buffer_adjust(struct radeon_device *rdev,
1147 struct drm_display_mode *mode2); 1271 struct drm_display_mode *mode2);
1148 1272
1149/* r600, rv610, rv630, rv620, rv635, rv670, rs780, rs880 */ 1273/* r600, rv610, rv630, rv620, rv635, rv670, rs780, rs880 */
1274extern void r600_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc);
1150extern bool r600_card_posted(struct radeon_device *rdev); 1275extern bool r600_card_posted(struct radeon_device *rdev);
1151extern void r600_cp_stop(struct radeon_device *rdev); 1276extern void r600_cp_stop(struct radeon_device *rdev);
1152extern void r600_ring_init(struct radeon_device *rdev, unsigned ring_size); 1277extern void r600_ring_init(struct radeon_device *rdev, unsigned ring_size);
1153extern int r600_cp_resume(struct radeon_device *rdev); 1278extern int r600_cp_resume(struct radeon_device *rdev);
1154extern void r600_cp_fini(struct radeon_device *rdev); 1279extern void r600_cp_fini(struct radeon_device *rdev);
1155extern int r600_count_pipe_bits(uint32_t val); 1280extern int r600_count_pipe_bits(uint32_t val);
1156extern int r600_gart_clear_page(struct radeon_device *rdev, int i);
1157extern int r600_mc_wait_for_idle(struct radeon_device *rdev); 1281extern int r600_mc_wait_for_idle(struct radeon_device *rdev);
1158extern int r600_pcie_gart_init(struct radeon_device *rdev); 1282extern int r600_pcie_gart_init(struct radeon_device *rdev);
1159extern void r600_pcie_gart_tlb_flush(struct radeon_device *rdev); 1283extern void r600_pcie_gart_tlb_flush(struct radeon_device *rdev);
@@ -1189,6 +1313,14 @@ extern void r600_hdmi_update_audio_settings(struct drm_encoder *encoder,
1189 uint8_t status_bits, 1313 uint8_t status_bits,
1190 uint8_t category_code); 1314 uint8_t category_code);
1191 1315
1316/* evergreen */
1317struct evergreen_mc_save {
1318 u32 vga_control[6];
1319 u32 vga_render_control;
1320 u32 vga_hdp_control;
1321 u32 crtc_control[6];
1322};
1323
1192#include "radeon_object.h" 1324#include "radeon_object.h"
1193 1325
1194#endif 1326#endif