aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/bochs/bochs_kms.c1
-rw-r--r--drivers/gpu/drm/cirrus/cirrus_mode.c1
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c4
-rw-r--r--drivers/gpu/drm/i915/intel_hdmi.c7
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c1
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c1
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/ltc/gf100.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/ltc/gk104.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/ltc/gm107.c2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_acpi.c16
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drm.c1
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_vga.c9
-rw-r--r--drivers/gpu/drm/radeon/cik_sdma.c7
-rw-r--r--drivers/gpu/drm/radeon/kv_dpm.c28
-rw-r--r--drivers/gpu/drm/radeon/ni_dma.c6
-rw-r--r--drivers/gpu/drm/radeon/r100.c28
-rw-r--r--drivers/gpu/drm/radeon/r600_dma.c9
-rw-r--r--drivers/gpu/drm/radeon/r600d.h7
-rw-r--r--drivers/gpu/drm/radeon/radeon_asic.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_asic.h3
-rw-r--r--drivers/gpu/drm/radeon/radeon_atpx_handler.c16
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c11
-rw-r--r--drivers/gpu/drm/radeon/radeon_drv.c3
-rw-r--r--drivers/gpu/drm/radeon/rs400.c4
-rw-r--r--drivers/gpu/drm/sti/sti_hdmi.c1
-rw-r--r--drivers/gpu/vga/vga_switcheroo.c6
-rw-r--r--drivers/gpu/vga/vgaarb.c46
28 files changed, 126 insertions, 100 deletions
diff --git a/drivers/gpu/drm/bochs/bochs_kms.c b/drivers/gpu/drm/bochs/bochs_kms.c
index 9d7346b92653..6b7efcf363d6 100644
--- a/drivers/gpu/drm/bochs/bochs_kms.c
+++ b/drivers/gpu/drm/bochs/bochs_kms.c
@@ -250,6 +250,7 @@ static void bochs_connector_init(struct drm_device *dev)
250 DRM_MODE_CONNECTOR_VIRTUAL); 250 DRM_MODE_CONNECTOR_VIRTUAL);
251 drm_connector_helper_add(connector, 251 drm_connector_helper_add(connector,
252 &bochs_connector_connector_helper_funcs); 252 &bochs_connector_connector_helper_funcs);
253 drm_connector_register(connector);
253} 254}
254 255
255 256
diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c b/drivers/gpu/drm/cirrus/cirrus_mode.c
index e1c5c3222129..c7c5a9d91fa0 100644
--- a/drivers/gpu/drm/cirrus/cirrus_mode.c
+++ b/drivers/gpu/drm/cirrus/cirrus_mode.c
@@ -555,6 +555,7 @@ static struct drm_connector *cirrus_vga_init(struct drm_device *dev)
555 555
556 drm_connector_helper_add(connector, &cirrus_vga_connector_helper_funcs); 556 drm_connector_helper_add(connector, &cirrus_vga_connector_helper_funcs);
557 557
558 drm_connector_register(connector);
558 return connector; 559 return connector;
559} 560}
560 561
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 81d7681faa63..fdff1d420c14 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1631,6 +1631,10 @@ static void intel_dp_get_config(struct intel_encoder *encoder,
1631 1631
1632 pipe_config->adjusted_mode.flags |= flags; 1632 pipe_config->adjusted_mode.flags |= flags;
1633 1633
1634 if (!HAS_PCH_SPLIT(dev) && !IS_VALLEYVIEW(dev) &&
1635 tmp & DP_COLOR_RANGE_16_235)
1636 pipe_config->limited_color_range = true;
1637
1634 pipe_config->has_dp_encoder = true; 1638 pipe_config->has_dp_encoder = true;
1635 1639
1636 intel_dp_get_m_n(crtc, pipe_config); 1640 intel_dp_get_m_n(crtc, pipe_config);
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index f9151f6641d9..ca34de7f6a7b 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -712,7 +712,8 @@ static void intel_hdmi_get_config(struct intel_encoder *encoder,
712 struct intel_crtc_config *pipe_config) 712 struct intel_crtc_config *pipe_config)
713{ 713{
714 struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base); 714 struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
715 struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; 715 struct drm_device *dev = encoder->base.dev;
716 struct drm_i915_private *dev_priv = dev->dev_private;
716 u32 tmp, flags = 0; 717 u32 tmp, flags = 0;
717 int dotclock; 718 int dotclock;
718 719
@@ -734,6 +735,10 @@ static void intel_hdmi_get_config(struct intel_encoder *encoder,
734 if (tmp & HDMI_MODE_SELECT_HDMI) 735 if (tmp & HDMI_MODE_SELECT_HDMI)
735 pipe_config->has_audio = true; 736 pipe_config->has_audio = true;
736 737
738 if (!HAS_PCH_SPLIT(dev) &&
739 tmp & HDMI_COLOR_RANGE_16_235)
740 pipe_config->limited_color_range = true;
741
737 pipe_config->adjusted_mode.flags |= flags; 742 pipe_config->adjusted_mode.flags |= flags;
738 743
739 if ((tmp & SDVO_COLOR_FORMAT_MASK) == HDMI_COLOR_FORMAT_12bpc) 744 if ((tmp & SDVO_COLOR_FORMAT_MASK) == HDMI_COLOR_FORMAT_12bpc)
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 2d068edd1adc..47a126a0493f 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -1400,7 +1400,7 @@ i830_dispatch_execbuffer(struct intel_engine_cs *ring,
1400 */ 1400 */
1401 intel_ring_emit(ring, SRC_COPY_BLT_CMD | BLT_WRITE_RGBA); 1401 intel_ring_emit(ring, SRC_COPY_BLT_CMD | BLT_WRITE_RGBA);
1402 intel_ring_emit(ring, BLT_DEPTH_32 | BLT_ROP_SRC_COPY | 4096); 1402 intel_ring_emit(ring, BLT_DEPTH_32 | BLT_ROP_SRC_COPY | 4096);
1403 intel_ring_emit(ring, DIV_ROUND_UP(len, 4096) << 16 | 1024); 1403 intel_ring_emit(ring, DIV_ROUND_UP(len, 4096) << 16 | 4096);
1404 intel_ring_emit(ring, cs_offset); 1404 intel_ring_emit(ring, cs_offset);
1405 intel_ring_emit(ring, 4096); 1405 intel_ring_emit(ring, 4096);
1406 intel_ring_emit(ring, offset); 1406 intel_ring_emit(ring, offset);
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c b/drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c
index 0a44459844e3..05a278bab247 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c
@@ -200,7 +200,6 @@ nvc0_bar_init(struct nouveau_object *object)
200 200
201 nv_mask(priv, 0x000200, 0x00000100, 0x00000000); 201 nv_mask(priv, 0x000200, 0x00000100, 0x00000000);
202 nv_mask(priv, 0x000200, 0x00000100, 0x00000100); 202 nv_mask(priv, 0x000200, 0x00000100, 0x00000100);
203 nv_mask(priv, 0x100c80, 0x00000001, 0x00000000);
204 203
205 nv_wr32(priv, 0x001704, 0x80000000 | priv->bar[1].mem->addr >> 12); 204 nv_wr32(priv, 0x001704, 0x80000000 | priv->bar[1].mem->addr >> 12);
206 if (priv->bar[0].mem) 205 if (priv->bar[0].mem)
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c
index b19a2b3c1081..32f28dc73ef2 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c
@@ -60,6 +60,7 @@ nvc0_fb_init(struct nouveau_object *object)
60 60
61 if (priv->r100c10_page) 61 if (priv->r100c10_page)
62 nv_wr32(priv, 0x100c10, priv->r100c10 >> 8); 62 nv_wr32(priv, 0x100c10, priv->r100c10 >> 8);
63 nv_mask(priv, 0x100c80, 0x00000001, 0x00000000); /* 128KiB lpg */
63 return 0; 64 return 0;
64} 65}
65 66
diff --git a/drivers/gpu/drm/nouveau/core/subdev/ltc/gf100.c b/drivers/gpu/drm/nouveau/core/subdev/ltc/gf100.c
index b54b582e72c4..d5d65285efe5 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/ltc/gf100.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/ltc/gf100.c
@@ -98,6 +98,7 @@ static int
98gf100_ltc_init(struct nouveau_object *object) 98gf100_ltc_init(struct nouveau_object *object)
99{ 99{
100 struct nvkm_ltc_priv *priv = (void *)object; 100 struct nvkm_ltc_priv *priv = (void *)object;
101 u32 lpg128 = !(nv_rd32(priv, 0x100c80) & 0x00000001);
101 int ret; 102 int ret;
102 103
103 ret = nvkm_ltc_init(priv); 104 ret = nvkm_ltc_init(priv);
@@ -107,6 +108,7 @@ gf100_ltc_init(struct nouveau_object *object)
107 nv_mask(priv, 0x17e820, 0x00100000, 0x00000000); /* INTR_EN &= ~0x10 */ 108 nv_mask(priv, 0x17e820, 0x00100000, 0x00000000); /* INTR_EN &= ~0x10 */
108 nv_wr32(priv, 0x17e8d8, priv->ltc_nr); 109 nv_wr32(priv, 0x17e8d8, priv->ltc_nr);
109 nv_wr32(priv, 0x17e8d4, priv->tag_base); 110 nv_wr32(priv, 0x17e8d4, priv->tag_base);
111 nv_mask(priv, 0x17e8c0, 0x00000002, lpg128 ? 0x00000002 : 0x00000000);
110 return 0; 112 return 0;
111} 113}
112 114
diff --git a/drivers/gpu/drm/nouveau/core/subdev/ltc/gk104.c b/drivers/gpu/drm/nouveau/core/subdev/ltc/gk104.c
index ea716569745d..b39b5d0eb8f9 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/ltc/gk104.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/ltc/gk104.c
@@ -28,6 +28,7 @@ static int
28gk104_ltc_init(struct nouveau_object *object) 28gk104_ltc_init(struct nouveau_object *object)
29{ 29{
30 struct nvkm_ltc_priv *priv = (void *)object; 30 struct nvkm_ltc_priv *priv = (void *)object;
31 u32 lpg128 = !(nv_rd32(priv, 0x100c80) & 0x00000001);
31 int ret; 32 int ret;
32 33
33 ret = nvkm_ltc_init(priv); 34 ret = nvkm_ltc_init(priv);
@@ -37,6 +38,7 @@ gk104_ltc_init(struct nouveau_object *object)
37 nv_wr32(priv, 0x17e8d8, priv->ltc_nr); 38 nv_wr32(priv, 0x17e8d8, priv->ltc_nr);
38 nv_wr32(priv, 0x17e000, priv->ltc_nr); 39 nv_wr32(priv, 0x17e000, priv->ltc_nr);
39 nv_wr32(priv, 0x17e8d4, priv->tag_base); 40 nv_wr32(priv, 0x17e8d4, priv->tag_base);
41 nv_mask(priv, 0x17e8c0, 0x00000002, lpg128 ? 0x00000002 : 0x00000000);
40 return 0; 42 return 0;
41} 43}
42 44
diff --git a/drivers/gpu/drm/nouveau/core/subdev/ltc/gm107.c b/drivers/gpu/drm/nouveau/core/subdev/ltc/gm107.c
index 4761b2e9af00..a4de64289762 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/ltc/gm107.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/ltc/gm107.c
@@ -98,6 +98,7 @@ static int
98gm107_ltc_init(struct nouveau_object *object) 98gm107_ltc_init(struct nouveau_object *object)
99{ 99{
100 struct nvkm_ltc_priv *priv = (void *)object; 100 struct nvkm_ltc_priv *priv = (void *)object;
101 u32 lpg128 = !(nv_rd32(priv, 0x100c80) & 0x00000001);
101 int ret; 102 int ret;
102 103
103 ret = nvkm_ltc_init(priv); 104 ret = nvkm_ltc_init(priv);
@@ -106,6 +107,7 @@ gm107_ltc_init(struct nouveau_object *object)
106 107
107 nv_wr32(priv, 0x17e27c, priv->ltc_nr); 108 nv_wr32(priv, 0x17e27c, priv->ltc_nr);
108 nv_wr32(priv, 0x17e278, priv->tag_base); 109 nv_wr32(priv, 0x17e278, priv->tag_base);
110 nv_mask(priv, 0x17e264, 0x00000002, lpg128 ? 0x00000002 : 0x00000000);
109 return 0; 111 return 0;
110} 112}
111 113
diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c
index 279206997e5c..622424692b3b 100644
--- a/drivers/gpu/drm/nouveau/nouveau_acpi.c
+++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c
@@ -46,7 +46,6 @@ static struct nouveau_dsm_priv {
46 bool dsm_detected; 46 bool dsm_detected;
47 bool optimus_detected; 47 bool optimus_detected;
48 acpi_handle dhandle; 48 acpi_handle dhandle;
49 acpi_handle other_handle;
50 acpi_handle rom_handle; 49 acpi_handle rom_handle;
51} nouveau_dsm_priv; 50} nouveau_dsm_priv;
52 51
@@ -222,10 +221,9 @@ static int nouveau_dsm_pci_probe(struct pci_dev *pdev)
222 if (!dhandle) 221 if (!dhandle)
223 return false; 222 return false;
224 223
225 if (!acpi_has_method(dhandle, "_DSM")) { 224 if (!acpi_has_method(dhandle, "_DSM"))
226 nouveau_dsm_priv.other_handle = dhandle;
227 return false; 225 return false;
228 } 226
229 if (acpi_check_dsm(dhandle, nouveau_dsm_muid, 0x00000102, 227 if (acpi_check_dsm(dhandle, nouveau_dsm_muid, 0x00000102,
230 1 << NOUVEAU_DSM_POWER)) 228 1 << NOUVEAU_DSM_POWER))
231 retval |= NOUVEAU_DSM_HAS_MUX; 229 retval |= NOUVEAU_DSM_HAS_MUX;
@@ -301,16 +299,6 @@ static bool nouveau_dsm_detect(void)
301 printk(KERN_INFO "VGA switcheroo: detected DSM switching method %s handle\n", 299 printk(KERN_INFO "VGA switcheroo: detected DSM switching method %s handle\n",
302 acpi_method_name); 300 acpi_method_name);
303 nouveau_dsm_priv.dsm_detected = true; 301 nouveau_dsm_priv.dsm_detected = true;
304 /*
305 * On some systems hotplug events are generated for the device
306 * being switched off when _DSM is executed. They cause ACPI
307 * hotplug to trigger and attempt to remove the device from
308 * the system, which causes it to break down. Prevent that from
309 * happening by setting the no_hotplug flag for the involved
310 * ACPI device objects.
311 */
312 acpi_bus_no_hotplug(nouveau_dsm_priv.dhandle);
313 acpi_bus_no_hotplug(nouveau_dsm_priv.other_handle);
314 ret = true; 302 ret = true;
315 } 303 }
316 304
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 250a5e88c751..9c3af96a7153 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -627,6 +627,7 @@ int nouveau_pmops_suspend(struct device *dev)
627 627
628 pci_save_state(pdev); 628 pci_save_state(pdev);
629 pci_disable_device(pdev); 629 pci_disable_device(pdev);
630 pci_ignore_hotplug(pdev);
630 pci_set_power_state(pdev, PCI_D3hot); 631 pci_set_power_state(pdev, PCI_D3hot);
631 return 0; 632 return 0;
632} 633}
diff --git a/drivers/gpu/drm/nouveau/nouveau_vga.c b/drivers/gpu/drm/nouveau/nouveau_vga.c
index 18d55d447248..c7592ec8ecb8 100644
--- a/drivers/gpu/drm/nouveau/nouveau_vga.c
+++ b/drivers/gpu/drm/nouveau/nouveau_vga.c
@@ -108,7 +108,16 @@ void
108nouveau_vga_fini(struct nouveau_drm *drm) 108nouveau_vga_fini(struct nouveau_drm *drm)
109{ 109{
110 struct drm_device *dev = drm->dev; 110 struct drm_device *dev = drm->dev;
111 bool runtime = false;
112
113 if (nouveau_runtime_pm == 1)
114 runtime = true;
115 if ((nouveau_runtime_pm == -1) && (nouveau_is_optimus() || nouveau_is_v1_dsm()))
116 runtime = true;
117
111 vga_switcheroo_unregister_client(dev->pdev); 118 vga_switcheroo_unregister_client(dev->pdev);
119 if (runtime && nouveau_is_v1_dsm() && !nouveau_is_optimus())
120 vga_switcheroo_fini_domain_pm_ops(drm->dev->dev);
112 vga_client_register(dev->pdev, NULL, NULL, NULL); 121 vga_client_register(dev->pdev, NULL, NULL, NULL);
113} 122}
114 123
diff --git a/drivers/gpu/drm/radeon/cik_sdma.c b/drivers/gpu/drm/radeon/cik_sdma.c
index 192278bc993c..c4ffa54b1e3d 100644
--- a/drivers/gpu/drm/radeon/cik_sdma.c
+++ b/drivers/gpu/drm/radeon/cik_sdma.c
@@ -489,13 +489,6 @@ int cik_sdma_resume(struct radeon_device *rdev)
489{ 489{
490 int r; 490 int r;
491 491
492 /* Reset dma */
493 WREG32(SRBM_SOFT_RESET, SOFT_RESET_SDMA | SOFT_RESET_SDMA1);
494 RREG32(SRBM_SOFT_RESET);
495 udelay(50);
496 WREG32(SRBM_SOFT_RESET, 0);
497 RREG32(SRBM_SOFT_RESET);
498
499 r = cik_sdma_load_microcode(rdev); 492 r = cik_sdma_load_microcode(rdev);
500 if (r) 493 if (r)
501 return r; 494 return r;
diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c
index 8b58e11b64fa..67cb472d188c 100644
--- a/drivers/gpu/drm/radeon/kv_dpm.c
+++ b/drivers/gpu/drm/radeon/kv_dpm.c
@@ -33,6 +33,8 @@
33#define KV_MINIMUM_ENGINE_CLOCK 800 33#define KV_MINIMUM_ENGINE_CLOCK 800
34#define SMC_RAM_END 0x40000 34#define SMC_RAM_END 0x40000
35 35
36static int kv_enable_nb_dpm(struct radeon_device *rdev,
37 bool enable);
36static void kv_init_graphics_levels(struct radeon_device *rdev); 38static void kv_init_graphics_levels(struct radeon_device *rdev);
37static int kv_calculate_ds_divider(struct radeon_device *rdev); 39static int kv_calculate_ds_divider(struct radeon_device *rdev);
38static int kv_calculate_nbps_level_settings(struct radeon_device *rdev); 40static int kv_calculate_nbps_level_settings(struct radeon_device *rdev);
@@ -1295,6 +1297,9 @@ void kv_dpm_disable(struct radeon_device *rdev)
1295{ 1297{
1296 kv_smc_bapm_enable(rdev, false); 1298 kv_smc_bapm_enable(rdev, false);
1297 1299
1300 if (rdev->family == CHIP_MULLINS)
1301 kv_enable_nb_dpm(rdev, false);
1302
1298 /* powerup blocks */ 1303 /* powerup blocks */
1299 kv_dpm_powergate_acp(rdev, false); 1304 kv_dpm_powergate_acp(rdev, false);
1300 kv_dpm_powergate_samu(rdev, false); 1305 kv_dpm_powergate_samu(rdev, false);
@@ -1769,15 +1774,24 @@ static int kv_update_dfs_bypass_settings(struct radeon_device *rdev,
1769 return ret; 1774 return ret;
1770} 1775}
1771 1776
1772static int kv_enable_nb_dpm(struct radeon_device *rdev) 1777static int kv_enable_nb_dpm(struct radeon_device *rdev,
1778 bool enable)
1773{ 1779{
1774 struct kv_power_info *pi = kv_get_pi(rdev); 1780 struct kv_power_info *pi = kv_get_pi(rdev);
1775 int ret = 0; 1781 int ret = 0;
1776 1782
1777 if (pi->enable_nb_dpm && !pi->nb_dpm_enabled) { 1783 if (enable) {
1778 ret = kv_notify_message_to_smu(rdev, PPSMC_MSG_NBDPM_Enable); 1784 if (pi->enable_nb_dpm && !pi->nb_dpm_enabled) {
1779 if (ret == 0) 1785 ret = kv_notify_message_to_smu(rdev, PPSMC_MSG_NBDPM_Enable);
1780 pi->nb_dpm_enabled = true; 1786 if (ret == 0)
1787 pi->nb_dpm_enabled = true;
1788 }
1789 } else {
1790 if (pi->enable_nb_dpm && pi->nb_dpm_enabled) {
1791 ret = kv_notify_message_to_smu(rdev, PPSMC_MSG_NBDPM_Disable);
1792 if (ret == 0)
1793 pi->nb_dpm_enabled = false;
1794 }
1781 } 1795 }
1782 1796
1783 return ret; 1797 return ret;
@@ -1864,7 +1878,7 @@ int kv_dpm_set_power_state(struct radeon_device *rdev)
1864 } 1878 }
1865 kv_update_sclk_t(rdev); 1879 kv_update_sclk_t(rdev);
1866 if (rdev->family == CHIP_MULLINS) 1880 if (rdev->family == CHIP_MULLINS)
1867 kv_enable_nb_dpm(rdev); 1881 kv_enable_nb_dpm(rdev, true);
1868 } 1882 }
1869 } else { 1883 } else {
1870 if (pi->enable_dpm) { 1884 if (pi->enable_dpm) {
@@ -1889,7 +1903,7 @@ int kv_dpm_set_power_state(struct radeon_device *rdev)
1889 } 1903 }
1890 kv_update_acp_boot_level(rdev); 1904 kv_update_acp_boot_level(rdev);
1891 kv_update_sclk_t(rdev); 1905 kv_update_sclk_t(rdev);
1892 kv_enable_nb_dpm(rdev); 1906 kv_enable_nb_dpm(rdev, true);
1893 } 1907 }
1894 } 1908 }
1895 1909
diff --git a/drivers/gpu/drm/radeon/ni_dma.c b/drivers/gpu/drm/radeon/ni_dma.c
index 8a3e6221cece..f26f0a9fb522 100644
--- a/drivers/gpu/drm/radeon/ni_dma.c
+++ b/drivers/gpu/drm/radeon/ni_dma.c
@@ -191,12 +191,6 @@ int cayman_dma_resume(struct radeon_device *rdev)
191 u32 reg_offset, wb_offset; 191 u32 reg_offset, wb_offset;
192 int i, r; 192 int i, r;
193 193
194 /* Reset dma */
195 WREG32(SRBM_SOFT_RESET, SOFT_RESET_DMA | SOFT_RESET_DMA1);
196 RREG32(SRBM_SOFT_RESET);
197 udelay(50);
198 WREG32(SRBM_SOFT_RESET, 0);
199
200 for (i = 0; i < 2; i++) { 194 for (i = 0; i < 2; i++) {
201 if (i == 0) { 195 if (i == 0) {
202 ring = &rdev->ring[R600_RING_TYPE_DMA_INDEX]; 196 ring = &rdev->ring[R600_RING_TYPE_DMA_INDEX];
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index 4c5ec44ff328..b0098e792e62 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -821,6 +821,20 @@ u32 r100_get_vblank_counter(struct radeon_device *rdev, int crtc)
821 return RREG32(RADEON_CRTC2_CRNT_FRAME); 821 return RREG32(RADEON_CRTC2_CRNT_FRAME);
822} 822}
823 823
824/**
825 * r100_ring_hdp_flush - flush Host Data Path via the ring buffer
826 * rdev: radeon device structure
827 * ring: ring buffer struct for emitting packets
828 */
829static void r100_ring_hdp_flush(struct radeon_device *rdev, struct radeon_ring *ring)
830{
831 radeon_ring_write(ring, PACKET0(RADEON_HOST_PATH_CNTL, 0));
832 radeon_ring_write(ring, rdev->config.r100.hdp_cntl |
833 RADEON_HDP_READ_BUFFER_INVALIDATE);
834 radeon_ring_write(ring, PACKET0(RADEON_HOST_PATH_CNTL, 0));
835 radeon_ring_write(ring, rdev->config.r100.hdp_cntl);
836}
837
824/* Who ever call radeon_fence_emit should call ring_lock and ask 838/* Who ever call radeon_fence_emit should call ring_lock and ask
825 * for enough space (today caller are ib schedule and buffer move) */ 839 * for enough space (today caller are ib schedule and buffer move) */
826void r100_fence_ring_emit(struct radeon_device *rdev, 840void r100_fence_ring_emit(struct radeon_device *rdev,
@@ -1056,20 +1070,6 @@ void r100_gfx_set_wptr(struct radeon_device *rdev,
1056 (void)RREG32(RADEON_CP_RB_WPTR); 1070 (void)RREG32(RADEON_CP_RB_WPTR);
1057} 1071}
1058 1072
1059/**
1060 * r100_ring_hdp_flush - flush Host Data Path via the ring buffer
1061 * rdev: radeon device structure
1062 * ring: ring buffer struct for emitting packets
1063 */
1064void r100_ring_hdp_flush(struct radeon_device *rdev, struct radeon_ring *ring)
1065{
1066 radeon_ring_write(ring, PACKET0(RADEON_HOST_PATH_CNTL, 0));
1067 radeon_ring_write(ring, rdev->config.r100.hdp_cntl |
1068 RADEON_HDP_READ_BUFFER_INVALIDATE);
1069 radeon_ring_write(ring, PACKET0(RADEON_HOST_PATH_CNTL, 0));
1070 radeon_ring_write(ring, rdev->config.r100.hdp_cntl);
1071}
1072
1073static void r100_cp_load_microcode(struct radeon_device *rdev) 1073static void r100_cp_load_microcode(struct radeon_device *rdev)
1074{ 1074{
1075 const __be32 *fw_data; 1075 const __be32 *fw_data;
diff --git a/drivers/gpu/drm/radeon/r600_dma.c b/drivers/gpu/drm/radeon/r600_dma.c
index 51fd98553eaf..a908daa006d2 100644
--- a/drivers/gpu/drm/radeon/r600_dma.c
+++ b/drivers/gpu/drm/radeon/r600_dma.c
@@ -124,15 +124,6 @@ int r600_dma_resume(struct radeon_device *rdev)
124 u32 rb_bufsz; 124 u32 rb_bufsz;
125 int r; 125 int r;
126 126
127 /* Reset dma */
128 if (rdev->family >= CHIP_RV770)
129 WREG32(SRBM_SOFT_RESET, RV770_SOFT_RESET_DMA);
130 else
131 WREG32(SRBM_SOFT_RESET, SOFT_RESET_DMA);
132 RREG32(SRBM_SOFT_RESET);
133 udelay(50);
134 WREG32(SRBM_SOFT_RESET, 0);
135
136 WREG32(DMA_SEM_INCOMPLETE_TIMER_CNTL, 0); 127 WREG32(DMA_SEM_INCOMPLETE_TIMER_CNTL, 0);
137 WREG32(DMA_SEM_WAIT_FAIL_TIMER_CNTL, 0); 128 WREG32(DMA_SEM_WAIT_FAIL_TIMER_CNTL, 0);
138 129
diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h
index 0c4a7d8d93e0..31e1052ad3e3 100644
--- a/drivers/gpu/drm/radeon/r600d.h
+++ b/drivers/gpu/drm/radeon/r600d.h
@@ -44,13 +44,6 @@
44#define R6XX_MAX_PIPES 8 44#define R6XX_MAX_PIPES 8
45#define R6XX_MAX_PIPES_MASK 0xff 45#define R6XX_MAX_PIPES_MASK 0xff
46 46
47/* PTE flags */
48#define PTE_VALID (1 << 0)
49#define PTE_SYSTEM (1 << 1)
50#define PTE_SNOOPED (1 << 2)
51#define PTE_READABLE (1 << 5)
52#define PTE_WRITEABLE (1 << 6)
53
54/* tiling bits */ 47/* tiling bits */
55#define ARRAY_LINEAR_GENERAL 0x00000000 48#define ARRAY_LINEAR_GENERAL 0x00000000
56#define ARRAY_LINEAR_ALIGNED 0x00000001 49#define ARRAY_LINEAR_ALIGNED 0x00000001
diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c
index eeeeabe09758..2dd5847f9b98 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.c
+++ b/drivers/gpu/drm/radeon/radeon_asic.c
@@ -185,7 +185,6 @@ static struct radeon_asic_ring r100_gfx_ring = {
185 .get_rptr = &r100_gfx_get_rptr, 185 .get_rptr = &r100_gfx_get_rptr,
186 .get_wptr = &r100_gfx_get_wptr, 186 .get_wptr = &r100_gfx_get_wptr,
187 .set_wptr = &r100_gfx_set_wptr, 187 .set_wptr = &r100_gfx_set_wptr,
188 .hdp_flush = &r100_ring_hdp_flush,
189}; 188};
190 189
191static struct radeon_asic r100_asic = { 190static struct radeon_asic r100_asic = {
@@ -332,7 +331,6 @@ static struct radeon_asic_ring r300_gfx_ring = {
332 .get_rptr = &r100_gfx_get_rptr, 331 .get_rptr = &r100_gfx_get_rptr,
333 .get_wptr = &r100_gfx_get_wptr, 332 .get_wptr = &r100_gfx_get_wptr,
334 .set_wptr = &r100_gfx_set_wptr, 333 .set_wptr = &r100_gfx_set_wptr,
335 .hdp_flush = &r100_ring_hdp_flush,
336}; 334};
337 335
338static struct radeon_asic r300_asic = { 336static struct radeon_asic r300_asic = {
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h
index 275a5dc01780..7756bc1e1cd3 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.h
+++ b/drivers/gpu/drm/radeon/radeon_asic.h
@@ -148,8 +148,7 @@ u32 r100_gfx_get_wptr(struct radeon_device *rdev,
148 struct radeon_ring *ring); 148 struct radeon_ring *ring);
149void r100_gfx_set_wptr(struct radeon_device *rdev, 149void r100_gfx_set_wptr(struct radeon_device *rdev,
150 struct radeon_ring *ring); 150 struct radeon_ring *ring);
151void r100_ring_hdp_flush(struct radeon_device *rdev, 151
152 struct radeon_ring *ring);
153/* 152/*
154 * r200,rv250,rs300,rv280 153 * r200,rv250,rs300,rv280
155 */ 154 */
diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
index a9fb0d016d38..8bc7d0bbd3c8 100644
--- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c
+++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
@@ -33,7 +33,6 @@ static struct radeon_atpx_priv {
33 bool atpx_detected; 33 bool atpx_detected;
34 /* handle for device - and atpx */ 34 /* handle for device - and atpx */
35 acpi_handle dhandle; 35 acpi_handle dhandle;
36 acpi_handle other_handle;
37 struct radeon_atpx atpx; 36 struct radeon_atpx atpx;
38} radeon_atpx_priv; 37} radeon_atpx_priv;
39 38
@@ -453,10 +452,9 @@ static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev)
453 return false; 452 return false;
454 453
455 status = acpi_get_handle(dhandle, "ATPX", &atpx_handle); 454 status = acpi_get_handle(dhandle, "ATPX", &atpx_handle);
456 if (ACPI_FAILURE(status)) { 455 if (ACPI_FAILURE(status))
457 radeon_atpx_priv.other_handle = dhandle;
458 return false; 456 return false;
459 } 457
460 radeon_atpx_priv.dhandle = dhandle; 458 radeon_atpx_priv.dhandle = dhandle;
461 radeon_atpx_priv.atpx.handle = atpx_handle; 459 radeon_atpx_priv.atpx.handle = atpx_handle;
462 return true; 460 return true;
@@ -540,16 +538,6 @@ static bool radeon_atpx_detect(void)
540 printk(KERN_INFO "VGA switcheroo: detected switching method %s handle\n", 538 printk(KERN_INFO "VGA switcheroo: detected switching method %s handle\n",
541 acpi_method_name); 539 acpi_method_name);
542 radeon_atpx_priv.atpx_detected = true; 540 radeon_atpx_priv.atpx_detected = true;
543 /*
544 * On some systems hotplug events are generated for the device
545 * being switched off when ATPX is executed. They cause ACPI
546 * hotplug to trigger and attempt to remove the device from
547 * the system, which causes it to break down. Prevent that from
548 * happening by setting the no_hotplug flag for the involved
549 * ACPI device objects.
550 */
551 acpi_bus_no_hotplug(radeon_atpx_priv.dhandle);
552 acpi_bus_no_hotplug(radeon_atpx_priv.other_handle);
553 return true; 541 return true;
554 } 542 }
555 return false; 543 return false;
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 6a219bcee66d..75223dd3a8a3 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -1393,7 +1393,7 @@ int radeon_device_init(struct radeon_device *rdev,
1393 1393
1394 r = radeon_init(rdev); 1394 r = radeon_init(rdev);
1395 if (r) 1395 if (r)
1396 return r; 1396 goto failed;
1397 1397
1398 r = radeon_ib_ring_tests(rdev); 1398 r = radeon_ib_ring_tests(rdev);
1399 if (r) 1399 if (r)
@@ -1413,7 +1413,7 @@ int radeon_device_init(struct radeon_device *rdev,
1413 radeon_agp_disable(rdev); 1413 radeon_agp_disable(rdev);
1414 r = radeon_init(rdev); 1414 r = radeon_init(rdev);
1415 if (r) 1415 if (r)
1416 return r; 1416 goto failed;
1417 } 1417 }
1418 1418
1419 if ((radeon_testing & 1)) { 1419 if ((radeon_testing & 1)) {
@@ -1435,6 +1435,11 @@ int radeon_device_init(struct radeon_device *rdev,
1435 DRM_INFO("radeon: acceleration disabled, skipping benchmarks\n"); 1435 DRM_INFO("radeon: acceleration disabled, skipping benchmarks\n");
1436 } 1436 }
1437 return 0; 1437 return 0;
1438
1439failed:
1440 if (runtime)
1441 vga_switcheroo_fini_domain_pm_ops(rdev->dev);
1442 return r;
1438} 1443}
1439 1444
1440static void radeon_debugfs_remove_files(struct radeon_device *rdev); 1445static void radeon_debugfs_remove_files(struct radeon_device *rdev);
@@ -1455,6 +1460,8 @@ void radeon_device_fini(struct radeon_device *rdev)
1455 radeon_bo_evict_vram(rdev); 1460 radeon_bo_evict_vram(rdev);
1456 radeon_fini(rdev); 1461 radeon_fini(rdev);
1457 vga_switcheroo_unregister_client(rdev->pdev); 1462 vga_switcheroo_unregister_client(rdev->pdev);
1463 if (rdev->flags & RADEON_IS_PX)
1464 vga_switcheroo_fini_domain_pm_ops(rdev->dev);
1458 vga_client_register(rdev->pdev, NULL, NULL, NULL); 1465 vga_client_register(rdev->pdev, NULL, NULL, NULL);
1459 if (rdev->rio_mem) 1466 if (rdev->rio_mem)
1460 pci_iounmap(rdev->pdev, rdev->rio_mem); 1467 pci_iounmap(rdev->pdev, rdev->rio_mem);
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index 8df888908833..4126fd0937a2 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -83,7 +83,7 @@
83 * CIK: 1D and linear tiling modes contain valid PIPE_CONFIG 83 * CIK: 1D and linear tiling modes contain valid PIPE_CONFIG
84 * 2.39.0 - Add INFO query for number of active CUs 84 * 2.39.0 - Add INFO query for number of active CUs
85 * 2.40.0 - Add RADEON_GEM_GTT_WC/UC, flush HDP cache before submitting 85 * 2.40.0 - Add RADEON_GEM_GTT_WC/UC, flush HDP cache before submitting
86 * CS to GPU 86 * CS to GPU on >= r600
87 */ 87 */
88#define KMS_DRIVER_MAJOR 2 88#define KMS_DRIVER_MAJOR 2
89#define KMS_DRIVER_MINOR 40 89#define KMS_DRIVER_MINOR 40
@@ -440,6 +440,7 @@ static int radeon_pmops_runtime_suspend(struct device *dev)
440 ret = radeon_suspend_kms(drm_dev, false, false); 440 ret = radeon_suspend_kms(drm_dev, false, false);
441 pci_save_state(pdev); 441 pci_save_state(pdev);
442 pci_disable_device(pdev); 442 pci_disable_device(pdev);
443 pci_ignore_hotplug(pdev);
443 pci_set_power_state(pdev, PCI_D3cold); 444 pci_set_power_state(pdev, PCI_D3cold);
444 drm_dev->switch_power_state = DRM_SWITCH_POWER_DYNAMIC_OFF; 445 drm_dev->switch_power_state = DRM_SWITCH_POWER_DYNAMIC_OFF;
445 446
diff --git a/drivers/gpu/drm/radeon/rs400.c b/drivers/gpu/drm/radeon/rs400.c
index 6c1fc339d228..c5799f16aa4b 100644
--- a/drivers/gpu/drm/radeon/rs400.c
+++ b/drivers/gpu/drm/radeon/rs400.c
@@ -221,9 +221,9 @@ void rs400_gart_set_page(struct radeon_device *rdev, unsigned i,
221 entry = (lower_32_bits(addr) & PAGE_MASK) | 221 entry = (lower_32_bits(addr) & PAGE_MASK) |
222 ((upper_32_bits(addr) & 0xff) << 4); 222 ((upper_32_bits(addr) & 0xff) << 4);
223 if (flags & RADEON_GART_PAGE_READ) 223 if (flags & RADEON_GART_PAGE_READ)
224 addr |= RS400_PTE_READABLE; 224 entry |= RS400_PTE_READABLE;
225 if (flags & RADEON_GART_PAGE_WRITE) 225 if (flags & RADEON_GART_PAGE_WRITE)
226 addr |= RS400_PTE_WRITEABLE; 226 entry |= RS400_PTE_WRITEABLE;
227 if (!(flags & RADEON_GART_PAGE_SNOOP)) 227 if (!(flags & RADEON_GART_PAGE_SNOOP))
228 entry |= RS400_PTE_UNSNOOPED; 228 entry |= RS400_PTE_UNSNOOPED;
229 entry = cpu_to_le32(entry); 229 entry = cpu_to_le32(entry);
diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index ef93156a69c6..b22968c08d1f 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -298,7 +298,6 @@ static int hdmi_avi_infoframe_config(struct sti_hdmi *hdmi)
298 hdmi_write(hdmi, val, HDMI_SW_DI_N_PKT_WORD2(HDMI_IFRAME_SLOT_AVI)); 298 hdmi_write(hdmi, val, HDMI_SW_DI_N_PKT_WORD2(HDMI_IFRAME_SLOT_AVI));
299 299
300 val = frame[0xC]; 300 val = frame[0xC];
301 val |= frame[0xD] << 8;
302 hdmi_write(hdmi, val, HDMI_SW_DI_N_PKT_WORD3(HDMI_IFRAME_SLOT_AVI)); 301 hdmi_write(hdmi, val, HDMI_SW_DI_N_PKT_WORD3(HDMI_IFRAME_SLOT_AVI));
303 302
304 /* Enable transmission slot for AVI infoframe 303 /* Enable transmission slot for AVI infoframe
diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c
index 6866448083b2..37ac7b5dbd06 100644
--- a/drivers/gpu/vga/vga_switcheroo.c
+++ b/drivers/gpu/vga/vga_switcheroo.c
@@ -660,6 +660,12 @@ int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *
660} 660}
661EXPORT_SYMBOL(vga_switcheroo_init_domain_pm_ops); 661EXPORT_SYMBOL(vga_switcheroo_init_domain_pm_ops);
662 662
663void vga_switcheroo_fini_domain_pm_ops(struct device *dev)
664{
665 dev->pm_domain = NULL;
666}
667EXPORT_SYMBOL(vga_switcheroo_fini_domain_pm_ops);
668
663static int vga_switcheroo_runtime_resume_hdmi_audio(struct device *dev) 669static int vga_switcheroo_runtime_resume_hdmi_audio(struct device *dev)
664{ 670{
665 struct pci_dev *pdev = to_pci_dev(dev); 671 struct pci_dev *pdev = to_pci_dev(dev);
diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c
index d2077f040f3e..77711623b973 100644
--- a/drivers/gpu/vga/vgaarb.c
+++ b/drivers/gpu/vga/vgaarb.c
@@ -41,6 +41,7 @@
41#include <linux/poll.h> 41#include <linux/poll.h>
42#include <linux/miscdevice.h> 42#include <linux/miscdevice.h>
43#include <linux/slab.h> 43#include <linux/slab.h>
44#include <linux/screen_info.h>
44 45
45#include <linux/uaccess.h> 46#include <linux/uaccess.h>
46 47
@@ -112,10 +113,8 @@ both:
112 return 1; 113 return 1;
113} 114}
114 115
115#ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE
116/* this is only used a cookie - it should not be dereferenced */ 116/* this is only used a cookie - it should not be dereferenced */
117static struct pci_dev *vga_default; 117static struct pci_dev *vga_default;
118#endif
119 118
120static void vga_arb_device_card_gone(struct pci_dev *pdev); 119static void vga_arb_device_card_gone(struct pci_dev *pdev);
121 120
@@ -131,7 +130,6 @@ static struct vga_device *vgadev_find(struct pci_dev *pdev)
131} 130}
132 131
133/* Returns the default VGA device (vgacon's babe) */ 132/* Returns the default VGA device (vgacon's babe) */
134#ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE
135struct pci_dev *vga_default_device(void) 133struct pci_dev *vga_default_device(void)
136{ 134{
137 return vga_default; 135 return vga_default;
@@ -147,7 +145,6 @@ void vga_set_default_device(struct pci_dev *pdev)
147 pci_dev_put(vga_default); 145 pci_dev_put(vga_default);
148 vga_default = pci_dev_get(pdev); 146 vga_default = pci_dev_get(pdev);
149} 147}
150#endif
151 148
152static inline void vga_irq_set_state(struct vga_device *vgadev, bool state) 149static inline void vga_irq_set_state(struct vga_device *vgadev, bool state)
153{ 150{
@@ -583,11 +580,12 @@ static bool vga_arbiter_add_pci_device(struct pci_dev *pdev)
583 /* Deal with VGA default device. Use first enabled one 580 /* Deal with VGA default device. Use first enabled one
584 * by default if arch doesn't have it's own hook 581 * by default if arch doesn't have it's own hook
585 */ 582 */
586#ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE
587 if (vga_default == NULL && 583 if (vga_default == NULL &&
588 ((vgadev->owns & VGA_RSRC_LEGACY_MASK) == VGA_RSRC_LEGACY_MASK)) 584 ((vgadev->owns & VGA_RSRC_LEGACY_MASK) == VGA_RSRC_LEGACY_MASK)) {
585 pr_info("vgaarb: setting as boot device: PCI:%s\n",
586 pci_name(pdev));
589 vga_set_default_device(pdev); 587 vga_set_default_device(pdev);
590#endif 588 }
591 589
592 vga_arbiter_check_bridge_sharing(vgadev); 590 vga_arbiter_check_bridge_sharing(vgadev);
593 591
@@ -621,10 +619,8 @@ static bool vga_arbiter_del_pci_device(struct pci_dev *pdev)
621 goto bail; 619 goto bail;
622 } 620 }
623 621
624#ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE
625 if (vga_default == pdev) 622 if (vga_default == pdev)
626 vga_set_default_device(NULL); 623 vga_set_default_device(NULL);
627#endif
628 624
629 if (vgadev->decodes & (VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM)) 625 if (vgadev->decodes & (VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM))
630 vga_decode_count--; 626 vga_decode_count--;
@@ -1320,6 +1316,38 @@ static int __init vga_arb_device_init(void)
1320 pr_info("vgaarb: loaded\n"); 1316 pr_info("vgaarb: loaded\n");
1321 1317
1322 list_for_each_entry(vgadev, &vga_list, list) { 1318 list_for_each_entry(vgadev, &vga_list, list) {
1319#if defined(CONFIG_X86) || defined(CONFIG_IA64)
1320 /* Override I/O based detection done by vga_arbiter_add_pci_device()
1321 * as it may take the wrong device (e.g. on Apple system under EFI).
1322 *
1323 * Select the device owning the boot framebuffer if there is one.
1324 */
1325 resource_size_t start, end;
1326 int i;
1327
1328 /* Does firmware framebuffer belong to us? */
1329 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
1330 if (!(pci_resource_flags(vgadev->pdev, i) & IORESOURCE_MEM))
1331 continue;
1332
1333 start = pci_resource_start(vgadev->pdev, i);
1334 end = pci_resource_end(vgadev->pdev, i);
1335
1336 if (!start || !end)
1337 continue;
1338
1339 if (screen_info.lfb_base < start ||
1340 (screen_info.lfb_base + screen_info.lfb_size) >= end)
1341 continue;
1342 if (!vga_default_device())
1343 pr_info("vgaarb: setting as boot device: PCI:%s\n",
1344 pci_name(vgadev->pdev));
1345 else if (vgadev->pdev != vga_default_device())
1346 pr_info("vgaarb: overriding boot device: PCI:%s\n",
1347 pci_name(vgadev->pdev));
1348 vga_set_default_device(vgadev->pdev);
1349 }
1350#endif
1323 if (vgadev->bridge_has_one_vga) 1351 if (vgadev->bridge_has_one_vga)
1324 pr_info("vgaarb: bridge control possible %s\n", pci_name(vgadev->pdev)); 1352 pr_info("vgaarb: bridge control possible %s\n", pci_name(vgadev->pdev));
1325 else 1353 else