aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/drm_fb_helper.c26
-rw-r--r--drivers/gpu/drm/drm_irq.c23
-rw-r--r--drivers/gpu/drm/drm_mm.c6
-rw-r--r--drivers/gpu/drm/i915/i915_drv.c2
-rw-r--r--drivers/gpu/drm/i915/intel_display.c8
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c17
-rw-r--r--drivers/gpu/drm/i915/intel_lvds.c3
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_mem.c2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_sgdma.c3
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_state.c5
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c22
-rw-r--r--drivers/gpu/drm/radeon/evergreend.h6
-rw-r--r--drivers/gpu/drm/radeon/ni.c18
-rw-r--r--drivers/gpu/drm/radeon/radeon_atombios.c23
-rw-r--r--drivers/gpu/drm/radeon/radeon_atpx_handler.c29
-rw-r--r--drivers/gpu/drm/radeon/radeon_cursor.c6
-rw-r--r--drivers/gpu/drm/radeon/radeon_gart.c6
-rw-r--r--drivers/gpu/drm/radeon/radeon_kms.c3
-rw-r--r--drivers/gpu/drm/radeon/reg_srcs/cayman1
-rw-r--r--drivers/gpu/drm/radeon/reg_srcs/evergreen1
-rw-r--r--drivers/gpu/vga/vga_switcheroo.c6
21 files changed, 164 insertions, 52 deletions
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 11d7a72c22d9..140b9525b48a 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1516,17 +1516,33 @@ bool drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel)
1516} 1516}
1517EXPORT_SYMBOL(drm_fb_helper_initial_config); 1517EXPORT_SYMBOL(drm_fb_helper_initial_config);
1518 1518
1519bool drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper) 1519/**
1520 * drm_fb_helper_hotplug_event - respond to a hotplug notification by
1521 * probing all the outputs attached to the fb.
1522 * @fb_helper: the drm_fb_helper
1523 *
1524 * LOCKING:
1525 * Called at runtime, must take mode config lock.
1526 *
1527 * Scan the connectors attached to the fb_helper and try to put together a
1528 * setup after *notification of a change in output configuration.
1529 *
1530 * RETURNS:
1531 * 0 on success and a non-zero error code otherwise.
1532 */
1533int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper)
1520{ 1534{
1535 struct drm_device *dev = fb_helper->dev;
1521 int count = 0; 1536 int count = 0;
1522 u32 max_width, max_height, bpp_sel; 1537 u32 max_width, max_height, bpp_sel;
1523 bool bound = false, crtcs_bound = false; 1538 bool bound = false, crtcs_bound = false;
1524 struct drm_crtc *crtc; 1539 struct drm_crtc *crtc;
1525 1540
1526 if (!fb_helper->fb) 1541 if (!fb_helper->fb)
1527 return false; 1542 return 0;
1528 1543
1529 list_for_each_entry(crtc, &fb_helper->dev->mode_config.crtc_list, head) { 1544 mutex_lock(&dev->mode_config.mutex);
1545 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
1530 if (crtc->fb) 1546 if (crtc->fb)
1531 crtcs_bound = true; 1547 crtcs_bound = true;
1532 if (crtc->fb == fb_helper->fb) 1548 if (crtc->fb == fb_helper->fb)
@@ -1535,7 +1551,8 @@ bool drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper)
1535 1551
1536 if (!bound && crtcs_bound) { 1552 if (!bound && crtcs_bound) {
1537 fb_helper->delayed_hotplug = true; 1553 fb_helper->delayed_hotplug = true;
1538 return false; 1554 mutex_unlock(&dev->mode_config.mutex);
1555 return 0;
1539 } 1556 }
1540 DRM_DEBUG_KMS("\n"); 1557 DRM_DEBUG_KMS("\n");
1541 1558
@@ -1546,6 +1563,7 @@ bool drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper)
1546 count = drm_fb_helper_probe_connector_modes(fb_helper, max_width, 1563 count = drm_fb_helper_probe_connector_modes(fb_helper, max_width,
1547 max_height); 1564 max_height);
1548 drm_setup_crtcs(fb_helper); 1565 drm_setup_crtcs(fb_helper);
1566 mutex_unlock(&dev->mode_config.mutex);
1549 1567
1550 return drm_fb_helper_single_fb_probe(fb_helper, bpp_sel); 1568 return drm_fb_helper_single_fb_probe(fb_helper, bpp_sel);
1551} 1569}
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 741457bd1c46..a1f12cb043de 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -932,11 +932,34 @@ EXPORT_SYMBOL(drm_vblank_put);
932 932
933void drm_vblank_off(struct drm_device *dev, int crtc) 933void drm_vblank_off(struct drm_device *dev, int crtc)
934{ 934{
935 struct drm_pending_vblank_event *e, *t;
936 struct timeval now;
935 unsigned long irqflags; 937 unsigned long irqflags;
938 unsigned int seq;
936 939
937 spin_lock_irqsave(&dev->vbl_lock, irqflags); 940 spin_lock_irqsave(&dev->vbl_lock, irqflags);
938 vblank_disable_and_save(dev, crtc); 941 vblank_disable_and_save(dev, crtc);
939 DRM_WAKEUP(&dev->vbl_queue[crtc]); 942 DRM_WAKEUP(&dev->vbl_queue[crtc]);
943
944 /* Send any queued vblank events, lest the natives grow disquiet */
945 seq = drm_vblank_count_and_time(dev, crtc, &now);
946 list_for_each_entry_safe(e, t, &dev->vblank_event_list, base.link) {
947 if (e->pipe != crtc)
948 continue;
949 DRM_DEBUG("Sending premature vblank event on disable: \
950 wanted %d, current %d\n",
951 e->event.sequence, seq);
952
953 e->event.sequence = seq;
954 e->event.tv_sec = now.tv_sec;
955 e->event.tv_usec = now.tv_usec;
956 drm_vblank_put(dev, e->pipe);
957 list_move_tail(&e->base.link, &e->base.file_priv->event_list);
958 wake_up_interruptible(&e->base.file_priv->event_wait);
959 trace_drm_vblank_event_delivered(e->base.pid, e->pipe,
960 e->event.sequence);
961 }
962
940 spin_unlock_irqrestore(&dev->vbl_lock, irqflags); 963 spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
941} 964}
942EXPORT_SYMBOL(drm_vblank_off); 965EXPORT_SYMBOL(drm_vblank_off);
diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
index 5d00b0fc0d91..959186cbf328 100644
--- a/drivers/gpu/drm/drm_mm.c
+++ b/drivers/gpu/drm/drm_mm.c
@@ -431,7 +431,7 @@ EXPORT_SYMBOL(drm_mm_search_free_in_range);
431void drm_mm_replace_node(struct drm_mm_node *old, struct drm_mm_node *new) 431void drm_mm_replace_node(struct drm_mm_node *old, struct drm_mm_node *new)
432{ 432{
433 list_replace(&old->node_list, &new->node_list); 433 list_replace(&old->node_list, &new->node_list);
434 list_replace(&old->node_list, &new->hole_stack); 434 list_replace(&old->hole_stack, &new->hole_stack);
435 new->hole_follows = old->hole_follows; 435 new->hole_follows = old->hole_follows;
436 new->mm = old->mm; 436 new->mm = old->mm;
437 new->start = old->start; 437 new->start = old->start;
@@ -699,8 +699,8 @@ int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm)
699 entry->size); 699 entry->size);
700 total_used += entry->size; 700 total_used += entry->size;
701 if (entry->hole_follows) { 701 if (entry->hole_follows) {
702 hole_start = drm_mm_hole_node_start(&mm->head_node); 702 hole_start = drm_mm_hole_node_start(entry);
703 hole_end = drm_mm_hole_node_end(&mm->head_node); 703 hole_end = drm_mm_hole_node_end(entry);
704 hole_size = hole_end - hole_start; 704 hole_size = hole_end - hole_start;
705 seq_printf(m, "0x%08lx-0x%08lx: 0x%08lx: free\n", 705 seq_printf(m, "0x%08lx-0x%08lx: 0x%08lx: free\n",
706 hole_start, hole_end, hole_size); 706 hole_start, hole_end, hole_size);
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index c34a8dd31d02..32d1b3e829c8 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -49,7 +49,7 @@ module_param_named(panel_ignore_lid, i915_panel_ignore_lid, int, 0600);
49unsigned int i915_powersave = 1; 49unsigned int i915_powersave = 1;
50module_param_named(powersave, i915_powersave, int, 0600); 50module_param_named(powersave, i915_powersave, int, 0600);
51 51
52unsigned int i915_semaphores = 1; 52unsigned int i915_semaphores = 0;
53module_param_named(semaphores, i915_semaphores, int, 0600); 53module_param_named(semaphores, i915_semaphores, int, 0600);
54 54
55unsigned int i915_enable_rc6 = 0; 55unsigned int i915_enable_rc6 = 0;
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index e522c702b04e..2166ee071ddb 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -5605,9 +5605,9 @@ static int intel_crtc_clock_get(struct drm_device *dev, struct drm_crtc *crtc)
5605 intel_clock_t clock; 5605 intel_clock_t clock;
5606 5606
5607 if ((dpll & DISPLAY_RATE_SELECT_FPA1) == 0) 5607 if ((dpll & DISPLAY_RATE_SELECT_FPA1) == 0)
5608 fp = FP0(pipe); 5608 fp = I915_READ(FP0(pipe));
5609 else 5609 else
5610 fp = FP1(pipe); 5610 fp = I915_READ(FP1(pipe));
5611 5611
5612 clock.m1 = (fp & FP_M1_DIV_MASK) >> FP_M1_DIV_SHIFT; 5612 clock.m1 = (fp & FP_M1_DIV_MASK) >> FP_M1_DIV_SHIFT;
5613 if (IS_PINEVIEW(dev)) { 5613 if (IS_PINEVIEW(dev)) {
@@ -6579,8 +6579,10 @@ intel_user_framebuffer_create(struct drm_device *dev,
6579 return ERR_PTR(-ENOENT); 6579 return ERR_PTR(-ENOENT);
6580 6580
6581 intel_fb = kzalloc(sizeof(*intel_fb), GFP_KERNEL); 6581 intel_fb = kzalloc(sizeof(*intel_fb), GFP_KERNEL);
6582 if (!intel_fb) 6582 if (!intel_fb) {
6583 drm_gem_object_unreference_unlocked(&obj->base);
6583 return ERR_PTR(-ENOMEM); 6584 return ERR_PTR(-ENOMEM);
6585 }
6584 6586
6585 ret = intel_framebuffer_init(dev, intel_fb, mode_cmd, obj); 6587 ret = intel_framebuffer_init(dev, intel_fb, mode_cmd, obj);
6586 if (ret) { 6588 if (ret) {
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index cb8578b7e443..a4d80314e7f8 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1470,7 +1470,8 @@ intel_dp_link_down(struct intel_dp *intel_dp)
1470 1470
1471 if (!HAS_PCH_CPT(dev) && 1471 if (!HAS_PCH_CPT(dev) &&
1472 I915_READ(intel_dp->output_reg) & DP_PIPEB_SELECT) { 1472 I915_READ(intel_dp->output_reg) & DP_PIPEB_SELECT) {
1473 struct intel_crtc *intel_crtc = to_intel_crtc(intel_dp->base.base.crtc); 1473 struct drm_crtc *crtc = intel_dp->base.base.crtc;
1474
1474 /* Hardware workaround: leaving our transcoder select 1475 /* Hardware workaround: leaving our transcoder select
1475 * set to transcoder B while it's off will prevent the 1476 * set to transcoder B while it's off will prevent the
1476 * corresponding HDMI output on transcoder A. 1477 * corresponding HDMI output on transcoder A.
@@ -1485,7 +1486,19 @@ intel_dp_link_down(struct intel_dp *intel_dp)
1485 /* Changes to enable or select take place the vblank 1486 /* Changes to enable or select take place the vblank
1486 * after being written. 1487 * after being written.
1487 */ 1488 */
1488 intel_wait_for_vblank(dev, intel_crtc->pipe); 1489 if (crtc == NULL) {
1490 /* We can arrive here never having been attached
1491 * to a CRTC, for instance, due to inheriting
1492 * random state from the BIOS.
1493 *
1494 * If the pipe is not running, play safe and
1495 * wait for the clocks to stabilise before
1496 * continuing.
1497 */
1498 POSTING_READ(intel_dp->output_reg);
1499 msleep(50);
1500 } else
1501 intel_wait_for_vblank(dev, to_intel_crtc(crtc)->pipe);
1489 } 1502 }
1490 1503
1491 I915_WRITE(intel_dp->output_reg, DP & ~DP_PORT_EN); 1504 I915_WRITE(intel_dp->output_reg, DP & ~DP_PORT_EN);
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index a562bd2648c7..67cb076d271b 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -539,6 +539,9 @@ static int intel_lid_notify(struct notifier_block *nb, unsigned long val,
539 struct drm_device *dev = dev_priv->dev; 539 struct drm_device *dev = dev_priv->dev;
540 struct drm_connector *connector = dev_priv->int_lvds_connector; 540 struct drm_connector *connector = dev_priv->int_lvds_connector;
541 541
542 if (dev->switch_power_state != DRM_SWITCH_POWER_ON)
543 return NOTIFY_OK;
544
542 /* 545 /*
543 * check and update the status of LVDS connector after receiving 546 * check and update the status of LVDS connector after receiving
544 * the LID nofication event. 547 * the LID nofication event.
diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c
index 5045f8b921d6..c3e953b08992 100644
--- a/drivers/gpu/drm/nouveau/nouveau_mem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_mem.c
@@ -152,8 +152,6 @@ nouveau_mem_vram_fini(struct drm_device *dev)
152{ 152{
153 struct drm_nouveau_private *dev_priv = dev->dev_private; 153 struct drm_nouveau_private *dev_priv = dev->dev_private;
154 154
155 nouveau_bo_ref(NULL, &dev_priv->vga_ram);
156
157 ttm_bo_device_release(&dev_priv->ttm.bdev); 155 ttm_bo_device_release(&dev_priv->ttm.bdev);
158 156
159 nouveau_ttm_global_release(dev_priv); 157 nouveau_ttm_global_release(dev_priv);
diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c b/drivers/gpu/drm/nouveau/nouveau_sgdma.c
index 4bce801bc588..c77111eca6ac 100644
--- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c
+++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c
@@ -42,7 +42,8 @@ nouveau_sgdma_populate(struct ttm_backend *be, unsigned long num_pages,
42 42
43 nvbe->nr_pages = 0; 43 nvbe->nr_pages = 0;
44 while (num_pages--) { 44 while (num_pages--) {
45 if (dma_addrs[nvbe->nr_pages] != DMA_ERROR_CODE) { 45 /* this code path isn't called and is incorrect anyways */
46 if (0) { /*dma_addrs[nvbe->nr_pages] != DMA_ERROR_CODE)*/
46 nvbe->pages[nvbe->nr_pages] = 47 nvbe->pages[nvbe->nr_pages] =
47 dma_addrs[nvbe->nr_pages]; 48 dma_addrs[nvbe->nr_pages];
48 nvbe->ttm_alloced[nvbe->nr_pages] = true; 49 nvbe->ttm_alloced[nvbe->nr_pages] = true;
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c
index a30adec5beaa..915fbce89595 100644
--- a/drivers/gpu/drm/nouveau/nouveau_state.c
+++ b/drivers/gpu/drm/nouveau/nouveau_state.c
@@ -768,6 +768,11 @@ static void nouveau_card_takedown(struct drm_device *dev)
768 engine->mc.takedown(dev); 768 engine->mc.takedown(dev);
769 engine->display.late_takedown(dev); 769 engine->display.late_takedown(dev);
770 770
771 if (dev_priv->vga_ram) {
772 nouveau_bo_unpin(dev_priv->vga_ram);
773 nouveau_bo_ref(NULL, &dev_priv->vga_ram);
774 }
775
771 mutex_lock(&dev->struct_mutex); 776 mutex_lock(&dev->struct_mutex);
772 ttm_bo_clean_mm(&dev_priv->ttm.bdev, TTM_PL_VRAM); 777 ttm_bo_clean_mm(&dev_priv->ttm.bdev, TTM_PL_VRAM);
773 ttm_bo_clean_mm(&dev_priv->ttm.bdev, TTM_PL_TT); 778 ttm_bo_clean_mm(&dev_priv->ttm.bdev, TTM_PL_TT);
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index e9bc135d9189..9073e3bfb08c 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -862,9 +862,15 @@ int evergreen_pcie_gart_enable(struct radeon_device *rdev)
862 SYSTEM_ACCESS_MODE_NOT_IN_SYS | 862 SYSTEM_ACCESS_MODE_NOT_IN_SYS |
863 SYSTEM_APERTURE_UNMAPPED_ACCESS_PASS_THRU | 863 SYSTEM_APERTURE_UNMAPPED_ACCESS_PASS_THRU |
864 EFFECTIVE_L1_TLB_SIZE(5) | EFFECTIVE_L1_QUEUE_SIZE(5); 864 EFFECTIVE_L1_TLB_SIZE(5) | EFFECTIVE_L1_QUEUE_SIZE(5);
865 WREG32(MC_VM_MD_L1_TLB0_CNTL, tmp); 865 if (rdev->flags & RADEON_IS_IGP) {
866 WREG32(MC_VM_MD_L1_TLB1_CNTL, tmp); 866 WREG32(FUS_MC_VM_MD_L1_TLB0_CNTL, tmp);
867 WREG32(MC_VM_MD_L1_TLB2_CNTL, tmp); 867 WREG32(FUS_MC_VM_MD_L1_TLB1_CNTL, tmp);
868 WREG32(FUS_MC_VM_MD_L1_TLB2_CNTL, tmp);
869 } else {
870 WREG32(MC_VM_MD_L1_TLB0_CNTL, tmp);
871 WREG32(MC_VM_MD_L1_TLB1_CNTL, tmp);
872 WREG32(MC_VM_MD_L1_TLB2_CNTL, tmp);
873 }
868 WREG32(MC_VM_MB_L1_TLB0_CNTL, tmp); 874 WREG32(MC_VM_MB_L1_TLB0_CNTL, tmp);
869 WREG32(MC_VM_MB_L1_TLB1_CNTL, tmp); 875 WREG32(MC_VM_MB_L1_TLB1_CNTL, tmp);
870 WREG32(MC_VM_MB_L1_TLB2_CNTL, tmp); 876 WREG32(MC_VM_MB_L1_TLB2_CNTL, tmp);
@@ -1774,7 +1780,10 @@ static void evergreen_gpu_init(struct radeon_device *rdev)
1774 1780
1775 1781
1776 mc_shared_chmap = RREG32(MC_SHARED_CHMAP); 1782 mc_shared_chmap = RREG32(MC_SHARED_CHMAP);
1777 mc_arb_ramcfg = RREG32(MC_ARB_RAMCFG); 1783 if (rdev->flags & RADEON_IS_IGP)
1784 mc_arb_ramcfg = RREG32(FUS_MC_ARB_RAMCFG);
1785 else
1786 mc_arb_ramcfg = RREG32(MC_ARB_RAMCFG);
1778 1787
1779 switch (rdev->config.evergreen.max_tile_pipes) { 1788 switch (rdev->config.evergreen.max_tile_pipes) {
1780 case 1: 1789 case 1:
@@ -2923,11 +2932,6 @@ static int evergreen_startup(struct radeon_device *rdev)
2923 rdev->asic->copy = NULL; 2932 rdev->asic->copy = NULL;
2924 dev_warn(rdev->dev, "failed blitter (%d) falling back to memcpy\n", r); 2933 dev_warn(rdev->dev, "failed blitter (%d) falling back to memcpy\n", r);
2925 } 2934 }
2926 /* XXX: ontario has problems blitting to gart at the moment */
2927 if (rdev->family == CHIP_PALM) {
2928 rdev->asic->copy = NULL;
2929 radeon_ttm_set_active_vram_size(rdev, rdev->mc.visible_vram_size);
2930 }
2931 2935
2932 /* allocate wb buffer */ 2936 /* allocate wb buffer */
2933 r = radeon_wb_init(rdev); 2937 r = radeon_wb_init(rdev);
diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h
index 9aaa3f0c9372..fc40e0cc3451 100644
--- a/drivers/gpu/drm/radeon/evergreend.h
+++ b/drivers/gpu/drm/radeon/evergreend.h
@@ -200,6 +200,7 @@
200#define BURSTLENGTH_SHIFT 9 200#define BURSTLENGTH_SHIFT 9
201#define BURSTLENGTH_MASK 0x00000200 201#define BURSTLENGTH_MASK 0x00000200
202#define CHANSIZE_OVERRIDE (1 << 11) 202#define CHANSIZE_OVERRIDE (1 << 11)
203#define FUS_MC_ARB_RAMCFG 0x2768
203#define MC_VM_AGP_TOP 0x2028 204#define MC_VM_AGP_TOP 0x2028
204#define MC_VM_AGP_BOT 0x202C 205#define MC_VM_AGP_BOT 0x202C
205#define MC_VM_AGP_BASE 0x2030 206#define MC_VM_AGP_BASE 0x2030
@@ -221,6 +222,11 @@
221#define MC_VM_MD_L1_TLB0_CNTL 0x2654 222#define MC_VM_MD_L1_TLB0_CNTL 0x2654
222#define MC_VM_MD_L1_TLB1_CNTL 0x2658 223#define MC_VM_MD_L1_TLB1_CNTL 0x2658
223#define MC_VM_MD_L1_TLB2_CNTL 0x265C 224#define MC_VM_MD_L1_TLB2_CNTL 0x265C
225
226#define FUS_MC_VM_MD_L1_TLB0_CNTL 0x265C
227#define FUS_MC_VM_MD_L1_TLB1_CNTL 0x2660
228#define FUS_MC_VM_MD_L1_TLB2_CNTL 0x2664
229
224#define MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR 0x203C 230#define MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR 0x203C
225#define MC_VM_SYSTEM_APERTURE_HIGH_ADDR 0x2038 231#define MC_VM_SYSTEM_APERTURE_HIGH_ADDR 0x2038
226#define MC_VM_SYSTEM_APERTURE_LOW_ADDR 0x2034 232#define MC_VM_SYSTEM_APERTURE_LOW_ADDR 0x2034
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c
index 7aade20f63a8..3d8a7634bbe9 100644
--- a/drivers/gpu/drm/radeon/ni.c
+++ b/drivers/gpu/drm/radeon/ni.c
@@ -674,7 +674,7 @@ static void cayman_gpu_init(struct radeon_device *rdev)
674 674
675 cc_rb_backend_disable = RREG32(CC_RB_BACKEND_DISABLE); 675 cc_rb_backend_disable = RREG32(CC_RB_BACKEND_DISABLE);
676 cc_gc_shader_pipe_config = RREG32(CC_GC_SHADER_PIPE_CONFIG); 676 cc_gc_shader_pipe_config = RREG32(CC_GC_SHADER_PIPE_CONFIG);
677 cgts_tcc_disable = RREG32(CGTS_TCC_DISABLE); 677 cgts_tcc_disable = 0xff000000;
678 gc_user_rb_backend_disable = RREG32(GC_USER_RB_BACKEND_DISABLE); 678 gc_user_rb_backend_disable = RREG32(GC_USER_RB_BACKEND_DISABLE);
679 gc_user_shader_pipe_config = RREG32(GC_USER_SHADER_PIPE_CONFIG); 679 gc_user_shader_pipe_config = RREG32(GC_USER_SHADER_PIPE_CONFIG);
680 cgts_user_tcc_disable = RREG32(CGTS_USER_TCC_DISABLE); 680 cgts_user_tcc_disable = RREG32(CGTS_USER_TCC_DISABLE);
@@ -871,7 +871,7 @@ static void cayman_gpu_init(struct radeon_device *rdev)
871 871
872 smx_dc_ctl0 = RREG32(SMX_DC_CTL0); 872 smx_dc_ctl0 = RREG32(SMX_DC_CTL0);
873 smx_dc_ctl0 &= ~NUMBER_OF_SETS(0x1ff); 873 smx_dc_ctl0 &= ~NUMBER_OF_SETS(0x1ff);
874 smx_dc_ctl0 |= NUMBER_OF_SETS(rdev->config.evergreen.sx_num_of_sets); 874 smx_dc_ctl0 |= NUMBER_OF_SETS(rdev->config.cayman.sx_num_of_sets);
875 WREG32(SMX_DC_CTL0, smx_dc_ctl0); 875 WREG32(SMX_DC_CTL0, smx_dc_ctl0);
876 876
877 WREG32(SPI_CONFIG_CNTL_1, VTX_DONE_DELAY(4) | CRC_SIMD_ID_WADDR_DISABLE); 877 WREG32(SPI_CONFIG_CNTL_1, VTX_DONE_DELAY(4) | CRC_SIMD_ID_WADDR_DISABLE);
@@ -887,20 +887,20 @@ static void cayman_gpu_init(struct radeon_device *rdev)
887 887
888 WREG32(TA_CNTL_AUX, DISABLE_CUBE_ANISO); 888 WREG32(TA_CNTL_AUX, DISABLE_CUBE_ANISO);
889 889
890 WREG32(SX_EXPORT_BUFFER_SIZES, (COLOR_BUFFER_SIZE((rdev->config.evergreen.sx_max_export_size / 4) - 1) | 890 WREG32(SX_EXPORT_BUFFER_SIZES, (COLOR_BUFFER_SIZE((rdev->config.cayman.sx_max_export_size / 4) - 1) |
891 POSITION_BUFFER_SIZE((rdev->config.evergreen.sx_max_export_pos_size / 4) - 1) | 891 POSITION_BUFFER_SIZE((rdev->config.cayman.sx_max_export_pos_size / 4) - 1) |
892 SMX_BUFFER_SIZE((rdev->config.evergreen.sx_max_export_smx_size / 4) - 1))); 892 SMX_BUFFER_SIZE((rdev->config.cayman.sx_max_export_smx_size / 4) - 1)));
893 893
894 WREG32(PA_SC_FIFO_SIZE, (SC_PRIM_FIFO_SIZE(rdev->config.evergreen.sc_prim_fifo_size) | 894 WREG32(PA_SC_FIFO_SIZE, (SC_PRIM_FIFO_SIZE(rdev->config.cayman.sc_prim_fifo_size) |
895 SC_HIZ_TILE_FIFO_SIZE(rdev->config.evergreen.sc_hiz_tile_fifo_size) | 895 SC_HIZ_TILE_FIFO_SIZE(rdev->config.cayman.sc_hiz_tile_fifo_size) |
896 SC_EARLYZ_TILE_FIFO_SIZE(rdev->config.evergreen.sc_earlyz_tile_fifo_size))); 896 SC_EARLYZ_TILE_FIFO_SIZE(rdev->config.cayman.sc_earlyz_tile_fifo_size)));
897 897
898 898
899 WREG32(VGT_NUM_INSTANCES, 1); 899 WREG32(VGT_NUM_INSTANCES, 1);
900 900
901 WREG32(CP_PERFMON_CNTL, 0); 901 WREG32(CP_PERFMON_CNTL, 0);
902 902
903 WREG32(SQ_MS_FIFO_SIZES, (CACHE_FIFO_SIZE(16 * rdev->config.evergreen.sq_num_cf_insts) | 903 WREG32(SQ_MS_FIFO_SIZES, (CACHE_FIFO_SIZE(16 * rdev->config.cayman.sq_num_cf_insts) |
904 FETCH_FIFO_HIWATER(0x4) | 904 FETCH_FIFO_HIWATER(0x4) |
905 DONE_FIFO_HIWATER(0xe0) | 905 DONE_FIFO_HIWATER(0xe0) |
906 ALU_UPDATE_FIFO_HIWATER(0x8))); 906 ALU_UPDATE_FIFO_HIWATER(0x8)));
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
index f5d12fb103fa..90dfb2b8cf03 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -431,7 +431,7 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev,
431 } 431 }
432 } 432 }
433 433
434 /* Acer laptop (Acer TravelMate 5730G) has an HDMI port 434 /* Acer laptop (Acer TravelMate 5730/5730G) has an HDMI port
435 * on the laptop and a DVI port on the docking station and 435 * on the laptop and a DVI port on the docking station and
436 * both share the same encoder, hpd pin, and ddc line. 436 * both share the same encoder, hpd pin, and ddc line.
437 * So while the bios table is technically correct, 437 * So while the bios table is technically correct,
@@ -440,7 +440,7 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev,
440 * with different crtcs which isn't possible on the hardware 440 * with different crtcs which isn't possible on the hardware
441 * side and leaves no crtcs for LVDS or VGA. 441 * side and leaves no crtcs for LVDS or VGA.
442 */ 442 */
443 if ((dev->pdev->device == 0x95c4) && 443 if (((dev->pdev->device == 0x95c4) || (dev->pdev->device == 0x9591)) &&
444 (dev->pdev->subsystem_vendor == 0x1025) && 444 (dev->pdev->subsystem_vendor == 0x1025) &&
445 (dev->pdev->subsystem_device == 0x013c)) { 445 (dev->pdev->subsystem_device == 0x013c)) {
446 if ((*connector_type == DRM_MODE_CONNECTOR_DVII) && 446 if ((*connector_type == DRM_MODE_CONNECTOR_DVII) &&
@@ -1574,9 +1574,17 @@ struct radeon_encoder_atom_dig *radeon_atombios_get_lvds_info(struct
1574 ATOM_FAKE_EDID_PATCH_RECORD *fake_edid_record; 1574 ATOM_FAKE_EDID_PATCH_RECORD *fake_edid_record;
1575 ATOM_PANEL_RESOLUTION_PATCH_RECORD *panel_res_record; 1575 ATOM_PANEL_RESOLUTION_PATCH_RECORD *panel_res_record;
1576 bool bad_record = false; 1576 bool bad_record = false;
1577 u8 *record = (u8 *)(mode_info->atom_context->bios + 1577 u8 *record;
1578 data_offset + 1578
1579 le16_to_cpu(lvds_info->info.usModePatchTableOffset)); 1579 if ((frev == 1) && (crev < 2))
1580 /* absolute */
1581 record = (u8 *)(mode_info->atom_context->bios +
1582 le16_to_cpu(lvds_info->info.usModePatchTableOffset));
1583 else
1584 /* relative */
1585 record = (u8 *)(mode_info->atom_context->bios +
1586 data_offset +
1587 le16_to_cpu(lvds_info->info.usModePatchTableOffset));
1580 while (*record != ATOM_RECORD_END_TYPE) { 1588 while (*record != ATOM_RECORD_END_TYPE) {
1581 switch (*record) { 1589 switch (*record) {
1582 case LCD_MODE_PATCH_RECORD_MODE_TYPE: 1590 case LCD_MODE_PATCH_RECORD_MODE_TYPE:
@@ -1599,9 +1607,10 @@ struct radeon_encoder_atom_dig *radeon_atombios_get_lvds_info(struct
1599 memcpy((u8 *)edid, (u8 *)&fake_edid_record->ucFakeEDIDString[0], 1607 memcpy((u8 *)edid, (u8 *)&fake_edid_record->ucFakeEDIDString[0],
1600 fake_edid_record->ucFakeEDIDLength); 1608 fake_edid_record->ucFakeEDIDLength);
1601 1609
1602 if (drm_edid_is_valid(edid)) 1610 if (drm_edid_is_valid(edid)) {
1603 rdev->mode_info.bios_hardcoded_edid = edid; 1611 rdev->mode_info.bios_hardcoded_edid = edid;
1604 else 1612 rdev->mode_info.bios_hardcoded_edid_size = edid_size;
1613 } else
1605 kfree(edid); 1614 kfree(edid);
1606 } 1615 }
1607 } 1616 }
diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
index ed5dfe58f29c..9d95792bea3e 100644
--- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c
+++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
@@ -15,6 +15,9 @@
15#define ATPX_VERSION 0 15#define ATPX_VERSION 0
16#define ATPX_GPU_PWR 2 16#define ATPX_GPU_PWR 2
17#define ATPX_MUX_SELECT 3 17#define ATPX_MUX_SELECT 3
18#define ATPX_I2C_MUX_SELECT 4
19#define ATPX_SWITCH_START 5
20#define ATPX_SWITCH_END 6
18 21
19#define ATPX_INTEGRATED 0 22#define ATPX_INTEGRATED 0
20#define ATPX_DISCRETE 1 23#define ATPX_DISCRETE 1
@@ -149,13 +152,35 @@ static int radeon_atpx_switch_mux(acpi_handle handle, int mux_id)
149 return radeon_atpx_execute(handle, ATPX_MUX_SELECT, mux_id); 152 return radeon_atpx_execute(handle, ATPX_MUX_SELECT, mux_id);
150} 153}
151 154
155static int radeon_atpx_switch_i2c_mux(acpi_handle handle, int mux_id)
156{
157 return radeon_atpx_execute(handle, ATPX_I2C_MUX_SELECT, mux_id);
158}
159
160static int radeon_atpx_switch_start(acpi_handle handle, int gpu_id)
161{
162 return radeon_atpx_execute(handle, ATPX_SWITCH_START, gpu_id);
163}
164
165static int radeon_atpx_switch_end(acpi_handle handle, int gpu_id)
166{
167 return radeon_atpx_execute(handle, ATPX_SWITCH_END, gpu_id);
168}
152 169
153static int radeon_atpx_switchto(enum vga_switcheroo_client_id id) 170static int radeon_atpx_switchto(enum vga_switcheroo_client_id id)
154{ 171{
172 int gpu_id;
173
155 if (id == VGA_SWITCHEROO_IGD) 174 if (id == VGA_SWITCHEROO_IGD)
156 radeon_atpx_switch_mux(radeon_atpx_priv.atpx_handle, 0); 175 gpu_id = ATPX_INTEGRATED;
157 else 176 else
158 radeon_atpx_switch_mux(radeon_atpx_priv.atpx_handle, 1); 177 gpu_id = ATPX_DISCRETE;
178
179 radeon_atpx_switch_start(radeon_atpx_priv.atpx_handle, gpu_id);
180 radeon_atpx_switch_mux(radeon_atpx_priv.atpx_handle, gpu_id);
181 radeon_atpx_switch_i2c_mux(radeon_atpx_priv.atpx_handle, gpu_id);
182 radeon_atpx_switch_end(radeon_atpx_priv.atpx_handle, gpu_id);
183
159 return 0; 184 return 0;
160} 185}
161 186
diff --git a/drivers/gpu/drm/radeon/radeon_cursor.c b/drivers/gpu/drm/radeon/radeon_cursor.c
index bdf2fa1189ae..3189a7efb2e9 100644
--- a/drivers/gpu/drm/radeon/radeon_cursor.c
+++ b/drivers/gpu/drm/radeon/radeon_cursor.c
@@ -167,9 +167,6 @@ int radeon_crtc_cursor_set(struct drm_crtc *crtc,
167 return -EINVAL; 167 return -EINVAL;
168 } 168 }
169 169
170 radeon_crtc->cursor_width = width;
171 radeon_crtc->cursor_height = height;
172
173 obj = drm_gem_object_lookup(crtc->dev, file_priv, handle); 170 obj = drm_gem_object_lookup(crtc->dev, file_priv, handle);
174 if (!obj) { 171 if (!obj) {
175 DRM_ERROR("Cannot find cursor object %x for crtc %d\n", handle, radeon_crtc->crtc_id); 172 DRM_ERROR("Cannot find cursor object %x for crtc %d\n", handle, radeon_crtc->crtc_id);
@@ -180,6 +177,9 @@ int radeon_crtc_cursor_set(struct drm_crtc *crtc,
180 if (ret) 177 if (ret)
181 goto fail; 178 goto fail;
182 179
180 radeon_crtc->cursor_width = width;
181 radeon_crtc->cursor_height = height;
182
183 radeon_lock_cursor(crtc, true); 183 radeon_lock_cursor(crtc, true);
184 /* XXX only 27 bit offset for legacy cursor */ 184 /* XXX only 27 bit offset for legacy cursor */
185 radeon_set_cursor(crtc, obj, gpu_addr); 185 radeon_set_cursor(crtc, obj, gpu_addr);
diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c
index 8a955bbdb608..a533f52fd163 100644
--- a/drivers/gpu/drm/radeon/radeon_gart.c
+++ b/drivers/gpu/drm/radeon/radeon_gart.c
@@ -181,9 +181,9 @@ int radeon_gart_bind(struct radeon_device *rdev, unsigned offset,
181 p = t / (PAGE_SIZE / RADEON_GPU_PAGE_SIZE); 181 p = t / (PAGE_SIZE / RADEON_GPU_PAGE_SIZE);
182 182
183 for (i = 0; i < pages; i++, p++) { 183 for (i = 0; i < pages; i++, p++) {
184 /* On TTM path, we only use the DMA API if TTM_PAGE_FLAG_DMA32 184 /* we reverted the patch using dma_addr in TTM for now but this
185 * is requested. */ 185 * code stops building on alpha so just comment it out for now */
186 if (dma_addr[i] != DMA_ERROR_CODE) { 186 if (0) { /*dma_addr[i] != DMA_ERROR_CODE) */
187 rdev->gart.ttm_alloced[p] = true; 187 rdev->gart.ttm_alloced[p] = true;
188 rdev->gart.pages_addr[p] = dma_addr[i]; 188 rdev->gart.pages_addr[p] = dma_addr[i];
189 } else { 189 } else {
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
index 871df0376b1c..bd58af658581 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -234,6 +234,9 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
234 return -EINVAL; 234 return -EINVAL;
235 } 235 }
236 break; 236 break;
237 case RADEON_INFO_FUSION_GART_WORKING:
238 value = 1;
239 break;
237 default: 240 default:
238 DRM_DEBUG_KMS("Invalid request %d\n", info->request); 241 DRM_DEBUG_KMS("Invalid request %d\n", info->request);
239 return -EINVAL; 242 return -EINVAL;
diff --git a/drivers/gpu/drm/radeon/reg_srcs/cayman b/drivers/gpu/drm/radeon/reg_srcs/cayman
index 6334f8ac1209..0aa8e85a9457 100644
--- a/drivers/gpu/drm/radeon/reg_srcs/cayman
+++ b/drivers/gpu/drm/radeon/reg_srcs/cayman
@@ -33,6 +33,7 @@ cayman 0x9400
330x00008E48 SQ_EX_ALLOC_TABLE_SLOTS 330x00008E48 SQ_EX_ALLOC_TABLE_SLOTS
340x00009100 SPI_CONFIG_CNTL 340x00009100 SPI_CONFIG_CNTL
350x0000913C SPI_CONFIG_CNTL_1 350x0000913C SPI_CONFIG_CNTL_1
360x00009508 TA_CNTL_AUX
360x00009830 DB_DEBUG 370x00009830 DB_DEBUG
370x00009834 DB_DEBUG2 380x00009834 DB_DEBUG2
380x00009838 DB_DEBUG3 390x00009838 DB_DEBUG3
diff --git a/drivers/gpu/drm/radeon/reg_srcs/evergreen b/drivers/gpu/drm/radeon/reg_srcs/evergreen
index 7e1637176e08..0e28cae7ea43 100644
--- a/drivers/gpu/drm/radeon/reg_srcs/evergreen
+++ b/drivers/gpu/drm/radeon/reg_srcs/evergreen
@@ -46,6 +46,7 @@ evergreen 0x9400
460x00008E48 SQ_EX_ALLOC_TABLE_SLOTS 460x00008E48 SQ_EX_ALLOC_TABLE_SLOTS
470x00009100 SPI_CONFIG_CNTL 470x00009100 SPI_CONFIG_CNTL
480x0000913C SPI_CONFIG_CNTL_1 480x0000913C SPI_CONFIG_CNTL_1
490x00009508 TA_CNTL_AUX
490x00009700 VC_CNTL 500x00009700 VC_CNTL
500x00009714 VC_ENHANCE 510x00009714 VC_ENHANCE
510x00009830 DB_DEBUG 520x00009830 DB_DEBUG
diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c
index e01cacba685f..498b284e5ef9 100644
--- a/drivers/gpu/vga/vga_switcheroo.c
+++ b/drivers/gpu/vga/vga_switcheroo.c
@@ -219,9 +219,6 @@ static int vga_switchto_stage1(struct vga_switcheroo_client *new_client)
219 int i; 219 int i;
220 struct vga_switcheroo_client *active = NULL; 220 struct vga_switcheroo_client *active = NULL;
221 221
222 if (new_client->active == true)
223 return 0;
224
225 for (i = 0; i < VGA_SWITCHEROO_MAX_CLIENTS; i++) { 222 for (i = 0; i < VGA_SWITCHEROO_MAX_CLIENTS; i++) {
226 if (vgasr_priv.clients[i].active == true) { 223 if (vgasr_priv.clients[i].active == true) {
227 active = &vgasr_priv.clients[i]; 224 active = &vgasr_priv.clients[i];
@@ -372,6 +369,9 @@ vga_switcheroo_debugfs_write(struct file *filp, const char __user *ubuf,
372 goto out; 369 goto out;
373 } 370 }
374 371
372 if (client->active == true)
373 goto out;
374
375 /* okay we want a switch - test if devices are willing to switch */ 375 /* okay we want a switch - test if devices are willing to switch */
376 can_switch = true; 376 can_switch = true;
377 for (i = 0; i < VGA_SWITCHEROO_MAX_CLIENTS; i++) { 377 for (i = 0; i < VGA_SWITCHEROO_MAX_CLIENTS; i++) {