diff options
Diffstat (limited to 'drivers/gpu/drm/nouveau')
23 files changed, 200 insertions, 107 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_backlight.c b/drivers/gpu/drm/nouveau/nouveau_backlight.c index d3a9c6e02477..00a55dfdba82 100644 --- a/drivers/gpu/drm/nouveau/nouveau_backlight.c +++ b/drivers/gpu/drm/nouveau/nouveau_backlight.c | |||
@@ -88,18 +88,20 @@ static const struct backlight_ops nv50_bl_ops = { | |||
88 | .update_status = nv50_set_intensity, | 88 | .update_status = nv50_set_intensity, |
89 | }; | 89 | }; |
90 | 90 | ||
91 | static int nouveau_nv40_backlight_init(struct drm_device *dev) | 91 | static int nouveau_nv40_backlight_init(struct drm_connector *connector) |
92 | { | 92 | { |
93 | struct backlight_properties props; | 93 | struct drm_device *dev = connector->dev; |
94 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 94 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
95 | struct backlight_properties props; | ||
95 | struct backlight_device *bd; | 96 | struct backlight_device *bd; |
96 | 97 | ||
97 | if (!(nv_rd32(dev, NV40_PMC_BACKLIGHT) & NV40_PMC_BACKLIGHT_MASK)) | 98 | if (!(nv_rd32(dev, NV40_PMC_BACKLIGHT) & NV40_PMC_BACKLIGHT_MASK)) |
98 | return 0; | 99 | return 0; |
99 | 100 | ||
100 | memset(&props, 0, sizeof(struct backlight_properties)); | 101 | memset(&props, 0, sizeof(struct backlight_properties)); |
102 | props.type = BACKLIGHT_RAW; | ||
101 | props.max_brightness = 31; | 103 | props.max_brightness = 31; |
102 | bd = backlight_device_register("nv_backlight", &dev->pdev->dev, dev, | 104 | bd = backlight_device_register("nv_backlight", &connector->kdev, dev, |
103 | &nv40_bl_ops, &props); | 105 | &nv40_bl_ops, &props); |
104 | if (IS_ERR(bd)) | 106 | if (IS_ERR(bd)) |
105 | return PTR_ERR(bd); | 107 | return PTR_ERR(bd); |
@@ -111,18 +113,20 @@ static int nouveau_nv40_backlight_init(struct drm_device *dev) | |||
111 | return 0; | 113 | return 0; |
112 | } | 114 | } |
113 | 115 | ||
114 | static int nouveau_nv50_backlight_init(struct drm_device *dev) | 116 | static int nouveau_nv50_backlight_init(struct drm_connector *connector) |
115 | { | 117 | { |
116 | struct backlight_properties props; | 118 | struct drm_device *dev = connector->dev; |
117 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 119 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
120 | struct backlight_properties props; | ||
118 | struct backlight_device *bd; | 121 | struct backlight_device *bd; |
119 | 122 | ||
120 | if (!nv_rd32(dev, NV50_PDISPLAY_SOR_BACKLIGHT)) | 123 | if (!nv_rd32(dev, NV50_PDISPLAY_SOR_BACKLIGHT)) |
121 | return 0; | 124 | return 0; |
122 | 125 | ||
123 | memset(&props, 0, sizeof(struct backlight_properties)); | 126 | memset(&props, 0, sizeof(struct backlight_properties)); |
127 | props.type = BACKLIGHT_RAW; | ||
124 | props.max_brightness = 1025; | 128 | props.max_brightness = 1025; |
125 | bd = backlight_device_register("nv_backlight", &dev->pdev->dev, dev, | 129 | bd = backlight_device_register("nv_backlight", &connector->kdev, dev, |
126 | &nv50_bl_ops, &props); | 130 | &nv50_bl_ops, &props); |
127 | if (IS_ERR(bd)) | 131 | if (IS_ERR(bd)) |
128 | return PTR_ERR(bd); | 132 | return PTR_ERR(bd); |
@@ -133,8 +137,9 @@ static int nouveau_nv50_backlight_init(struct drm_device *dev) | |||
133 | return 0; | 137 | return 0; |
134 | } | 138 | } |
135 | 139 | ||
136 | int nouveau_backlight_init(struct drm_device *dev) | 140 | int nouveau_backlight_init(struct drm_connector *connector) |
137 | { | 141 | { |
142 | struct drm_device *dev = connector->dev; | ||
138 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 143 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
139 | 144 | ||
140 | #ifdef CONFIG_ACPI | 145 | #ifdef CONFIG_ACPI |
@@ -147,9 +152,9 @@ int nouveau_backlight_init(struct drm_device *dev) | |||
147 | 152 | ||
148 | switch (dev_priv->card_type) { | 153 | switch (dev_priv->card_type) { |
149 | case NV_40: | 154 | case NV_40: |
150 | return nouveau_nv40_backlight_init(dev); | 155 | return nouveau_nv40_backlight_init(connector); |
151 | case NV_50: | 156 | case NV_50: |
152 | return nouveau_nv50_backlight_init(dev); | 157 | return nouveau_nv50_backlight_init(connector); |
153 | default: | 158 | default: |
154 | break; | 159 | break; |
155 | } | 160 | } |
@@ -157,8 +162,9 @@ int nouveau_backlight_init(struct drm_device *dev) | |||
157 | return 0; | 162 | return 0; |
158 | } | 163 | } |
159 | 164 | ||
160 | void nouveau_backlight_exit(struct drm_device *dev) | 165 | void nouveau_backlight_exit(struct drm_connector *connector) |
161 | { | 166 | { |
167 | struct drm_device *dev = connector->dev; | ||
162 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 168 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
163 | 169 | ||
164 | if (dev_priv->backlight) { | 170 | if (dev_priv->backlight) { |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c index 8314a49b6b9a..90aef64b76f2 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bios.c +++ b/drivers/gpu/drm/nouveau/nouveau_bios.c | |||
@@ -269,7 +269,7 @@ struct init_tbl_entry { | |||
269 | int (*handler)(struct nvbios *, uint16_t, struct init_exec *); | 269 | int (*handler)(struct nvbios *, uint16_t, struct init_exec *); |
270 | }; | 270 | }; |
271 | 271 | ||
272 | static int parse_init_table(struct nvbios *, unsigned int, struct init_exec *); | 272 | static int parse_init_table(struct nvbios *, uint16_t, struct init_exec *); |
273 | 273 | ||
274 | #define MACRO_INDEX_SIZE 2 | 274 | #define MACRO_INDEX_SIZE 2 |
275 | #define MACRO_SIZE 8 | 275 | #define MACRO_SIZE 8 |
@@ -2011,6 +2011,27 @@ init_sub_direct(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
2011 | } | 2011 | } |
2012 | 2012 | ||
2013 | static int | 2013 | static int |
2014 | init_jump(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | ||
2015 | { | ||
2016 | /* | ||
2017 | * INIT_JUMP opcode: 0x5C ('\') | ||
2018 | * | ||
2019 | * offset (8 bit): opcode | ||
2020 | * offset + 1 (16 bit): offset (in bios) | ||
2021 | * | ||
2022 | * Continue execution of init table from 'offset' | ||
2023 | */ | ||
2024 | |||
2025 | uint16_t jmp_offset = ROM16(bios->data[offset + 1]); | ||
2026 | |||
2027 | if (!iexec->execute) | ||
2028 | return 3; | ||
2029 | |||
2030 | BIOSLOG(bios, "0x%04X: Jump to 0x%04X\n", offset, jmp_offset); | ||
2031 | return jmp_offset - offset; | ||
2032 | } | ||
2033 | |||
2034 | static int | ||
2014 | init_i2c_if(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 2035 | init_i2c_if(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
2015 | { | 2036 | { |
2016 | /* | 2037 | /* |
@@ -3659,6 +3680,7 @@ static struct init_tbl_entry itbl_entry[] = { | |||
3659 | { "INIT_ZM_REG_SEQUENCE" , 0x58, init_zm_reg_sequence }, | 3680 | { "INIT_ZM_REG_SEQUENCE" , 0x58, init_zm_reg_sequence }, |
3660 | /* INIT_INDIRECT_REG (0x5A, 7, 0, 0) removed due to no example of use */ | 3681 | /* INIT_INDIRECT_REG (0x5A, 7, 0, 0) removed due to no example of use */ |
3661 | { "INIT_SUB_DIRECT" , 0x5B, init_sub_direct }, | 3682 | { "INIT_SUB_DIRECT" , 0x5B, init_sub_direct }, |
3683 | { "INIT_JUMP" , 0x5C, init_jump }, | ||
3662 | { "INIT_I2C_IF" , 0x5E, init_i2c_if }, | 3684 | { "INIT_I2C_IF" , 0x5E, init_i2c_if }, |
3663 | { "INIT_COPY_NV_REG" , 0x5F, init_copy_nv_reg }, | 3685 | { "INIT_COPY_NV_REG" , 0x5F, init_copy_nv_reg }, |
3664 | { "INIT_ZM_INDEX_IO" , 0x62, init_zm_index_io }, | 3686 | { "INIT_ZM_INDEX_IO" , 0x62, init_zm_index_io }, |
@@ -3700,8 +3722,7 @@ static struct init_tbl_entry itbl_entry[] = { | |||
3700 | #define MAX_TABLE_OPS 1000 | 3722 | #define MAX_TABLE_OPS 1000 |
3701 | 3723 | ||
3702 | static int | 3724 | static int |
3703 | parse_init_table(struct nvbios *bios, unsigned int offset, | 3725 | parse_init_table(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
3704 | struct init_exec *iexec) | ||
3705 | { | 3726 | { |
3706 | /* | 3727 | /* |
3707 | * Parses all commands in an init table. | 3728 | * Parses all commands in an init table. |
@@ -6333,6 +6354,32 @@ apply_dcb_encoder_quirks(struct drm_device *dev, int idx, u32 *conn, u32 *conf) | |||
6333 | } | 6354 | } |
6334 | } | 6355 | } |
6335 | 6356 | ||
6357 | /* XFX GT-240X-YA | ||
6358 | * | ||
6359 | * So many things wrong here, replace the entire encoder table.. | ||
6360 | */ | ||
6361 | if (nv_match_device(dev, 0x0ca3, 0x1682, 0x3003)) { | ||
6362 | if (idx == 0) { | ||
6363 | *conn = 0x02001300; /* VGA, connector 1 */ | ||
6364 | *conf = 0x00000028; | ||
6365 | } else | ||
6366 | if (idx == 1) { | ||
6367 | *conn = 0x01010312; /* DVI, connector 0 */ | ||
6368 | *conf = 0x00020030; | ||
6369 | } else | ||
6370 | if (idx == 2) { | ||
6371 | *conn = 0x01010310; /* VGA, connector 0 */ | ||
6372 | *conf = 0x00000028; | ||
6373 | } else | ||
6374 | if (idx == 3) { | ||
6375 | *conn = 0x02022362; /* HDMI, connector 2 */ | ||
6376 | *conf = 0x00020010; | ||
6377 | } else { | ||
6378 | *conn = 0x0000000e; /* EOL */ | ||
6379 | *conf = 0x00000000; | ||
6380 | } | ||
6381 | } | ||
6382 | |||
6336 | return true; | 6383 | return true; |
6337 | } | 6384 | } |
6338 | 6385 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_channel.c b/drivers/gpu/drm/nouveau/nouveau_channel.c index 3837090d66af..4cea35c57d15 100644 --- a/drivers/gpu/drm/nouveau/nouveau_channel.c +++ b/drivers/gpu/drm/nouveau/nouveau_channel.c | |||
@@ -200,7 +200,7 @@ nouveau_channel_alloc(struct drm_device *dev, struct nouveau_channel **chan_ret, | |||
200 | /* disable the fifo caches */ | 200 | /* disable the fifo caches */ |
201 | pfifo->reassign(dev, false); | 201 | pfifo->reassign(dev, false); |
202 | 202 | ||
203 | /* Construct inital RAMFC for new channel */ | 203 | /* Construct initial RAMFC for new channel */ |
204 | ret = pfifo->create_context(chan); | 204 | ret = pfifo->create_context(chan); |
205 | if (ret) { | 205 | if (ret) { |
206 | nouveau_channel_put(&chan); | 206 | nouveau_channel_put(&chan); |
@@ -278,7 +278,7 @@ nouveau_channel_put_unlocked(struct nouveau_channel **pchan) | |||
278 | return; | 278 | return; |
279 | } | 279 | } |
280 | 280 | ||
281 | /* noone wants the channel anymore */ | 281 | /* no one wants the channel anymore */ |
282 | NV_DEBUG(dev, "freeing channel %d\n", chan->id); | 282 | NV_DEBUG(dev, "freeing channel %d\n", chan->id); |
283 | nouveau_debugfs_channel_fini(chan); | 283 | nouveau_debugfs_channel_fini(chan); |
284 | 284 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c index 390d82c3c4b0..7ae151109a66 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c | |||
@@ -116,6 +116,10 @@ nouveau_connector_destroy(struct drm_connector *connector) | |||
116 | nouveau_connector_hotplug, connector); | 116 | nouveau_connector_hotplug, connector); |
117 | } | 117 | } |
118 | 118 | ||
119 | if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS || | ||
120 | connector->connector_type == DRM_MODE_CONNECTOR_eDP) | ||
121 | nouveau_backlight_exit(connector); | ||
122 | |||
119 | kfree(nv_connector->edid); | 123 | kfree(nv_connector->edid); |
120 | drm_sysfs_connector_remove(connector); | 124 | drm_sysfs_connector_remove(connector); |
121 | drm_connector_cleanup(connector); | 125 | drm_connector_cleanup(connector); |
@@ -894,6 +898,11 @@ nouveau_connector_create(struct drm_device *dev, int index) | |||
894 | } | 898 | } |
895 | 899 | ||
896 | drm_sysfs_connector_add(connector); | 900 | drm_sysfs_connector_add(connector); |
901 | |||
902 | if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS || | ||
903 | connector->connector_type == DRM_MODE_CONNECTOR_eDP) | ||
904 | nouveau_backlight_init(connector); | ||
905 | |||
897 | dcb->drm = connector; | 906 | dcb->drm = connector; |
898 | return dcb->drm; | 907 | return dcb->drm; |
899 | 908 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_dma.c b/drivers/gpu/drm/nouveau/nouveau_dma.c index ce38e97b9428..568caedd7216 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dma.c +++ b/drivers/gpu/drm/nouveau/nouveau_dma.c | |||
@@ -83,7 +83,7 @@ nouveau_dma_init(struct nouveau_channel *chan) | |||
83 | return ret; | 83 | return ret; |
84 | 84 | ||
85 | /* NV_MEMORY_TO_MEMORY_FORMAT requires a notifier object */ | 85 | /* NV_MEMORY_TO_MEMORY_FORMAT requires a notifier object */ |
86 | ret = nouveau_notifier_alloc(chan, NvNotify0, 32, 0xfd0, 0x1000, | 86 | ret = nouveau_notifier_alloc(chan, NvNotify0, 32, 0xfe0, 0x1000, |
87 | &chan->m2mf_ntfy); | 87 | &chan->m2mf_ntfy); |
88 | if (ret) | 88 | if (ret) |
89 | return ret; | 89 | return ret; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index 06111887b789..a76514a209b3 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h | |||
@@ -216,7 +216,7 @@ struct nouveau_channel { | |||
216 | /* mapping of the fifo itself */ | 216 | /* mapping of the fifo itself */ |
217 | struct drm_local_map *map; | 217 | struct drm_local_map *map; |
218 | 218 | ||
219 | /* mapping of the regs controling the fifo */ | 219 | /* mapping of the regs controlling the fifo */ |
220 | void __iomem *user; | 220 | void __iomem *user; |
221 | uint32_t user_get; | 221 | uint32_t user_get; |
222 | uint32_t user_put; | 222 | uint32_t user_put; |
@@ -682,6 +682,9 @@ struct drm_nouveau_private { | |||
682 | /* For PFIFO and PGRAPH. */ | 682 | /* For PFIFO and PGRAPH. */ |
683 | spinlock_t context_switch_lock; | 683 | spinlock_t context_switch_lock; |
684 | 684 | ||
685 | /* VM/PRAMIN flush, legacy PRAMIN aperture */ | ||
686 | spinlock_t vm_lock; | ||
687 | |||
685 | /* RAMIN configuration, RAMFC, RAMHT and RAMRO offsets */ | 688 | /* RAMIN configuration, RAMFC, RAMHT and RAMRO offsets */ |
686 | struct nouveau_ramht *ramht; | 689 | struct nouveau_ramht *ramht; |
687 | struct nouveau_gpuobj *ramfc; | 690 | struct nouveau_gpuobj *ramfc; |
@@ -999,15 +1002,15 @@ static inline int nouveau_acpi_edid(struct drm_device *dev, struct drm_connector | |||
999 | 1002 | ||
1000 | /* nouveau_backlight.c */ | 1003 | /* nouveau_backlight.c */ |
1001 | #ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT | 1004 | #ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT |
1002 | extern int nouveau_backlight_init(struct drm_device *); | 1005 | extern int nouveau_backlight_init(struct drm_connector *); |
1003 | extern void nouveau_backlight_exit(struct drm_device *); | 1006 | extern void nouveau_backlight_exit(struct drm_connector *); |
1004 | #else | 1007 | #else |
1005 | static inline int nouveau_backlight_init(struct drm_device *dev) | 1008 | static inline int nouveau_backlight_init(struct drm_connector *dev) |
1006 | { | 1009 | { |
1007 | return 0; | 1010 | return 0; |
1008 | } | 1011 | } |
1009 | 1012 | ||
1010 | static inline void nouveau_backlight_exit(struct drm_device *dev) { } | 1013 | static inline void nouveau_backlight_exit(struct drm_connector *dev) { } |
1011 | #endif | 1014 | #endif |
1012 | 1015 | ||
1013 | /* nouveau_bios.c */ | 1016 | /* nouveau_bios.c */ |
@@ -1190,7 +1193,7 @@ extern int nv50_graph_load_context(struct nouveau_channel *); | |||
1190 | extern int nv50_graph_unload_context(struct drm_device *); | 1193 | extern int nv50_graph_unload_context(struct drm_device *); |
1191 | extern int nv50_grctx_init(struct nouveau_grctx *); | 1194 | extern int nv50_grctx_init(struct nouveau_grctx *); |
1192 | extern void nv50_graph_tlb_flush(struct drm_device *dev); | 1195 | extern void nv50_graph_tlb_flush(struct drm_device *dev); |
1193 | extern void nv86_graph_tlb_flush(struct drm_device *dev); | 1196 | extern void nv84_graph_tlb_flush(struct drm_device *dev); |
1194 | extern struct nouveau_enum nv50_data_error_names[]; | 1197 | extern struct nouveau_enum nv50_data_error_names[]; |
1195 | 1198 | ||
1196 | /* nvc0_graph.c */ | 1199 | /* nvc0_graph.c */ |
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index 889c4454682e..39aee6d4daf8 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c | |||
@@ -181,13 +181,13 @@ nouveau_fbcon_sync(struct fb_info *info) | |||
181 | OUT_RING (chan, 0); | 181 | OUT_RING (chan, 0); |
182 | } | 182 | } |
183 | 183 | ||
184 | nouveau_bo_wr32(chan->notifier_bo, chan->m2mf_ntfy + 3, 0xffffffff); | 184 | nouveau_bo_wr32(chan->notifier_bo, chan->m2mf_ntfy/4 + 3, 0xffffffff); |
185 | FIRE_RING(chan); | 185 | FIRE_RING(chan); |
186 | mutex_unlock(&chan->mutex); | 186 | mutex_unlock(&chan->mutex); |
187 | 187 | ||
188 | ret = -EBUSY; | 188 | ret = -EBUSY; |
189 | for (i = 0; i < 100000; i++) { | 189 | for (i = 0; i < 100000; i++) { |
190 | if (!nouveau_bo_rd32(chan->notifier_bo, chan->m2mf_ntfy + 3)) { | 190 | if (!nouveau_bo_rd32(chan->notifier_bo, chan->m2mf_ntfy/4 + 3)) { |
191 | ret = 0; | 191 | ret = 0; |
192 | break; | 192 | break; |
193 | } | 193 | } |
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index e8b04f4aed7e..b52e46018245 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c | |||
@@ -97,7 +97,7 @@ nouveau_gem_new(struct drm_device *dev, struct nouveau_channel *chan, | |||
97 | return -ENOMEM; | 97 | return -ENOMEM; |
98 | } | 98 | } |
99 | 99 | ||
100 | nvbo->bo.persistant_swap_storage = nvbo->gem->filp; | 100 | nvbo->bo.persistent_swap_storage = nvbo->gem->filp; |
101 | nvbo->gem->driver_private = nvbo; | 101 | nvbo->gem->driver_private = nvbo; |
102 | return 0; | 102 | return 0; |
103 | } | 103 | } |
diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c index 2683377f4131..5045f8b921d6 100644 --- a/drivers/gpu/drm/nouveau/nouveau_mem.c +++ b/drivers/gpu/drm/nouveau/nouveau_mem.c | |||
@@ -398,7 +398,7 @@ nouveau_mem_vram_init(struct drm_device *dev) | |||
398 | dma_bits = 40; | 398 | dma_bits = 40; |
399 | } else | 399 | } else |
400 | if (drm_pci_device_is_pcie(dev) && | 400 | if (drm_pci_device_is_pcie(dev) && |
401 | dev_priv->chipset != 0x40 && | 401 | dev_priv->chipset > 0x40 && |
402 | dev_priv->chipset != 0x45) { | 402 | dev_priv->chipset != 0x45) { |
403 | if (pci_dma_supported(dev->pdev, DMA_BIT_MASK(39))) | 403 | if (pci_dma_supported(dev->pdev, DMA_BIT_MASK(39))) |
404 | dma_bits = 39; | 404 | dma_bits = 39; |
@@ -552,6 +552,7 @@ nouveau_mem_timing_init(struct drm_device *dev) | |||
552 | u8 tRC; /* Byte 9 */ | 552 | u8 tRC; /* Byte 9 */ |
553 | u8 tUNK_10, tUNK_11, tUNK_12, tUNK_13, tUNK_14; | 553 | u8 tUNK_10, tUNK_11, tUNK_12, tUNK_13, tUNK_14; |
554 | u8 tUNK_18, tUNK_19, tUNK_20, tUNK_21; | 554 | u8 tUNK_18, tUNK_19, tUNK_20, tUNK_21; |
555 | u8 magic_number = 0; /* Yeah... sorry*/ | ||
555 | u8 *mem = NULL, *entry; | 556 | u8 *mem = NULL, *entry; |
556 | int i, recordlen, entries; | 557 | int i, recordlen, entries; |
557 | 558 | ||
@@ -596,6 +597,12 @@ nouveau_mem_timing_init(struct drm_device *dev) | |||
596 | if (!memtimings->timing) | 597 | if (!memtimings->timing) |
597 | return; | 598 | return; |
598 | 599 | ||
600 | /* Get "some number" from the timing reg for NV_40 | ||
601 | * Used in calculations later */ | ||
602 | if(dev_priv->card_type == NV_40) { | ||
603 | magic_number = (nv_rd32(dev,0x100228) & 0x0f000000) >> 24; | ||
604 | } | ||
605 | |||
599 | entry = mem + mem[1]; | 606 | entry = mem + mem[1]; |
600 | for (i = 0; i < entries; i++, entry += recordlen) { | 607 | for (i = 0; i < entries; i++, entry += recordlen) { |
601 | struct nouveau_pm_memtiming *timing = &pm->memtimings.timing[i]; | 608 | struct nouveau_pm_memtiming *timing = &pm->memtimings.timing[i]; |
@@ -635,36 +642,51 @@ nouveau_mem_timing_init(struct drm_device *dev) | |||
635 | 642 | ||
636 | /* XXX: I don't trust the -1's and +1's... they must come | 643 | /* XXX: I don't trust the -1's and +1's... they must come |
637 | * from somewhere! */ | 644 | * from somewhere! */ |
638 | timing->reg_100224 = ((tUNK_0 + tUNK_19 + 1) << 24 | | 645 | timing->reg_100224 = (tUNK_0 + tUNK_19 + 1 + magic_number) << 24 | |
639 | tUNK_18 << 16 | | 646 | tUNK_18 << 16 | |
640 | (tUNK_1 + tUNK_19 + 1) << 8 | | 647 | (tUNK_1 + tUNK_19 + 1 + magic_number) << 8; |
641 | (tUNK_2 - 1)); | 648 | if(dev_priv->chipset == 0xa8) { |
649 | timing->reg_100224 |= (tUNK_2 - 1); | ||
650 | } else { | ||
651 | timing->reg_100224 |= (tUNK_2 + 2 - magic_number); | ||
652 | } | ||
642 | 653 | ||
643 | timing->reg_100228 = (tUNK_12 << 16 | tUNK_11 << 8 | tUNK_10); | 654 | timing->reg_100228 = (tUNK_12 << 16 | tUNK_11 << 8 | tUNK_10); |
644 | if(recordlen > 19) { | 655 | if(dev_priv->chipset >= 0xa3 && dev_priv->chipset < 0xaa) { |
645 | timing->reg_100228 += (tUNK_19 - 1) << 24; | 656 | timing->reg_100228 |= (tUNK_19 - 1) << 24; |
646 | }/* I cannot back-up this else-statement right now | 657 | } |
647 | else { | 658 | |
648 | timing->reg_100228 += tUNK_12 << 24; | 659 | if(dev_priv->card_type == NV_40) { |
649 | }*/ | 660 | /* NV40: don't know what the rest of the regs are.. |
650 | 661 | * And don't need to know either */ | |
651 | /* XXX: reg_10022c */ | 662 | timing->reg_100228 |= 0x20200000 | magic_number << 24; |
652 | timing->reg_10022c = tUNK_2 - 1; | 663 | } else if(dev_priv->card_type >= NV_50) { |
653 | 664 | /* XXX: reg_10022c */ | |
654 | timing->reg_100230 = (tUNK_20 << 24 | tUNK_21 << 16 | | 665 | timing->reg_10022c = tUNK_2 - 1; |
655 | tUNK_13 << 8 | tUNK_13); | 666 | |
656 | 667 | timing->reg_100230 = (tUNK_20 << 24 | tUNK_21 << 16 | | |
657 | /* XXX: +6? */ | 668 | tUNK_13 << 8 | tUNK_13); |
658 | timing->reg_100234 = (tRAS << 24 | (tUNK_19 + 6) << 8 | tRC); | 669 | |
659 | timing->reg_100234 += max(tUNK_10,tUNK_11) << 16; | 670 | timing->reg_100234 = (tRAS << 24 | tRC); |
660 | 671 | timing->reg_100234 += max(tUNK_10,tUNK_11) << 16; | |
661 | /* XXX; reg_100238, reg_10023c | 672 | |
662 | * reg: 0x00?????? | 673 | if(dev_priv->chipset < 0xa3) { |
663 | * reg_10023c: | 674 | timing->reg_100234 |= (tUNK_2 + 2) << 8; |
664 | * 0 for pre-NV50 cards | 675 | } else { |
665 | * 0x????0202 for NV50+ cards (empirical evidence) */ | 676 | /* XXX: +6? */ |
666 | if(dev_priv->card_type >= NV_50) { | 677 | timing->reg_100234 |= (tUNK_19 + 6) << 8; |
678 | } | ||
679 | |||
680 | /* XXX; reg_100238, reg_10023c | ||
681 | * reg_100238: 0x00?????? | ||
682 | * reg_10023c: 0x!!??0202 for NV50+ cards (empirical evidence) */ | ||
667 | timing->reg_10023c = 0x202; | 683 | timing->reg_10023c = 0x202; |
684 | if(dev_priv->chipset < 0xa3) { | ||
685 | timing->reg_10023c |= 0x4000000 | (tUNK_2 - 1) << 16; | ||
686 | } else { | ||
687 | /* currently unknown | ||
688 | * 10023c seen as 06xxxxxx, 0bxxxxxx or 0fxxxxxx */ | ||
689 | } | ||
668 | } | 690 | } |
669 | 691 | ||
670 | NV_DEBUG(dev, "Entry %d: 220: %08x %08x %08x %08x\n", i, | 692 | NV_DEBUG(dev, "Entry %d: 220: %08x %08x %08x %08x\n", i, |
@@ -675,7 +697,7 @@ nouveau_mem_timing_init(struct drm_device *dev) | |||
675 | timing->reg_100238, timing->reg_10023c); | 697 | timing->reg_100238, timing->reg_10023c); |
676 | } | 698 | } |
677 | 699 | ||
678 | memtimings->nr_timing = entries; | 700 | memtimings->nr_timing = entries; |
679 | memtimings->supported = true; | 701 | memtimings->supported = true; |
680 | } | 702 | } |
681 | 703 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_notifier.c b/drivers/gpu/drm/nouveau/nouveau_notifier.c index 7ba3fc0b30c1..5b39718ae1f8 100644 --- a/drivers/gpu/drm/nouveau/nouveau_notifier.c +++ b/drivers/gpu/drm/nouveau/nouveau_notifier.c | |||
@@ -35,19 +35,22 @@ nouveau_notifier_init_channel(struct nouveau_channel *chan) | |||
35 | { | 35 | { |
36 | struct drm_device *dev = chan->dev; | 36 | struct drm_device *dev = chan->dev; |
37 | struct nouveau_bo *ntfy = NULL; | 37 | struct nouveau_bo *ntfy = NULL; |
38 | uint32_t flags; | 38 | uint32_t flags, ttmpl; |
39 | int ret; | 39 | int ret; |
40 | 40 | ||
41 | if (nouveau_vram_notify) | 41 | if (nouveau_vram_notify) { |
42 | flags = NOUVEAU_GEM_DOMAIN_VRAM; | 42 | flags = NOUVEAU_GEM_DOMAIN_VRAM; |
43 | else | 43 | ttmpl = TTM_PL_FLAG_VRAM; |
44 | } else { | ||
44 | flags = NOUVEAU_GEM_DOMAIN_GART; | 45 | flags = NOUVEAU_GEM_DOMAIN_GART; |
46 | ttmpl = TTM_PL_FLAG_TT; | ||
47 | } | ||
45 | 48 | ||
46 | ret = nouveau_gem_new(dev, NULL, PAGE_SIZE, 0, flags, 0, 0, &ntfy); | 49 | ret = nouveau_gem_new(dev, NULL, PAGE_SIZE, 0, flags, 0, 0, &ntfy); |
47 | if (ret) | 50 | if (ret) |
48 | return ret; | 51 | return ret; |
49 | 52 | ||
50 | ret = nouveau_bo_pin(ntfy, flags); | 53 | ret = nouveau_bo_pin(ntfy, ttmpl); |
51 | if (ret) | 54 | if (ret) |
52 | goto out_err; | 55 | goto out_err; |
53 | 56 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_object.c b/drivers/gpu/drm/nouveau/nouveau_object.c index 4f00c87ed86e..67a16e01ffa6 100644 --- a/drivers/gpu/drm/nouveau/nouveau_object.c +++ b/drivers/gpu/drm/nouveau/nouveau_object.c | |||
@@ -1039,19 +1039,20 @@ nv_ro32(struct nouveau_gpuobj *gpuobj, u32 offset) | |||
1039 | { | 1039 | { |
1040 | struct drm_nouveau_private *dev_priv = gpuobj->dev->dev_private; | 1040 | struct drm_nouveau_private *dev_priv = gpuobj->dev->dev_private; |
1041 | struct drm_device *dev = gpuobj->dev; | 1041 | struct drm_device *dev = gpuobj->dev; |
1042 | unsigned long flags; | ||
1042 | 1043 | ||
1043 | if (gpuobj->pinst == ~0 || !dev_priv->ramin_available) { | 1044 | if (gpuobj->pinst == ~0 || !dev_priv->ramin_available) { |
1044 | u64 ptr = gpuobj->vinst + offset; | 1045 | u64 ptr = gpuobj->vinst + offset; |
1045 | u32 base = ptr >> 16; | 1046 | u32 base = ptr >> 16; |
1046 | u32 val; | 1047 | u32 val; |
1047 | 1048 | ||
1048 | spin_lock(&dev_priv->ramin_lock); | 1049 | spin_lock_irqsave(&dev_priv->vm_lock, flags); |
1049 | if (dev_priv->ramin_base != base) { | 1050 | if (dev_priv->ramin_base != base) { |
1050 | dev_priv->ramin_base = base; | 1051 | dev_priv->ramin_base = base; |
1051 | nv_wr32(dev, 0x001700, dev_priv->ramin_base); | 1052 | nv_wr32(dev, 0x001700, dev_priv->ramin_base); |
1052 | } | 1053 | } |
1053 | val = nv_rd32(dev, 0x700000 + (ptr & 0xffff)); | 1054 | val = nv_rd32(dev, 0x700000 + (ptr & 0xffff)); |
1054 | spin_unlock(&dev_priv->ramin_lock); | 1055 | spin_unlock_irqrestore(&dev_priv->vm_lock, flags); |
1055 | return val; | 1056 | return val; |
1056 | } | 1057 | } |
1057 | 1058 | ||
@@ -1063,18 +1064,19 @@ nv_wo32(struct nouveau_gpuobj *gpuobj, u32 offset, u32 val) | |||
1063 | { | 1064 | { |
1064 | struct drm_nouveau_private *dev_priv = gpuobj->dev->dev_private; | 1065 | struct drm_nouveau_private *dev_priv = gpuobj->dev->dev_private; |
1065 | struct drm_device *dev = gpuobj->dev; | 1066 | struct drm_device *dev = gpuobj->dev; |
1067 | unsigned long flags; | ||
1066 | 1068 | ||
1067 | if (gpuobj->pinst == ~0 || !dev_priv->ramin_available) { | 1069 | if (gpuobj->pinst == ~0 || !dev_priv->ramin_available) { |
1068 | u64 ptr = gpuobj->vinst + offset; | 1070 | u64 ptr = gpuobj->vinst + offset; |
1069 | u32 base = ptr >> 16; | 1071 | u32 base = ptr >> 16; |
1070 | 1072 | ||
1071 | spin_lock(&dev_priv->ramin_lock); | 1073 | spin_lock_irqsave(&dev_priv->vm_lock, flags); |
1072 | if (dev_priv->ramin_base != base) { | 1074 | if (dev_priv->ramin_base != base) { |
1073 | dev_priv->ramin_base = base; | 1075 | dev_priv->ramin_base = base; |
1074 | nv_wr32(dev, 0x001700, dev_priv->ramin_base); | 1076 | nv_wr32(dev, 0x001700, dev_priv->ramin_base); |
1075 | } | 1077 | } |
1076 | nv_wr32(dev, 0x700000 + (ptr & 0xffff), val); | 1078 | nv_wr32(dev, 0x700000 + (ptr & 0xffff), val); |
1077 | spin_unlock(&dev_priv->ramin_lock); | 1079 | spin_unlock_irqrestore(&dev_priv->vm_lock, flags); |
1078 | return; | 1080 | return; |
1079 | } | 1081 | } |
1080 | 1082 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_perf.c b/drivers/gpu/drm/nouveau/nouveau_perf.c index ac62a1b8c4fc..670e3cb697ec 100644 --- a/drivers/gpu/drm/nouveau/nouveau_perf.c +++ b/drivers/gpu/drm/nouveau/nouveau_perf.c | |||
@@ -134,7 +134,7 @@ nouveau_perf_init(struct drm_device *dev) | |||
134 | case 0x13: | 134 | case 0x13: |
135 | case 0x15: | 135 | case 0x15: |
136 | perflvl->fanspeed = entry[55]; | 136 | perflvl->fanspeed = entry[55]; |
137 | perflvl->voltage = entry[56]; | 137 | perflvl->voltage = (recordlen > 56) ? entry[56] : 0; |
138 | perflvl->core = ROM32(entry[1]) * 10; | 138 | perflvl->core = ROM32(entry[1]) * 10; |
139 | perflvl->memory = ROM32(entry[5]) * 20; | 139 | perflvl->memory = ROM32(entry[5]) * 20; |
140 | break; | 140 | break; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c b/drivers/gpu/drm/nouveau/nouveau_sgdma.c index a33fe4019286..4bce801bc588 100644 --- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c +++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c | |||
@@ -55,6 +55,7 @@ nouveau_sgdma_populate(struct ttm_backend *be, unsigned long num_pages, | |||
55 | be->func->clear(be); | 55 | be->func->clear(be); |
56 | return -EFAULT; | 56 | return -EFAULT; |
57 | } | 57 | } |
58 | nvbe->ttm_alloced[nvbe->nr_pages] = false; | ||
58 | } | 59 | } |
59 | 60 | ||
60 | nvbe->nr_pages++; | 61 | nvbe->nr_pages++; |
@@ -427,7 +428,7 @@ nouveau_sgdma_init(struct drm_device *dev) | |||
427 | u32 aper_size, align; | 428 | u32 aper_size, align; |
428 | int ret; | 429 | int ret; |
429 | 430 | ||
430 | if (dev_priv->card_type >= NV_50 || drm_pci_device_is_pcie(dev)) | 431 | if (dev_priv->card_type >= NV_40 && drm_pci_device_is_pcie(dev)) |
431 | aper_size = 512 * 1024 * 1024; | 432 | aper_size = 512 * 1024 * 1024; |
432 | else | 433 | else |
433 | aper_size = 64 * 1024 * 1024; | 434 | aper_size = 64 * 1024 * 1024; |
@@ -457,7 +458,7 @@ nouveau_sgdma_init(struct drm_device *dev) | |||
457 | dev_priv->gart_info.func = &nv50_sgdma_backend; | 458 | dev_priv->gart_info.func = &nv50_sgdma_backend; |
458 | } else | 459 | } else |
459 | if (drm_pci_device_is_pcie(dev) && | 460 | if (drm_pci_device_is_pcie(dev) && |
460 | dev_priv->chipset != 0x40 && dev_priv->chipset != 0x45) { | 461 | dev_priv->chipset > 0x40 && dev_priv->chipset != 0x45) { |
461 | if (nv44_graph_class(dev)) { | 462 | if (nv44_graph_class(dev)) { |
462 | dev_priv->gart_info.func = &nv44_sgdma_backend; | 463 | dev_priv->gart_info.func = &nv44_sgdma_backend; |
463 | align = 512 * 1024; | 464 | align = 512 * 1024; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c index 05294910e135..a30adec5beaa 100644 --- a/drivers/gpu/drm/nouveau/nouveau_state.c +++ b/drivers/gpu/drm/nouveau/nouveau_state.c | |||
@@ -376,15 +376,11 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
376 | engine->graph.destroy_context = nv50_graph_destroy_context; | 376 | engine->graph.destroy_context = nv50_graph_destroy_context; |
377 | engine->graph.load_context = nv50_graph_load_context; | 377 | engine->graph.load_context = nv50_graph_load_context; |
378 | engine->graph.unload_context = nv50_graph_unload_context; | 378 | engine->graph.unload_context = nv50_graph_unload_context; |
379 | if (dev_priv->chipset != 0x86) | 379 | if (dev_priv->chipset == 0x50 || |
380 | dev_priv->chipset == 0xac) | ||
380 | engine->graph.tlb_flush = nv50_graph_tlb_flush; | 381 | engine->graph.tlb_flush = nv50_graph_tlb_flush; |
381 | else { | 382 | else |
382 | /* from what i can see nvidia do this on every | 383 | engine->graph.tlb_flush = nv84_graph_tlb_flush; |
383 | * pre-NVA3 board except NVAC, but, we've only | ||
384 | * ever seen problems on NV86 | ||
385 | */ | ||
386 | engine->graph.tlb_flush = nv86_graph_tlb_flush; | ||
387 | } | ||
388 | engine->fifo.channels = 128; | 384 | engine->fifo.channels = 128; |
389 | engine->fifo.init = nv50_fifo_init; | 385 | engine->fifo.init = nv50_fifo_init; |
390 | engine->fifo.takedown = nv50_fifo_takedown; | 386 | engine->fifo.takedown = nv50_fifo_takedown; |
@@ -612,6 +608,7 @@ nouveau_card_init(struct drm_device *dev) | |||
612 | spin_lock_init(&dev_priv->channels.lock); | 608 | spin_lock_init(&dev_priv->channels.lock); |
613 | spin_lock_init(&dev_priv->tile.lock); | 609 | spin_lock_init(&dev_priv->tile.lock); |
614 | spin_lock_init(&dev_priv->context_switch_lock); | 610 | spin_lock_init(&dev_priv->context_switch_lock); |
611 | spin_lock_init(&dev_priv->vm_lock); | ||
615 | 612 | ||
616 | /* Make the CRTCs and I2C buses accessible */ | 613 | /* Make the CRTCs and I2C buses accessible */ |
617 | ret = engine->display.early_init(dev); | 614 | ret = engine->display.early_init(dev); |
@@ -704,10 +701,6 @@ nouveau_card_init(struct drm_device *dev) | |||
704 | goto out_fence; | 701 | goto out_fence; |
705 | } | 702 | } |
706 | 703 | ||
707 | ret = nouveau_backlight_init(dev); | ||
708 | if (ret) | ||
709 | NV_ERROR(dev, "Error %d registering backlight\n", ret); | ||
710 | |||
711 | nouveau_fbcon_init(dev); | 704 | nouveau_fbcon_init(dev); |
712 | drm_kms_helper_poll_init(dev); | 705 | drm_kms_helper_poll_init(dev); |
713 | return 0; | 706 | return 0; |
@@ -759,8 +752,6 @@ static void nouveau_card_takedown(struct drm_device *dev) | |||
759 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 752 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
760 | struct nouveau_engine *engine = &dev_priv->engine; | 753 | struct nouveau_engine *engine = &dev_priv->engine; |
761 | 754 | ||
762 | nouveau_backlight_exit(dev); | ||
763 | |||
764 | if (!engine->graph.accel_blocked) { | 755 | if (!engine->graph.accel_blocked) { |
765 | nouveau_fence_fini(dev); | 756 | nouveau_fence_fini(dev); |
766 | nouveau_channel_put_unlocked(&dev_priv->channel); | 757 | nouveau_channel_put_unlocked(&dev_priv->channel); |
@@ -969,7 +960,7 @@ int nouveau_load(struct drm_device *dev, unsigned long flags) | |||
969 | if (ret) | 960 | if (ret) |
970 | goto err_mmio; | 961 | goto err_mmio; |
971 | 962 | ||
972 | /* Map PRAMIN BAR, or on older cards, the aperture withing BAR0 */ | 963 | /* Map PRAMIN BAR, or on older cards, the aperture within BAR0 */ |
973 | if (dev_priv->card_type >= NV_40) { | 964 | if (dev_priv->card_type >= NV_40) { |
974 | int ramin_bar = 2; | 965 | int ramin_bar = 2; |
975 | if (pci_resource_len(dev->pdev, ramin_bar) == 0) | 966 | if (pci_resource_len(dev->pdev, ramin_bar) == 0) |
diff --git a/drivers/gpu/drm/nouveau/nv04_crtc.c b/drivers/gpu/drm/nouveau/nv04_crtc.c index a260fbbe3d9b..748b9d9c2949 100644 --- a/drivers/gpu/drm/nouveau/nv04_crtc.c +++ b/drivers/gpu/drm/nouveau/nv04_crtc.c | |||
@@ -164,7 +164,7 @@ nv_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
164 | NV_DEBUG_KMS(dev, "Setting dpms mode %d on CRTC %d\n", mode, | 164 | NV_DEBUG_KMS(dev, "Setting dpms mode %d on CRTC %d\n", mode, |
165 | nv_crtc->index); | 165 | nv_crtc->index); |
166 | 166 | ||
167 | if (nv_crtc->last_dpms == mode) /* Don't do unnecesary mode changes. */ | 167 | if (nv_crtc->last_dpms == mode) /* Don't do unnecessary mode changes. */ |
168 | return; | 168 | return; |
169 | 169 | ||
170 | nv_crtc->last_dpms = mode; | 170 | nv_crtc->last_dpms = mode; |
@@ -677,7 +677,7 @@ static void nv_crtc_prepare(struct drm_crtc *crtc) | |||
677 | 677 | ||
678 | NVBlankScreen(dev, nv_crtc->index, true); | 678 | NVBlankScreen(dev, nv_crtc->index, true); |
679 | 679 | ||
680 | /* Some more preperation. */ | 680 | /* Some more preparation. */ |
681 | NVWriteCRTC(dev, nv_crtc->index, NV_PCRTC_CONFIG, NV_PCRTC_CONFIG_START_ADDRESS_NON_VGA); | 681 | NVWriteCRTC(dev, nv_crtc->index, NV_PCRTC_CONFIG, NV_PCRTC_CONFIG_START_ADDRESS_NON_VGA); |
682 | if (dev_priv->card_type == NV_40) { | 682 | if (dev_priv->card_type == NV_40) { |
683 | uint32_t reg900 = NVReadRAMDAC(dev, nv_crtc->index, NV_PRAMDAC_900); | 683 | uint32_t reg900 = NVReadRAMDAC(dev, nv_crtc->index, NV_PRAMDAC_900); |
diff --git a/drivers/gpu/drm/nouveau/nv04_dfp.c b/drivers/gpu/drm/nouveau/nv04_dfp.c index c82db37d9f41..12098bf839c4 100644 --- a/drivers/gpu/drm/nouveau/nv04_dfp.c +++ b/drivers/gpu/drm/nouveau/nv04_dfp.c | |||
@@ -581,12 +581,13 @@ static void nv04_dfp_restore(struct drm_encoder *encoder) | |||
581 | int head = nv_encoder->restore.head; | 581 | int head = nv_encoder->restore.head; |
582 | 582 | ||
583 | if (nv_encoder->dcb->type == OUTPUT_LVDS) { | 583 | if (nv_encoder->dcb->type == OUTPUT_LVDS) { |
584 | struct drm_display_mode *native_mode = nouveau_encoder_connector_get(nv_encoder)->native_mode; | 584 | struct nouveau_connector *connector = |
585 | if (native_mode) | 585 | nouveau_encoder_connector_get(nv_encoder); |
586 | call_lvds_script(dev, nv_encoder->dcb, head, LVDS_PANEL_ON, | 586 | |
587 | native_mode->clock); | 587 | if (connector && connector->native_mode) |
588 | else | 588 | call_lvds_script(dev, nv_encoder->dcb, head, |
589 | NV_ERROR(dev, "Not restoring LVDS without native mode\n"); | 589 | LVDS_PANEL_ON, |
590 | connector->native_mode->clock); | ||
590 | 591 | ||
591 | } else if (nv_encoder->dcb->type == OUTPUT_TMDS) { | 592 | } else if (nv_encoder->dcb->type == OUTPUT_TMDS) { |
592 | int clock = nouveau_hw_pllvals_to_clk | 593 | int clock = nouveau_hw_pllvals_to_clk |
diff --git a/drivers/gpu/drm/nouveau/nv40_graph.c b/drivers/gpu/drm/nouveau/nv40_graph.c index 18d30c2c1aa6..fceb44c0ec74 100644 --- a/drivers/gpu/drm/nouveau/nv40_graph.c +++ b/drivers/gpu/drm/nouveau/nv40_graph.c | |||
@@ -181,7 +181,7 @@ nv40_graph_load_context(struct nouveau_channel *chan) | |||
181 | NV40_PGRAPH_CTXCTL_CUR_LOADED); | 181 | NV40_PGRAPH_CTXCTL_CUR_LOADED); |
182 | /* 0x32E0 records the instance address of the active FIFO's PGRAPH | 182 | /* 0x32E0 records the instance address of the active FIFO's PGRAPH |
183 | * context. If at any time this doesn't match 0x40032C, you will | 183 | * context. If at any time this doesn't match 0x40032C, you will |
184 | * recieve PGRAPH_INTR_CONTEXT_SWITCH | 184 | * receive PGRAPH_INTR_CONTEXT_SWITCH |
185 | */ | 185 | */ |
186 | nv_wr32(dev, NV40_PFIFO_GRCTX_INSTANCE, inst); | 186 | nv_wr32(dev, NV40_PFIFO_GRCTX_INSTANCE, inst); |
187 | return 0; | 187 | return 0; |
diff --git a/drivers/gpu/drm/nouveau/nv50_crtc.c b/drivers/gpu/drm/nouveau/nv50_crtc.c index 2b9984027f41..a19ccaa025b3 100644 --- a/drivers/gpu/drm/nouveau/nv50_crtc.c +++ b/drivers/gpu/drm/nouveau/nv50_crtc.c | |||
@@ -469,9 +469,6 @@ nv50_crtc_wait_complete(struct drm_crtc *crtc) | |||
469 | 469 | ||
470 | start = ptimer->read(dev); | 470 | start = ptimer->read(dev); |
471 | do { | 471 | do { |
472 | nv_wr32(dev, 0x61002c, 0x370); | ||
473 | nv_wr32(dev, 0x000140, 1); | ||
474 | |||
475 | if (nv_ro32(disp->ntfy, 0x000)) | 472 | if (nv_ro32(disp->ntfy, 0x000)) |
476 | return 0; | 473 | return 0; |
477 | } while (ptimer->read(dev) - start < 2000000000ULL); | 474 | } while (ptimer->read(dev) - start < 2000000000ULL); |
diff --git a/drivers/gpu/drm/nouveau/nv50_evo.c b/drivers/gpu/drm/nouveau/nv50_evo.c index a2cfaa691e9b..c8e83c1a4de8 100644 --- a/drivers/gpu/drm/nouveau/nv50_evo.c +++ b/drivers/gpu/drm/nouveau/nv50_evo.c | |||
@@ -186,6 +186,7 @@ nv50_evo_channel_init(struct nouveau_channel *evo) | |||
186 | nv_mask(dev, 0x610028, 0x00000000, 0x00010001 << id); | 186 | nv_mask(dev, 0x610028, 0x00000000, 0x00010001 << id); |
187 | 187 | ||
188 | evo->dma.max = (4096/4) - 2; | 188 | evo->dma.max = (4096/4) - 2; |
189 | evo->dma.max &= ~7; | ||
189 | evo->dma.put = 0; | 190 | evo->dma.put = 0; |
190 | evo->dma.cur = evo->dma.put; | 191 | evo->dma.cur = evo->dma.put; |
191 | evo->dma.free = evo->dma.max - evo->dma.cur; | 192 | evo->dma.free = evo->dma.max - evo->dma.cur; |
diff --git a/drivers/gpu/drm/nouveau/nv50_graph.c b/drivers/gpu/drm/nouveau/nv50_graph.c index 8675b00caf18..b02a5b1e7d37 100644 --- a/drivers/gpu/drm/nouveau/nv50_graph.c +++ b/drivers/gpu/drm/nouveau/nv50_graph.c | |||
@@ -503,7 +503,7 @@ nv50_graph_tlb_flush(struct drm_device *dev) | |||
503 | } | 503 | } |
504 | 504 | ||
505 | void | 505 | void |
506 | nv86_graph_tlb_flush(struct drm_device *dev) | 506 | nv84_graph_tlb_flush(struct drm_device *dev) |
507 | { | 507 | { |
508 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 508 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
509 | struct nouveau_timer_engine *ptimer = &dev_priv->engine.timer; | 509 | struct nouveau_timer_engine *ptimer = &dev_priv->engine.timer; |
diff --git a/drivers/gpu/drm/nouveau/nv50_instmem.c b/drivers/gpu/drm/nouveau/nv50_instmem.c index a6f8aa651fc6..4f95a1e5822e 100644 --- a/drivers/gpu/drm/nouveau/nv50_instmem.c +++ b/drivers/gpu/drm/nouveau/nv50_instmem.c | |||
@@ -404,23 +404,25 @@ void | |||
404 | nv50_instmem_flush(struct drm_device *dev) | 404 | nv50_instmem_flush(struct drm_device *dev) |
405 | { | 405 | { |
406 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 406 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
407 | unsigned long flags; | ||
407 | 408 | ||
408 | spin_lock(&dev_priv->ramin_lock); | 409 | spin_lock_irqsave(&dev_priv->vm_lock, flags); |
409 | nv_wr32(dev, 0x00330c, 0x00000001); | 410 | nv_wr32(dev, 0x00330c, 0x00000001); |
410 | if (!nv_wait(dev, 0x00330c, 0x00000002, 0x00000000)) | 411 | if (!nv_wait(dev, 0x00330c, 0x00000002, 0x00000000)) |
411 | NV_ERROR(dev, "PRAMIN flush timeout\n"); | 412 | NV_ERROR(dev, "PRAMIN flush timeout\n"); |
412 | spin_unlock(&dev_priv->ramin_lock); | 413 | spin_unlock_irqrestore(&dev_priv->vm_lock, flags); |
413 | } | 414 | } |
414 | 415 | ||
415 | void | 416 | void |
416 | nv84_instmem_flush(struct drm_device *dev) | 417 | nv84_instmem_flush(struct drm_device *dev) |
417 | { | 418 | { |
418 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 419 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
420 | unsigned long flags; | ||
419 | 421 | ||
420 | spin_lock(&dev_priv->ramin_lock); | 422 | spin_lock_irqsave(&dev_priv->vm_lock, flags); |
421 | nv_wr32(dev, 0x070000, 0x00000001); | 423 | nv_wr32(dev, 0x070000, 0x00000001); |
422 | if (!nv_wait(dev, 0x070000, 0x00000002, 0x00000000)) | 424 | if (!nv_wait(dev, 0x070000, 0x00000002, 0x00000000)) |
423 | NV_ERROR(dev, "PRAMIN flush timeout\n"); | 425 | NV_ERROR(dev, "PRAMIN flush timeout\n"); |
424 | spin_unlock(&dev_priv->ramin_lock); | 426 | spin_unlock_irqrestore(&dev_priv->vm_lock, flags); |
425 | } | 427 | } |
426 | 428 | ||
diff --git a/drivers/gpu/drm/nouveau/nv50_vm.c b/drivers/gpu/drm/nouveau/nv50_vm.c index 4fd3432b5b8d..6c2694490741 100644 --- a/drivers/gpu/drm/nouveau/nv50_vm.c +++ b/drivers/gpu/drm/nouveau/nv50_vm.c | |||
@@ -174,10 +174,11 @@ void | |||
174 | nv50_vm_flush_engine(struct drm_device *dev, int engine) | 174 | nv50_vm_flush_engine(struct drm_device *dev, int engine) |
175 | { | 175 | { |
176 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 176 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
177 | unsigned long flags; | ||
177 | 178 | ||
178 | spin_lock(&dev_priv->ramin_lock); | 179 | spin_lock_irqsave(&dev_priv->vm_lock, flags); |
179 | nv_wr32(dev, 0x100c80, (engine << 16) | 1); | 180 | nv_wr32(dev, 0x100c80, (engine << 16) | 1); |
180 | if (!nv_wait(dev, 0x100c80, 0x00000001, 0x00000000)) | 181 | if (!nv_wait(dev, 0x100c80, 0x00000001, 0x00000000)) |
181 | NV_ERROR(dev, "vm flush timeout: engine %d\n", engine); | 182 | NV_ERROR(dev, "vm flush timeout: engine %d\n", engine); |
182 | spin_unlock(&dev_priv->ramin_lock); | 183 | spin_unlock_irqrestore(&dev_priv->vm_lock, flags); |
183 | } | 184 | } |
diff --git a/drivers/gpu/drm/nouveau/nvc0_vm.c b/drivers/gpu/drm/nouveau/nvc0_vm.c index 69af0ba7edd3..a179e6c55afb 100644 --- a/drivers/gpu/drm/nouveau/nvc0_vm.c +++ b/drivers/gpu/drm/nouveau/nvc0_vm.c | |||
@@ -104,20 +104,27 @@ nvc0_vm_flush(struct nouveau_vm *vm) | |||
104 | struct nouveau_instmem_engine *pinstmem = &dev_priv->engine.instmem; | 104 | struct nouveau_instmem_engine *pinstmem = &dev_priv->engine.instmem; |
105 | struct drm_device *dev = vm->dev; | 105 | struct drm_device *dev = vm->dev; |
106 | struct nouveau_vm_pgd *vpgd; | 106 | struct nouveau_vm_pgd *vpgd; |
107 | u32 r100c80, engine; | 107 | unsigned long flags; |
108 | u32 engine = (dev_priv->chan_vm == vm) ? 1 : 5; | ||
108 | 109 | ||
109 | pinstmem->flush(vm->dev); | 110 | pinstmem->flush(vm->dev); |
110 | 111 | ||
111 | if (vm == dev_priv->chan_vm) | 112 | spin_lock_irqsave(&dev_priv->vm_lock, flags); |
112 | engine = 1; | ||
113 | else | ||
114 | engine = 5; | ||
115 | |||
116 | list_for_each_entry(vpgd, &vm->pgd_list, head) { | 113 | list_for_each_entry(vpgd, &vm->pgd_list, head) { |
117 | r100c80 = nv_rd32(dev, 0x100c80); | 114 | /* looks like maybe a "free flush slots" counter, the |
115 | * faster you write to 0x100cbc to more it decreases | ||
116 | */ | ||
117 | if (!nv_wait_ne(dev, 0x100c80, 0x00ff0000, 0x00000000)) { | ||
118 | NV_ERROR(dev, "vm timeout 0: 0x%08x %d\n", | ||
119 | nv_rd32(dev, 0x100c80), engine); | ||
120 | } | ||
118 | nv_wr32(dev, 0x100cb8, vpgd->obj->vinst >> 8); | 121 | nv_wr32(dev, 0x100cb8, vpgd->obj->vinst >> 8); |
119 | nv_wr32(dev, 0x100cbc, 0x80000000 | engine); | 122 | nv_wr32(dev, 0x100cbc, 0x80000000 | engine); |
120 | if (!nv_wait(dev, 0x100c80, 0xffffffff, r100c80)) | 123 | /* wait for flush to be queued? */ |
121 | NV_ERROR(dev, "vm flush timeout eng %d\n", engine); | 124 | if (!nv_wait(dev, 0x100c80, 0x00008000, 0x00008000)) { |
125 | NV_ERROR(dev, "vm timeout 1: 0x%08x %d\n", | ||
126 | nv_rd32(dev, 0x100c80), engine); | ||
127 | } | ||
122 | } | 128 | } |
129 | spin_unlock_irqrestore(&dev_priv->vm_lock, flags); | ||
123 | } | 130 | } |