29 #include <linux/slab.h>
35 #include "rv515_reg_safe.h"
46 DRM_ERROR(
"Failed to register debugfs file for RBBM !\n");
48 if (rv515_debugfs_pipes_info_init(rdev)) {
49 DRM_ERROR(
"Failed to register debugfs file for pipes !\n");
51 if (rv515_debugfs_ga_info_init(rdev)) {
52 DRM_ERROR(
"Failed to register debugfs file for pipes !\n");
148 unsigned pipe_select_current, gb_pipe_select,
tmp;
152 "resetting GPU. Bad things might happen.\n");
158 pipe_select_current = (tmp >> 2) & 3;
159 tmp = (1 << pipe_select_current) |
160 (((gb_pipe_select >> 8) & 0xF) << 4);
164 "resetting GPU. Bad things might happen.\n");
168 "programming pipes. Bad things might happen.\n");
176 rdev->
mc.vram_width = 128;
177 rdev->
mc.vram_is_ddr =
true;
181 rdev->
mc.vram_width = 64;
184 rdev->
mc.vram_width = 128;
187 rdev->
mc.vram_width = 128;
195 rv515_vram_get_type(rdev);
198 rdev->
mc.gtt_base_align = 0;
221 #if defined(CONFIG_DEBUG_FS)
222 static int rv515_debugfs_pipes_info(
struct seq_file *
m,
void *
data)
224 struct drm_info_node *
node = (
struct drm_info_node *) m->
private;
230 seq_printf(m,
"GB_PIPE_SELECT 0x%08x\n", tmp);
234 seq_printf(m,
"GB_TILE_CONFIG 0x%08x\n", tmp);
236 seq_printf(m,
"DST_PIPE_CONFIG 0x%08x\n", tmp);
240 static int rv515_debugfs_ga_info(
struct seq_file *m,
void *data)
242 struct drm_info_node *node = (
struct drm_info_node *) m->
private;
248 seq_printf(m,
"VAP_CNTL_STATUS 0x%08x\n", tmp);
255 static struct drm_info_list rv515_pipes_info_list[] = {
256 {
"rv515_pipes_info", rv515_debugfs_pipes_info, 0,
NULL},
259 static struct drm_info_list rv515_ga_info_list[] = {
260 {
"rv515_ga_info", rv515_debugfs_ga_info, 0,
NULL},
264 static int rv515_debugfs_pipes_info_init(
struct radeon_device *rdev)
266 #if defined(CONFIG_DEBUG_FS)
273 static int rv515_debugfs_ga_info_init(
struct radeon_device *rdev)
275 #if defined(CONFIG_DEBUG_FS)
322 dev_warn(rdev->
dev,
"Wait MC idle timeout before updating MC.\n");
364 rv515_mc_program(rdev);
368 rv515_gpu_init(rdev);
384 dev_err(rdev->
dev,
"failed initializing CP fences (%d).\n", r);
394 dev_err(rdev->
dev,
"failed initializing CP (%d).\n", r);
400 dev_err(rdev->
dev,
"IB initialization failed (%d).\n", r);
418 dev_warn(rdev->
dev,
"GPU reset failed ! (0xE40=0x%08X, 0x7C0=0x%08X)\n",
430 r = rv515_startup(rdev);
449 rdev->
config.
r300.reg_safe_bm = rv515_reg_safe_bm;
490 dev_err(rdev->
dev,
"Expecting atombios for RV515 GPU\n");
496 "GPU reset failed ! (0xE40=0x%08X, 0x7C0=0x%08X)\n",
532 r = rv515_startup(rdev);
535 dev_err(rdev->
dev,
"Disabling GPU acceleration\n");
560 WREG32(data_reg, 0x841880A8);
562 WREG32(data_reg, 0x84208680);
564 WREG32(data_reg, 0xBFF880B0);
566 WREG32(data_reg, 0x83D88088);
568 WREG32(data_reg, 0x84608680);
570 WREG32(data_reg, 0xBFF080D0);
572 WREG32(data_reg, 0x83988068);
574 WREG32(data_reg, 0x84A08680);
576 WREG32(data_reg, 0xBFF080F8);
578 WREG32(data_reg, 0x83588058);
580 WREG32(data_reg, 0x84E08660);
582 WREG32(data_reg, 0xBFF88120);
584 WREG32(data_reg, 0x83188040);
586 WREG32(data_reg, 0x85008660);
588 WREG32(data_reg, 0xBFF88150);
590 WREG32(data_reg, 0x82D88030);
592 WREG32(data_reg, 0x85408640);
594 WREG32(data_reg, 0xBFF88180);
596 WREG32(data_reg, 0x82A08018);
598 WREG32(data_reg, 0x85808620);
600 WREG32(data_reg, 0xBFF081B8);
602 WREG32(data_reg, 0x82608010);
604 WREG32(data_reg, 0x85A08600);
606 WREG32(data_reg, 0x800081F0);
608 WREG32(data_reg, 0x8228BFF8);
610 WREG32(data_reg, 0x85E085E0);
612 WREG32(data_reg, 0xBFF88228);
613 WREG32(index_reg, 0x10000);
614 WREG32(data_reg, 0x82A8BF00);
615 WREG32(index_reg, 0x10001);
616 WREG32(data_reg, 0x82A08CC0);
617 WREG32(index_reg, 0x10002);
618 WREG32(data_reg, 0x8008BEF8);
619 WREG32(index_reg, 0x10100);
620 WREG32(data_reg, 0x81F0BF28);
621 WREG32(index_reg, 0x10101);
622 WREG32(data_reg, 0x83608CA0);
623 WREG32(index_reg, 0x10102);
624 WREG32(data_reg, 0x8018BED0);
625 WREG32(index_reg, 0x10200);
626 WREG32(data_reg, 0x8148BF38);
627 WREG32(index_reg, 0x10201);
628 WREG32(data_reg, 0x84408C80);
629 WREG32(index_reg, 0x10202);
630 WREG32(data_reg, 0x8008BEB8);
631 WREG32(index_reg, 0x10300);
632 WREG32(data_reg, 0x80B0BF78);
633 WREG32(index_reg, 0x10301);
634 WREG32(data_reg, 0x85008C20);
635 WREG32(index_reg, 0x10302);
636 WREG32(data_reg, 0x8020BEA0);
637 WREG32(index_reg, 0x10400);
638 WREG32(data_reg, 0x8028BF90);
639 WREG32(index_reg, 0x10401);
640 WREG32(data_reg, 0x85E08BC0);
641 WREG32(index_reg, 0x10402);
642 WREG32(data_reg, 0x8018BE90);
643 WREG32(index_reg, 0x10500);
644 WREG32(data_reg, 0xBFB8BFB0);
645 WREG32(index_reg, 0x10501);
646 WREG32(data_reg, 0x86C08B40);
647 WREG32(index_reg, 0x10502);
648 WREG32(data_reg, 0x8010BE90);
649 WREG32(index_reg, 0x10600);
650 WREG32(data_reg, 0xBF58BFC8);
651 WREG32(index_reg, 0x10601);
652 WREG32(data_reg, 0x87A08AA0);
653 WREG32(index_reg, 0x10602);
654 WREG32(data_reg, 0x8010BE98);
655 WREG32(index_reg, 0x10700);
656 WREG32(data_reg, 0xBF10BFF0);
657 WREG32(index_reg, 0x10701);
658 WREG32(data_reg, 0x886089E0);
659 WREG32(index_reg, 0x10702);
660 WREG32(data_reg, 0x8018BEB0);
661 WREG32(index_reg, 0x10800);
662 WREG32(data_reg, 0xBED8BFE8);
663 WREG32(index_reg, 0x10801);
664 WREG32(data_reg, 0x89408940);
665 WREG32(index_reg, 0x10802);
666 WREG32(data_reg, 0xBFE8BED8);
667 WREG32(index_reg, 0x20000);
668 WREG32(data_reg, 0x80008000);
669 WREG32(index_reg, 0x20001);
670 WREG32(data_reg, 0x90008000);
671 WREG32(index_reg, 0x20002);
672 WREG32(data_reg, 0x80008000);
673 WREG32(index_reg, 0x20003);
674 WREG32(data_reg, 0x80008000);
675 WREG32(index_reg, 0x20100);
676 WREG32(data_reg, 0x80108000);
677 WREG32(index_reg, 0x20101);
678 WREG32(data_reg, 0x8FE0BF70);
679 WREG32(index_reg, 0x20102);
680 WREG32(data_reg, 0xBFE880C0);
681 WREG32(index_reg, 0x20103);
682 WREG32(data_reg, 0x80008000);
683 WREG32(index_reg, 0x20200);
684 WREG32(data_reg, 0x8018BFF8);
685 WREG32(index_reg, 0x20201);
686 WREG32(data_reg, 0x8F80BF08);
687 WREG32(index_reg, 0x20202);
688 WREG32(data_reg, 0xBFD081A0);
689 WREG32(index_reg, 0x20203);
690 WREG32(data_reg, 0xBFF88000);
691 WREG32(index_reg, 0x20300);
692 WREG32(data_reg, 0x80188000);
693 WREG32(index_reg, 0x20301);
694 WREG32(data_reg, 0x8EE0BEC0);
695 WREG32(index_reg, 0x20302);
696 WREG32(data_reg, 0xBFB082A0);
697 WREG32(index_reg, 0x20303);
698 WREG32(data_reg, 0x80008000);
699 WREG32(index_reg, 0x20400);
700 WREG32(data_reg, 0x80188000);
701 WREG32(index_reg, 0x20401);
702 WREG32(data_reg, 0x8E00BEA0);
703 WREG32(index_reg, 0x20402);
704 WREG32(data_reg, 0xBF8883C0);
705 WREG32(index_reg, 0x20403);
706 WREG32(data_reg, 0x80008000);
707 WREG32(index_reg, 0x20500);
708 WREG32(data_reg, 0x80188000);
709 WREG32(index_reg, 0x20501);
710 WREG32(data_reg, 0x8D00BE90);
711 WREG32(index_reg, 0x20502);
712 WREG32(data_reg, 0xBF588500);
713 WREG32(index_reg, 0x20503);
714 WREG32(data_reg, 0x80008008);
715 WREG32(index_reg, 0x20600);
716 WREG32(data_reg, 0x80188000);
717 WREG32(index_reg, 0x20601);
718 WREG32(data_reg, 0x8BC0BE98);
719 WREG32(index_reg, 0x20602);
720 WREG32(data_reg, 0xBF308660);
721 WREG32(index_reg, 0x20603);
722 WREG32(data_reg, 0x80008008);
723 WREG32(index_reg, 0x20700);
724 WREG32(data_reg, 0x80108000);
725 WREG32(index_reg, 0x20701);
726 WREG32(data_reg, 0x8A80BEB0);
727 WREG32(index_reg, 0x20702);
728 WREG32(data_reg, 0xBF0087C0);
729 WREG32(index_reg, 0x20703);
730 WREG32(data_reg, 0x80008008);
731 WREG32(index_reg, 0x20800);
732 WREG32(data_reg, 0x80108000);
733 WREG32(index_reg, 0x20801);
734 WREG32(data_reg, 0x8920BED0);
735 WREG32(index_reg, 0x20802);
736 WREG32(data_reg, 0xBED08920);
737 WREG32(index_reg, 0x20803);
738 WREG32(data_reg, 0x80008010);
739 WREG32(index_reg, 0x30000);
740 WREG32(data_reg, 0x90008000);
741 WREG32(index_reg, 0x30001);
742 WREG32(data_reg, 0x80008000);
743 WREG32(index_reg, 0x30100);
744 WREG32(data_reg, 0x8FE0BF90);
745 WREG32(index_reg, 0x30101);
746 WREG32(data_reg, 0xBFF880A0);
747 WREG32(index_reg, 0x30200);
748 WREG32(data_reg, 0x8F60BF40);
749 WREG32(index_reg, 0x30201);
750 WREG32(data_reg, 0xBFE88180);
751 WREG32(index_reg, 0x30300);
752 WREG32(data_reg, 0x8EC0BF00);
753 WREG32(index_reg, 0x30301);
754 WREG32(data_reg, 0xBFC88280);
755 WREG32(index_reg, 0x30400);
756 WREG32(data_reg, 0x8DE0BEE0);
757 WREG32(index_reg, 0x30401);
758 WREG32(data_reg, 0xBFA083A0);
759 WREG32(index_reg, 0x30500);
760 WREG32(data_reg, 0x8CE0BED0);
761 WREG32(index_reg, 0x30501);
762 WREG32(data_reg, 0xBF7884E0);
763 WREG32(index_reg, 0x30600);
764 WREG32(data_reg, 0x8BA0BED8);
765 WREG32(index_reg, 0x30601);
766 WREG32(data_reg, 0xBF508640);
767 WREG32(index_reg, 0x30700);
768 WREG32(data_reg, 0x8A60BEE8);
769 WREG32(index_reg, 0x30701);
770 WREG32(data_reg, 0xBF2087A0);
771 WREG32(index_reg, 0x30800);
772 WREG32(data_reg, 0x8900BF00);
773 WREG32(index_reg, 0x30801);
774 WREG32(data_reg, 0xBF008900);
790 static void rv515_crtc_bandwidth_compute(
struct radeon_device *rdev,
796 fixed20_12 pclk, request_fifo_depth, tolerable_latency, estimated_width;
797 fixed20_12 consumption_time, line_time, chunk_time, read_delay_latency;
799 if (!crtc->
base.enabled) {
812 a.
full = dfixed_div(b, c);
814 request_fifo_depth.
full = dfixed_ceil(request_fifo_depth);
829 a.
full = dfixed_div(a, b);
830 pclk.
full = dfixed_div(b, a);
837 b.
full = dfixed_div(b, c);
838 consumption_time.
full = dfixed_div(pclk, b);
870 chunk_time.
full = dfixed_div(a, rdev->
pm.sclk);
900 tolerable_latency.
full = line_time.
full;
903 tolerable_latency.
full = request_fifo_depth.
full - tolerable_latency.
full;
904 tolerable_latency.
full =
dfixed_mul(tolerable_latency, chunk_time);
905 tolerable_latency.
full = line_time.
full - tolerable_latency.
full;
920 estimated_width.
full = dfixed_div(estimated_width, consumption_time);
940 fixed20_12 priority_mark02, priority_mark12, fill_rate;
943 if (rdev->
mode_info.crtcs[0]->base.enabled)
944 mode0 = &rdev->
mode_info.crtcs[0]->base.mode;
945 if (rdev->
mode_info.crtcs[1]->base.enabled)
946 mode1 = &rdev->
mode_info.crtcs[1]->base.mode;
949 rv515_crtc_bandwidth_compute(rdev, rdev->
mode_info.crtcs[0], &wm0);
950 rv515_crtc_bandwidth_compute(rdev, rdev->
mode_info.crtcs[1], &wm1);
956 if (mode0 && mode1) {
966 fill_rate.
full = dfixed_div(wm0.
sclk, a);
971 b.
full = dfixed_div(b, a);
979 priority_mark02.
full = dfixed_div(a, b);
985 b.
full = dfixed_div(b, a);
993 priority_mark12.
full = dfixed_div(a, b);
998 priority_mark02.
full = 0;
1004 priority_mark12.
full = 0;
1018 fill_rate.
full = dfixed_div(wm0.
sclk, a);
1023 b.
full = dfixed_div(b, a);
1031 priority_mark02.
full = dfixed_div(a, b);
1036 priority_mark02.
full = 0;
1047 fill_rate.
full = dfixed_div(wm1.
sclk, a);
1052 b.
full = dfixed_div(b, a);
1060 priority_mark12.
full = dfixed_div(a, b);
1065 priority_mark12.
full = 0;
1087 if (rdev->
mode_info.crtcs[0]->base.enabled)
1088 mode0 = &rdev->
mode_info.crtcs[0]->base.mode;
1089 if (rdev->
mode_info.crtcs[1]->base.enabled)
1090 mode1 = &rdev->
mode_info.crtcs[1]->base.mode;